diff --git a/node_modules/@lumino/widgets/dist/index.es6.js b/node_modules/@lumino/widgets/dist/index.es6.js
index 93173e9..d499446 100644
--- a/node_modules/@lumino/widgets/dist/index.es6.js
+++ b/node_modules/@lumino/widgets/dist/index.es6.js
@@ -6556,28 +6556,28 @@ class Menu extends Widget {
         }
     }
     /**
-     * A message handler invoked on a `'before-attach'` message.
+     * A message handler invoked on a `'after-attach'` message.
      */
-    onBeforeAttach(msg) {
+    onAfterAttach(msg) {
         this.node.addEventListener('keydown', this);
         this.node.addEventListener('mouseup', this);
         this.node.addEventListener('mousemove', this);
         this.node.addEventListener('mouseenter', this);
         this.node.addEventListener('mouseleave', this);
         this.node.addEventListener('contextmenu', this);
-        document.addEventListener('mousedown', this, true);
+        this.node.ownerDocument.addEventListener('mousedown', this, true);
     }
     /**
-     * A message handler invoked on an `'after-detach'` message.
+     * A message handler invoked on an `'before-detach'` message.
      */
-    onAfterDetach(msg) {
+    onBeforeDetach(msg) {
         this.node.removeEventListener('keydown', this);
         this.node.removeEventListener('mouseup', this);
         this.node.removeEventListener('mousemove', this);
         this.node.removeEventListener('mouseenter', this);
         this.node.removeEventListener('mouseleave', this);
         this.node.removeEventListener('contextmenu', this);
-        document.removeEventListener('mousedown', this, true);
+        this.node.ownerDocument.removeEventListener('mousedown', this, true);
     }
     /**
      * A message handler invoked on an `'activate-request'` message.
@@ -7161,15 +7161,8 @@ var Private$9;
      * The horizontal pixel overlap for an open submenu.
      */
     Private.SUBMENU_OVERLAP = 3;
-    let transientWindowDataCache = null;
-    let transientCacheCounter = 0;
-    function getWindowData() {
-        // if transient cache is in use, take one from it
-        if (transientCacheCounter > 0) {
-            transientCacheCounter--;
-            return transientWindowDataCache;
-        }
-        return _getWindowData();
+    function getWindowData(element) {
+        return _getWindowData(element);
     }
     /**
      * Store window data in transient cache.
@@ -7181,8 +7174,6 @@ var Private$9;
      * Note: should be called before any DOM modifications.
      */
     function saveWindowData() {
-        transientWindowDataCache = _getWindowData();
-        transientCacheCounter++;
     }
     Private.saveWindowData = saveWindowData;
     /**
@@ -7277,12 +7268,13 @@ var Private$9;
         return result;
     }
     Private.computeCollapsed = computeCollapsed;
-    function _getWindowData() {
+    function _getWindowData(element) {
+        var _a, _b;
         return {
-            pageXOffset: window.pageXOffset,
-            pageYOffset: window.pageYOffset,
-            clientWidth: document.documentElement.clientWidth,
-            clientHeight: document.documentElement.clientHeight
+            pageXOffset: ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.window.scrollX) || 0,
+            pageYOffset: ((_b = element.ownerDocument.defaultView) === null || _b === void 0 ? void 0 : _b.window.scrollY) || 0,
+            clientWidth: element.ownerDocument.documentElement.clientWidth,
+            clientHeight: element.ownerDocument.documentElement.clientHeight
         };
     }
     /**
@@ -7290,7 +7282,7 @@ var Private$9;
      */
     function openRootMenu(menu, x, y, forceX, forceY, horizontalAlignment, host, ref) {
         // Get the current position and size of the main viewport.
-        const windowData = getWindowData();
+        const windowData = getWindowData(host || menu.node);
         let px = windowData.pageXOffset;
         let py = windowData.pageYOffset;
         let cw = windowData.clientWidth;
@@ -7302,6 +7294,8 @@ var Private$9;
         // Fetch common variables.
         let node = menu.node;
         let style = node.style;
+        style.top = '0';
+        style.left = '0';
         // Clear the menu geometry and prepare it for measuring.
         style.opacity = '0';
         style.maxHeight = `${maxHeight}px`;
@@ -7337,7 +7331,7 @@ var Private$9;
      */
     function openSubmenu(submenu, itemNode) {
         // Get the current position and size of the main viewport.
-        const windowData = getWindowData();
+        const windowData = getWindowData(itemNode);
         let px = windowData.pageXOffset;
         let py = windowData.pageYOffset;
         let cw = windowData.clientWidth;
@@ -7353,7 +7347,7 @@ var Private$9;
         style.opacity = '0';
         style.maxHeight = `${maxHeight}px`;
         // Attach the menu to the document.
-        Widget.attach(submenu, document.body);
+        Widget.attach(submenu, itemNode.ownerDocument.body);
         // Measure the size of the menu.
         let { width, height } = node.getBoundingClientRect();
         // Compute the box sizing for the menu.
@@ -7372,6 +7366,8 @@ var Private$9;
         if (y + height > py + ch) {
             y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;
         }
+        style.top = '0';
+        style.left = '0';
         // Update the position of the menu to the computed position.
         style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;
         // Finally, make the menu visible on the screen.
diff --git a/node_modules/@lumino/widgets/dist/index.es6.js.map b/node_modules/@lumino/widgets/dist/index.es6.js.map
index 63094f4..ee7c3a5 100644
--- a/node_modules/@lumino/widgets/dist/index.es6.js.map
+++ b/node_modules/@lumino/widgets/dist/index.es6.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.es6.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n  /**\n   * The preferred size for the sizer.\n   *\n   * #### Notes\n   * The sizer will be given this initial size subject to its size\n   * bounds. The sizer will not deviate from this size unless such\n   * deviation is required to fit into the available layout space.\n   *\n   * There is no limit to this value, but it will be clamped to the\n   * bounds defined by {@link minSize} and {@link maxSize}.\n   *\n   * The default value is `0`.\n   */\n  sizeHint = 0;\n\n  /**\n   * The minimum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized less than this value, even if\n   * it means the sizer will overflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity)`\n   * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `0`.\n   */\n  minSize = 0;\n\n  /**\n   * The maximum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized greater than this value, even if\n   * it means the sizer will underflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity]`\n   * and that it is `>=` to {@link minSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `Infinity`.\n   */\n  maxSize = Infinity;\n\n  /**\n   * The stretch factor for the sizer.\n   *\n   * #### Notes\n   * This controls how much the sizer stretches relative to its sibling\n   * sizers when layout space is distributed. A stretch factor of zero\n   * is special and will cause the sizer to only be resized after all\n   * other sizers with a stretch factor greater than zero have been\n   * resized to their limits.\n   *\n   * It is assumed that this value is an integer that lies in the range\n   * `[0, Infinity)`. Failure to adhere to this constraint will yield\n   * undefined results.\n   *\n   * The default value is `1`.\n   */\n  stretch = 1;\n\n  /**\n   * The computed size of the sizer.\n   *\n   * #### Notes\n   * This value is the output of a call to {@link BoxEngine.calc}. It represents\n   * the computed size for the object along the layout orientation,\n   * and will always lie in the range `[minSize, maxSize]`.\n   *\n   * This value is output only.\n   *\n   * Changing this value will have no effect.\n   */\n  size = 0;\n\n  /**\n   * An internal storage property for the layout algorithm.\n   *\n   * #### Notes\n   * This value is used as temporary storage by the layout algorithm.\n   *\n   * Changing this value will have no effect.\n   */\n  done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n  /**\n   * Calculate the optimal layout sizes for a sequence of box sizers.\n   *\n   * This distributes the available layout space among the box sizers\n   * according to the following algorithm:\n   *\n   * 1. Initialize the sizers's size to its size hint and compute the\n   *    sums for each of size hint, min size, and max size.\n   *\n   * 2. If the total size hint equals the available space, return.\n   *\n   * 3. If the available space is less than the total min size, set all\n   *    sizers to their min size and return.\n   *\n   * 4. If the available space is greater than the total max size, set\n   *    all sizers to their max size and return.\n   *\n   * 5. If the layout space is less than the total size hint, distribute\n   *    the negative delta as follows:\n   *\n   *    a. Shrink each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the negative space and the sum of\n   *       stretch factors. If the sizer reaches its min size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains negative\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its min size,\n   *       remove it from the computation.\n   *\n   * 6. If the layout space is greater than the total size hint,\n   *    distribute the positive delta as follows:\n   *\n   *    a. Expand each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the postive space and the sum of\n   *       stretch factors. If the sizer reaches its max size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains positive\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its max size,\n   *       remove it from the computation.\n   *\n   * 7. return\n   *\n   * @param sizers - The sizers for a particular layout line.\n   *\n   * @param space - The available layout space for the sizers.\n   *\n   * @returns The delta between the provided available space and the\n   *   actual consumed space. This value will be zero if the sizers\n   *   can be adjusted to fit, negative if the available space is too\n   *   small, and positive if the available space is too large.\n   *\n   * #### Notes\n   * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n   *\n   * This function can be called at any time to recompute the layout for\n   * an existing sequence of sizers. The previously computed results will\n   * have no effect on the new output. It is therefore not necessary to\n   * create new sizer objects on each resize event.\n   */\n  export function calc(sizers: ArrayLike<BoxSizer>, space: number): number {\n    // Bail early if there is nothing to do.\n    let count = sizers.length;\n    if (count === 0) {\n      return space;\n    }\n\n    // Setup the size and stretch counters.\n    let totalMin = 0;\n    let totalMax = 0;\n    let totalSize = 0;\n    let totalStretch = 0;\n    let stretchCount = 0;\n\n    // Setup the sizers and compute the totals.\n    for (let i = 0; i < count; ++i) {\n      let sizer = sizers[i];\n      let min = sizer.minSize;\n      let max = sizer.maxSize;\n      let hint = sizer.sizeHint;\n      sizer.done = false;\n      sizer.size = Math.max(min, Math.min(hint, max));\n      totalSize += sizer.size;\n      totalMin += min;\n      totalMax += max;\n      if (sizer.stretch > 0) {\n        totalStretch += sizer.stretch;\n        stretchCount++;\n      }\n    }\n\n    // If the space is equal to the total size, return early.\n    if (space === totalSize) {\n      return 0;\n    }\n\n    // If the space is less than the total min, minimize each sizer.\n    if (space <= totalMin) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.minSize;\n      }\n      return space - totalMin;\n    }\n\n    // If the space is greater than the total max, maximize each sizer.\n    if (space >= totalMax) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.maxSize;\n      }\n      return space - totalMax;\n    }\n\n    // The loops below perform sub-pixel precision sizing. A near zero\n    // value is used for compares instead of zero to ensure that the\n    // loop terminates when the subdivided space is reasonably small.\n    let nearZero = 0.01;\n\n    // A counter which is decremented each time a sizer is resized to\n    // its limit. This ensures the loops terminate even if there is\n    // space remaining to distribute.\n    let notDoneCount = count;\n\n    // Distribute negative delta space.\n    if (space < totalSize) {\n      // Shrink each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its min size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = totalSize - space;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n    }\n    // Distribute positive delta space.\n    else {\n      // Expand each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its max size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = space - totalSize;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n    }\n\n    // Indicate that the consumed space equals the available space.\n    return 0;\n  }\n\n  /**\n   * Adjust a sizer by a delta and update its neighbors accordingly.\n   *\n   * @param sizers - The sizers which should be adjusted.\n   *\n   * @param index - The index of the sizer to grow.\n   *\n   * @param delta - The amount to adjust the sizer, positive or negative.\n   *\n   * #### Notes\n   * This will adjust the indicated sizer by the specified amount, along\n   * with the sizes of the appropriate neighbors, subject to the limits\n   * specified by each of the sizers.\n   *\n   * This is useful when implementing box layouts where the boundaries\n   * between the sizers are interactively adjustable by the user.\n   */\n  export function adjust(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Bail early when there is nothing to do.\n    if (sizers.length === 0 || delta === 0) {\n      return;\n    }\n\n    // Dispatch to the proper implementation.\n    if (delta > 0) {\n      growSizer(sizers, index, delta);\n    } else {\n      shrinkSizer(sizers, index, -delta);\n    }\n  }\n\n  /**\n   * Grow a sizer by a positive delta and adjust neighbors.\n   */\n  function growSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the left can expand.\n    let growLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the right can shrink.\n    let shrinkLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the left by the delta.\n    let grow = delta;\n    for (let i = index; i >= 0 && grow > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the right by the delta.\n    let shrink = delta;\n    for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n\n  /**\n   * Shrink a sizer by a positive delta and adjust neighbors.\n   */\n  function shrinkSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the right can expand.\n    let growLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the left can shrink.\n    let shrinkLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the right by the delta.\n    let grow = delta;\n    for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the left by the delta.\n    let shrink = delta;\n    for (let i = index; i >= 0 && shrink > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title<T> implements IDisposable {\n  /**\n   * Construct a new title.\n   *\n   * @param options - The options for initializing the title.\n   */\n  constructor(options: Title.IOptions<T>) {\n    this.owner = options.owner;\n    if (options.label !== undefined) {\n      this._label = options.label;\n    }\n    if (options.mnemonic !== undefined) {\n      this._mnemonic = options.mnemonic;\n    }\n    if (options.icon !== undefined) {\n      this._icon = options.icon;\n    }\n\n    if (options.iconClass !== undefined) {\n      this._iconClass = options.iconClass;\n    }\n    if (options.iconLabel !== undefined) {\n      this._iconLabel = options.iconLabel;\n    }\n    if (options.caption !== undefined) {\n      this._caption = options.caption;\n    }\n    if (options.className !== undefined) {\n      this._className = options.className;\n    }\n    if (options.closable !== undefined) {\n      this._closable = options.closable;\n    }\n    this._dataset = options.dataset || {};\n  }\n\n  /**\n   * A signal emitted when the state of the title changes.\n   */\n  get changed(): ISignal<this, void> {\n    return this._changed;\n  }\n\n  /**\n   * The object which owns the title.\n   */\n  readonly owner: T;\n\n  /**\n   * Get the label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get label(): string {\n    return this._label;\n  }\n\n  /**\n   * Set the label for the title.\n   */\n  set label(value: string) {\n    if (this._label === value) {\n      return;\n    }\n    this._label = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the mnemonic index for the title.\n   *\n   * #### Notes\n   * The default value is `-1`.\n   */\n  get mnemonic(): number {\n    return this._mnemonic;\n  }\n\n  /**\n   * Set the mnemonic index for the title.\n   */\n  set mnemonic(value: number) {\n    if (this._mnemonic === value) {\n      return;\n    }\n    this._mnemonic = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon renderer for the title.\n   *\n   * #### Notes\n   * The default value is undefined.\n   */\n  get icon(): VirtualElement.IRenderer | undefined {\n    return this._icon;\n  }\n\n  /**\n   * Set the icon renderer for the title.\n   *\n   * #### Notes\n   * A renderer is an object that supplies a render and unrender function.\n   */\n  set icon(value: VirtualElement.IRenderer | undefined) {\n    if (this._icon === value) {\n      return;\n    }\n    this._icon = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconClass(): string {\n    return this._iconClass;\n  }\n\n  /**\n   * Set the icon class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconClass(value: string) {\n    if (this._iconClass === value) {\n      return;\n    }\n    this._iconClass = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconLabel(): string {\n    return this._iconLabel;\n  }\n\n  /**\n   * Set the icon label for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconLabel(value: string) {\n    if (this._iconLabel === value) {\n      return;\n    }\n    this._iconLabel = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the caption for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get caption(): string {\n    return this._caption;\n  }\n\n  /**\n   * Set the caption for the title.\n   */\n  set caption(value: string) {\n    if (this._caption === value) {\n      return;\n    }\n    this._caption = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the extra class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get className(): string {\n    return this._className;\n  }\n\n  /**\n   * Set the extra class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set className(value: string) {\n    if (this._className === value) {\n      return;\n    }\n    this._className = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the closable state for the title.\n   *\n   * #### Notes\n   * The default value is `false`.\n   */\n  get closable(): boolean {\n    return this._closable;\n  }\n\n  /**\n   * Set the closable state for the title.\n   *\n   * #### Notes\n   * This controls the presence of a close icon when applicable.\n   */\n  set closable(value: boolean) {\n    if (this._closable === value) {\n      return;\n    }\n    this._closable = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the dataset for the title.\n   *\n   * #### Notes\n   * The default value is an empty dataset.\n   */\n  get dataset(): Title.Dataset {\n    return this._dataset;\n  }\n\n  /**\n   * Set the dataset for the title.\n   *\n   * #### Notes\n   * This controls the data attributes when applicable.\n   */\n  set dataset(value: Title.Dataset) {\n    if (this._dataset === value) {\n      return;\n    }\n    this._dataset = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Test whether the title has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this._isDisposed;\n  }\n\n  /**\n   * Dispose of the resources held by the title.\n   *\n   * #### Notes\n   * It is the responsibility of the owner to call the title disposal.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n    this._isDisposed = true;\n\n    Signal.clearData(this);\n  }\n\n  private _label = '';\n  private _caption = '';\n  private _mnemonic = -1;\n  private _icon: VirtualElement.IRenderer | undefined = undefined;\n  private _iconClass = '';\n  private _iconLabel = '';\n  private _className = '';\n  private _closable = false;\n  private _dataset: Title.Dataset;\n  private _changed = new Signal<this, void>(this);\n  private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n  /**\n   * A type alias for a simple immutable string dataset.\n   */\n  export type Dataset = { readonly [key: string]: string };\n\n  /**\n   * An options object for initializing a title.\n   */\n  export interface IOptions<T> {\n    /**\n     * The object which owns the title.\n     */\n    owner: T;\n\n    /**\n     * The label for the title.\n     */\n    label?: string;\n\n    /**\n     * The mnemonic index for the title.\n     */\n    mnemonic?: number;\n\n    /**\n     * The icon renderer for the title.\n     */\n    icon?: VirtualElement.IRenderer;\n\n    /**\n     * The icon class name for the title.\n     */\n    iconClass?: string;\n\n    /**\n     * The icon label for the title.\n     */\n    iconLabel?: string;\n\n    /**\n     * The caption for the title.\n     */\n    caption?: string;\n\n    /**\n     * The extra class name for the title.\n     */\n    className?: string;\n\n    /**\n     * The closable state for the title.\n     */\n    closable?: boolean;\n\n    /**\n     * The dataset for the title.\n     */\n    dataset?: Dataset;\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n  ConflatableMessage,\n  IMessageHandler,\n  Message,\n  MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n  /**\n   * Construct a new widget.\n   *\n   * @param options - The options for initializing the widget.\n   */\n  constructor(options: Widget.IOptions = {}) {\n    this.node = Private.createNode(options);\n    this.addClass('lm-Widget');\n  }\n\n  /**\n   * Dispose of the widget and its descendant widgets.\n   *\n   * #### Notes\n   * It is unsafe to use the widget after it has been disposed.\n   *\n   * All calls made to this method after the first are a no-op.\n   */\n  dispose(): void {\n    // Do nothing if the widget is already disposed.\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Set the disposed flag and emit the disposed signal.\n    this.setFlag(Widget.Flag.IsDisposed);\n    this._disposed.emit(undefined);\n\n    // Remove or detach the widget if necessary.\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n\n    // Dispose of the widget layout.\n    if (this._layout) {\n      this._layout.dispose();\n      this._layout = null;\n    }\n\n    // Dispose the title\n    this.title.dispose();\n\n    // Clear the extra data associated with the widget.\n    Signal.clearData(this);\n    MessageLoop.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * A signal emitted when the widget is disposed.\n   */\n  get disposed(): ISignal<this, void> {\n    return this._disposed;\n  }\n\n  /**\n   * Get the DOM node owned by the widget.\n   */\n  readonly node: HTMLElement;\n\n  /**\n   * Test whether the widget has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this.testFlag(Widget.Flag.IsDisposed);\n  }\n\n  /**\n   * Test whether the widget's node is attached to the DOM.\n   */\n  get isAttached(): boolean {\n    return this.testFlag(Widget.Flag.IsAttached);\n  }\n\n  /**\n   * Test whether the widget is explicitly hidden.\n   *\n   * #### Notes\n   * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n   * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n   */\n  get isHidden(): boolean {\n    return this.testFlag(Widget.Flag.IsHidden);\n  }\n\n  /**\n   * Test whether the widget is visible.\n   *\n   * #### Notes\n   * A widget is visible when it is attached to the DOM, is not\n   * explicitly hidden, and has no explicitly hidden ancestors.\n   *\n   * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n   * It recursively checks the visibility of all parent widgets.\n   */\n  get isVisible(): boolean {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let parent: Widget | null = this;\n    do {\n      if (parent.isHidden || !parent.isAttached) {\n        return false;\n      }\n      parent = parent.parent;\n    } while (parent != null);\n    return true;\n  }\n\n  /**\n   * The title object for the widget.\n   *\n   * #### Notes\n   * The title object is used by some container widgets when displaying\n   * the widget alongside some title, such as a tab panel or side bar.\n   *\n   * Since not all widgets will use the title, it is created on demand.\n   *\n   * The `owner` property of the title is set to this widget.\n   */\n  get title(): Title<Widget> {\n    return Private.titleProperty.get(this);\n  }\n\n  /**\n   * Get the id of the widget's DOM node.\n   */\n  get id(): string {\n    return this.node.id;\n  }\n\n  /**\n   * Set the id of the widget's DOM node.\n   */\n  set id(value: string) {\n    this.node.id = value;\n  }\n\n  /**\n   * The dataset for the widget's DOM node.\n   */\n  get dataset(): DOMStringMap {\n    return this.node.dataset;\n  }\n\n  /**\n   * Get the method for hiding the widget.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding the widget.\n   */\n  set hiddenMode(value: Widget.HiddenMode) {\n    if (this._hiddenMode === value) {\n      return;\n    }\n\n    if (this.isHidden) {\n      // Reset styles set by previous mode.\n      this._toggleHidden(false);\n    }\n\n    if (value == Widget.HiddenMode.Scale) {\n      this.node.style.willChange = 'transform';\n    } else {\n      this.node.style.willChange = 'auto';\n    }\n\n    this._hiddenMode = value;\n\n    if (this.isHidden) {\n      // Set styles for new mode.\n      this._toggleHidden(true);\n    }\n  }\n\n  /**\n   * Get the parent of the widget.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent of the widget.\n   *\n   * #### Notes\n   * Children are typically added to a widget by using a layout, which\n   * means user code will not normally set the parent widget directly.\n   *\n   * The widget will be automatically removed from its old parent.\n   *\n   * This is a no-op if there is no effective parent change.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (value && this.contains(value)) {\n      throw new Error('Invalid parent widget.');\n    }\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-removed', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    this._parent = value;\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-added', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    if (!this.isDisposed) {\n      MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n    }\n  }\n\n  /**\n   * Get the layout for the widget.\n   */\n  get layout(): Layout | null {\n    return this._layout;\n  }\n\n  /**\n   * Set the layout for the widget.\n   *\n   * #### Notes\n   * The layout is single-use only. It cannot be changed after the\n   * first assignment.\n   *\n   * The layout is disposed automatically when the widget is disposed.\n   */\n  set layout(value: Layout | null) {\n    if (this._layout === value) {\n      return;\n    }\n    if (this.testFlag(Widget.Flag.DisallowLayout)) {\n      throw new Error('Cannot set widget layout.');\n    }\n    if (this._layout) {\n      throw new Error('Cannot change widget layout.');\n    }\n    if (value!.parent) {\n      throw new Error('Cannot change layout parent.');\n    }\n    this._layout = value;\n    value!.parent = this;\n  }\n\n  /**\n   * Create an iterator over the widget's children.\n   *\n   * @returns A new iterator over the children of the widget.\n   *\n   * #### Notes\n   * The widget must have a populated layout in order to have children.\n   *\n   * If a layout is not installed, the returned iterator will be empty.\n   */\n  *children(): IterableIterator<Widget> {\n    if (this._layout) {\n      yield* this._layout;\n    }\n  }\n\n  /**\n   * Test whether a widget is a descendant of this widget.\n   *\n   * @param widget - The descendant widget of interest.\n   *\n   * @returns `true` if the widget is a descendant, `false` otherwise.\n   */\n  contains(widget: Widget): boolean {\n    for (let value: Widget | null = widget; value; value = value._parent) {\n      if (value === this) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Test whether the widget's DOM node has the given class name.\n   *\n   * @param name - The class name of interest.\n   *\n   * @returns `true` if the node has the class, `false` otherwise.\n   */\n  hasClass(name: string): boolean {\n    return this.node.classList.contains(name);\n  }\n\n  /**\n   * Add a class name to the widget's DOM node.\n   *\n   * @param name - The class name to add to the node.\n   *\n   * #### Notes\n   * If the class name is already added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  addClass(name: string): void {\n    this.node.classList.add(name);\n  }\n\n  /**\n   * Remove a class name from the widget's DOM node.\n   *\n   * @param name - The class name to remove from the node.\n   *\n   * #### Notes\n   * If the class name is not yet added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  removeClass(name: string): void {\n    this.node.classList.remove(name);\n  }\n\n  /**\n   * Toggle a class name on the widget's DOM node.\n   *\n   * @param name - The class name to toggle on the node.\n   *\n   * @param force - Whether to force add the class (`true`) or force\n   *   remove the class (`false`). If not provided, the presence of\n   *   the class will be toggled from its current state.\n   *\n   * @returns `true` if the class is now present, `false` otherwise.\n   *\n   * #### Notes\n   * The class name must not contain whitespace.\n   */\n  toggleClass(name: string, force?: boolean): boolean {\n    if (force === true) {\n      this.node.classList.add(name);\n      return true;\n    }\n    if (force === false) {\n      this.node.classList.remove(name);\n      return false;\n    }\n    return this.node.classList.toggle(name);\n  }\n\n  /**\n   * Post an `'update-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  update(): void {\n    MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n  }\n\n  /**\n   * Post a `'fit-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  fit(): void {\n    MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n  }\n\n  /**\n   * Post an `'activate-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  activate(): void {\n    MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n  }\n\n  /**\n   * Send a `'close-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for sending the message.\n   */\n  close(): void {\n    MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n  }\n\n  /**\n   * Show the widget and make it visible to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `false`.\n   *\n   * If the widget is not explicitly hidden, this is a no-op.\n   */\n  show(): void {\n    if (!this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n    }\n    this.clearFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(false);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-shown', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Hide the widget and make it hidden to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `true`.\n   *\n   * If the widget is explicitly hidden, this is a no-op.\n   */\n  hide(): void {\n    if (this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n    }\n    this.setFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(true);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-hidden', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Show or hide the widget according to a boolean value.\n   *\n   * @param hidden - `true` to hide the widget, or `false` to show it.\n   *\n   * #### Notes\n   * This is a convenience method for `hide()` and `show()`.\n   */\n  setHidden(hidden: boolean): void {\n    if (hidden) {\n      this.hide();\n    } else {\n      this.show();\n    }\n  }\n\n  /**\n   * Test whether the given widget flag is set.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  testFlag(flag: Widget.Flag): boolean {\n    return (this._flags & flag) !== 0;\n  }\n\n  /**\n   * Set the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  setFlag(flag: Widget.Flag): void {\n    this._flags |= flag;\n  }\n\n  /**\n   * Clear the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  clearFlag(flag: Widget.Flag): void {\n    this._flags &= ~flag;\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   *\n   * #### Notes\n   * Subclasses may reimplement this method as needed.\n   */\n  processMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.notifyLayout(msg);\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.notifyLayout(msg);\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.notifyLayout(msg);\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.notifyLayout(msg);\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.setFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.notifyLayout(msg);\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.notifyLayout(msg);\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n          this.setFlag(Widget.Flag.IsVisible);\n        }\n        this.setFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.notifyLayout(msg);\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.clearFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterDetach(msg);\n        break;\n      case 'activate-request':\n        this.notifyLayout(msg);\n        this.onActivateRequest(msg);\n        break;\n      case 'close-request':\n        this.notifyLayout(msg);\n        this.onCloseRequest(msg);\n        break;\n      case 'child-added':\n        this.notifyLayout(msg);\n        this.onChildAdded(msg as Widget.ChildMessage);\n        break;\n      case 'child-removed':\n        this.notifyLayout(msg);\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      default:\n        this.notifyLayout(msg);\n        break;\n    }\n  }\n\n  /**\n   * Invoke the message processing routine of the widget's layout.\n   *\n   * @param msg - The message to dispatch to the layout.\n   *\n   * #### Notes\n   * This is a no-op if the widget does not have a layout.\n   *\n   * This will not typically be called directly by user code.\n   */\n  protected notifyLayout(msg: Message): void {\n    if (this._layout) {\n      this._layout.processParentMessage(msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   *\n   * #### Notes\n   * The default implementation unparents or detaches the widget.\n   */\n  protected onCloseRequest(msg: Message): void {\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {}\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onUpdateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onActivateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n  private _toggleHidden(hidden: boolean) {\n    if (hidden) {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.addClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = 'scale(0)';\n          this.node.setAttribute('aria-hidden', 'true');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = 'hidden';\n          this.node.style.zIndex = '-1';\n          break;\n      }\n    } else {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.removeClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = '';\n          this.node.removeAttribute('aria-hidden');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = '';\n          this.node.style.zIndex = '';\n          break;\n      }\n    }\n  }\n\n  private _flags = 0;\n  private _layout: Layout | null = null;\n  private _parent: Widget | null = null;\n  private _disposed = new Signal<this, void>(this);\n  private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n  /**\n   * An options object for initializing a widget.\n   */\n  export interface IOptions {\n    /**\n     * The optional node to use for the widget.\n     *\n     * If a node is provided, the widget will assume full ownership\n     * and control of the node, as if it had created the node itself.\n     *\n     * The default is a new `<div>`.\n     */\n    node?: HTMLElement;\n\n    /**\n     * The optional element tag, used for constructing the widget's node.\n     *\n     * If a pre-constructed node is provided via the `node` arg, this\n     * value is ignored.\n     */\n    tag?: keyof HTMLElementTagNameMap;\n  }\n\n  /**\n   * The method for hiding the widget.\n   *\n   * The default is Display.\n   *\n   * Using `Scale` will often increase performance as most browsers will not\n   * trigger style computation for the `transform` action. This should be used\n   * sparingly and tested, since increasing the number of composition layers\n   * may slow things down.\n   *\n   * To ensure the transformation does not trigger style recomputation, you\n   * may need to set the widget CSS style `will-change: transform`. This\n   * should be used only when needed as it may overwhelm the browser with a\n   * high number of layers. See\n   * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n   */\n  export enum HiddenMode {\n    /**\n     * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n     * CSS from the standard Lumino CSS.\n     */\n    Display = 0,\n\n    /**\n     * Hide the widget by setting the `transform` to `'scale(0)'`.\n     */\n    Scale,\n\n    /**\n     *Hide the widget by setting the `content-visibility` to `'hidden'`.\n     */\n    ContentVisibility\n  }\n\n  /**\n   * An enum of widget bit flags.\n   */\n  export enum Flag {\n    /**\n     * The widget has been disposed.\n     */\n    IsDisposed = 0x1,\n\n    /**\n     * The widget is attached to the DOM.\n     */\n    IsAttached = 0x2,\n\n    /**\n     * The widget is hidden.\n     */\n    IsHidden = 0x4,\n\n    /**\n     * The widget is visible.\n     *\n     * @deprecated since 2.7.0, apply that flag consistently was not reliable\n     * so it was dropped in favor of a recursive check of the visibility of all parents.\n     */\n    IsVisible = 0x8,\n\n    /**\n     * A layout cannot be set on the widget.\n     */\n    DisallowLayout = 0x10\n  }\n\n  /**\n   * A collection of stateless messages related to widgets.\n   */\n  export namespace Msg {\n    /**\n     * A singleton `'before-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const BeforeShow = new Message('before-show');\n\n    /**\n     * A singleton `'after-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const AfterShow = new Message('after-show');\n\n    /**\n     * A singleton `'before-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const BeforeHide = new Message('before-hide');\n\n    /**\n     * A singleton `'after-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const AfterHide = new Message('after-hide');\n\n    /**\n     * A singleton `'before-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is attached.\n     */\n    export const BeforeAttach = new Message('before-attach');\n\n    /**\n     * A singleton `'after-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is attached.\n     */\n    export const AfterAttach = new Message('after-attach');\n\n    /**\n     * A singleton `'before-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is detached.\n     */\n    export const BeforeDetach = new Message('before-detach');\n\n    /**\n     * A singleton `'after-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is detached.\n     */\n    export const AfterDetach = new Message('after-detach');\n\n    /**\n     * A singleton `'parent-changed'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget when its parent has changed.\n     */\n    export const ParentChanged = new Message('parent-changed');\n\n    /**\n     * A singleton conflatable `'update-request'` message.\n     *\n     * #### Notes\n     * This message can be dispatched to supporting widgets in order to\n     * update their content based on the current widget state. Not all\n     * widgets will respond to messages of this type.\n     *\n     * For widgets with a layout, this message will inform the layout to\n     * update the position and size of its child widgets.\n     */\n    export const UpdateRequest = new ConflatableMessage('update-request');\n\n    /**\n     * A singleton conflatable `'fit-request'` message.\n     *\n     * #### Notes\n     * For widgets with a layout, this message will inform the layout to\n     * recalculate its size constraints to fit the space requirements of\n     * its child widgets, and to update their position and size. Not all\n     * layouts will respond to messages of this type.\n     */\n    export const FitRequest = new ConflatableMessage('fit-request');\n\n    /**\n     * A singleton conflatable `'activate-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should\n     * perform the actions necessary to activate the widget, which\n     * may include focusing its node or descendant node.\n     */\n    export const ActivateRequest = new ConflatableMessage('activate-request');\n\n    /**\n     * A singleton conflatable `'close-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should close\n     * and remove itself from the widget hierarchy.\n     */\n    export const CloseRequest = new ConflatableMessage('close-request');\n  }\n\n  /**\n   * A message class for child related messages.\n   */\n  export class ChildMessage extends Message {\n    /**\n     * Construct a new child message.\n     *\n     * @param type - The message type.\n     *\n     * @param child - The child widget for the message.\n     */\n    constructor(type: string, child: Widget) {\n      super(type);\n      this.child = child;\n    }\n\n    /**\n     * The child widget for the message.\n     */\n    readonly child: Widget;\n  }\n\n  /**\n   * A message class for `'resize'` messages.\n   */\n  export class ResizeMessage extends Message {\n    /**\n     * Construct a new resize message.\n     *\n     * @param width - The **offset width** of the widget, or `-1` if\n     *   the width is not known.\n     *\n     * @param height - The **offset height** of the widget, or `-1` if\n     *   the height is not known.\n     */\n    constructor(width: number, height: number) {\n      super('resize');\n      this.width = width;\n      this.height = height;\n    }\n\n    /**\n     * The offset width of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the width is unknown.\n     */\n    readonly width: number;\n\n    /**\n     * The offset height of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the height is unknown.\n     */\n    readonly height: number;\n  }\n\n  /**\n   * The namespace for the `ResizeMessage` class statics.\n   */\n  export namespace ResizeMessage {\n    /**\n     * A singleton `'resize'` message with an unknown size.\n     */\n    export const UnknownSize = new ResizeMessage(-1, -1);\n  }\n\n  /**\n   * Attach a widget to a host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param host - The DOM node to use as the widget's host.\n   *\n   * @param ref - The child of `host` to use as the reference element.\n   *   If this is provided, the widget will be inserted before this\n   *   node in the host. The default is `null`, which will cause the\n   *   widget to be added as the last child of the host.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget, if\n   * the widget is already attached, or if the host is not attached\n   * to the DOM.\n   */\n  export function attach(\n    widget: Widget,\n    host: HTMLElement,\n    ref: HTMLElement | null = null\n  ): void {\n    if (widget.parent) {\n      throw new Error('Cannot attach a child widget.');\n    }\n    if (widget.isAttached || widget.node.isConnected) {\n      throw new Error('Widget is already attached.');\n    }\n    if (!host.isConnected) {\n      throw new Error('Host is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    host.insertBefore(widget.node, ref);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n  }\n\n  /**\n   * Detach the widget from its host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget,\n   * or if the widget is not attached to the DOM.\n   */\n  export function detach(widget: Widget): void {\n    if (widget.parent) {\n      throw new Error('Cannot detach a child widget.');\n    }\n    if (!widget.isAttached || !widget.node.isConnected) {\n      throw new Error('Widget is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    widget.node.parentNode!.removeChild(widget.node);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An attached property for the widget title object.\n   */\n  export const titleProperty = new AttachedProperty<Widget, Title<Widget>>({\n    name: 'title',\n    create: owner => new Title<Widget>({ owner })\n  });\n\n  /**\n   * Create a DOM node for the given widget options.\n   */\n  export function createNode(options: Widget.IOptions): HTMLElement {\n    return options.node || document.createElement(options.tag || 'div');\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable<Widget>, IDisposable {\n  /**\n   * Construct a new layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: Layout.IOptions = {}) {\n    this._fitPolicy = options.fitPolicy || 'set-min-size';\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This should be reimplemented to clear and dispose of the widgets.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    this._parent = null;\n    this._disposed = true;\n    Signal.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * Test whether the layout is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Get the parent widget of the layout.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent widget of the layout.\n   *\n   * #### Notes\n   * This is set automatically when installing the layout on the parent\n   * widget. The parent widget should not be set directly by user code.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (this._parent) {\n      throw new Error('Cannot change parent widget.');\n    }\n    if (value!.layout !== this) {\n      throw new Error('Invalid parent widget.');\n    }\n    this._parent = value;\n    this.init();\n  }\n\n  /**\n   * Get the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  get fitPolicy(): Layout.FitPolicy {\n    return this._fitPolicy;\n  }\n\n  /**\n   * Set the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   *\n   * Changing the fit policy will clear the current size constraint\n   * for the parent widget and then re-fit the parent.\n   */\n  set fitPolicy(value: Layout.FitPolicy) {\n    // Bail if the policy does not change\n    if (this._fitPolicy === value) {\n      return;\n    }\n\n    // Update the internal policy.\n    this._fitPolicy = value;\n\n    // Clear the size constraints and schedule a fit of the parent.\n    if (this._parent) {\n      let style = this._parent.node.style;\n      style.minWidth = '';\n      style.minHeight = '';\n      style.maxWidth = '';\n      style.maxHeight = '';\n      this._parent.fit();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This abstract method must be implemented by a subclass.\n   */\n  abstract [Symbol.iterator](): IterableIterator<Widget>;\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method should *not* modify the widget's `parent`.\n   */\n  abstract removeWidget(widget: Widget): void;\n\n  /**\n   * Process a message sent to the parent widget.\n   *\n   * @param msg - The message sent to the parent widget.\n   *\n   * #### Notes\n   * This method is called by the parent widget to process a message.\n   *\n   * Subclasses may reimplement this method as needed.\n   */\n  processParentMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.onAfterDetach(msg);\n        break;\n      case 'child-removed':\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      case 'child-shown':\n        this.onChildShown(msg as Widget.ChildMessage);\n        break;\n      case 'child-hidden':\n        this.onChildHidden(msg as Widget.ChildMessage);\n        break;\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   *\n   * #### Notes\n   * This method is invoked immediately after the layout is installed\n   * on the parent widget.\n   *\n   * The default implementation reparents all of the widgets to the\n   * layout parent widget.\n   *\n   * Subclasses should reimplement this method and attach the child\n   * widget nodes to the parent widget's node.\n   */\n  protected init(): void {\n    for (const widget of this) {\n      widget.parent = this.parent;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the specified layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the available layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * This will remove the child widget from the layout.\n   *\n   * Subclasses should **not** typically reimplement this method.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    this.removeWidget(msg.child);\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n  private _disposed = false;\n  private _fitPolicy: Layout.FitPolicy;\n  private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n  /**\n   * A type alias for the layout fit policy.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  export type FitPolicy =\n    | /**\n     * No size constraint will be applied to the parent widget.\n     */\n    'set-no-constraint'\n\n    /**\n     * The computed min size will be applied to the parent widget.\n     */\n    | 'set-min-size';\n\n  /**\n   * An options object for initializing a layout.\n   */\n  export interface IOptions {\n    /**\n     * The fit policy for the layout.\n     *\n     * The default is `'set-min-size'`.\n     */\n    fitPolicy?: FitPolicy;\n  }\n\n  /**\n   * A type alias for the horizontal alignment of a widget.\n   */\n  export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n  /**\n   * A type alias for the vertical alignment of a widget.\n   */\n  export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n  /**\n   * Get the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The horizontal alignment for the widget.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   */\n  export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n    return Private.horizontalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the horizontal alignment.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setHorizontalAlignment(\n    widget: Widget,\n    value: HorizontalAlignment\n  ): void {\n    Private.horizontalAlignmentProperty.set(widget, value);\n  }\n\n  /**\n   * Get the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The vertical alignment for the widget.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   */\n  export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n    return Private.verticalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the vertical alignment.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setVerticalAlignment(\n    widget: Widget,\n    value: VerticalAlignment\n  ): void {\n    Private.verticalAlignmentProperty.set(widget, value);\n  }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n  /**\n   * Construct a new layout item.\n   *\n   * @param widget - The widget to be managed by the item.\n   *\n   * #### Notes\n   * The widget will be set to absolute positioning.\n   * The widget will use strict CSS containment.\n   */\n  constructor(widget: Widget) {\n    this.widget = widget;\n    this.widget.node.style.position = 'absolute';\n    this.widget.node.style.contain = 'strict';\n  }\n\n  /**\n   * Dispose of the the layout item.\n   *\n   * #### Notes\n   * This will reset the positioning of the widget.\n   */\n  dispose(): void {\n    // Do nothing if the item is already disposed.\n    if (this._disposed) {\n      return;\n    }\n\n    // Mark the item as disposed.\n    this._disposed = true;\n\n    // Reset the widget style.\n    let style = this.widget.node.style;\n    style.position = '';\n    style.top = '';\n    style.left = '';\n    style.width = '';\n    style.height = '';\n    style.contain = '';\n  }\n\n  /**\n   * The widget managed by the layout item.\n   */\n  readonly widget: Widget;\n\n  /**\n   * The computed minimum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minWidth(): number {\n    return this._minWidth;\n  }\n\n  /**\n   * The computed minimum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minHeight(): number {\n    return this._minHeight;\n  }\n\n  /**\n   * The computed maximum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxWidth(): number {\n    return this._maxWidth;\n  }\n\n  /**\n   * The computed maximum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxHeight(): number {\n    return this._maxHeight;\n  }\n\n  /**\n   * Whether the layout item is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Whether the managed widget is hidden.\n   */\n  get isHidden(): boolean {\n    return this.widget.isHidden;\n  }\n\n  /**\n   * Whether the managed widget is visible.\n   */\n  get isVisible(): boolean {\n    return this.widget.isVisible;\n  }\n\n  /**\n   * Whether the managed widget is attached.\n   */\n  get isAttached(): boolean {\n    return this.widget.isAttached;\n  }\n\n  /**\n   * Update the computed size limits of the managed widget.\n   */\n  fit(): void {\n    let limits = ElementExt.sizeLimits(this.widget.node);\n    this._minWidth = limits.minWidth;\n    this._minHeight = limits.minHeight;\n    this._maxWidth = limits.maxWidth;\n    this._maxHeight = limits.maxHeight;\n  }\n\n  /**\n   * Update the position and size of the managed widget.\n   *\n   * @param left - The left edge position of the layout box.\n   *\n   * @param top - The top edge position of the layout box.\n   *\n   * @param width - The width of the layout box.\n   *\n   * @param height - The height of the layout box.\n   */\n  update(left: number, top: number, width: number, height: number): void {\n    // Clamp the size to the computed size limits.\n    let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n    let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n    // Adjust the left edge for the horizontal alignment, if needed.\n    if (clampW < width) {\n      switch (Layout.getHorizontalAlignment(this.widget)) {\n        case 'left':\n          break;\n        case 'center':\n          left += (width - clampW) / 2;\n          break;\n        case 'right':\n          left += width - clampW;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Adjust the top edge for the vertical alignment, if needed.\n    if (clampH < height) {\n      switch (Layout.getVerticalAlignment(this.widget)) {\n        case 'top':\n          break;\n        case 'center':\n          top += (height - clampH) / 2;\n          break;\n        case 'bottom':\n          top += height - clampH;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Set up the resize variables.\n    let resized = false;\n    let style = this.widget.node.style;\n\n    // Update the top edge of the widget if needed.\n    if (this._top !== top) {\n      this._top = top;\n      style.top = `${top}px`;\n    }\n\n    // Update the left edge of the widget if needed.\n    if (this._left !== left) {\n      this._left = left;\n      style.left = `${left}px`;\n    }\n\n    // Update the width of the widget if needed.\n    if (this._width !== clampW) {\n      resized = true;\n      this._width = clampW;\n      style.width = `${clampW}px`;\n    }\n\n    // Update the height of the widget if needed.\n    if (this._height !== clampH) {\n      resized = true;\n      this._height = clampH;\n      style.height = `${clampH}px`;\n    }\n\n    // Send a resize message to the widget if needed.\n    if (resized) {\n      let msg = new Widget.ResizeMessage(clampW, clampH);\n      MessageLoop.sendMessage(this.widget, msg);\n    }\n  }\n\n  private _top = NaN;\n  private _left = NaN;\n  private _width = NaN;\n  private _height = NaN;\n  private _minWidth = 0;\n  private _minHeight = 0;\n  private _maxWidth = Infinity;\n  private _maxHeight = Infinity;\n  private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The attached property for a widget horizontal alignment.\n   */\n  export const horizontalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.HorizontalAlignment\n  >({\n    name: 'horizontalAlignment',\n    create: () => 'center',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The attached property for a widget vertical alignment.\n   */\n  export const verticalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.VerticalAlignment\n  >({\n    name: 'verticalAlignment',\n    create: () => 'top',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The change handler for the attached alignment properties.\n   */\n  function onAlignmentChanged(child: Widget): void {\n    if (child.parent && child.parent.layout) {\n      child.parent.update();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    while (this._widgets.length > 0) {\n      this._widgets.pop()!.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * A read-only array of the widgets in the layout.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this._widgets;\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    yield* this._widgets;\n  }\n\n  /**\n   * Add a widget to the end of the layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this._widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    widget.parent = this.parent;\n\n    // Look up the current index of the widget.\n    let i = this._widgets.indexOf(widget);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._widgets.length));\n\n    // If the widget is not in the array, insert it.\n    if (i === -1) {\n      // Insert the widget into the array.\n      ArrayExt.insert(this._widgets, j, widget);\n\n      // If the layout is parented, attach the widget to the DOM.\n      if (this.parent) {\n        this.attachWidget(j, widget);\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the widget exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._widgets.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the widget to the new location.\n    ArrayExt.move(this._widgets, i, j);\n\n    // If the layout is parented, move the widget in the DOM.\n    if (this.parent) {\n      this.moveWidget(i, j, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    this.removeWidgetAt(this._widgets.indexOf(widget));\n  }\n\n  /**\n   * Remove the widget at a given index from the layout.\n   *\n   * @param index - The index of the widget to remove.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  removeWidgetAt(index: number): void {\n    // Remove the widget from the array.\n    let widget = ArrayExt.removeAt(this._widgets, index);\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (widget && this.parent) {\n      this.detachWidget(index, widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    let index = 0;\n    for (const widget of this) {\n      this.attachWidget(index++, widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[index];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation moves the widget's node to the proper\n   * location in the parent's node and sends the appropriate attach and\n   * detach messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is moved in the parent's node.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` and  message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[toIndex];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n  /**\n   * Clamp a dimension value to an integer >= 0.\n   */\n  export function clampDimension(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n  /**\n   * Construct a new split layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: SplitLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.orientation !== undefined) {\n      this._orientation = options.orientation;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n    this._handles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the split layout.\n   */\n  readonly renderer: SplitLayout.IRenderer;\n\n  /**\n   * Get the layout orientation for the split layout.\n   */\n  get orientation(): SplitLayout.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split layout.\n   */\n  set orientation(value: SplitLayout.Orientation) {\n    if (this._orientation === value) {\n      return;\n    }\n    this._orientation = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['orientation'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  get alignment(): SplitLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  set alignment(value: SplitLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the split layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the split handles in the layout.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return this._handles;\n  }\n\n  /**\n   * Get the absolute sizes of the widgets in the layout.\n   *\n   * @returns A new array of the absolute sizes of the widgets.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  absoluteSizes(): number[] {\n    return this._sizers.map(sizer => sizer.size);\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the layout.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return Private.normalize(this._sizers.map(sizer => sizer.size));\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the layout.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    // Copy the sizes and pad with zeros as needed.\n    let n = this._sizers.length;\n    let temp = sizes.slice(0, n);\n    while (temp.length < n) {\n      temp.push(0);\n    }\n\n    // Normalize the padded sizes.\n    let normed = Private.normalize(temp);\n\n    // Apply the normalized sizes to the sizers.\n    for (let i = 0; i < n; ++i) {\n      let sizer = this._sizers[i];\n      sizer.sizeHint = normed[i];\n      sizer.size = normed[i];\n    }\n\n    // Set the flag indicating the sizes are normalized.\n    this._hasNormedSizes = true;\n\n    // Trigger an update of the parent widget.\n    if (update && this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Move the offset position of a split handle.\n   *\n   * @param index - The index of the handle of the interest.\n   *\n   * @param position - The desired offset position of the handle.\n   *\n   * #### Notes\n   * The position is relative to the offset parent.\n   *\n   * This will move the handle as close as possible to the desired\n   * position. The sibling widgets will be adjusted as necessary.\n   */\n  moveHandle(index: number, position: number): void {\n    // Bail if the index is invalid or the handle is hidden.\n    let handle = this._handles[index];\n    if (!handle || handle.classList.contains('lm-mod-hidden')) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (this._orientation === 'horizontal') {\n      delta = position - handle.offsetLeft;\n    } else {\n      delta = position - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent widget resizing unless needed.\n    for (let sizer of this._sizers) {\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(this._sizers, index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['orientation'] = this.orientation;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create the item, handle, and sizer for the new widget.\n    let item = new LayoutItem(widget);\n    let handle = Private.createHandle(this.renderer);\n    let average = Private.averageSize(this._sizers);\n    let sizer = Private.createSizer(average);\n\n    // Insert the item, handle, and sizer into the internal arrays.\n    ArrayExt.insert(this._items, index, item);\n    ArrayExt.insert(this._sizers, index, sizer);\n    ArrayExt.insert(this._handles, index, handle);\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget and handle nodes to the parent.\n    this.parent!.node.appendChild(widget.node);\n    this.parent!.node.appendChild(handle);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the item, sizer, and handle for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n    ArrayExt.move(this._handles, fromIndex, toIndex);\n\n    // Post a fit request to the parent to show/hide last handle.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the item, handle, and sizer for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n    let handle = ArrayExt.removeAt(this._handles, index);\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget and handle nodes from the parent.\n    this.parent!.node.removeChild(widget.node);\n    this.parent!.node.removeChild(handle!);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const item = this._items[i];\n    if (item.isHidden) {\n      return;\n    }\n\n    // Fetch the style for the handle.\n    let handleStyle = this._handles[i].style;\n\n    // Update the widget and handle, and advance the relevant edge.\n    if (isHorizontal) {\n      left += this.widgetOffset;\n      item.update(left, top, size, height);\n      left += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${this._spacing}px`;\n      handleStyle.height = `${height}px`;\n    } else {\n      top += this.widgetOffset;\n      item.update(left, top, width, size);\n      top += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${width}px`;\n      handleStyle.height = `${this._spacing}px`;\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Update the handles and track the visible widget count.\n    let nVisible = 0;\n    let lastHandleIndex = -1;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      if (this._items[i].isHidden) {\n        this._handles[i].classList.add('lm-mod-hidden');\n      } else {\n        this._handles[i].classList.remove('lm-mod-hidden');\n        lastHandleIndex = i;\n        nVisible++;\n      }\n    }\n\n    // Hide the handle for the last visible widget.\n    if (lastHandleIndex !== -1) {\n      this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed =\n      this._spacing * Math.max(0, nVisible - 1) +\n      this.widgetOffset * this._items.length;\n\n    // Setup the computed minimum size.\n    let horz = this._orientation === 'horizontal';\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed size limits.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // Prevent resizing unless necessary.\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the stretch factor.\n      sizer.stretch = SplitLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0 && this.widgetOffset === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Set up the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n    let horz = this._orientation === 'horizontal';\n\n    if (nVisible > 0) {\n      // Compute the adjusted layout space.\n      let space: number;\n      if (horz) {\n        // left += this.widgetOffset;\n        space = Math.max(0, width - this._fixed);\n      } else {\n        // top += this.widgetOffset;\n        space = Math.max(0, height - this._fixed);\n      }\n\n      // Scale the size hints if they are normalized.\n      if (this._hasNormedSizes) {\n        for (let sizer of this._sizers) {\n          sizer.sizeHint *= space;\n        }\n        this._hasNormedSizes = false;\n      }\n\n      // Distribute the layout space to the box sizers.\n      let delta = BoxEngine.calc(this._sizers, space);\n\n      // Account for alignment if there is extra layout space.\n      if (delta > 0) {\n        switch (this._alignment) {\n          case 'start':\n            break;\n          case 'center':\n            extra = 0;\n            offset = delta / 2;\n            break;\n          case 'end':\n            extra = 0;\n            offset = delta;\n            break;\n          case 'justify':\n            extra = delta / nVisible;\n            offset = 0;\n            break;\n          default:\n            throw 'unreachable';\n        }\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      const item = this._items[i];\n\n      // Fetch the computed size for the widget.\n      const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n      this.updateItemPosition(\n        i,\n        horz,\n        horz ? left + offset : left,\n        horz ? top : top + offset,\n        height,\n        width,\n        size\n      );\n\n      const fullOffset =\n        this.widgetOffset +\n        (this._handles[i].classList.contains('lm-mod-hidden')\n          ? 0\n          : this._spacing);\n\n      if (horz) {\n        left += size + fullOffset;\n      } else {\n        top += size + fullOffset;\n      }\n    }\n  }\n\n  protected widgetOffset = 0;\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _hasNormedSizes = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _handles: HTMLDivElement[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: SplitLayout.Alignment = 'start';\n  private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n  /**\n   * A type alias for a split layout orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a split layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a split layout.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The orientation of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Orientation}.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a split layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new handle for use with a split layout.\n     *\n     * @returns A new handle element.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * Get the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Create a new box sizer with the given size hint.\n   */\n  export function createSizer(size: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = Math.floor(size);\n    return sizer;\n  }\n\n  /**\n   * Create a new split handle node using the given renderer.\n   */\n  export function createHandle(\n    renderer: SplitLayout.IRenderer\n  ): HTMLDivElement {\n    let handle = renderer.createHandle();\n    handle.style.position = 'absolute';\n    // Do not use size containment to allow the handle to fill the available space\n    handle.style.contain = 'style';\n    return handle;\n  }\n\n  /**\n   * Compute the average size of an array of box sizers.\n   */\n  export function averageSize(sizers: BoxSizer[]): number {\n    return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n  }\n\n  /**\n   * Normalize an array of values.\n   */\n  export function normalize(values: number[]): number[] {\n    let n = values.length;\n    if (n === 0) {\n      return [];\n    }\n    let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n    return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof SplitLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n  /**\n   * Construct a new accordion layout.\n   *\n   * @param options - The options for initializing the layout.\n   *\n   * #### Notes\n   * The default orientation will be vertical.\n   *\n   * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n   */\n  constructor(options: AccordionLayout.IOptions) {\n    super({ ...options, orientation: options.orientation || 'vertical' });\n    this.titleSpace = options.titleSpace || 22;\n  }\n\n  /**\n   * The section title height or width depending on the orientation.\n   */\n  get titleSpace(): number {\n    return this.widgetOffset;\n  }\n  set titleSpace(value: number) {\n    value = Utils.clampDimension(value);\n    if (this.widgetOffset === value) {\n      return;\n    }\n    this.widgetOffset = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return this._titles;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Clear the layout state.\n    this._titles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the accordion layout.\n   */\n  readonly renderer: AccordionLayout.IRenderer;\n\n  public updateTitle(index: number, widget: Widget): void {\n    const oldTitle = this._titles[index];\n    const expanded = oldTitle.classList.contains('lm-mod-expanded');\n    const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n    this._titles[index] = newTitle;\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.replaceChild(newTitle, oldTitle);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (!widget.id) {\n      widget.id = `id-${UUID.uuid4()}`;\n    }\n    super.insertWidget(index, widget);\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    const title = Private.createTitle(this.renderer, widget.title);\n\n    ArrayExt.insert(this._titles, index, title);\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.appendChild(title);\n\n    widget.node.setAttribute('role', 'region');\n    widget.node.setAttribute('aria-labelledby', title.id);\n\n    super.attachWidget(index, widget);\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    ArrayExt.move(this._titles, fromIndex, toIndex);\n    super.moveWidget(fromIndex, toIndex, widget);\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    const title = ArrayExt.removeAt(this._titles, index);\n\n    this.parent!.node.removeChild(title!);\n\n    super.detachWidget(index, widget);\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const titleStyle = this._titles[i].style;\n\n    // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n    titleStyle.top = `${top}px`;\n    titleStyle.left = `${left}px`;\n    titleStyle.height = `${this.widgetOffset}px`;\n    if (isHorizontal) {\n      titleStyle.width = `${height}px`;\n    } else {\n      titleStyle.width = `${width}px`;\n    }\n\n    super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n  }\n\n  private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n  /**\n   * A type alias for a accordion layout orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion layout alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * An options object for initializing a accordion layout.\n   */\n  export interface IOptions extends SplitLayout.IOptions {\n    /**\n     * The renderer to use for the accordion layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The section title height or width depending on the orientation.\n     *\n     * The default is `22`.\n     */\n    titleSpace?: number;\n  }\n\n  /**\n   * A renderer for use with an accordion layout.\n   */\n  export interface IRenderer extends SplitLayout.IRenderer {\n    /**\n     * Common class name for all accordion titles.\n     */\n    readonly titleClassName: string;\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param title - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(title: Title<Widget>): HTMLElement;\n  }\n}\n\nnamespace Private {\n  /**\n   * Create the title HTML element.\n   *\n   * @param renderer Accordion renderer\n   * @param data Widget title\n   * @returns Title HTML element\n   */\n  export function createTitle(\n    renderer: AccordionLayout.IRenderer,\n    data: Title<Widget>,\n    expanded: boolean = true\n  ): HTMLElement {\n    const title = renderer.createSectionTitle(data);\n    title.style.position = 'absolute';\n    title.style.contain = 'strict';\n    title.setAttribute('aria-label', `${data.label} Section`);\n    title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n    title.setAttribute('aria-controls', data.owner.id);\n    if (expanded) {\n      title.classList.add('lm-mod-expanded');\n    }\n    return title;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n  /**\n   * Construct a new panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: Panel.IOptions = {}) {\n    super();\n    this.addClass('lm-Panel');\n    this.layout = Private.createLayout(options);\n  }\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return (this.layout as PanelLayout).widgets;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    (this.layout as PanelLayout).addWidget(widget);\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    (this.layout as PanelLayout).insertWidget(index, widget);\n  }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n  /**\n   * An options object for creating a panel.\n   */\n  export interface IOptions {\n    /**\n     * The panel layout to use for the panel.\n     *\n     * The default is a new `PanelLayout`.\n     */\n    layout?: PanelLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a panel layout for the given panel options.\n   */\n  export function createLayout(options: Panel.IOptions): PanelLayout {\n    return options.layout || new PanelLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n  /**\n   * Construct a new split panel.\n   *\n   * @param options - The options for initializing the split panel.\n   */\n  constructor(options: SplitPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-SplitPanel');\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    super.dispose();\n  }\n\n  /**\n   * Get the layout orientation for the split panel.\n   */\n  get orientation(): SplitPanel.Orientation {\n    return (this.layout as SplitLayout).orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split panel.\n   */\n  set orientation(value: SplitPanel.Orientation) {\n    (this.layout as SplitLayout).orientation = value;\n  }\n\n  /**\n   * Get the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  get alignment(): SplitPanel.Alignment {\n    return (this.layout as SplitLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  set alignment(value: SplitPanel.Alignment) {\n    (this.layout as SplitLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the split panel.\n   */\n  get spacing(): number {\n    return (this.layout as SplitLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split panel.\n   */\n  set spacing(value: number) {\n    (this.layout as SplitLayout).spacing = value;\n  }\n\n  /**\n   * The renderer used by the split panel.\n   */\n  get renderer(): SplitPanel.IRenderer {\n    return (this.layout as SplitLayout).renderer;\n  }\n\n  /**\n   * A signal emitted when a split handle has moved.\n   */\n  get handleMoved(): ISignal<this, void> {\n    return this._handleMoved;\n  }\n\n  /**\n   * A read-only array of the split handles in the panel.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return (this.layout as SplitLayout).handles;\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the panel.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return (this.layout as SplitLayout).relativeSizes();\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the panel.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n  }\n\n  /**\n   * Handle the DOM events for the split panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the `'keydown'` event for the split panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    if (this._pressData) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the split panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the primary button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the target, if any.\n    let layout = this.layout as SplitLayout;\n    let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n      return handle.contains(event.target as HTMLElement);\n    });\n\n    // Bail early if the mouse press was not on a handle.\n    if (index === -1) {\n      return;\n    }\n\n    // Stop the event when a split handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    document.addEventListener('pointerup', this, true);\n    document.addEventListener('pointermove', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset delta for the handle press.\n    let delta: number;\n    let handle = layout.handles[index];\n    let rect = handle.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      delta = event.clientX - rect.left;\n    } else {\n      delta = event.clientY - rect.top;\n    }\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!);\n    this._pressData = { index, delta, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the split panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Stop the event when dragging a split handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let pos: number;\n    let layout = this.layout as SplitLayout;\n    let rect = this.node.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      pos = event.clientX - rect.left - this._pressData!.delta;\n    } else {\n      pos = event.clientY - rect.top - this._pressData!.delta;\n    }\n\n    // Move the handle as close to the desired position as possible.\n    layout.moveHandle(this._pressData!.index, pos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the split panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the primary button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse grab for the split panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Emit the handle moved signal.\n    this._handleMoved.emit();\n\n    // Remove the extra document listeners.\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('pointerup', this, true);\n    document.removeEventListener('pointermove', this, true);\n    document.removeEventListener('contextmenu', this, true);\n  }\n\n  private _handleMoved = new Signal<any, void>(this);\n  private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n  /**\n   * A type alias for a split panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a split panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a split panel renderer.\n   */\n  export type IRenderer = SplitLayout.IRenderer;\n\n  /**\n   * An options object for initializing a split panel.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The layout orientation of the panel.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The split layout to use for the split panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `SplitLayout`.\n     */\n    layout?: SplitLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new handle for use with a split panel.\n     *\n     * @returns A new handle element for a split panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-SplitPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * Get the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return SplitLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    SplitLayout.setStretch(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The index of the pressed handle.\n     */\n    index: number;\n\n    /**\n     * The offset of the press in handle coordinates.\n     */\n    delta: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * Create a split layout for the given panel options.\n   */\n  export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n    return (\n      options.layout ||\n      new SplitLayout({\n        renderer: options.renderer || SplitPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n  /**\n   * Construct a new accordion panel.\n   *\n   * @param options - The options for initializing the accordion panel.\n   *\n   */\n  constructor(options: AccordionPanel.IOptions = {}) {\n    super({ ...options, layout: Private.createLayout(options) });\n    this.addClass('lm-AccordionPanel');\n  }\n\n  /**\n   * The renderer used by the accordion panel.\n   */\n  get renderer(): AccordionPanel.IRenderer {\n    return (this.layout as AccordionLayout).renderer;\n  }\n\n  /**\n   * The section title space.\n   *\n   * This is the height if the panel is vertical and the width if it is\n   * horizontal.\n   */\n  get titleSpace(): number {\n    return (this.layout as AccordionLayout).titleSpace;\n  }\n  set titleSpace(value: number) {\n    (this.layout as AccordionLayout).titleSpace = value;\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return (this.layout as AccordionLayout).titles;\n  }\n\n  /**\n   * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n   */\n  get expansionToggled(): ISignal<this, number> {\n    return this._expansionToggled;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    super.addWidget(widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Collapse the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  collapse(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && !widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Expand the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  expand(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    super.insertWidget(index, widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Handle the DOM events for the accordion panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    super.handleEvent(event);\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._eventKeyDown(event as KeyboardEvent);\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    super.onBeforeAttach(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    super.onAfterDetach(msg);\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<Widget>): void {\n    const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n      return widget.contains(sender.owner);\n    });\n\n    if (index >= 0) {\n      (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n      this.update();\n    }\n  }\n\n  /**\n   * Compute the size of widgets in this panel on the title click event.\n   * On closing, the size of the widget is cached and we will try to expand\n   * the last opened widget.\n   * On opening, we will use the cached size if it is available to restore the\n   * widget.\n   * In both cases, if we can not compute the size of widgets, we will let\n   * `SplitLayout` decide.\n   *\n   * @param index - The index of widget to be opened of closed\n   *\n   * @returns Relative size of widgets in this panel, if this size can\n   * not be computed, return `undefined`\n   */\n  private _computeWidgetSize(index: number): number[] | undefined {\n    const layout = this.layout as AccordionLayout;\n\n    const widget = layout.widgets[index];\n    if (!widget) {\n      return undefined;\n    }\n    const isHidden = widget.isHidden;\n    const widgetSizes = layout.absoluteSizes();\n    const delta = (isHidden ? -1 : 1) * this.spacing;\n    const totalSize = widgetSizes.reduce(\n      (prev: number, curr: number) => prev + curr\n    );\n\n    let newSize = [...widgetSizes];\n\n    if (!isHidden) {\n      // Hide the widget\n      const currentSize = widgetSizes[index];\n\n      this._widgetSizesCache.set(widget, currentSize);\n      newSize[index] = 0;\n\n      const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // All widget are closed, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n\n      newSize[widgetToCollapse] =\n        widgetSizes[widgetToCollapse] + currentSize + delta;\n    } else {\n      // Show the widget\n      const previousSize = this._widgetSizesCache.get(widget);\n      if (!previousSize) {\n        // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n      newSize[index] += previousSize;\n\n      const widgetToCollapse = newSize\n        .map(sz => sz - previousSize > 0)\n        .lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // Can not reduce the size of one widget, reduce all opened widgets\n        // proportionally with its size.\n        newSize.forEach((_, idx) => {\n          if (idx !== index) {\n            newSize[idx] -=\n              (widgetSizes[idx] / totalSize) * (previousSize - delta);\n          }\n        });\n      } else {\n        newSize[widgetToCollapse] -= previousSize - delta;\n      }\n    }\n    return newSize.map(sz => sz / (totalSize + delta));\n  }\n  /**\n   * Handle the `'click'` event for the accordion panel\n   */\n  private _evtClick(event: MouseEvent): void {\n    const target = event.target as HTMLElement | null;\n\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._toggleExpansion(index);\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the accordion panel.\n   */\n  private _eventKeyDown(event: KeyboardEvent): void {\n    if (event.defaultPrevented) {\n      return;\n    }\n\n    const target = event.target as HTMLElement | null;\n    let handled = false;\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        const keyCode = event.keyCode.toString();\n\n        // If Space or Enter is pressed on title, emulate click event\n        if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n          target.click();\n          handled = true;\n        } else if (\n          this.orientation === 'horizontal'\n            ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n            : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n        ) {\n          // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n          const direction =\n            event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n              ? -1\n              : 1;\n          const length = this.titles.length;\n          const newIndex = (index + length + direction) % length;\n\n          this.titles[newIndex].focus();\n          handled = true;\n        } else if (event.key === 'End' || keyCode === '35') {\n          // If End is pressed on title, focus on the last title\n          this.titles[this.titles.length - 1].focus();\n          handled = true;\n        } else if (event.key === 'Home' || keyCode === '36') {\n          // If Home is pressed on title, focus on the first title\n          this.titles[0].focus();\n          handled = true;\n        }\n      }\n\n      if (handled) {\n        event.preventDefault();\n      }\n    }\n  }\n\n  private _toggleExpansion(index: number) {\n    const title = this.titles[index];\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    const newSize = this._computeWidgetSize(index);\n    if (newSize) {\n      this.setRelativeSizes(newSize, false);\n    }\n\n    if (widget.isHidden) {\n      title.classList.add('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'true');\n      widget.show();\n    } else {\n      title.classList.remove('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'false');\n      widget.hide();\n    }\n\n    // Emit the expansion state signal.\n    this._expansionToggled.emit(index);\n  }\n\n  private _widgetSizesCache: WeakMap<Widget, number> = new WeakMap();\n  private _expansionToggled = new Signal<this, number>(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n  /**\n   * A type alias for a accordion panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a accordion panel renderer.\n   */\n  export type IRenderer = AccordionLayout.IRenderer;\n\n  /**\n   * An options object for initializing a accordion panel.\n   */\n  export interface IOptions extends Partial<AccordionLayout.IOptions> {\n    /**\n     * The accordion layout to use for the accordion panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `AccordionLayout`.\n     */\n    layout?: AccordionLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer extends SplitPanel.Renderer implements IRenderer {\n    constructor() {\n      super();\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches any title node in the accordion.\n     */\n    readonly titleClassName = 'lm-AccordionPanel-title';\n\n    /**\n     * Render the collapse indicator for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the collapse indicator.\n     */\n    createCollapseIcon(data: Title<Widget>): HTMLElement {\n      return document.createElement('span');\n    }\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(data: Title<Widget>): HTMLElement {\n      const handle = document.createElement('h3');\n      handle.setAttribute('tabindex', '0');\n      handle.id = this.createTitleKey(data);\n      handle.className = this.titleClassName;\n      for (const aData in data.dataset) {\n        handle.dataset[aData] = data.dataset[aData];\n      }\n\n      const collapser = handle.appendChild(this.createCollapseIcon(data));\n      collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n      const label = handle.appendChild(document.createElement('span'));\n      label.className = 'lm-AccordionPanel-titleLabel';\n      label.textContent = data.label;\n      label.title = data.caption || data.label;\n\n      return handle;\n    }\n\n    /**\n     * Create a unique render key for the title.\n     *\n     * @param data - The data to use for the title.\n     *\n     * @returns The unique render key for the title.\n     *\n     * #### Notes\n     * This method caches the key against the section title the first time\n     * the key is generated.\n     */\n    createTitleKey(data: Title<Widget>): string {\n      let key = this._titleKeys.get(data);\n      if (key === undefined) {\n        key = `title-key-${this._uuid}-${this._titleID++}`;\n        this._titleKeys.set(data, key);\n      }\n      return key;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _titleID = 0;\n    private _titleKeys = new WeakMap<Title<Widget>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n  /**\n   * Create an accordion layout for the given panel options.\n   *\n   * @param options Panel options\n   * @returns Panel layout\n   */\n  export function createLayout(\n    options: AccordionPanel.IOptions\n  ): AccordionLayout {\n    return (\n      options.layout ||\n      new AccordionLayout({\n        renderer: options.renderer || AccordionPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing,\n        titleSpace: options.titleSpace\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n  /**\n   * Construct a new box layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: BoxLayout.IOptions = {}) {\n    super();\n    if (options.direction !== undefined) {\n      this._direction = options.direction;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the layout direction for the box layout.\n   */\n  get direction(): BoxLayout.Direction {\n    return this._direction;\n  }\n\n  /**\n   * Set the layout direction for the box layout.\n   */\n  set direction(value: BoxLayout.Direction) {\n    if (this._direction === value) {\n      return;\n    }\n    this._direction = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['direction'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the box layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['direction'] = this.direction;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Create and add a new sizer for the widget.\n    ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Move the sizer for the widget.\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Remove the sizer for the widget.\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n    // Setup the computed minimum size.\n    let horz = Private.isHorizontal(this._direction);\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the size basis and stretch factor.\n      sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n      sizer.stretch = BoxLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Distribute the layout space and adjust the start position.\n    let delta: number;\n    switch (this._direction) {\n      case 'left-to-right':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        break;\n      case 'top-to-bottom':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        break;\n      case 'right-to-left':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        left += width;\n        break;\n      case 'bottom-to-top':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        top += height;\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Setup the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n\n    // Account for alignment if there is extra layout space.\n    if (delta > 0) {\n      switch (this._alignment) {\n        case 'start':\n          break;\n        case 'center':\n          extra = 0;\n          offset = delta / 2;\n          break;\n        case 'end':\n          extra = 0;\n          offset = delta;\n          break;\n        case 'justify':\n          extra = delta / nVisible;\n          offset = 0;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the computed size for the widget.\n      let size = this._sizers[i].size;\n\n      // Update the widget geometry and advance the relevant edge.\n      switch (this._direction) {\n        case 'left-to-right':\n          item.update(left + offset, top, size + extra, height);\n          left += size + extra + this._spacing;\n          break;\n        case 'top-to-bottom':\n          item.update(left, top + offset, width, size + extra);\n          top += size + extra + this._spacing;\n          break;\n        case 'right-to-left':\n          item.update(left - offset - size - extra, top, size + extra, height);\n          left -= size + extra + this._spacing;\n          break;\n        case 'bottom-to-top':\n          item.update(left, top - offset - size - extra, width, size + extra);\n          top -= size + extra + this._spacing;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n  }\n\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: BoxLayout.Alignment = 'start';\n  private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n  /**\n   * A type alias for a box layout direction.\n   */\n  export type Direction =\n    | 'left-to-right'\n    | 'right-to-left'\n    | 'top-to-bottom'\n    | 'bottom-to-top';\n\n  /**\n   * A type alias for a box layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a box layout.\n   */\n  export interface IOptions {\n    /**\n     * The direction of the layout.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * Get the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n\n  /**\n   * Get the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return Private.sizeBasisProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    Private.sizeBasisProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * The property descriptor for a widget size basis.\n   */\n  export const sizeBasisProperty = new AttachedProperty<Widget, number>({\n    name: 'sizeBasis',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Test whether a direction has horizontal orientation.\n   */\n  export function isHorizontal(dir: BoxLayout.Direction): boolean {\n    return dir === 'left-to-right' || dir === 'right-to-left';\n  }\n\n  /**\n   * Clamp a spacing value to an integer >= 0.\n   */\n  export function clampSpacing(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof BoxLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n  /**\n   * Construct a new box panel.\n   *\n   * @param options - The options for initializing the box panel.\n   */\n  constructor(options: BoxPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-BoxPanel');\n  }\n\n  /**\n   * Get the layout direction for the box panel.\n   */\n  get direction(): BoxPanel.Direction {\n    return (this.layout as BoxLayout).direction;\n  }\n\n  /**\n   * Set the layout direction for the box panel.\n   */\n  set direction(value: BoxPanel.Direction) {\n    (this.layout as BoxLayout).direction = value;\n  }\n\n  /**\n   * Get the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxPanel.Alignment {\n    return (this.layout as BoxLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxPanel.Alignment) {\n    (this.layout as BoxLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the box panel.\n   */\n  get spacing(): number {\n    return (this.layout as BoxLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box panel.\n   */\n  set spacing(value: number) {\n    (this.layout as BoxLayout).spacing = value;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-BoxPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-BoxPanel-child');\n  }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n  /**\n   * A type alias for a box panel direction.\n   */\n  export type Direction = BoxLayout.Direction;\n\n  /**\n   * A type alias for a box panel alignment.\n   */\n  export type Alignment = BoxLayout.Alignment;\n\n  /**\n   * An options object for initializing a box panel.\n   */\n  export interface IOptions {\n    /**\n     * The layout direction of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Direction}.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The box layout to use for the box panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `BoxLayout`.\n     */\n    layout?: BoxLayout;\n  }\n\n  /**\n   * Get the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return BoxLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    BoxLayout.setStretch(widget, value);\n  }\n\n  /**\n   * Get the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return BoxLayout.getSizeBasis(widget);\n  }\n\n  /**\n   * Set the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    BoxLayout.setSizeBasis(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a box layout for the given panel options.\n   */\n  export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n    return options.layout || new BoxLayout(options);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n  /**\n   * Construct a new command palette.\n   *\n   * @param options - The options for initializing the palette.\n   */\n  constructor(options: CommandPalette.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-CommandPalette');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || CommandPalette.defaultRenderer;\n    this.commands.commandChanged.connect(this._onGenericChange, this);\n    this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._items.length = 0;\n    this._results = null;\n    super.dispose();\n  }\n\n  /**\n   * The command registry used by the command palette.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the command palette.\n   */\n  readonly renderer: CommandPalette.IRenderer;\n\n  /**\n   * The command palette search node.\n   *\n   * #### Notes\n   * This is the node which contains the search-related elements.\n   */\n  get searchNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-search'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The command palette input node.\n   *\n   * #### Notes\n   * This is the actual input node for the search area.\n   */\n  get inputNode(): HTMLInputElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-input'\n    )[0] as HTMLInputElement;\n  }\n\n  /**\n   * The command palette content node.\n   *\n   * #### Notes\n   * This is the node which holds the command item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * A read-only array of the command items in the palette.\n   */\n  get items(): ReadonlyArray<CommandPalette.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Add a command item to the command palette.\n   *\n   * @param options - The options for creating the command item.\n   *\n   * @returns The command item added to the palette.\n   */\n  addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n    // Create a new command item for the options.\n    let item = Private.createItem(this.commands, options);\n\n    // Add the item to the array.\n    this._items.push(item);\n\n    // Refresh the search results.\n    this.refresh();\n\n    // Return the item added to the palette.\n    return item;\n  }\n\n  /**\n   * Adds command items to the command palette.\n   *\n   * @param items - An array of options for creating each command item.\n   *\n   * @returns The command items added to the palette.\n   */\n  addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n    const newItems = items.map(item => Private.createItem(this.commands, item));\n    newItems.forEach(item => this._items.push(item));\n    this.refresh();\n    return newItems;\n  }\n\n  /**\n   * Remove an item from the command palette.\n   *\n   * @param item - The item to remove from the palette.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the palette.\n   */\n  removeItem(item: CommandPalette.IItem): void {\n    this.removeItemAt(this._items.indexOf(item));\n  }\n\n  /**\n   * Remove the item at a given index from the command palette.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Remove all items from the command palette.\n   */\n  clearItems(): void {\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the array of items.\n    this._items.length = 0;\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Clear the search results and schedule an update.\n   *\n   * #### Notes\n   * This should be called whenever the search results of the palette\n   * should be updated.\n   *\n   * This is typically called automatically by the palette as needed,\n   * but can be called manually if the input text is programatically\n   * changed.\n   *\n   * The rendered results are updated asynchronously.\n   */\n  refresh(): void {\n    this._results = null;\n    if (this.inputNode.value !== '') {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'inherit';\n    } else {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'none';\n    }\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the command palette.\n   *\n   * @param event - The DOM event sent to the command palette.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the command palette's DOM node.\n   * It should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'input':\n        this.refresh();\n        break;\n      case 'focus':\n      case 'blur':\n        this._toggleFocused();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('input', this);\n    this.node.addEventListener('focus', this, true);\n    this.node.addEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('input', this);\n    this.node.removeEventListener('focus', this, true);\n    this.node.removeEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   */\n  protected onAfterShow(msg: Message): void {\n    this.update();\n    super.onAfterShow(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      let input = this.inputNode;\n      input.focus();\n      input.select();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (!this.isVisible) {\n      // Ensure to clear the content if the widget is hidden\n      VirtualDOM.render(null, this.contentNode);\n      return;\n    }\n\n    // Fetch the current query text and content node.\n    let query = this.inputNode.value;\n    let contentNode = this.contentNode;\n\n    // Ensure the search results are generated.\n    let results = this._results;\n    if (!results) {\n      // Generate and store the new search results.\n      results = this._results = Private.search(this._items, query);\n\n      // Reset the active index.\n      this._activeIndex = query\n        ? ArrayExt.findFirstIndex(results, Private.canActivate)\n        : -1;\n    }\n\n    // If there is no query and no results, clear the content.\n    if (!query && results.length === 0) {\n      VirtualDOM.render(null, contentNode);\n      return;\n    }\n\n    // If the is a query but no results, render the empty message.\n    if (query && results.length === 0) {\n      let content = this.renderer.renderEmptyMessage({ query });\n      VirtualDOM.render(content, contentNode);\n      return;\n    }\n\n    // Create the render content for the search results.\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let content = new Array<VirtualElement>(results.length);\n    for (let i = 0, n = results.length; i < n; ++i) {\n      let result = results[i];\n      if (result.type === 'header') {\n        let indices = result.indices;\n        let category = result.category;\n        content[i] = renderer.renderHeader({ category, indices });\n      } else {\n        let item = result.item;\n        let indices = result.indices;\n        let active = i === activeIndex;\n        content[i] = renderer.renderItem({ item, indices, active });\n      }\n    }\n\n    // Render the search result content.\n    VirtualDOM.render(content, contentNode);\n\n    // Adjust the scroll position as needed.\n    if (activeIndex < 0 || activeIndex >= results.length) {\n      contentNode.scrollTop = 0;\n    } else {\n      let element = contentNode.children[activeIndex];\n      ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n    }\n  }\n\n  /**\n   * Handle the `'click'` event for the command palette.\n   */\n  private _evtClick(event: MouseEvent): void {\n    // Bail if the click is not the left button.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Clear input if the target is clear button\n    if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n      this.inputNode.value = '';\n      this.refresh();\n      return;\n    }\n\n    // Find the index of the item which was clicked.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return node.contains(event.target as HTMLElement);\n    });\n\n    // Bail if the click was not on an item.\n    if (index === -1) {\n      return;\n    }\n\n    // Kill the event when a content item is clicked.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Execute the item if possible.\n    this._execute(index);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the command palette.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n      return;\n    }\n    switch (event.keyCode) {\n      case 13: // Enter\n        event.preventDefault();\n        event.stopPropagation();\n        this._execute(this._activeIndex);\n        break;\n      case 38: // Up Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activatePreviousItem();\n        break;\n      case 40: // Down Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activateNextItem();\n        break;\n    }\n  }\n\n  /**\n   * Activate the next enabled command item.\n   */\n  private _activateNextItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the next enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this._activeIndex = ArrayExt.findFirstIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Activate the previous enabled command item.\n   */\n  private _activatePreviousItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the previous enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this._activeIndex = ArrayExt.findLastIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Execute the command item at the given index, if possible.\n   */\n  private _execute(index: number): void {\n    // Bail if there are no search results.\n    if (!this._results) {\n      return;\n    }\n\n    // Bail if the index is out of range.\n    let part = this._results[index];\n    if (!part) {\n      return;\n    }\n\n    // Update the search text if the item is a header.\n    if (part.type === 'header') {\n      let input = this.inputNode;\n      input.value = `${part.category.toLowerCase()} `;\n      input.focus();\n      this.refresh();\n      return;\n    }\n\n    // Bail if item is not enabled.\n    if (!part.item.isEnabled) {\n      return;\n    }\n\n    // Execute the item.\n    this.commands.execute(part.item.command, part.item.args);\n\n    // Clear the query text.\n    this.inputNode.value = '';\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Toggle the focused modifier based on the input node focus state.\n   */\n  private _toggleFocused(): void {\n    let focused = document.activeElement === this.inputNode;\n    this.toggleClass('lm-mod-focused', focused);\n  }\n\n  /**\n   * A signal handler for generic command changes.\n   */\n  private _onGenericChange(): void {\n    this.refresh();\n  }\n\n  private _activeIndex = -1;\n  private _items: CommandPalette.IItem[] = [];\n  private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n  /**\n   * An options object for creating a command palette.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the command palette.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the command palette.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for creating a command item.\n   */\n  export interface IItemOptions {\n    /**\n     * The category for the item.\n     */\n    category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    command: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     *\n     * The rank is used as a tie-breaker when ordering command items\n     * for display. Items are sorted in the following order:\n     *   1. Text match (lower is better)\n     *   2. Category (locale order)\n     *   3. Rank (lower is better)\n     *   4. Label (locale order)\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n\n  /**\n   * An object which represents an item in a command palette.\n   *\n   * #### Notes\n   * Item objects are created automatically by a command palette.\n   */\n  export interface IItem {\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    readonly label: string;\n\n    /**\n     * The display caption for the command item.\n     */\n    readonly caption: string;\n\n    /**\n     * The icon renderer for the command item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the command item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the command item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The extra class name for the command item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the command item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the command item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the command item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    readonly isToggleable: boolean;\n\n    /**\n     * Whether the command item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the command item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * The render data for a command palette header.\n   */\n  export interface IHeaderRenderData {\n    /**\n     * The category of the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched characters in the category.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * The render data for a command palette item.\n   */\n  export interface IItemRenderData {\n    /**\n     * The command palette item to render.\n     */\n    readonly item: IItem;\n\n    /**\n     * The indices of the matched characters in the label.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n  }\n\n  /**\n   * The render data for a command palette empty message.\n   */\n  export interface IEmptyMessageRenderData {\n    /**\n     * The query which failed to match any commands.\n     */\n    query: string;\n  }\n\n  /**\n   * A renderer for use with a command palette.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement;\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     *\n     * #### Notes\n     * The command palette will not render invisible items.\n     */\n    renderItem(data: IItemRenderData): VirtualElement;\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement {\n      let content = this.formatHeader(data);\n      return h.li({ className: 'lm-CommandPalette-header' }, content);\n    }\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IItemRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      if (data.item.isToggleable) {\n        return h.li(\n          {\n            className,\n            dataset,\n            role: 'menuitemcheckbox',\n            'aria-checked': `${data.item.isToggled}`\n          },\n          this.renderItemIcon(data),\n          this.renderItemContent(data),\n          this.renderItemShortcut(data)\n        );\n      }\n      return h.li(\n        {\n          className,\n          dataset,\n          role: 'menuitem'\n        },\n        this.renderItemIcon(data),\n        this.renderItemContent(data),\n        this.renderItemShortcut(data)\n      );\n    }\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n      let content = this.formatEmptyMessage(data);\n      return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n    }\n\n    /**\n     * Render the icon for a command palette item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the icon.\n     */\n    renderItemIcon(data: IItemRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the content for a command palette item.\n     *\n     * @param data - The data to use for rendering the content.\n     *\n     * @returns A virtual element representing the content.\n     */\n    renderItemContent(data: IItemRenderData): VirtualElement {\n      return h.div(\n        { className: 'lm-CommandPalette-itemContent' },\n        this.renderItemLabel(data),\n        this.renderItemCaption(data)\n      );\n    }\n\n    /**\n     * Render the label for a command palette item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the label.\n     */\n    renderItemLabel(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemLabel(data);\n      return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n    }\n\n    /**\n     * Render the caption for a command palette item.\n     *\n     * @param data - The data to use for rendering the caption.\n     *\n     * @returns A virtual element representing the caption.\n     */\n    renderItemCaption(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemCaption(data);\n      return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n    }\n\n    /**\n     * Render the shortcut for a command palette item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the shortcut.\n     */\n    renderItemShortcut(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemShortcut(data);\n      return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n    }\n\n    /**\n     * Create the class name for the command palette item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the command palette item.\n     */\n    createItemClass(data: IItemRenderData): string {\n      // Set up the initial class name.\n      let name = 'lm-CommandPalette-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the command palette item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the command palette item.\n     */\n    createItemDataset(data: IItemRenderData): ElementDataset {\n      return { ...data.item.dataset, command: data.item.command };\n    }\n\n    /**\n     * Create the class name for the command item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IItemRenderData): string {\n      let name = 'lm-CommandPalette-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the header node.\n     *\n     * @param data - The data to use for the header content.\n     *\n     * @returns The content to add to the header node.\n     */\n    formatHeader(data: IHeaderRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.category;\n      }\n      return StringExt.highlight(data.category, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the empty message node.\n     *\n     * @param data - The data to use for the empty message content.\n     *\n     * @returns The content to add to the empty message node.\n     */\n    formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n      return `No commands found that match '${data.query}'`;\n    }\n\n    /**\n     * Create the render content for the item shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatItemShortcut(data: IItemRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n\n    /**\n     * Create the render content for the item label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatItemLabel(data: IItemRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.item.label;\n      }\n      return StringExt.highlight(data.item.label, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the item caption node.\n     *\n     * @param data - The data to use for the caption content.\n     *\n     * @returns The content to add to the caption node.\n     */\n    formatItemCaption(data: IItemRenderData): h.Child {\n      return data.item.caption;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a command palette.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let search = document.createElement('div');\n    let wrapper = document.createElement('div');\n    let input = document.createElement('input');\n    let content = document.createElement('ul');\n    let clear = document.createElement('button');\n    search.className = 'lm-CommandPalette-search';\n    wrapper.className = 'lm-CommandPalette-wrapper';\n    input.className = 'lm-CommandPalette-input';\n    clear.className = 'lm-close-icon';\n\n    content.className = 'lm-CommandPalette-content';\n    content.setAttribute('role', 'menu');\n    input.spellcheck = false;\n    wrapper.appendChild(input);\n    wrapper.appendChild(clear);\n    search.appendChild(wrapper);\n    node.appendChild(search);\n    node.appendChild(content);\n    return node;\n  }\n\n  /**\n   * Create a new command item from a command registry and options.\n   */\n  export function createItem(\n    commands: CommandRegistry,\n    options: CommandPalette.IItemOptions\n  ): CommandPalette.IItem {\n    return new CommandItem(commands, options);\n  }\n\n  /**\n   * A search result object for a header label.\n   */\n  export interface IHeaderResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'header';\n\n    /**\n     * The category for the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A search result object for a command item.\n   */\n  export interface IItemResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'item';\n\n    /**\n     * The command item which was matched.\n     */\n    readonly item: CommandPalette.IItem;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A type alias for a search result item.\n   */\n  export type SearchResult = IHeaderResult | IItemResult;\n\n  /**\n   * Search an array of command items for fuzzy matches.\n   */\n  export function search(\n    items: CommandPalette.IItem[],\n    query: string\n  ): SearchResult[] {\n    // Fuzzy match the items for the query.\n    let scores = matchItems(items, query);\n\n    // Sort the items based on their score.\n    scores.sort(scoreCmp);\n\n    // Create the results for the search.\n    return createResults(scores);\n  }\n\n  /**\n   * Test whether a result item can be activated.\n   */\n  export function canActivate(result: SearchResult): boolean {\n    return result.type === 'item' && result.item.isEnabled;\n  }\n\n  /**\n   * Normalize a category for a command item.\n   */\n  function normalizeCategory(category: string): string {\n    return category.trim().replace(/\\s+/g, ' ');\n  }\n\n  /**\n   * Normalize the query text for a fuzzy search.\n   */\n  function normalizeQuery(text: string): string {\n    return text.replace(/\\s+/g, '').toLowerCase();\n  }\n\n  /**\n   * An enum of the supported match types.\n   */\n  const enum MatchType {\n    Label,\n    Category,\n    Split,\n    Default\n  }\n\n  /**\n   * A text match score with associated command item.\n   */\n  interface IScore {\n    /**\n     * The numerical type for the text match.\n     */\n    matchType: MatchType;\n\n    /**\n     * The numerical score for the text match.\n     */\n    score: number;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    categoryIndices: number[] | null;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    labelIndices: number[] | null;\n\n    /**\n     * The command item associated with the match.\n     */\n    item: CommandPalette.IItem;\n  }\n\n  /**\n   * Perform a fuzzy match on an array of command items.\n   */\n  function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n    // Normalize the query text to lower case with no whitespace.\n    query = normalizeQuery(query);\n\n    // Create the array to hold the scores.\n    let scores: IScore[] = [];\n\n    // Iterate over the items and match against the query.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Ignore items which are not visible.\n      let item = items[i];\n      if (!item.isVisible) {\n        continue;\n      }\n\n      // If the query is empty, all items are matched by default.\n      if (!query) {\n        scores.push({\n          matchType: MatchType.Default,\n          categoryIndices: null,\n          labelIndices: null,\n          score: 0,\n          item\n        });\n        continue;\n      }\n\n      // Run the fuzzy search for the item and query.\n      let score = fuzzySearch(item, query);\n\n      // Ignore the item if it is not a match.\n      if (!score) {\n        continue;\n      }\n\n      // Penalize disabled items.\n      // TODO - push disabled items all the way down in sort cmp?\n      if (!item.isEnabled) {\n        score.score += 1000;\n      }\n\n      // Add the score to the results.\n      scores.push(score);\n    }\n\n    // Return the final array of scores.\n    return scores;\n  }\n\n  /**\n   * Perform a fuzzy search on a single command item.\n   */\n  function fuzzySearch(\n    item: CommandPalette.IItem,\n    query: string\n  ): IScore | null {\n    // Create the source text to be searched.\n    let category = item.category.toLowerCase();\n    let label = item.label.toLowerCase();\n    let source = `${category} ${label}`;\n\n    // Set up the match score and indices array.\n    let score = Infinity;\n    let indices: number[] | null = null;\n\n    // The regex for search word boundaries\n    let rgx = /\\b\\w/g;\n\n    // Search the source by word boundary.\n    // eslint-disable-next-line no-constant-condition\n    while (true) {\n      // Find the next word boundary in the source.\n      let rgxMatch = rgx.exec(source);\n\n      // Break if there is no more source context.\n      if (!rgxMatch) {\n        break;\n      }\n\n      // Run the string match on the relevant substring.\n      let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n      // Break if there is no match.\n      if (!match) {\n        break;\n      }\n\n      // Update the match if the score is better.\n      if (match.score <= score) {\n        score = match.score;\n        indices = match.indices;\n      }\n    }\n\n    // Bail if there was no match.\n    if (!indices || score === Infinity) {\n      return null;\n    }\n\n    // Compute the pivot index between category and label text.\n    let pivot = category.length + 1;\n\n    // Find the slice index to separate matched indices.\n    let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n    // Extract the matched category and label indices.\n    let categoryIndices = indices.slice(0, j);\n    let labelIndices = indices.slice(j);\n\n    // Adjust the label indices for the pivot offset.\n    for (let i = 0, n = labelIndices.length; i < n; ++i) {\n      labelIndices[i] -= pivot;\n    }\n\n    // Handle a pure label match.\n    if (categoryIndices.length === 0) {\n      return {\n        matchType: MatchType.Label,\n        categoryIndices: null,\n        labelIndices,\n        score,\n        item\n      };\n    }\n\n    // Handle a pure category match.\n    if (labelIndices.length === 0) {\n      return {\n        matchType: MatchType.Category,\n        categoryIndices,\n        labelIndices: null,\n        score,\n        item\n      };\n    }\n\n    // Handle a split match.\n    return {\n      matchType: MatchType.Split,\n      categoryIndices,\n      labelIndices,\n      score,\n      item\n    };\n  }\n\n  /**\n   * A sort comparison function for a match score.\n   */\n  function scoreCmp(a: IScore, b: IScore): number {\n    // First compare based on the match type\n    let m1 = a.matchType - b.matchType;\n    if (m1 !== 0) {\n      return m1;\n    }\n\n    // Otherwise, compare based on the match score.\n    let d1 = a.score - b.score;\n    if (d1 !== 0) {\n      return d1;\n    }\n\n    // Find the match index based on the match type.\n    let i1 = 0;\n    let i2 = 0;\n    switch (a.matchType) {\n      case MatchType.Label:\n        i1 = a.labelIndices![0];\n        i2 = b.labelIndices![0];\n        break;\n      case MatchType.Category:\n      case MatchType.Split:\n        i1 = a.categoryIndices![0];\n        i2 = b.categoryIndices![0];\n        break;\n    }\n\n    // Compare based on the match index.\n    if (i1 !== i2) {\n      return i1 - i2;\n    }\n\n    // Otherwise, compare by category.\n    let d2 = a.item.category.localeCompare(b.item.category);\n    if (d2 !== 0) {\n      return d2;\n    }\n\n    // Otherwise, compare by rank.\n    let r1 = a.item.rank;\n    let r2 = b.item.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity safe\n    }\n\n    // Finally, compare by label.\n    return a.item.label.localeCompare(b.item.label);\n  }\n\n  /**\n   * Create the results from an array of sorted scores.\n   */\n  function createResults(scores: IScore[]): SearchResult[] {\n    // Set up the search results array.\n    let results: SearchResult[] = [];\n\n    // Iterate over each score in the array.\n    for (let i = 0, n = scores.length; i < n; ++i) {\n      // Extract the current item and indices.\n      let { item, categoryIndices, labelIndices } = scores[i];\n\n      // Extract the category for the current item.\n      let category = item.category;\n\n      // Is this the same category as the preceding result?\n      if (i === 0 || category !== scores[i - 1].item.category) {\n        // Add the header result for the category.\n        results.push({ type: 'header', category, indices: categoryIndices });\n      }\n\n      // Create the item result for the score.\n      results.push({ type: 'item', item, indices: labelIndices });\n    }\n\n    // Return the final results.\n    return results;\n  }\n\n  /**\n   * A concrete implementation of `CommandPalette.IItem`.\n   */\n  class CommandItem implements CommandPalette.IItem {\n    /**\n     * Construct a new command item.\n     */\n    constructor(\n      commands: CommandRegistry,\n      options: CommandPalette.IItemOptions\n    ) {\n      this._commands = commands;\n      this.category = normalizeCategory(options.category);\n      this.command = options.command;\n      this.args = options.args || JSONExt.emptyObject;\n      this.rank = options.rank !== undefined ? options.rank : Infinity;\n    }\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    get label(): string {\n      return this._commands.label(this.command, this.args);\n    }\n\n    /**\n     * The icon renderer for the command item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      return this._commands.icon(this.command, this.args);\n    }\n\n    /**\n     * The icon class for the command item.\n     */\n    get iconClass(): string {\n      return this._commands.iconClass(this.command, this.args);\n    }\n\n    /**\n     * The icon label for the command item.\n     */\n    get iconLabel(): string {\n      return this._commands.iconLabel(this.command, this.args);\n    }\n\n    /**\n     * The display caption for the command item.\n     */\n    get caption(): string {\n      return this._commands.caption(this.command, this.args);\n    }\n\n    /**\n     * The extra class name for the command item.\n     */\n    get className(): string {\n      return this._commands.className(this.command, this.args);\n    }\n\n    /**\n     * The dataset for the command item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      return this._commands.dataset(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is enabled.\n     */\n    get isEnabled(): boolean {\n      return this._commands.isEnabled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggled.\n     */\n    get isToggled(): boolean {\n      return this._commands.isToggled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    get isToggleable(): boolean {\n      return this._commands.isToggleable(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is visible.\n     */\n    get isVisible(): boolean {\n      return this._commands.isVisible(this.command, this.args);\n    }\n\n    /**\n     * The key binding for the command item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      let { command, args } = this;\n      return (\n        ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n          return kb.command === command && JSONExt.deepEqual(kb.args, args);\n        }) || null\n      );\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ARIAAttrNames,\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n  pageXOffset: number;\n  pageYOffset: number;\n  clientWidth: number;\n  clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n  /**\n   * Construct a new menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: Menu.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-Menu');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || Menu.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the menu.\n   */\n  dispose(): void {\n    this.close();\n    this._items.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted just before the menu is closed.\n   *\n   * #### Notes\n   * This signal is emitted when the menu receives a `'close-request'`\n   * message, just before it removes itself from the DOM.\n   *\n   * This signal is not emitted if the menu is already detached from\n   * the DOM when it receives the `'close-request'` message.\n   */\n  get aboutToClose(): ISignal<this, void> {\n    return this._aboutToClose;\n  }\n\n  /**\n   * A signal emitted when a new menu is requested by the user.\n   *\n   * #### Notes\n   * This signal is emitted whenever the user presses the right or left\n   * arrow keys, and a submenu cannot be opened or closed in response.\n   *\n   * This signal is useful when implementing menu bars in order to open\n   * the next or previous menu in response to a user key press.\n   *\n   * This signal is only emitted for the root menu in a hierarchy.\n   */\n  get menuRequested(): ISignal<this, 'next' | 'previous'> {\n    return this._menuRequested;\n  }\n\n  /**\n   * The command registry used by the menu.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the menu.\n   */\n  readonly renderer: Menu.IRenderer;\n\n  /**\n   * The parent menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu is an open submenu.\n   */\n  get parentMenu(): Menu | null {\n    return this._parentMenu;\n  }\n\n  /**\n   * The child menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu has an open submenu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The root menu of the menu hierarchy.\n   */\n  get rootMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._parentMenu) {\n      menu = menu._parentMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The leaf menu of the menu hierarchy.\n   */\n  get leafMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._childMenu) {\n      menu = menu._childMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The menu content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-Menu-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu item.\n   */\n  get activeItem(): Menu.IItem | null {\n    return this._items[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the item will be set to `null`.\n   */\n  set activeItem(value: Menu.IItem | null) {\n    this.activeIndex = value ? this._items.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu item.\n   *\n   * #### Notes\n   * This will be `-1` if no menu item is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._items.length) {\n      value = -1;\n    }\n\n    // Ensure the item can be activated.\n    if (value !== -1 && !Private.canActivate(this._items[value])) {\n      value = -1;\n    }\n\n    // Bail if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Make active element in focus\n    if (\n      this._activeIndex >= 0 &&\n      this.contentNode.childNodes[this._activeIndex]\n    ) {\n      (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n    }\n\n    // schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menu items in the menu.\n   */\n  get items(): ReadonlyArray<Menu.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Activate the next selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activateNextItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this.activeIndex = ArrayExt.findFirstIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Activate the previous selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activatePreviousItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this.activeIndex = ArrayExt.findLastIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Trigger the active menu item.\n   *\n   * #### Notes\n   * If the active item is a submenu, it will be opened and the first\n   * item will be activated.\n   *\n   * If the active item is a command, the command will be executed.\n   *\n   * If the menu is not attached, this is a no-op.\n   *\n   * If there is no active item, this is a no-op.\n   */\n  triggerActiveItem(): void {\n    // Bail if the menu is not attached.\n    if (!this.isAttached) {\n      return;\n    }\n\n    // Bail if there is no active item.\n    let item = this.activeItem;\n    if (!item) {\n      return;\n    }\n\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // If the item is a submenu, open it.\n    if (item.type === 'submenu') {\n      this._openChildMenu(true);\n      return;\n    }\n\n    // Close the root menu before executing the command.\n    this.rootMenu.close();\n\n    // Execute the command for the item.\n    let { command, args } = item;\n    if (this.commands.isEnabled(command, args)) {\n      this.commands.execute(command, args);\n    } else {\n      console.log(`Command '${command}' is disabled.`);\n    }\n  }\n\n  /**\n   * Add a menu item to the end of the menu.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   */\n  addItem(options: Menu.IItemOptions): Menu.IItem {\n    return this.insertItem(this._items.length, options);\n  }\n\n  /**\n   * Insert a menu item into the menu at the specified index.\n   *\n   * @param index - The index at which to insert the item.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the items.\n   */\n  insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Clamp the insert index to the array bounds.\n    let i = Math.max(0, Math.min(index, this._items.length));\n\n    // Create the item for the options.\n    let item = Private.createItem(this, options);\n\n    // Insert the item into the array.\n    ArrayExt.insert(this._items, i, item);\n\n    // Schedule an update of the items.\n    this.update();\n\n    // Return the item added to the menu.\n    return item;\n  }\n\n  /**\n   * Remove an item from the menu.\n   *\n   * @param item - The item to remove from the menu.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the menu.\n   */\n  removeItem(item: Menu.IItem): void {\n    let index = this._items.indexOf(item);\n    if (index === -1) {\n      return;\n    }\n    this.removeItemAt(index);\n  }\n\n  /**\n   * Remove the item at a given index from the menu.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Remove all menu items from the menu.\n   */\n  clearItems(): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the items.\n    this._items.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Open the menu at the specified location.\n   *\n   * @param x - The client X coordinate of the menu location.\n   *\n   * @param y - The client Y coordinate of the menu location.\n   *\n   * @param options - The additional options for opening the menu.\n   *\n   * #### Notes\n   * The menu will be opened at the given location unless it will not\n   * fully fit on the screen. If it will not fit, it will be adjusted\n   * to fit naturally on the screen.\n   *\n   * The menu will be attached under the `host` element in the DOM\n   * (or `document.body` if `host` is `null`) and before the `ref`\n   * element (or as the last child of `host` if `ref` is `null`).\n   * The menu may be displayed outside of the `host` element\n   * following the rules of CSS absolute positioning.\n   *\n   * This is a no-op if the menu is already attached to the DOM.\n   */\n  open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n    // Bail early if the menu is already attached.\n    if (this.isAttached) {\n      return;\n    }\n\n    // Extract the menu options.\n    let forceX = options.forceX || false;\n    let forceY = options.forceY || false;\n    const host = options.host ?? null;\n    const ref = options.ref ?? null;\n    const horizontalAlignment =\n      options.horizontalAlignment ??\n      (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n    // Open the menu as a root menu.\n    Private.openRootMenu(\n      this,\n      x,\n      y,\n      forceX,\n      forceY,\n      horizontalAlignment,\n      host,\n      ref\n    );\n\n    // Activate the menu to accept keyboard input.\n    this.activate();\n  }\n\n  /**\n   * Handle the DOM events for the menu.\n   *\n   * @param event - The DOM event sent to the menu.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu's DOM nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseenter':\n        this._evtMouseEnter(event as MouseEvent);\n        break;\n      case 'mouseleave':\n        this._evtMouseLeave(event as MouseEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mouseup', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseenter', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('contextmenu', this);\n    document.addEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mouseup', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseenter', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('contextmenu', this);\n    document.removeEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this.node.focus();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let items = this._items;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let collapsedFlags = Private.computeCollapsed(items);\n    let content = new Array<VirtualElement>(items.length);\n    for (let i = 0, n = items.length; i < n; ++i) {\n      let item = items[i];\n      let active = i === activeIndex;\n      let collapsed = collapsedFlags[i];\n      content[i] = renderer.renderItem({\n        item,\n        active,\n        collapsed,\n        onfocus: () => {\n          this.activeIndex = i;\n        }\n      });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   */\n  protected onCloseRequest(msg: Message): void {\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Close any open child menu.\n    let childMenu = this._childMenu;\n    if (childMenu) {\n      this._childIndex = -1;\n      this._childMenu = null;\n      childMenu._parentMenu = null;\n      childMenu.close();\n    }\n\n    // Remove this menu from its parent and activate the parent.\n    let parentMenu = this._parentMenu;\n    if (parentMenu) {\n      this._parentMenu = null;\n      parentMenu._childIndex = -1;\n      parentMenu._childMenu = null;\n      parentMenu.activate();\n    }\n\n    // Emit the `aboutToClose` signal if the menu is attached.\n    if (this.isAttached) {\n      this._aboutToClose.emit(undefined);\n    }\n\n    // Finish closing the menu.\n    super.onCloseRequest(msg);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // A menu handles all keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Enter\n    if (kc === 13) {\n      this.triggerActiveItem();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this.close();\n      return;\n    }\n\n    // Left Arrow\n    if (kc === 37) {\n      if (this._parentMenu) {\n        this.close();\n      } else {\n        this._menuRequested.emit('previous');\n      }\n      return;\n    }\n\n    // Up Arrow\n    if (kc === 38) {\n      this.activatePreviousItem();\n      return;\n    }\n\n    // Right Arrow\n    if (kc === 39) {\n      let item = this.activeItem;\n      if (item && item.type === 'submenu') {\n        this.triggerActiveItem();\n      } else {\n        this.rootMenu._menuRequested.emit('next');\n      }\n      return;\n    }\n\n    // Down Arrow\n    if (kc === 40) {\n      this.activateNextItem();\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._items, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that item is triggered.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.triggerActiveItem();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n    }\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    if (event.button !== 0) {\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n    this.triggerActiveItem();\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Hit test the item nodes for the item under the mouse.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the mouse is already over the active index.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Update and coerce the active index.\n    this.activeIndex = index;\n    index = this.activeIndex;\n\n    // If the index is the current child index, cancel the timers.\n    if (index === this._childIndex) {\n      this._cancelOpenTimer();\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // If a child menu is currently open, start the close timer.\n    if (this._childIndex !== -1) {\n      this._startCloseTimer();\n    }\n\n    // Cancel the open timer to give a full delay for opening.\n    this._cancelOpenTimer();\n\n    // Bail if the active item is not a valid submenu item.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      return;\n    }\n\n    // Start the open timer to open the active item submenu.\n    this._startOpenTimer();\n  }\n\n  /**\n   * Handle the `'mouseenter'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseEnter(event: MouseEvent): void {\n    // Synchronize the active ancestor items.\n    for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n      menu._cancelOpenTimer();\n      menu._cancelCloseTimer();\n      menu.activeIndex = menu._childIndex;\n    }\n  }\n\n  /**\n   * Handle the `'mouseleave'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseLeave(event: MouseEvent): void {\n    // Cancel any pending submenu opening.\n    this._cancelOpenTimer();\n\n    // If there is no open child menu, just reset the active index.\n    if (!this._childMenu) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // If the mouse is over the child menu, cancel the close timer.\n    let { clientX, clientY } = event;\n    if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // Otherwise, reset the active index and start the close timer.\n    this.activeIndex = -1;\n    this._startCloseTimer();\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the document node.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the menu is not a root menu.\n    if (this._parentMenu) {\n      return;\n    }\n\n    // The mouse button which is pressed is irrelevant. If the press\n    // is not on a menu, the entire hierarchy is closed and the event\n    // is allowed to propagate. This allows other code to act on the\n    // event, such as focusing the clicked element.\n    if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n      event.preventDefault();\n      event.stopPropagation();\n    } else {\n      this.close();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if the active item is not a valid submenu.\n   */\n  private _openChildMenu(activateFirst = false): void {\n    // If the item is not a valid submenu, close the child menu.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Do nothing if the child menu will not change.\n    let submenu = item.submenu;\n    if (submenu === this._childMenu) {\n      return;\n    }\n\n    // Prior to any DOM modifications save window data\n    Menu.saveWindowData();\n\n    // Ensure the current child menu is closed.\n    this._closeChildMenu();\n\n    // Update the private child state.\n    this._childMenu = submenu;\n    this._childIndex = this._activeIndex;\n\n    // Set the parent menu reference for the child.\n    submenu._parentMenu = this;\n\n    // Ensure the menu is updated and lookup the item node.\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    let itemNode = this.contentNode.children[this._activeIndex];\n\n    // Open the submenu at the active node.\n    Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n    // Activate the first item if desired.\n    if (activateFirst) {\n      submenu.activeIndex = -1;\n      submenu.activateNextItem();\n    }\n\n    // Activate the child menu.\n    submenu.activate();\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    if (this._childMenu) {\n      this._childMenu.close();\n    }\n  }\n\n  /**\n   * Start the open timer, unless it is already pending.\n   */\n  private _startOpenTimer(): void {\n    if (this._openTimerID === 0) {\n      this._openTimerID = window.setTimeout(() => {\n        this._openTimerID = 0;\n        this._openChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Start the close timer, unless it is already pending.\n   */\n  private _startCloseTimer(): void {\n    if (this._closeTimerID === 0) {\n      this._closeTimerID = window.setTimeout(() => {\n        this._closeTimerID = 0;\n        this._closeChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Cancel the open timer, if the timer is pending.\n   */\n  private _cancelOpenTimer(): void {\n    if (this._openTimerID !== 0) {\n      clearTimeout(this._openTimerID);\n      this._openTimerID = 0;\n    }\n  }\n\n  /**\n   * Cancel the close timer, if the timer is pending.\n   */\n  private _cancelCloseTimer(): void {\n    if (this._closeTimerID !== 0) {\n      clearTimeout(this._closeTimerID);\n      this._closeTimerID = 0;\n    }\n  }\n\n  /**\n   * Save window data used for menu positioning in transient cache.\n   *\n   * In order to avoid layout trashing it is recommended to invoke this\n   * method immediately prior to opening the menu and any DOM modifications\n   * (like closing previously visible menu, or adding a class to menu widget).\n   *\n   * The transient cache will be released upon `open()` call.\n   */\n  static saveWindowData(): void {\n    Private.saveWindowData();\n  }\n\n  private _childIndex = -1;\n  private _activeIndex = -1;\n  private _openTimerID = 0;\n  private _closeTimerID = 0;\n  private _items: Menu.IItem[] = [];\n  private _childMenu: Menu | null = null;\n  private _parentMenu: Menu | null = null;\n  private _aboutToClose = new Signal<this, void>(this);\n  private _menuRequested = new Signal<this, 'next' | 'previous'>(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n  /**\n   * An options object for creating a menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the menu.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for the `open` method on a menu.\n   */\n  export interface IOpenOptions {\n    /**\n     * Whether to force the X position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * X coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceX?: boolean;\n\n    /**\n     * Whether to force the Y position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * Y coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceY?: boolean;\n\n    /**\n     * The DOM node to use as the menu's host.\n     *\n     * If not specified then uses `document.body`.\n     */\n    host?: HTMLElement;\n\n    /**\n     * The child of `host` to use as the reference element.\n     * If this is provided, the menu will be inserted before this\n     * node in the host. The default is `null`, which will cause the\n     * menu to be added as the last child of the host.\n     */\n    ref?: HTMLElement;\n\n    /**\n     * The alignment of the menu.\n     *\n     * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n     */\n    horizontalAlignment?: 'left' | 'right';\n  }\n\n  /**\n   * A type alias for a menu item type.\n   */\n  export type ItemType = 'command' | 'submenu' | 'separator';\n\n  /**\n   * An options object for creating a menu item.\n   */\n  export interface IItemOptions {\n    /**\n     * The type of the menu item.\n     *\n     * The default value is `'command'`.\n     */\n    type?: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     *\n     * The default value is an empty string.\n     */\n    command?: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     *\n     * The default value is `null`.\n     */\n    submenu?: Menu | null;\n  }\n\n  /**\n   * An object which represents a menu item.\n   *\n   * #### Notes\n   * Item objects are created automatically by a menu.\n   */\n  export interface IItem {\n    /**\n     * The type of the menu item.\n     */\n    readonly type: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    readonly label: string;\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    readonly mnemonic: number;\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the menu item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the menu item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The display caption for the menu item.\n     */\n    readonly caption: string;\n\n    /**\n     * The extra class name for the menu item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the menu item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the menu item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the menu item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * An object which holds the data to render a menu item.\n   */\n  export interface IRenderData {\n    /**\n     * The item to be rendered.\n     */\n    readonly item: IItem;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the item should be collapsed.\n     */\n    readonly collapsed: boolean;\n\n    /**\n     * Handler for when element is in focus.\n     */\n    readonly onfocus?: () => void;\n  }\n\n  /**\n   * A renderer for use with a menu.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          tabindex: '0',\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data),\n        this.renderShortcut(data),\n        this.renderSubmenu(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-Menu-itemLabel' }, content);\n    }\n\n    /**\n     * Render the shortcut element for a menu item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the item shortcut.\n     */\n    renderShortcut(data: IRenderData): VirtualElement {\n      let content = this.formatShortcut(data);\n      return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n    }\n\n    /**\n     * Render the submenu icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the submenu icon.\n     *\n     * @returns A virtual element representing the submenu icon.\n     */\n    renderSubmenu(data: IRenderData): VirtualElement {\n      return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n    }\n\n    /**\n     * Create the class name for the menu item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      // Setup the initial class name.\n      let name = 'lm-Menu-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (!data.item.isVisible) {\n        name += ' lm-mod-hidden';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n      if (data.collapsed) {\n        name += ' lm-mod-collapsed';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the menu item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the menu item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      let result: ElementDataset;\n      let { type, command, dataset } = data.item;\n      if (type === 'command') {\n        result = { ...dataset, type, command };\n      } else {\n        result = { ...dataset, type };\n      }\n      return result;\n    }\n\n    /**\n     * Create the class name for the menu item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-Menu-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the aria attributes for menu item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      let aria: { [T in ARIAAttrNames]?: string } = {};\n      switch (data.item.type) {\n        case 'separator':\n          aria.role = 'presentation';\n          break;\n        case 'submenu':\n          aria['aria-haspopup'] = 'true';\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          break;\n        default:\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          if (data.item.isToggled) {\n            aria.role = 'menuitemcheckbox';\n            aria['aria-checked'] = 'true';\n          } else {\n            aria.role = 'menuitem';\n          }\n      }\n      return aria;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.item;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n\n    /**\n     * Create the render content for the shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatShortcut(data: IRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The ms delay for opening and closing a submenu.\n   */\n  export const TIMER_DELAY = 300;\n\n  /**\n   * The horizontal pixel overlap for an open submenu.\n   */\n  export const SUBMENU_OVERLAP = 3;\n\n  let transientWindowDataCache: IWindowData | null = null;\n  let transientCacheCounter: number = 0;\n\n  function getWindowData(): IWindowData {\n    // if transient cache is in use, take one from it\n    if (transientCacheCounter > 0) {\n      transientCacheCounter--;\n      return transientWindowDataCache!;\n    }\n    return _getWindowData();\n  }\n\n  /**\n   * Store window data in transient cache.\n   *\n   * The transient cache will be released upon `getWindowData()` call.\n   * If this function is called multiple times, the cache will be\n   * retained until as many calls to `getWindowData()` were made.\n   *\n   * Note: should be called before any DOM modifications.\n   */\n  export function saveWindowData(): void {\n    transientWindowDataCache = _getWindowData();\n    transientCacheCounter++;\n  }\n\n  /**\n   * Create the DOM node for a menu.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-Menu-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menu');\n    node.tabIndex = 0;\n    return node;\n  }\n\n  /**\n   * Test whether a menu item can be activated.\n   */\n  export function canActivate(item: Menu.IItem): boolean {\n    return item.type !== 'separator' && item.isEnabled && item.isVisible;\n  }\n\n  /**\n   * Create a new menu item for an owner menu.\n   */\n  export function createItem(\n    owner: Menu,\n    options: Menu.IItemOptions\n  ): Menu.IItem {\n    return new MenuItem(owner.commands, options);\n  }\n\n  /**\n   * Hit test a menu hierarchy starting at the given root.\n   */\n  export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n    for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n      if (ElementExt.hitTest(temp.node, x, y)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Compute which extra separator items should be collapsed.\n   */\n  export function computeCollapsed(\n    items: ReadonlyArray<Menu.IItem>\n  ): boolean[] {\n    // Allocate the return array and fill it with `false`.\n    let result = new Array<boolean>(items.length);\n    ArrayExt.fill(result, false);\n\n    // Collapse the leading separators.\n    let k1 = 0;\n    let n = items.length;\n    for (; k1 < n; ++k1) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k1] = true;\n    }\n\n    // Hide the trailing separators.\n    let k2 = n - 1;\n    for (; k2 >= 0; --k2) {\n      let item = items[k2];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k2] = true;\n    }\n\n    // Hide the remaining consecutive separators.\n    let hide = false;\n    while (++k1 < k2) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        hide = false;\n      } else if (hide) {\n        result[k1] = true;\n      } else {\n        hide = true;\n      }\n    }\n\n    // Return the resulting flags.\n    return result;\n  }\n\n  function _getWindowData(): IWindowData {\n    return {\n      pageXOffset: window.pageXOffset,\n      pageYOffset: window.pageYOffset,\n      clientWidth: document.documentElement.clientWidth,\n      clientHeight: document.documentElement.clientHeight\n    };\n  }\n\n  /**\n   * Open a menu as a root menu at the target location.\n   */\n  export function openRootMenu(\n    menu: Menu,\n    x: number,\n    y: number,\n    forceX: boolean,\n    forceY: boolean,\n    horizontalAlignment: 'left' | 'right',\n    host: HTMLElement | null,\n    ref: HTMLElement | null\n  ): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData();\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before attaching and measuring.\n    MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch - (forceY ? y : 0);\n\n    // Fetch common variables.\n    let node = menu.node;\n    let style = node.style;\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(menu, host || document.body, ref);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // align the menu to the right of the target if requested or language is RTL\n    if (horizontalAlignment === 'right') {\n      x -= width;\n    }\n\n    // Adjust the X position of the menu to fit on-screen.\n    if (!forceX && x + width > px + cw) {\n      x = px + cw - width;\n    }\n\n    // Adjust the Y position of the menu to fit on-screen.\n    if (!forceY && y + height > py + ch) {\n      if (y > py + ch) {\n        y = py + ch - height;\n      } else {\n        y = y - height;\n      }\n    }\n\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * Open a menu as a submenu using an item node for positioning.\n   */\n  export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData();\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before opening.\n    MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch;\n\n    // Fetch common variables.\n    let node = submenu.node;\n    let style = node.style;\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(submenu, document.body);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // Compute the box sizing for the menu.\n    let box = ElementExt.boxSizing(submenu.node);\n\n    // Get the bounding rect for the target item node.\n    let itemRect = itemNode.getBoundingClientRect();\n\n    // Compute the target X position.\n    let x = itemRect.right - SUBMENU_OVERLAP;\n\n    // Adjust the X position to fit on the screen.\n    if (x + width > px + cw) {\n      x = itemRect.left + SUBMENU_OVERLAP - width;\n    }\n\n    // Compute the target Y position.\n    let y = itemRect.top - box.borderTop - box.paddingTop;\n\n    // Adjust the Y position to fit on the screen.\n    if (y + height > py + ch) {\n      y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n    }\n\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    items: ReadonlyArray<Menu.IItem>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Lookup the item\n      let item = items[k];\n\n      // Ignore items which cannot be activated.\n      if (!canActivate(item)) {\n        continue;\n      }\n\n      // Ignore items with an empty label.\n      let label = item.label;\n      if (label.length === 0) {\n        continue;\n      }\n\n      // Lookup the mnemonic index for the label.\n      let mn = item.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < label.length) {\n        if (label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n\n  /**\n   * A concrete implementation of `Menu.IItem`.\n   */\n  class MenuItem implements Menu.IItem {\n    /**\n     * Construct a new menu item.\n     */\n    constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n      this._commands = commands;\n      this.type = options.type || 'command';\n      this.command = options.command || '';\n      this.args = options.args || JSONExt.emptyObject;\n      this.submenu = options.submenu || null;\n    }\n\n    /**\n     * The type of the menu item.\n     */\n    readonly type: Menu.ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    get label(): string {\n      if (this.type === 'command') {\n        return this._commands.label(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.label;\n      }\n      return '';\n    }\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    get mnemonic(): number {\n      if (this.type === 'command') {\n        return this._commands.mnemonic(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.mnemonic;\n      }\n      return -1;\n    }\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      if (this.type === 'command') {\n        return this._commands.icon(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.icon;\n      }\n      return undefined;\n    }\n\n    /**\n     * The icon class for the menu item.\n     */\n    get iconClass(): string {\n      if (this.type === 'command') {\n        return this._commands.iconClass(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconClass;\n      }\n      return '';\n    }\n\n    /**\n     * The icon label for the menu item.\n     */\n    get iconLabel(): string {\n      if (this.type === 'command') {\n        return this._commands.iconLabel(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconLabel;\n      }\n      return '';\n    }\n\n    /**\n     * The display caption for the menu item.\n     */\n    get caption(): string {\n      if (this.type === 'command') {\n        return this._commands.caption(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.caption;\n      }\n      return '';\n    }\n\n    /**\n     * The extra class name for the menu item.\n     */\n    get className(): string {\n      if (this.type === 'command') {\n        return this._commands.className(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.className;\n      }\n      return '';\n    }\n\n    /**\n     * The dataset for the menu item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      if (this.type === 'command') {\n        return this._commands.dataset(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.dataset;\n      }\n      return {};\n    }\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    get isEnabled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isEnabled(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    get isToggled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isToggled(this.command, this.args);\n      }\n      return false;\n    }\n\n    /**\n     * Whether the menu item is visible.\n     */\n    get isVisible(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isVisible(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * The key binding for the menu item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      if (this.type === 'command') {\n        let { command, args } = this;\n        return (\n          ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n            return kb.command === command && JSONExt.deepEqual(kb.args, args);\n          }) || null\n        );\n      }\n      return null;\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n  /**\n   * Construct a new context menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: ContextMenu.IOptions) {\n    const { groupByTarget, sortBySelector, ...others } = options;\n    this.menu = new Menu(others);\n    this._groupByTarget = groupByTarget !== false;\n    this._sortBySelector = sortBySelector !== false;\n  }\n\n  /**\n   * The menu widget which displays the matched context items.\n   */\n  readonly menu: Menu;\n\n  /**\n   * Add an item to the context menu.\n   *\n   * @param options - The options for creating the item.\n   *\n   * @returns A disposable which will remove the item from the menu.\n   */\n  addItem(options: ContextMenu.IItemOptions): IDisposable {\n    // Create an item from the given options.\n    let item = Private.createItem(options, this._idTick++);\n\n    // Add the item to the internal array.\n    this._items.push(item);\n\n    // Return a disposable which will remove the item.\n    return new DisposableDelegate(() => {\n      ArrayExt.removeFirstOf(this._items, item);\n    });\n  }\n\n  /**\n   * Open the context menu in response to a `'contextmenu'` event.\n   *\n   * @param event - The `'contextmenu'` event of interest.\n   *\n   * @returns `true` if the menu was opened, or `false` if no items\n   *   matched the event and the menu was not opened.\n   *\n   * #### Notes\n   * This method will populate the context menu with items which match\n   * the propagation path of the event, then open the menu at the mouse\n   * position indicated by the event.\n   */\n  open(event: MouseEvent): boolean {\n    // Prior to any DOM modifications update the window data.\n    Menu.saveWindowData();\n\n    // Clear the current contents of the context menu.\n    this.menu.clearItems();\n\n    // Bail early if there are no items to match.\n    if (this._items.length === 0) {\n      return false;\n    }\n\n    // Find the matching items for the event.\n    let items = Private.matchItems(\n      this._items,\n      event,\n      this._groupByTarget,\n      this._sortBySelector\n    );\n\n    // Bail if there are no matching items.\n    if (!items || items.length === 0) {\n      return false;\n    }\n\n    // Add the filtered items to the menu.\n    for (const item of items) {\n      this.menu.addItem(item);\n    }\n\n    // Open the context menu at the current mouse position.\n    this.menu.open(event.clientX, event.clientY);\n\n    // Indicate success.\n    return true;\n  }\n\n  private _groupByTarget: boolean = true;\n  private _idTick = 0;\n  private _items: Private.IItem[] = [];\n  private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n  /**\n   * An options object for initializing a context menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry to use with the context menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the context menu.\n     */\n    renderer?: Menu.IRenderer;\n\n    /**\n     * Whether to sort by selector and rank or only rank.\n     *\n     * Default true.\n     */\n    sortBySelector?: boolean;\n\n    /**\n     * Whether to group items following the DOM hierarchy.\n     *\n     * Default true.\n     *\n     * #### Note\n     * If true, when the mouse event occurs on element `span` within `div.top`,\n     * the items matching `div.top` will be shown before the ones matching `body`.\n     */\n    groupByTarget?: boolean;\n  }\n\n  /**\n   * An options object for creating a context menu item.\n   */\n  export interface IItemOptions extends Menu.IItemOptions {\n    /**\n     * The CSS selector for the context menu item.\n     *\n     * The context menu item will only be displayed in the context menu\n     * when the selector matches a node on the propagation path of the\n     * contextmenu event. This allows the menu item to be restricted to\n     * user-defined contexts.\n     *\n     * The selector must not contain commas.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     *\n     * The rank is used as a tie-breaker when ordering context menu\n     * items for display. Items are sorted in the following order:\n     *   1. Depth in the DOM tree (deeper is better)\n     *   2. Selector specificity (higher is better)\n     *   3. Rank (lower is better)\n     *   4. Insertion order\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A normalized item for a context menu.\n   */\n  export interface IItem extends Menu.IItemOptions {\n    /**\n     * The selector for the item.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     */\n    rank: number;\n\n    /**\n     * The tie-breaking id for the item.\n     */\n    id: number;\n  }\n\n  /**\n   * Create a normalized context menu item from an options object.\n   */\n  export function createItem(\n    options: ContextMenu.IItemOptions,\n    id: number\n  ): IItem {\n    let selector = validateSelector(options.selector);\n    let rank = options.rank !== undefined ? options.rank : Infinity;\n    return { ...options, selector, rank, id };\n  }\n\n  /**\n   * Find the items which match a context menu event.\n   *\n   * The results are sorted by DOM level, specificity, and rank.\n   */\n  export function matchItems(\n    items: IItem[],\n    event: MouseEvent,\n    groupByTarget: boolean,\n    sortBySelector: boolean\n  ): IItem[] | null {\n    // Look up the target of the event.\n    let target = event.target as Element | null;\n\n    // Bail if there is no target.\n    if (!target) {\n      return null;\n    }\n\n    // Look up the current target of the event.\n    let currentTarget = event.currentTarget as Element | null;\n\n    // Bail if there is no current target.\n    if (!currentTarget) {\n      return null;\n    }\n\n    // There are some third party libraries that cause the `target` to\n    // be detached from the DOM before lumino can process the event.\n    // If that happens, search for a new target node by point. If that\n    // node is still dangling, bail.\n    if (!currentTarget.contains(target)) {\n      target = document.elementFromPoint(event.clientX, event.clientY);\n      if (!target || !currentTarget.contains(target)) {\n        return null;\n      }\n    }\n\n    // Set up the result array.\n    let result: IItem[] = [];\n\n    // Copy the items array to allow in-place modification.\n    let availableItems: Array<IItem | null> = items.slice();\n\n    // Walk up the DOM hierarchy searching for matches.\n    while (target !== null) {\n      // Set up the match array for this DOM level.\n      let matches: IItem[] = [];\n\n      // Search the remaining items for matches.\n      for (let i = 0, n = availableItems.length; i < n; ++i) {\n        // Fetch the item.\n        let item = availableItems[i];\n\n        // Skip items which are already consumed.\n        if (!item) {\n          continue;\n        }\n\n        // Skip items which do not match the element.\n        if (!Selector.matches(target, item.selector)) {\n          continue;\n        }\n\n        // Add the matched item to the result for this DOM level.\n        matches.push(item);\n\n        // Mark the item as consumed.\n        availableItems[i] = null;\n      }\n\n      // Sort the matches for this level and add them to the results.\n      if (matches.length !== 0) {\n        if (groupByTarget) {\n          matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n        }\n        result.push(...matches);\n      }\n\n      // Stop searching at the limits of the DOM range.\n      if (target === currentTarget) {\n        break;\n      }\n\n      // Step to the parent DOM level.\n      target = target.parentElement;\n    }\n\n    if (!groupByTarget) {\n      result.sort(sortBySelector ? itemCmp : itemCmpRank);\n    }\n\n    // Return the matched and sorted results.\n    return result;\n  }\n\n  /**\n   * Validate the selector for a menu item.\n   *\n   * This returns the validated selector, or throws if the selector is\n   * invalid or contains commas.\n   */\n  function validateSelector(selector: string): string {\n    if (selector.indexOf(',') !== -1) {\n      throw new Error(`Selector cannot contain commas: ${selector}`);\n    }\n    if (!Selector.isValid(selector)) {\n      throw new Error(`Invalid selector: ${selector}`);\n    }\n    return selector;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by ranks.\n   */\n  function itemCmpRank(a: IItem, b: IItem): number {\n    // Sort based on rank.\n    let r1 = a.rank;\n    let r2 = b.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity-safe\n    }\n\n    // When all else fails, sort by item id.\n    return a.id - b.id;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by selectors and ranks.\n   */\n  function itemCmp(a: IItem, b: IItem): number {\n    // Sort first based on selector specificity.\n    let s1 = Selector.calculateSpecificity(a.selector);\n    let s2 = Selector.calculateSpecificity(b.selector);\n    if (s1 !== s2) {\n      return s2 - s1;\n    }\n\n    // If specificities are equal\n    return itemCmpRank(a, b);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ElementARIAAttrs,\n  ElementBaseAttrs,\n  ElementDataset,\n  ElementInlineStyle,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n  'ArrowLeft',\n  'ArrowUp',\n  'ArrowRight',\n  'ArrowDown',\n  'Home',\n  'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar<T> extends Widget {\n  /**\n   * Construct a new tab bar.\n   *\n   * @param options - The options for initializing the tab bar.\n   */\n  constructor(options: TabBar.IOptions<T> = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-TabBar');\n    this.contentNode.setAttribute('role', 'tablist');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this._document = options.document || document;\n    this.tabsMovable = options.tabsMovable || false;\n    this.titlesEditable = options.titlesEditable || false;\n    this.allowDeselect = options.allowDeselect || false;\n    this.addButtonEnabled = options.addButtonEnabled || false;\n    this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n    this.name = options.name || '';\n    this.orientation = options.orientation || 'horizontal';\n    this.removeBehavior = options.removeBehavior || 'select-tab-after';\n    this.renderer = options.renderer || TabBar.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    this._titles.length = 0;\n    this._previousTitle = null;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabBar.ICurrentChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when a tab is moved by the user.\n   *\n   * #### Notes\n   * This signal is emitted when a tab is moved by user interaction.\n   *\n   * This signal is not emitted when a tab is moved programmatically.\n   */\n  get tabMoved(): ISignal<this, TabBar.ITabMovedArgs<T>> {\n    return this._tabMoved;\n  }\n\n  /**\n   * A signal emitted when a tab is clicked by the user.\n   *\n   * #### Notes\n   * If the clicked tab is not the current tab, the clicked tab will be\n   * made current and the `currentChanged` signal will be emitted first.\n   *\n   * This signal is emitted even if the clicked tab is the current tab.\n   */\n  get tabActivateRequested(): ISignal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  > {\n    return this._tabActivateRequested;\n  }\n\n  /**\n   * A signal emitted when the tab bar add button is clicked.\n   */\n  get addRequested(): ISignal<this, void> {\n    return this._addRequested;\n  }\n\n  /**\n   * A signal emitted when a tab close icon is clicked.\n   *\n   * #### Notes\n   * This signal is not emitted unless the tab title is `closable`.\n   */\n  get tabCloseRequested(): ISignal<this, TabBar.ITabCloseRequestedArgs<T>> {\n    return this._tabCloseRequested;\n  }\n\n  /**\n   * A signal emitted when a tab is dragged beyond the detach threshold.\n   *\n   * #### Notes\n   * This signal is emitted when the user drags a tab with the mouse,\n   * and mouse is dragged beyond the detach threshold.\n   *\n   * The consumer of the signal should call `releaseMouse` and remove\n   * the tab in order to complete the detach.\n   *\n   * This signal is only emitted once per drag cycle.\n   */\n  get tabDetachRequested(): ISignal<this, TabBar.ITabDetachRequestedArgs<T>> {\n    return this._tabDetachRequested;\n  }\n\n  /**\n   * The renderer used by the tab bar.\n   */\n  readonly renderer: TabBar.IRenderer<T>;\n\n  /**\n   * The document to use with the tab bar.\n   *\n   * The default is the global `document` instance.\n   */\n  get document(): Document | ShadowRoot {\n    return this._document;\n  }\n\n  /**\n   * Whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  tabsMovable: boolean;\n\n  /**\n   * Whether the titles can be user-edited.\n   *\n   */\n  get titlesEditable(): boolean {\n    return this._titlesEditable;\n  }\n\n  /**\n   * Set whether titles can be user edited.\n   *\n   */\n  set titlesEditable(value: boolean) {\n    this._titlesEditable = value;\n  }\n\n  /**\n   * Whether a tab can be deselected by the user.\n   *\n   * #### Notes\n   * Tabs can be always be deselected programmatically.\n   */\n  allowDeselect: boolean;\n\n  /**\n   * The selection behavior when inserting a tab.\n   */\n  insertBehavior: TabBar.InsertBehavior;\n\n  /**\n   * The selection behavior when removing a tab.\n   */\n  removeBehavior: TabBar.RemoveBehavior;\n\n  /**\n   * Get the currently selected title.\n   *\n   * #### Notes\n   * This will be `null` if no tab is selected.\n   */\n  get currentTitle(): Title<T> | null {\n    return this._titles[this._currentIndex] || null;\n  }\n\n  /**\n   * Set the currently selected title.\n   *\n   * #### Notes\n   * If the title does not exist, the title will be set to `null`.\n   */\n  set currentTitle(value: Title<T> | null) {\n    this.currentIndex = value ? this._titles.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this._currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the value is out of range, the index will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    // Adjust for an out of range index.\n    if (value < 0 || value >= this._titles.length) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._currentIndex === value) {\n      return;\n    }\n\n    // Look up the previous index and title.\n    let pi = this._currentIndex;\n    let pt = this._titles[pi] || null;\n\n    // Look up the current index and title.\n    let ci = value;\n    let ct = this._titles[ci] || null;\n\n    // Update the current index and previous title.\n    this._currentIndex = ci;\n    this._previousTitle = pt;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: ci,\n      currentTitle: ct\n    });\n  }\n\n  /**\n   * Get the name of the tab bar.\n   */\n  get name(): string {\n    return this._name;\n  }\n\n  /**\n   * Set the name of the tab bar.\n   */\n  set name(value: string) {\n    this._name = value;\n    if (value) {\n      this.contentNode.setAttribute('aria-label', value);\n    } else {\n      this.contentNode.removeAttribute('aria-label');\n    }\n  }\n\n  /**\n   * Get the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  get orientation(): TabBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  set orientation(value: TabBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Toggle the orientation values.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n    this.contentNode.setAttribute('aria-orientation', value);\n  }\n\n  /**\n   * Whether the add button is enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add button is enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    // Do nothing if the value does not change.\n    if (this._addButtonEnabled === value) {\n      return;\n    }\n\n    this._addButtonEnabled = value;\n    if (value) {\n      this.addButtonNode.classList.remove('lm-mod-hidden');\n    } else {\n      this.addButtonNode.classList.add('lm-mod-hidden');\n    }\n  }\n\n  /**\n   * A read-only array of the titles in the tab bar.\n   */\n  get titles(): ReadonlyArray<Title<T>> {\n    return this._titles;\n  }\n\n  /**\n   * The tab bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the tab nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * The tab bar add button node.\n   *\n   * #### Notes\n   * This is the node which holds the add button.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get addButtonNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-addButton'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Add a tab to the end of the tab bar.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  addTab(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return this.insertTab(this._titles.length, value);\n  }\n\n  /**\n   * Insert a tab into the tab bar at the specified index.\n   *\n   * @param index - The index at which to insert the tab.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the tabs.\n   *\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  insertTab(index: number, value: Title<T> | Title.IOptions<T>): Title<T> {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Coerce the value to a title.\n    let title = Private.asTitle(value);\n\n    // Look up the index of the title.\n    let i = this._titles.indexOf(title);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._titles.length));\n\n    // If the title is not in the array, insert it.\n    if (i === -1) {\n      // Insert the title into the array.\n      ArrayExt.insert(this._titles, j, title);\n\n      // Connect to the title changed signal.\n      title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the tabs.\n      this.update();\n\n      // Adjust the current index for the insert.\n      this._adjustCurrentForInsert(j, title);\n\n      // Return the title added to the tab bar.\n      return title;\n    }\n\n    // Otherwise, the title exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._titles.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return title;\n    }\n\n    // Move the title to the new location.\n    ArrayExt.move(this._titles, i, j);\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the move.\n    this._adjustCurrentForMove(i, j);\n\n    // Return the title added to the tab bar.\n    return title;\n  }\n\n  /**\n   * Remove a tab from the tab bar.\n   *\n   * @param title - The title for the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the title is not in the tab bar.\n   */\n  removeTab(title: Title<T>): void {\n    this.removeTabAt(this._titles.indexOf(title));\n  }\n\n  /**\n   * Remove the tab at a given index from the tab bar.\n   *\n   * @param index - The index of the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeTabAt(index: number): void {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Remove the title from the array.\n    let title = ArrayExt.removeAt(this._titles, index);\n\n    // Bail if the index is out of range.\n    if (!title) {\n      return;\n    }\n\n    // Disconnect from the title changed signal.\n    title.changed.disconnect(this._onTitleChanged, this);\n\n    // Clear the previous title if it's being removed.\n    if (title === this._previousTitle) {\n      this._previousTitle = null;\n    }\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the remove.\n    this._adjustCurrentForRemove(index, title);\n  }\n\n  /**\n   * Remove all tabs from the tab bar.\n   */\n  clearTabs(): void {\n    // Bail if there is nothing to remove.\n    if (this._titles.length === 0) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Disconnect from the title changed signals.\n    for (let title of this._titles) {\n      title.changed.disconnect(this._onTitleChanged, this);\n    }\n\n    // Get the current index and title.\n    let pi = this.currentIndex;\n    let pt = this.currentTitle;\n\n    // Reset the current index and previous title.\n    this._currentIndex = -1;\n    this._previousTitle = null;\n\n    // Clear the title array.\n    this._titles.length = 0;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // If no tab was selected, there's nothing else to do.\n    if (pi === -1) {\n      return;\n    }\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   *\n   * #### Notes\n   * This will cause the tab bar to stop handling mouse events and to\n   * restore the tabs to their non-dragged positions.\n   */\n  releaseMouse(): void {\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the DOM events for the tab bar.\n   *\n   * @param event - The DOM event sent to the tab bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tab bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'dblclick':\n        this._evtDblClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        event.eventPhase === Event.CAPTURING_PHASE\n          ? this._evtKeyDownCapturing(event as KeyboardEvent)\n          : this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n    this.node.addEventListener('dblclick', this);\n    this.node.addEventListener('keydown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this.node.removeEventListener('dblclick', this);\n    this.node.removeEventListener('keydown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let titles = this._titles;\n    let renderer = this.renderer;\n    let currentTitle = this.currentTitle;\n    let content = new Array<VirtualElement>(titles.length);\n    // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n    // If the add button handles it, no need to do anything. If no element of the tab\n    // bar handles it, set it on the current or the first tab to ensure one element\n    // handles it after update.\n    const tabHandlingTabindex =\n      this._getCurrentTabindex() ??\n      (this._currentIndex > -1 ? this._currentIndex : 0);\n\n    for (let i = 0, n = titles.length; i < n; ++i) {\n      let title = titles[i];\n      let current = title === currentTitle;\n      let zIndex = current ? n : n - i - 1;\n      let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n      content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * Get the index of the tab which handles tabindex=\"0\".\n   * If the add button handles tabindex=\"0\", -1 is returned.\n   * If none of the previous handles tabindex=\"0\", null is returned.\n   */\n  private _getCurrentTabindex(): number | null {\n    let index = null;\n    const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n    if (elemTabindex) {\n      index = [...this.contentNode.children].indexOf(elemTabindex);\n    } else if (\n      this._addButtonEnabled &&\n      this.addButtonNode.getAttribute('tabindex') === '0'\n    ) {\n      index = -1;\n    }\n    return index;\n  }\n\n  /**\n   * Handle the `'dblclick'` event for the tab bar.\n   */\n  private _evtDblClick(event: MouseEvent): void {\n    // Do nothing if titles are not editable\n    if (!this.titlesEditable) {\n      return;\n    }\n\n    let tabs = this.contentNode.children;\n\n    // Find the index of the targeted tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab.\n    if (index === -1) {\n      return;\n    }\n\n    let title = this.titles[index];\n    let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n    if (label && label.contains(event.target as HTMLElement)) {\n      let value = title.label || '';\n\n      // Clear the label element\n      let oldValue = label.innerHTML;\n      label.innerHTML = '';\n\n      let input = document.createElement('input');\n      input.classList.add('lm-TabBar-tabInput');\n      input.value = value;\n      label.appendChild(input);\n\n      let onblur = () => {\n        input.removeEventListener('blur', onblur);\n        label.innerHTML = oldValue;\n        this.node.addEventListener('keydown', this);\n      };\n\n      input.addEventListener('dblclick', (event: Event) =>\n        event.stopPropagation()\n      );\n      input.addEventListener('blur', onblur);\n      input.addEventListener('keydown', (event: KeyboardEvent) => {\n        if (event.key === 'Enter') {\n          if (input.value !== '') {\n            title.label = title.caption = input.value;\n          }\n          onblur();\n        } else if (event.key === 'Escape') {\n          onblur();\n        }\n      });\n      this.node.removeEventListener('keydown', this);\n      input.select();\n      input.focus();\n\n      if (label.children.length > 0) {\n        (label.children[0] as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at capturing phase.\n   */\n  private _evtKeyDownCapturing(event: KeyboardEvent): void {\n    if (event.eventPhase !== Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.key === 'Escape') {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at target phase.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Allow for navigation using tab key\n    if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Check if Enter or Spacebar key has been pressed and open that tab\n    if (\n      event.key === 'Enter' ||\n      event.key === 'Spacebar' ||\n      event.key === ' '\n    ) {\n      // Get focus element that is in focus by the tab key\n      const focusedElement = document.activeElement;\n\n      // Test first if the focus is on the add button node\n      if (\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(focusedElement)\n      ) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._addRequested.emit();\n      } else {\n        const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n          tab.contains(focusedElement)\n        );\n        if (index >= 0) {\n          event.preventDefault();\n          event.stopPropagation();\n          this.currentIndex = index;\n        }\n      }\n      // Handle the arrow keys to switch tabs.\n    } else if (ARROW_KEYS.includes(event.key)) {\n      // Create a list of all focusable elements in the tab bar.\n      const focusable: Element[] = [...this.contentNode.children];\n      if (this.addButtonEnabled) {\n        focusable.push(this.addButtonNode);\n      }\n      // If the tab bar contains only one element, nothing to do.\n      if (focusable.length <= 1) {\n        return;\n      }\n      event.preventDefault();\n      event.stopPropagation();\n\n      // Get the current focused element.\n      let focusedIndex = focusable.indexOf(document.activeElement as Element);\n      if (focusedIndex === -1) {\n        focusedIndex = this._currentIndex;\n      }\n\n      // Find the next element to focus on.\n      let nextFocused: Element | null | undefined;\n      if (\n        (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowDown' && this._orientation === 'vertical')\n      ) {\n        nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n      } else if (\n        (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowUp' && this._orientation === 'vertical')\n      ) {\n        nextFocused =\n          focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n      } else if (event.key === 'Home') {\n        nextFocused = focusable[0];\n      } else if (event.key === 'End') {\n        nextFocused = focusable[focusable.length - 1];\n      }\n\n      // Change the focused element and the tabindex value.\n      if (nextFocused) {\n        focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n        nextFocused?.setAttribute('tabindex', '0');\n        (nextFocused as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the tab bar.\n   */\n  private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse press.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if a drag is in progress.\n    if (this._dragData) {\n      return;\n    }\n\n    // Do nothing if a title editable input was clicked.\n    if (\n      (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n    ) {\n      return;\n    }\n\n    // Check if the add button was clicked.\n    let addButtonClicked =\n      this.addButtonEnabled &&\n      this.addButtonNode.contains(event.target as HTMLElement);\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Find the index of the pressed tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab or the add button.\n    if (index === -1 && !addButtonClicked) {\n      return;\n    }\n\n    // Pressing on a tab stops the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Initialize the non-measured parts of the drag data.\n    this._dragData = {\n      tab: tabs[index] as HTMLElement,\n      index: index,\n      pressX: event.clientX,\n      pressY: event.clientY,\n      tabPos: -1,\n      tabSize: -1,\n      tabPressPos: -1,\n      targetIndex: -1,\n      tabLayout: null,\n      contentRect: null,\n      override: null,\n      dragActive: false,\n      dragAborted: false,\n      detachRequested: false\n    };\n\n    // Add the document pointer up listener.\n    this.document.addEventListener('pointerup', this, true);\n\n    // Do nothing else if the middle button or add button is clicked.\n    if (event.button === 1 || addButtonClicked) {\n      return;\n    }\n\n    // Do nothing else if the close icon is clicked.\n    let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n    if (icon && icon.contains(event.target as HTMLElement)) {\n      return;\n    }\n\n    // Add the extra listeners if the tabs are movable.\n    if (this.tabsMovable) {\n      this.document.addEventListener('pointermove', this, true);\n      this.document.addEventListener('keydown', this, true);\n      this.document.addEventListener('contextmenu', this, true);\n    }\n\n    // Update the current index as appropriate.\n    if (this.allowDeselect && this.currentIndex === index) {\n      this.currentIndex = -1;\n    } else {\n      this.currentIndex = index;\n    }\n\n    // Do nothing else if there is no current tab.\n    if (this.currentIndex === -1) {\n      return;\n    }\n\n    // Emit the tab activate request signal.\n    this._tabActivateRequested.emit({\n      index: this.currentIndex,\n      title: this.currentTitle!\n    });\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the tab bar.\n   */\n  private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Suppress the event during a drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Bail early if the drag threshold has not been met.\n    if (!data.dragActive && !Private.dragExceeded(data, event)) {\n      return;\n    }\n\n    // Activate the drag if necessary.\n    if (!data.dragActive) {\n      // Fill in the rest of the drag data measurements.\n      let tabRect = data.tab.getBoundingClientRect();\n      if (this._orientation === 'horizontal') {\n        data.tabPos = data.tab.offsetLeft;\n        data.tabSize = tabRect.width;\n        data.tabPressPos = data.pressX - tabRect.left;\n      } else {\n        data.tabPos = data.tab.offsetTop;\n        data.tabSize = tabRect.height;\n        data.tabPressPos = data.pressY - tabRect.top;\n      }\n      data.tabPressOffset = {\n        x: data.pressX - tabRect.left,\n        y: data.pressY - tabRect.top\n      };\n      data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n      data.contentRect = this.contentNode.getBoundingClientRect();\n      data.override = Drag.overrideCursor('default');\n\n      // Add the dragging style classes.\n      data.tab.classList.add('lm-mod-dragging');\n      this.addClass('lm-mod-dragging');\n\n      // Mark the drag as active.\n      data.dragActive = true;\n    }\n\n    // Emit the detach requested signal if the threshold is exceeded.\n    if (!data.detachRequested && Private.detachExceeded(data, event)) {\n      // Only emit the signal once per drag cycle.\n      data.detachRequested = true;\n\n      // Setup the arguments for the signal.\n      let index = data.index;\n      let clientX = event.clientX;\n      let clientY = event.clientY;\n      let tab = tabs[index] as HTMLElement;\n      let title = this._titles[index];\n\n      // Emit the tab detach requested signal.\n      this._tabDetachRequested.emit({\n        index,\n        title,\n        tab,\n        clientX,\n        clientY,\n        offset: data.tabPressOffset\n      });\n\n      // Bail if the signal handler aborted the drag.\n      if (data.dragAborted) {\n        return;\n      }\n    }\n\n    // Update the positions of the tabs.\n    Private.layoutTabs(tabs, data, event, this._orientation);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the document.\n   */\n  private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse release.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if no drag is in progress.\n    const data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Remove the extra mouse event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Handle a release when the drag is not active.\n    if (!data.dragActive) {\n      // Clear the drag data.\n      this._dragData = null;\n\n      // Handle clicking the add button.\n      let addButtonClicked =\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(event.target as HTMLElement);\n      if (addButtonClicked) {\n        this._addRequested.emit(undefined);\n        return;\n      }\n\n      // Lookup the tab nodes.\n      let tabs = this.contentNode.children;\n\n      // Find the index of the released tab.\n      let index = ArrayExt.findFirstIndex(tabs, tab => {\n        return ElementExt.hitTest(tab, event.clientX, event.clientY);\n      });\n\n      // Do nothing if the release is not on the original pressed tab.\n      if (index !== data.index) {\n        return;\n      }\n\n      // Ignore the release if the title is not closable.\n      let title = this._titles[index];\n      if (!title.closable) {\n        return;\n      }\n\n      // Emit the close requested signal if the middle button is released.\n      if (event.button === 1) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Emit the close requested signal if the close icon was released.\n      let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n      if (icon && icon.contains(event.target as HTMLElement)) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Otherwise, there is nothing left to do.\n      return;\n    }\n\n    // Do nothing if the left button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Position the tab at its final resting position.\n    Private.finalizeTabPosition(data, this._orientation);\n\n    // Remove the dragging class from the tab so it can be transitioned.\n    data.tab.classList.remove('lm-mod-dragging');\n\n    // Parse the transition duration for releasing the tab.\n    let duration = Private.parseTransitionDuration(data.tab);\n\n    // Complete the release on a timer to allow the tab to transition.\n    setTimeout(() => {\n      // Do nothing if the drag has been aborted.\n      if (data.dragAborted) {\n        return;\n      }\n\n      // Clear the drag data reference.\n      this._dragData = null;\n\n      // Reset the positions of the tabs.\n      Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n      // Clear the cursor grab.\n      data.override!.dispose();\n\n      // Remove the remaining dragging style.\n      this.removeClass('lm-mod-dragging');\n\n      // If the tab was not moved, there is nothing else to do.\n      let i = data.index;\n      let j = data.targetIndex;\n      if (j === -1 || i === j) {\n        return;\n      }\n\n      // Move the title to the new locations.\n      ArrayExt.move(this._titles, i, j);\n\n      // Adjust the current index for the move.\n      this._adjustCurrentForMove(i, j);\n\n      // Emit the tab moved signal.\n      this._tabMoved.emit({\n        fromIndex: i,\n        toIndex: j,\n        title: this._titles[j]\n      });\n\n      // Update the tabs immediately to prevent flicker.\n      MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    }, duration);\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   */\n  private _releaseMouse(): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Clear the drag data reference.\n    this._dragData = null;\n\n    // Remove the extra document event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Indicate the drag has been aborted. This allows the mouse\n    // event handlers to return early when the drag is canceled.\n    data.dragAborted = true;\n\n    // If the drag is not active, there's nothing more to do.\n    if (!data.dragActive) {\n      return;\n    }\n\n    // Reset the tabs to their non-dragged positions.\n    Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n    // Clear the cursor override.\n    data.override!.dispose();\n\n    // Clear the dragging style classes.\n    data.tab.classList.remove('lm-mod-dragging');\n    this.removeClass('lm-mod-dragging');\n  }\n\n  /**\n   * Adjust the current index for a tab insert operation.\n   *\n   * This method accounts for the tab bar's insertion behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForInsert(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ct = this.currentTitle;\n    let ci = this._currentIndex;\n    let bh = this.insertBehavior;\n\n    // TODO: do we need to do an update to update the aria-selected attribute?\n\n    // Handle the behavior where the new tab is always selected,\n    // or the behavior where the new tab is selected if needed.\n    if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n      this._currentIndex = i;\n      this._previousTitle = ct;\n      this._currentChanged.emit({\n        previousIndex: ci,\n        previousTitle: ct,\n        currentIndex: i,\n        currentTitle: title\n      });\n      return;\n    }\n\n    // Otherwise, silently adjust the current index if needed.\n    if (ci >= i) {\n      this._currentIndex++;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab move operation.\n   *\n   * This method will not cause the actual current tab to change.\n   * It silently adjusts the index to account for the given move.\n   */\n  private _adjustCurrentForMove(i: number, j: number): void {\n    if (this._currentIndex === i) {\n      this._currentIndex = j;\n    } else if (this._currentIndex < i && this._currentIndex >= j) {\n      this._currentIndex++;\n    } else if (this._currentIndex > i && this._currentIndex <= j) {\n      this._currentIndex--;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab remove operation.\n   *\n   * This method accounts for the tab bar's remove behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForRemove(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ci = this._currentIndex;\n    let bh = this.removeBehavior;\n\n    // Silently adjust the index if the current tab is not removed.\n    if (ci !== i) {\n      if (ci > i) {\n        this._currentIndex--;\n      }\n      return;\n    }\n\n    // TODO: do we need to do an update to adjust the aria-selected value?\n\n    // No tab gets selected if the tab bar is empty.\n    if (this._titles.length === 0) {\n      this._currentIndex = -1;\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: -1,\n        currentTitle: null\n      });\n      return;\n    }\n\n    // Handle behavior where the next sibling tab is selected.\n    if (bh === 'select-tab-after') {\n      this._currentIndex = Math.min(i, this._titles.length - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous sibling tab is selected.\n    if (bh === 'select-tab-before') {\n      this._currentIndex = Math.max(0, i - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous history tab is selected.\n    if (bh === 'select-previous-tab') {\n      if (this._previousTitle) {\n        this._currentIndex = this._titles.indexOf(this._previousTitle);\n        this._previousTitle = null;\n      } else {\n        this._currentIndex = Math.min(i, this._titles.length - 1);\n      }\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Otherwise, no tab gets selected.\n    this._currentIndex = -1;\n    this._currentChanged.emit({\n      previousIndex: i,\n      previousTitle: title,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<T>): void {\n    this.update();\n  }\n\n  private _name: string;\n  private _currentIndex = -1;\n  private _titles: Title<T>[] = [];\n  private _orientation: TabBar.Orientation;\n  private _document: Document | ShadowRoot;\n  private _titlesEditable: boolean = false;\n  private _previousTitle: Title<T> | null = null;\n  private _dragData: Private.IDragData | null = null;\n  private _addButtonEnabled: boolean = false;\n  private _tabMoved = new Signal<this, TabBar.ITabMovedArgs<T>>(this);\n  private _currentChanged = new Signal<this, TabBar.ICurrentChangedArgs<T>>(\n    this\n  );\n  private _addRequested = new Signal<this, void>(this);\n  private _tabCloseRequested = new Signal<\n    this,\n    TabBar.ITabCloseRequestedArgs<T>\n  >(this);\n  private _tabDetachRequested = new Signal<\n    this,\n    TabBar.ITabDetachRequestedArgs<T>\n  >(this);\n  private _tabActivateRequested = new Signal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n  /**\n   * A type alias for a tab bar orientation.\n   */\n  export type Orientation =\n    | /**\n     * The tabs are arranged in a single row, left-to-right.\n     *\n     * The tab text orientation is horizontal.\n     */\n    'horizontal'\n\n    /**\n     * The tabs are arranged in a single column, top-to-bottom.\n     *\n     * The tab text orientation is horizontal.\n     */\n    | 'vertical';\n\n  /**\n   * A type alias for the selection behavior on tab insert.\n   */\n  export type InsertBehavior =\n    | /**\n     * The selected tab will not be changed.\n     */\n    'none'\n\n    /**\n     * The inserted tab will be selected.\n     */\n    | 'select-tab'\n\n    /**\n     * The inserted tab will be selected if the current tab is null.\n     */\n    | 'select-tab-if-needed';\n\n  /**\n   * A type alias for the selection behavior on tab remove.\n   */\n  export type RemoveBehavior =\n    | /**\n     * No tab will be selected.\n     */\n    'none'\n\n    /**\n     * The tab after the removed tab will be selected if possible.\n     */\n    | 'select-tab-after'\n\n    /**\n     * The tab before the removed tab will be selected if possible.\n     */\n    | 'select-tab-before'\n\n    /**\n     * The previously selected tab will be selected if possible.\n     */\n    | 'select-previous-tab';\n\n  /**\n   * An options object for creating a tab bar.\n   */\n  export interface IOptions<T> {\n    /**\n     * The document to use with the tab bar.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n\n    /**\n     * Name of the tab bar.\n     *\n     * This is used for accessibility reasons. The default is the empty string.\n     */\n    name?: string;\n\n    /**\n     * The layout orientation of the tab bar.\n     *\n     * The default is `horizontal`.\n     */\n    orientation?: TabBar.Orientation;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether a tab can be deselected by the user.\n     *\n     * The default is `false`.\n     */\n    allowDeselect?: boolean;\n\n    /**\n     * Whether the titles can be directly edited by the user.\n     *\n     * The default is `false`.\n     */\n    titlesEditable?: boolean;\n\n    /**\n     * Whether the add button is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The selection behavior when inserting a tab.\n     *\n     * The default is `'select-tab-if-needed'`.\n     */\n    insertBehavior?: TabBar.InsertBehavior;\n\n    /**\n     * The selection behavior when removing a tab.\n     *\n     * The default is `'select-tab-after'`.\n     */\n    removeBehavior?: TabBar.RemoveBehavior;\n\n    /**\n     * A renderer to use with the tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer<T>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs<T> {\n    /**\n     * The previously selected index.\n     */\n    readonly previousIndex: number;\n\n    /**\n     * The previously selected title.\n     */\n    readonly previousTitle: Title<T> | null;\n\n    /**\n     * The currently selected index.\n     */\n    readonly currentIndex: number;\n\n    /**\n     * The currently selected title.\n     */\n    readonly currentTitle: Title<T> | null;\n  }\n\n  /**\n   * The arguments object for the `tabMoved` signal.\n   */\n  export interface ITabMovedArgs<T> {\n    /**\n     * The previous index of the tab.\n     */\n    readonly fromIndex: number;\n\n    /**\n     * The current index of the tab.\n     */\n    readonly toIndex: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabActivateRequested` signal.\n   */\n  export interface ITabActivateRequestedArgs<T> {\n    /**\n     * The index of the tab to activate.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabCloseRequested` signal.\n   */\n  export interface ITabCloseRequestedArgs<T> {\n    /**\n     * The index of the tab to close.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabDetachRequested` signal.\n   */\n  export interface ITabDetachRequestedArgs<T> {\n    /**\n     * The index of the tab to detach.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * The node representing the tab.\n     */\n    readonly tab: HTMLElement;\n\n    /**\n     * The current client X position of the mouse.\n     */\n    readonly clientX: number;\n\n    /**\n     * The current client Y position of the mouse.\n     */\n    readonly clientY: number;\n\n    /**\n     * The mouse position in the tab coordinate.\n     */\n    readonly offset?: { x: number; y: number };\n  }\n\n  /**\n   * An object which holds the data to render a tab.\n   */\n  export interface IRenderData<T> {\n    /**\n     * The title associated with the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * Whether the tab is the current tab.\n     */\n    readonly current: boolean;\n\n    /**\n     * The z-index for the tab.\n     */\n    readonly zIndex: number;\n\n    /**\n     * The tabindex value for the tab.\n     */\n    readonly tabIndex?: number;\n  }\n\n  /**\n   * A renderer for use with a tab bar.\n   */\n  export interface IRenderer<T> {\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector: string;\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<T>): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer<any> {\n    constructor() {\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<any>): VirtualElement {\n      let title = data.title.caption;\n      let key = this.createTabKey(data);\n      let id = key;\n      let style = this.createTabStyle(data);\n      let className = this.createTabClass(data);\n      let dataset = this.createTabDataset(data);\n      let aria = this.createTabARIA(data);\n      if (data.title.closable) {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data),\n          this.renderCloseIcon(data)\n        );\n      } else {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data)\n        );\n      }\n    }\n\n    /**\n     * Render the icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab icon.\n     */\n    renderIcon(data: IRenderData<any>): VirtualElement {\n      const { title } = data;\n      let className = this.createIconClass(data);\n\n      // If title.icon is undefined, it will be ignored.\n      return h.div({ className }, title.icon!, title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab label.\n     */\n    renderLabel(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n    }\n\n    /**\n     * Render the close icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab close icon.\n     */\n    renderCloseIcon(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n    }\n\n    /**\n     * Create a unique render key for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The unique render key for the tab.\n     *\n     * #### Notes\n     * This method caches the key against the tab title the first time\n     * the key is generated. This enables efficient rendering of moved\n     * tabs and avoids subtle hover style artifacts.\n     */\n    createTabKey(data: IRenderData<any>): string {\n      let key = this._tabKeys.get(data.title);\n      if (key === undefined) {\n        key = `tab-key-${this._uuid}-${this._tabID++}`;\n        this._tabKeys.set(data.title, key);\n      }\n      return key;\n    }\n\n    /**\n     * Create the inline style object for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The inline style data for the tab.\n     */\n    createTabStyle(data: IRenderData<any>): ElementInlineStyle {\n      return { zIndex: `${data.zIndex}` };\n    }\n\n    /**\n     * Create the class name for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab.\n     */\n    createTabClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tab';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.title.closable) {\n        name += ' lm-mod-closable';\n      }\n      if (data.current) {\n        name += ' lm-mod-current';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The dataset for the tab.\n     */\n    createTabDataset(data: IRenderData<any>): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the ARIA attributes for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The ARIA attributes for the tab.\n     */\n    createTabARIA(data: IRenderData<any>): ElementARIAAttrs | ElementBaseAttrs {\n      return {\n        role: 'tab',\n        'aria-selected': data.current.toString(),\n        tabindex: `${data.tabIndex ?? '-1'}`\n      };\n    }\n\n    /**\n     * Create the class name for the tab icon.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab icon.\n     */\n    createIconClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tabIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _tabID = 0;\n    private _tabKeys = new WeakMap<Title<any>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * A selector which matches the add button node in the tab bar.\n   */\n  export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The start drag distance threshold.\n   */\n  export const DRAG_THRESHOLD = 5;\n\n  /**\n   * The detach distance threshold.\n   */\n  export const DETACH_THRESHOLD = 20;\n\n  /**\n   * A struct which holds the drag data for a tab bar.\n   */\n  export interface IDragData {\n    /**\n     * The tab node being dragged.\n     */\n    tab: HTMLElement;\n\n    /**\n     * The index of the tab being dragged.\n     */\n    index: number;\n\n    /**\n     * The mouse press client X position.\n     */\n    pressX: number;\n\n    /**\n     * The mouse press client Y position.\n     */\n    pressY: number;\n\n    /**\n     * The offset left/top of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPos: number;\n\n    /**\n     * The offset width/height of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabSize: number;\n\n    /**\n     * The original mouse X/Y position in tab coordinates.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPressPos: number;\n\n    /**\n     * The original mouse position in tab coordinates.\n     *\n     * This is undefined if the drag is not active.\n     */\n    tabPressOffset?: { x: number; y: number };\n\n    /**\n     * The tab target index upon mouse release.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    targetIndex: number;\n\n    /**\n     * The array of tab layout objects snapped at drag start.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    tabLayout: ITabLayout[] | null;\n\n    /**\n     * The bounding client rect of the tab bar content node.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    contentRect: DOMRect | null;\n\n    /**\n     * The disposable to clean up the cursor override.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    override: IDisposable | null;\n\n    /**\n     * Whether the drag is currently active.\n     */\n    dragActive: boolean;\n\n    /**\n     * Whether the drag has been aborted.\n     */\n    dragAborted: boolean;\n\n    /**\n     * Whether a detach request as been made.\n     */\n    detachRequested: boolean;\n  }\n\n  /**\n   * An object which holds layout data for a tab.\n   */\n  export interface ITabLayout {\n    /**\n     * The left/top margin value for the tab.\n     */\n    margin: number;\n\n    /**\n     * The offset left/top position of the tab.\n     */\n    pos: number;\n\n    /**\n     * The offset width/height of the tab.\n     */\n    size: number;\n  }\n\n  /**\n   * Create the DOM node for a tab bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.setAttribute('role', 'tablist');\n    content.className = 'lm-TabBar-content';\n    node.appendChild(content);\n\n    let add = document.createElement('div');\n    add.className = 'lm-TabBar-addButton lm-mod-hidden';\n    add.setAttribute('tabindex', '-1');\n    add.setAttribute('role', 'button');\n    node.appendChild(add);\n    return node;\n  }\n\n  /**\n   * Coerce a title or options into a real title.\n   */\n  export function asTitle<T>(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return value instanceof Title ? value : new Title<T>(value);\n  }\n\n  /**\n   * Parse the transition duration for a tab node.\n   */\n  export function parseTransitionDuration(tab: HTMLElement): number {\n    let style = window.getComputedStyle(tab);\n    return 1000 * (parseFloat(style.transitionDuration!) || 0);\n  }\n\n  /**\n   * Get a snapshot of the current tab layout values.\n   */\n  export function snapTabLayout(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): ITabLayout[] {\n    let layout = new Array<ITabLayout>(tabs.length);\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let node = tabs[i] as HTMLElement;\n      let style = window.getComputedStyle(node);\n      if (orientation === 'horizontal') {\n        layout[i] = {\n          pos: node.offsetLeft,\n          size: node.offsetWidth,\n          margin: parseFloat(style.marginLeft!) || 0\n        };\n      } else {\n        layout[i] = {\n          pos: node.offsetTop,\n          size: node.offsetHeight,\n          margin: parseFloat(style.marginTop!) || 0\n        };\n      }\n    }\n    return layout;\n  }\n\n  /**\n   * Test if the event exceeds the drag threshold.\n   */\n  export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n    let dx = Math.abs(event.clientX - data.pressX);\n    let dy = Math.abs(event.clientY - data.pressY);\n    return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n  }\n\n  /**\n   * Test if the event exceeds the drag detach threshold.\n   */\n  export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n    let rect = data.contentRect!;\n    return (\n      event.clientX < rect.left - DETACH_THRESHOLD ||\n      event.clientX >= rect.right + DETACH_THRESHOLD ||\n      event.clientY < rect.top - DETACH_THRESHOLD ||\n      event.clientY >= rect.bottom + DETACH_THRESHOLD\n    );\n  }\n\n  /**\n   * Update the relative tab positions and computed target index.\n   */\n  export function layoutTabs(\n    tabs: HTMLCollection,\n    data: IDragData,\n    event: MouseEvent,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive values.\n    let pressPos: number;\n    let localPos: number;\n    let clientPos: number;\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      pressPos = data.pressX;\n      localPos = event.clientX - data.contentRect!.left;\n      clientPos = event.clientX;\n      clientSize = data.contentRect!.width;\n    } else {\n      pressPos = data.pressY;\n      localPos = event.clientY - data.contentRect!.top;\n      clientPos = event.clientY;\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the target data.\n    let targetIndex = data.index;\n    let targetPos = localPos - data.tabPressPos;\n    let targetEnd = targetPos + data.tabSize;\n\n    // Update the relative tab positions.\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let pxPos: string;\n      let layout = data.tabLayout![i];\n      let threshold = layout.pos + (layout.size >> 1);\n      if (i < data.index && targetPos < threshold) {\n        pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n        targetIndex = Math.min(targetIndex, i);\n      } else if (i > data.index && targetEnd > threshold) {\n        pxPos = `${-data.tabSize - layout.margin}px`;\n        targetIndex = Math.max(targetIndex, i);\n      } else if (i === data.index) {\n        let ideal = clientPos - pressPos;\n        let limit = clientSize - (data.tabPos + data.tabSize);\n        pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n      } else {\n        pxPos = '';\n      }\n      if (orientation === 'horizontal') {\n        (tabs[i] as HTMLElement).style.left = pxPos;\n      } else {\n        (tabs[i] as HTMLElement).style.top = pxPos;\n      }\n    }\n\n    // Update the computed target index.\n    data.targetIndex = targetIndex;\n  }\n\n  /**\n   * Position the drag tab at its final resting relative position.\n   */\n  export function finalizeTabPosition(\n    data: IDragData,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive client size.\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      clientSize = data.contentRect!.width;\n    } else {\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the ideal final tab position.\n    let ideal: number;\n    if (data.targetIndex === data.index) {\n      ideal = 0;\n    } else if (data.targetIndex > data.index) {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n    } else {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos - data.tabPos;\n    }\n\n    // Compute the tab position limit.\n    let limit = clientSize - (data.tabPos + data.tabSize);\n    let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n    // Set the final orientation-sensitive position.\n    if (orientation === 'horizontal') {\n      data.tab.style.left = `${final}px`;\n    } else {\n      data.tab.style.top = `${final}px`;\n    }\n  }\n\n  /**\n   * Reset the relative positions of the given tabs.\n   */\n  export function resetTabPositions(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): void {\n    for (const tab of tabs) {\n      if (orientation === 'horizontal') {\n        (tab as HTMLElement).style.left = '';\n      } else {\n        (tab as HTMLElement).style.top = '';\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n  /**\n   * Construct a new dock layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: DockLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n    this._document = options.document || document;\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   */\n  dispose(): void {\n    // Get an iterator over the widgets in the layout.\n    let widgets = this[Symbol.iterator]();\n\n    // Dispose of the layout items.\n    this._items.forEach(item => {\n      item.dispose();\n    });\n\n    // Clear the layout state before disposing the widgets.\n    this._box = null;\n    this._root = null;\n    this._items.clear();\n\n    // Dispose of the widgets contained in the old layout root.\n    for (const widget of widgets) {\n      widget.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the dock layout.\n   */\n  readonly renderer: DockLayout.IRenderer;\n\n  /**\n   * The method for hiding child widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    for (const bar of this.tabBars()) {\n      if (bar.titles.length > 1) {\n        for (const title of bar.titles) {\n          title.owner.hiddenMode = this._hiddenMode;\n        }\n      }\n    }\n  }\n\n  /**\n   * Get the inter-element spacing for the dock layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the dock layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Whether the dock layout is empty.\n   */\n  get isEmpty(): boolean {\n    return this._root === null;\n  }\n\n  /**\n   * Create an iterator over all widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This iterator includes the generated tab bars.\n   */\n  [Symbol.iterator](): IterableIterator<Widget> {\n    return this._root ? this._root.iterAllWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the user widgets in the layout.\n   *\n   * @returns A new iterator over the user widgets in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  widgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterUserWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the layout.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the layout.\n   */\n  selectedWidgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterSelectedWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the layout.\n   *\n   * @returns A new iterator over the tab bars in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  tabBars(): IterableIterator<TabBar<Widget>> {\n    return this._root ? this._root.iterTabBars() : empty();\n  }\n\n  /**\n   * Create an iterator over the handles in the layout.\n   *\n   * @returns A new iterator over the handles in the layout.\n   */\n  handles(): IterableIterator<HTMLDivElement> {\n    return this._root ? this._root.iterHandles() : empty();\n  }\n\n  /**\n   * Move a handle to the given offset position.\n   *\n   * @param handle - The handle to move.\n   *\n   * @param offsetX - The desired offset X position of the handle.\n   *\n   * @param offsetY - The desired offset Y position of the handle.\n   *\n   * #### Notes\n   * If the given handle is not contained in the layout, this is no-op.\n   *\n   * The handle will be moved as close as possible to the desired\n   * position without violating any of the layout constraints.\n   *\n   * Only one of the coordinates is used depending on the orientation\n   * of the handle. This method accepts both coordinates to make it\n   * easy to invoke from a mouse move event without needing to know\n   * the handle orientation.\n   */\n  moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n    // Bail early if there is no root or if the handle is hidden.\n    let hidden = handle.classList.contains('lm-mod-hidden');\n    if (!this._root || hidden) {\n      return;\n    }\n\n    // Lookup the split node for the handle.\n    let data = this._root.findSplitNode(handle);\n    if (!data) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (data.node.orientation === 'horizontal') {\n      delta = offsetX - handle.offsetLeft;\n    } else {\n      delta = offsetY - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent sibling resizing unless needed.\n    data.node.holdSizes();\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Save the current configuration of the dock layout.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockLayout.ILayoutConfig {\n    // Bail early if there is no root.\n    if (!this._root) {\n      return { main: null };\n    }\n\n    // Hold the current sizes in the layout tree.\n    this._root.holdAllSizes();\n\n    // Return the layout config.\n    return { main: this._root.createConfig() };\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   */\n  restoreLayout(config: DockLayout.ILayoutConfig): void {\n    // Create the widget set for validating the config.\n    let widgetSet = new Set<Widget>();\n\n    // Normalize the main area config and collect the widgets.\n    let mainConfig: DockLayout.AreaConfig | null;\n    if (config.main) {\n      mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n    } else {\n      mainConfig = null;\n    }\n\n    // Create iterators over the old content.\n    let oldWidgets = this.widgets();\n    let oldTabBars = this.tabBars();\n    let oldHandles = this.handles();\n\n    // Clear the root before removing the old content.\n    this._root = null;\n\n    // Unparent the old widgets which are not in the new config.\n    for (const widget of oldWidgets) {\n      if (!widgetSet.has(widget)) {\n        widget.parent = null;\n      }\n    }\n\n    // Dispose of the old tab bars.\n    for (const tabBar of oldTabBars) {\n      tabBar.dispose();\n    }\n\n    // Remove the old handles.\n    for (const handle of oldHandles) {\n      if (handle.parentNode) {\n        handle.parentNode.removeChild(handle);\n      }\n    }\n\n    // Reparent the new widgets to the current parent.\n    for (const widget of widgetSet) {\n      widget.parent = this.parent;\n    }\n\n    // Create the root node for the new config.\n    if (mainConfig) {\n      this._root = Private.realizeAreaConfig(\n        mainConfig,\n        {\n          // Ignoring optional `document` argument as we must reuse `this._document`\n          createTabBar: (document?: Document | ShadowRoot) =>\n            this._createTabBar(),\n          createHandle: () => this._createHandle()\n        },\n        this._document\n      );\n    } else {\n      this._root = null;\n    }\n\n    // If there is no parent, there is nothing more to do.\n    if (!this.parent) {\n      return;\n    }\n\n    // Attach the new widgets to the parent.\n    widgetSet.forEach(widget => {\n      this.attachWidget(widget);\n    });\n\n    // Post a fit request to the parent.\n    this.parent.fit();\n  }\n\n  /**\n   * Add a widget to the dock layout.\n   *\n   * @param widget - The widget to add to the dock layout.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * The widget will be moved if it is already contained in the layout.\n   *\n   * An error will be thrown if the reference widget is invalid.\n   */\n  addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n    // Parse the options.\n    let ref = options.ref || null;\n    let mode = options.mode || 'tab-after';\n\n    // Find the tab node which holds the reference widget.\n    let refNode: Private.TabLayoutNode | null = null;\n    if (this._root && ref) {\n      refNode = this._root.findTabNode(ref);\n    }\n\n    // Throw an error if the reference widget is invalid.\n    if (ref && !refNode) {\n      throw new Error('Reference widget is not in the layout.');\n    }\n\n    // Reparent the widget to the current layout parent.\n    widget.parent = this.parent;\n\n    // Insert the widget according to the insert mode.\n    switch (mode) {\n      case 'tab-after':\n        this._insertTab(widget, ref, refNode, true);\n        break;\n      case 'tab-before':\n        this._insertTab(widget, ref, refNode, false);\n        break;\n      case 'split-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false);\n        break;\n      case 'split-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false);\n        break;\n      case 'split-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true);\n        break;\n      case 'split-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true);\n        break;\n      case 'merge-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n        break;\n      case 'merge-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n        break;\n      case 'merge-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n        break;\n      case 'merge-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n        break;\n    }\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Ensure the widget is attached to the parent widget.\n    this.attachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Remove the widget from its current layout location.\n    this._removeWidget(widget);\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Detach the widget from the parent widget.\n    this.detachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Find the tab area which contains the given client position.\n   *\n   * @param clientX - The client X position of interest.\n   *\n   * @param clientY - The client Y position of interest.\n   *\n   * @returns The geometry of the tab area at the given position, or\n   *   `null` if there is no tab area at the given position.\n   */\n  hitTestTabAreas(\n    clientX: number,\n    clientY: number\n  ): DockLayout.ITabAreaGeometry | null {\n    // Bail early if hit testing cannot produce valid results.\n    if (!this._root || !this.parent || !this.parent.isVisible) {\n      return null;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent.node);\n    }\n\n    // Convert from client to local coordinates.\n    let rect = this.parent.node.getBoundingClientRect();\n    let x = clientX - rect.left - this._box.borderLeft;\n    let y = clientY - rect.top - this._box.borderTop;\n\n    // Find the tab layout node at the local position.\n    let tabNode = this._root.hitTestTabNodes(x, y);\n\n    // Bail if a tab layout node was not found.\n    if (!tabNode) {\n      return null;\n    }\n\n    // Extract the data from the tab node.\n    let { tabBar, top, left, width, height } = tabNode;\n\n    // Compute the right and bottom edges of the tab area.\n    let borderWidth = this._box.borderLeft + this._box.borderRight;\n    let borderHeight = this._box.borderTop + this._box.borderBottom;\n    let right = rect.width - borderWidth - (left + width);\n    let bottom = rect.height - borderHeight - (top + height);\n\n    // Return the hit test results.\n    return { tabBar, x, y, top, left, right, bottom, width, height };\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    // Perform superclass initialization.\n    super.init();\n\n    // Attach each widget to the parent.\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n\n    // Attach each handle to the parent.\n    for (const handle of this.handles()) {\n      this.parent!.node.appendChild(handle);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Attach the widget to the layout parent widget.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is already attached.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Do nothing if the widget is already attached.\n    if (this.parent!.node === widget.node.parentNode) {\n      return;\n    }\n\n    // Create the layout item for the widget.\n    this._items.set(widget, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach the widget from the layout parent widget.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not attached.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Do nothing if the widget is not attached.\n    if (this.parent!.node !== widget.node.parentNode) {\n      return;\n    }\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Delete the layout item for the widget.\n    let item = this._items.get(widget);\n    if (item) {\n      this._items.delete(widget);\n      item.dispose();\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Remove the specified widget from the layout structure.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not in the layout tree.\n   *\n   * This does not detach the widget from the parent node.\n   */\n  private _removeWidget(widget: Widget): void {\n    // Bail early if there is no layout root.\n    if (!this._root) {\n      return;\n    }\n\n    // Find the tab node which contains the given widget.\n    let tabNode = this._root.findTabNode(widget);\n\n    // Bail early if the tab node is not found.\n    if (!tabNode) {\n      return;\n    }\n\n    Private.removeAria(widget);\n\n    // If there are multiple tabs, just remove the widget's tab.\n    if (tabNode.tabBar.titles.length > 1) {\n      tabNode.tabBar.removeTab(widget.title);\n      if (\n        this._hiddenMode === Widget.HiddenMode.Scale &&\n        tabNode.tabBar.titles.length == 1\n      ) {\n        const existingWidget = tabNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Display;\n      }\n      return;\n    }\n\n    // Otherwise, the tab node needs to be removed...\n\n    // Dispose the tab bar.\n    tabNode.tabBar.dispose();\n\n    // Handle the case where the tab node is the root.\n    if (this._root === tabNode) {\n      this._root = null;\n      return;\n    }\n\n    // Otherwise, remove the tab node from its parent...\n\n    // Prevent widget resizing unless needed.\n    this._root.holdAllSizes();\n\n    // Clear the parent reference on the tab node.\n    let splitNode = tabNode.parent!;\n    tabNode.parent = null;\n\n    // Remove the tab node from its parent split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n    let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n    ArrayExt.removeAt(splitNode.sizers, i);\n\n    // Remove the handle from its parent DOM node.\n    if (handle.parentNode) {\n      handle.parentNode.removeChild(handle);\n    }\n\n    // If there are multiple children, just update the handles.\n    if (splitNode.children.length > 1) {\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Otherwise, the split node also needs to be removed...\n\n    // Clear the parent reference on the split node.\n    let maybeParent = splitNode.parent;\n    splitNode.parent = null;\n\n    // Lookup the remaining child node and handle.\n    let childNode = splitNode.children[0];\n    let childHandle = splitNode.handles[0];\n\n    // Clear the split node data.\n    splitNode.children.length = 0;\n    splitNode.handles.length = 0;\n    splitNode.sizers.length = 0;\n\n    // Remove the child handle from its parent node.\n    if (childHandle.parentNode) {\n      childHandle.parentNode.removeChild(childHandle);\n    }\n\n    // Handle the case where the split node is the root.\n    if (this._root === splitNode) {\n      childNode.parent = null;\n      this._root = childNode;\n      return;\n    }\n\n    // Otherwise, move the child node to the parent node...\n    let parentNode = maybeParent!;\n\n    // Lookup the index of the split node.\n    let j = parentNode.children.indexOf(splitNode);\n\n    // Handle the case where the child node is a tab node.\n    if (childNode instanceof Private.TabLayoutNode) {\n      childNode.parent = parentNode;\n      parentNode.children[j] = childNode;\n      return;\n    }\n\n    // Remove the split data from the parent.\n    let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n    ArrayExt.removeAt(parentNode.children, j);\n    ArrayExt.removeAt(parentNode.sizers, j);\n\n    // Remove the handle from its parent node.\n    if (splitHandle.parentNode) {\n      splitHandle.parentNode.removeChild(splitHandle);\n    }\n\n    // The child node and the split parent node will have the same\n    // orientation. Merge the grand-children with the parent node.\n    for (let i = 0, n = childNode.children.length; i < n; ++i) {\n      let gChild = childNode.children[i];\n      let gHandle = childNode.handles[i];\n      let gSizer = childNode.sizers[i];\n      ArrayExt.insert(parentNode.children, j + i, gChild);\n      ArrayExt.insert(parentNode.handles, j + i, gHandle);\n      ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n      gChild.parent = parentNode;\n    }\n\n    // Clear the child node.\n    childNode.children.length = 0;\n    childNode.handles.length = 0;\n    childNode.sizers.length = 0;\n    childNode.parent = null;\n\n    // Sync the handles on the parent node.\n    parentNode.syncHandles();\n  }\n\n  /**\n   * Create the tab layout node to hold the widget.\n   */\n  private _createTabNode(widget: Widget): Private.TabLayoutNode {\n    let tabNode = new Private.TabLayoutNode(this._createTabBar());\n    tabNode.tabBar.addTab(widget.title);\n    Private.addAria(widget, tabNode.tabBar);\n    return tabNode;\n  }\n\n  /**\n   * Insert a widget next to an existing tab.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertTab(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    after: boolean\n  ): void {\n    // Do nothing if the tab is inserted next to itself.\n    if (widget === ref) {\n      return;\n    }\n\n    // Create the root if it does not exist.\n    if (!this._root) {\n      let tabNode = new Private.TabLayoutNode(this._createTabBar());\n      tabNode.tabBar.addTab(widget.title);\n      this._root = tabNode;\n      Private.addAria(widget, tabNode.tabBar);\n      return;\n    }\n\n    // Use the first tab node as the ref node if needed.\n    if (!refNode) {\n      refNode = this._root.findFirstTabNode()!;\n    }\n\n    // If the widget is not contained in the ref node, ensure it is\n    // removed from the layout and hidden before being added again.\n    if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n      this._removeWidget(widget);\n      widget.hide();\n    }\n\n    // Lookup the target index for inserting the tab.\n    let index: number;\n    if (ref) {\n      index = refNode.tabBar.titles.indexOf(ref.title);\n    } else {\n      index = refNode.tabBar.currentIndex;\n    }\n\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      if (refNode.tabBar.titles.length === 0) {\n        // Singular tab should use display mode to limit number of layers.\n        widget.hiddenMode = Widget.HiddenMode.Display;\n      } else if (refNode.tabBar.titles.length == 1) {\n        // If we are adding a second tab, switch the existing tab back to scale.\n        const existingWidget = refNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n      } else {\n        // For the third and subsequent tabs no special action is needed.\n        widget.hiddenMode = Widget.HiddenMode.Scale;\n      }\n    } else {\n      // For all other modes just propagate the current mode.\n      widget.hiddenMode = this._hiddenMode;\n    }\n\n    // Insert the widget's tab relative to the target index.\n    refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n    Private.addAria(widget, refNode.tabBar);\n  }\n\n  /**\n   * Insert a widget as a new split area.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertSplit(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    orientation: Private.Orientation,\n    after: boolean,\n    merge: boolean = false\n  ): void {\n    // Do nothing if there is no effective split.\n    if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n      return;\n    }\n\n    // Ensure the widget is removed from the current layout.\n    this._removeWidget(widget);\n\n    // Set the root if it does not exist.\n    if (!this._root) {\n      this._root = this._createTabNode(widget);\n      return;\n    }\n\n    // If the ref node parent is null, split the root.\n    if (!refNode || !refNode.parent) {\n      // Ensure the root is split with the correct orientation.\n      let root = this._splitRoot(orientation);\n\n      // Determine the insert index for the new tab node.\n      let i = after ? root.children.length : 0;\n\n      // Normalize the split node.\n      root.normalizeSizes();\n\n      // Create the sizer for new tab node.\n      let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n      // Insert the tab node sized to the golden ratio.\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(root.children, i, tabNode);\n      ArrayExt.insert(root.sizers, i, sizer);\n      ArrayExt.insert(root.handles, i, this._createHandle());\n      tabNode.parent = root;\n\n      // Re-normalize the split node to maintain the ratios.\n      root.normalizeSizes();\n\n      // Finally, synchronize the visibility of the handles.\n      root.syncHandles();\n      return;\n    }\n\n    // Lookup the split node for the ref widget.\n    let splitNode = refNode.parent;\n\n    // If the split node already had the correct orientation,\n    // the widget can be inserted into the split node directly.\n    if (splitNode.orientation === orientation) {\n      // Find the index of the ref node.\n      let i = splitNode.children.indexOf(refNode);\n\n      // Conditionally reuse a tab layout found in the wanted position.\n      if (merge) {\n        let j = i + (after ? 1 : -1);\n        let sibling = splitNode.children[j];\n        if (sibling instanceof Private.TabLayoutNode) {\n          this._insertTab(widget, null, sibling, true);\n          ++sibling.tabBar.currentIndex;\n          return;\n        }\n      }\n\n      // Normalize the split node.\n      splitNode.normalizeSizes();\n\n      // Consume half the space for the insert location.\n      let s = (splitNode.sizers[i].sizeHint /= 2);\n\n      // Insert the tab node sized to the other half.\n      let j = i + (after ? 1 : 0);\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(splitNode.children, j, tabNode);\n      ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n      ArrayExt.insert(splitNode.handles, j, this._createHandle());\n      tabNode.parent = splitNode;\n\n      // Finally, synchronize the visibility of the handles.\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Remove the ref node from the split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n    // Create a new normalized split node for the children.\n    let childNode = new Private.SplitLayoutNode(orientation);\n    childNode.normalized = true;\n\n    // Add the ref node sized to half the space.\n    childNode.children.push(refNode);\n    childNode.sizers.push(Private.createSizer(0.5));\n    childNode.handles.push(this._createHandle());\n    refNode.parent = childNode;\n\n    // Add the tab node sized to the other half.\n    let j = after ? 1 : 0;\n    let tabNode = this._createTabNode(widget);\n    ArrayExt.insert(childNode.children, j, tabNode);\n    ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n    ArrayExt.insert(childNode.handles, j, this._createHandle());\n    tabNode.parent = childNode;\n\n    // Synchronize the visibility of the handles.\n    childNode.syncHandles();\n\n    // Finally, add the new child node to the original split node.\n    ArrayExt.insert(splitNode.children, i, childNode);\n    childNode.parent = splitNode;\n  }\n\n  /**\n   * Ensure the root is a split node with the given orientation.\n   */\n  private _splitRoot(\n    orientation: Private.Orientation\n  ): Private.SplitLayoutNode {\n    // Bail early if the root already meets the requirements.\n    let oldRoot = this._root;\n    if (oldRoot instanceof Private.SplitLayoutNode) {\n      if (oldRoot.orientation === orientation) {\n        return oldRoot;\n      }\n    }\n\n    // Create a new root node with the specified orientation.\n    let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n    // Add the old root to the new root.\n    if (oldRoot) {\n      newRoot.children.push(oldRoot);\n      newRoot.sizers.push(Private.createSizer(0));\n      newRoot.handles.push(this._createHandle());\n      oldRoot.parent = newRoot;\n    }\n\n    // Return the new root as a convenience.\n    return newRoot;\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the size limits for the layout tree.\n    if (this._root) {\n      let limits = this._root.fit(this._spacing, this._items);\n      minW = limits.minWidth;\n      minH = limits.minHeight;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Bail early if there is no root layout node.\n    if (!this._root) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let x = this._box.paddingTop;\n    let y = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the geometry of the layout tree.\n    this._root.update(x, y, width, height, this._spacing, this._items);\n  }\n\n  /**\n   * Create a new tab bar for use by the dock layout.\n   *\n   * #### Notes\n   * The tab bar will be attached to the parent if it exists.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar using the renderer.\n    let tabBar = this.renderer.createTabBar(this._document);\n\n    // Enforce necessary tab bar behavior.\n    tabBar.orientation = 'horizontal';\n\n    // Attach the tab bar to the parent if possible.\n    if (this.parent) {\n      this.attachWidget(tabBar);\n    }\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for the dock layout.\n   *\n   * #### Notes\n   * The handle will be attached to the parent if it exists.\n   */\n  private _createHandle(): HTMLDivElement {\n    // Create the handle using the renderer.\n    let handle = this.renderer.createHandle();\n\n    // Initialize the handle layout behavior.\n    let style = handle.style;\n    style.position = 'absolute';\n    style.contain = 'strict';\n    style.top = '0';\n    style.left = '0';\n    style.width = '0';\n    style.height = '0';\n\n    // Attach the handle to the parent if it exists.\n    if (this.parent) {\n      this.parent.node.appendChild(handle);\n    }\n\n    // Return the initialized handle.\n    return handle;\n  }\n\n  private _spacing = 4;\n  private _dirty = false;\n  private _root: Private.LayoutNode | null = null;\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _document: Document | ShadowRoot;\n  private _hiddenMode: Widget.HiddenMode;\n  private _items: Private.ItemMap = new Map<Widget, LayoutItem>();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n  /**\n   * An options object for creating a dock layout.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * The renderer to use for the dock layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a dock layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new tab bar for use with a dock layout.\n     *\n     * @returns A new tab bar for a dock layout.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget>;\n\n    /**\n     * Create a new handle node for use with a dock layout.\n     *\n     * @returns A new handle node for a dock layout.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * A type alias for the supported insertion modes.\n   *\n   * An insert mode is used to specify how a widget should be added\n   * to the dock layout relative to a reference widget.\n   */\n  export type InsertMode =\n    | /**\n     * The area to the top of the reference widget.\n     *\n     * The widget will be inserted just above the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the top edge of the dock layout.\n     */\n    'split-top'\n\n    /**\n     * The area to the left of the reference widget.\n     *\n     * The widget will be inserted just left of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the left edge of the dock layout.\n     */\n    | 'split-left'\n\n    /**\n     * The area to the right of the reference widget.\n     *\n     * The widget will be inserted just right of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted  at the right edge of the dock layout.\n     */\n    | 'split-right'\n\n    /**\n     * The area to the bottom of the reference widget.\n     *\n     * The widget will be inserted just below the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the bottom edge of the dock layout.\n     */\n    | 'split-bottom'\n\n    /**\n     * Like `split-top` but if a tab layout exists above the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-top'\n\n    /**\n     * Like `split-left` but if a tab layout exists left of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-left'\n\n    /**\n     * Like `split-right` but if a tab layout exists right of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-right'\n\n    /**\n     * Like `split-bottom` but if a tab layout exists below the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-bottom'\n\n    /**\n     * The tab position before the reference widget.\n     *\n     * The widget will be added as a tab before the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-before'\n\n    /**\n     * The tab position after the reference widget.\n     *\n     * The widget will be added as a tab after the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-after';\n\n  /**\n   * An options object for adding a widget to the dock layout.\n   */\n  export interface IAddOptions {\n    /**\n     * The insertion mode for adding the widget.\n     *\n     * The default is `'tab-after'`.\n     */\n    mode?: InsertMode;\n\n    /**\n     * The reference widget for the insert location.\n     *\n     * The default is `null`.\n     */\n    ref?: Widget | null;\n  }\n\n  /**\n   * A layout config object for a tab area.\n   */\n  export interface ITabAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'tab-area';\n\n    /**\n     * The widgets contained in the tab area.\n     */\n    widgets: Widget[];\n\n    /**\n     * The index of the selected tab.\n     */\n    currentIndex: number;\n  }\n\n  /**\n   * A layout config object for a split area.\n   */\n  export interface ISplitAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'split-area';\n\n    /**\n     * The orientation of the split area.\n     */\n    orientation: 'horizontal' | 'vertical';\n\n    /**\n     * The children in the split area.\n     */\n    children: AreaConfig[];\n\n    /**\n     * The relative sizes of the children.\n     */\n    sizes: number[];\n  }\n\n  /**\n   * A type alias for a general area config.\n   */\n  export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n  /**\n   * A dock layout configuration object.\n   */\n  export interface ILayoutConfig {\n    /**\n     * The layout config for the main dock area.\n     */\n    main: AreaConfig | null;\n  }\n\n  /**\n   * An object which represents the geometry of a tab area.\n   */\n  export interface ITabAreaGeometry {\n    /**\n     * The tab bar for the tab area.\n     */\n    tabBar: TabBar<Widget>;\n\n    /**\n     * The local X position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the local X coordinate of the hit test query.\n     */\n    x: number;\n\n    /**\n     * The local Y position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the local Y coordinate of the hit test query.\n     */\n    y: number;\n\n    /**\n     * The local coordinate of the top edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the top edge of the tab area.\n     */\n    top: number;\n\n    /**\n     * The local coordinate of the left edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the left edge of the tab area.\n     */\n    left: number;\n\n    /**\n     * The local coordinate of the right edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the right edge of the layout parent\n     * widget, to the right edge of the tab area.\n     */\n    right: number;\n\n    /**\n     * The local coordinate of the bottom edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the bottom edge of the layout parent\n     * widget, to the bottom edge of the tab area.\n     */\n    bottom: number;\n\n    /**\n     * The width of the tab area.\n     *\n     * #### Notes\n     * This is total width allocated for the tab area.\n     */\n    width: number;\n\n    /**\n     * The height of the tab area.\n     *\n     * #### Notes\n     * This is total height allocated for the tab area.\n     */\n    height: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * A type alias for a dock layout node.\n   */\n  export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n  /**\n   * A type alias for the orientation of a split layout node.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a layout item map.\n   */\n  export type ItemMap = Map<Widget, LayoutItem>;\n\n  /**\n   * Create a box sizer with an initial size hint.\n   */\n  export function createSizer(hint: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = hint;\n    sizer.size = hint;\n    return sizer;\n  }\n\n  /**\n   * Normalize an area config object and collect the visited widgets.\n   */\n  export function normalizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    let result: DockLayout.AreaConfig | null;\n    if (config.type === 'tab-area') {\n      result = normalizeTabAreaConfig(config, widgetSet);\n    } else {\n      result = normalizeSplitAreaConfig(config, widgetSet);\n    }\n    return result;\n  }\n\n  /**\n   * Convert a normalized area config into a layout tree.\n   */\n  export function realizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): LayoutNode {\n    let node: LayoutNode;\n    if (config.type === 'tab-area') {\n      node = realizeTabAreaConfig(config, renderer, document);\n    } else {\n      node = realizeSplitAreaConfig(config, renderer, document);\n    }\n    return node;\n  }\n\n  /**\n   * A layout node which holds the data for a tabbed area.\n   */\n  export class TabLayoutNode {\n    /**\n     * Construct a new tab layout node.\n     *\n     * @param tabBar - The tab bar to use for the layout node.\n     */\n    constructor(tabBar: TabBar<Widget>) {\n      let tabSizer = new BoxSizer();\n      let widgetSizer = new BoxSizer();\n      tabSizer.stretch = 0;\n      widgetSizer.stretch = 1;\n      this.tabBar = tabBar;\n      this.sizers = [tabSizer, widgetSizer];\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * The tab bar for the layout node.\n     */\n    readonly tabBar: TabBar<Widget>;\n\n    /**\n     * The sizers for the layout node.\n     */\n    readonly sizers: [BoxSizer, BoxSizer];\n\n    /**\n     * The most recent value for the `top` edge of the layout box.\n     */\n    get top(): number {\n      return this._top;\n    }\n\n    /**\n     * The most recent value for the `left` edge of the layout box.\n     */\n    get left(): number {\n      return this._left;\n    }\n\n    /**\n     * The most recent value for the `width` of the layout box.\n     */\n    get width(): number {\n      return this._width;\n    }\n\n    /**\n     * The most recent value for the `height` of the layout box.\n     */\n    get height(): number {\n      return this._height;\n    }\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      yield this.tabBar;\n      yield* this.iterUserWidgets();\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const title of this.tabBar.titles) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      let title = this.tabBar.currentTitle;\n      if (title) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      yield this.tabBar;\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    // eslint-disable-next-line require-yield\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      return;\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      return this;\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      if (x < this._left || x >= this._left + this._width) {\n        return null;\n      }\n      if (y < this._top || y >= this._top + this._height) {\n        return null;\n      }\n      return this;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ITabAreaConfig {\n      let widgets = this.tabBar.titles.map(title => title.owner);\n      let currentIndex = this.tabBar.currentIndex;\n      return { type: 'tab-area', widgets, currentIndex };\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      return;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Set up the limit variables.\n      let minWidth = 0;\n      let minHeight = 0;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Lookup the tab bar and widget sizers.\n      let [tabBarSizer, widgetSizer] = this.sizers;\n\n      // Update the tab bar limits.\n      if (tabBarItem) {\n        tabBarItem.fit();\n      }\n\n      // Update the widget limits.\n      if (widgetItem) {\n        widgetItem.fit();\n      }\n\n      // Update the results and sizer for the tab bar.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        minWidth = Math.max(minWidth, tabBarItem.minWidth);\n        minHeight += tabBarItem.minHeight;\n        tabBarSizer.minSize = tabBarItem.minHeight;\n        tabBarSizer.maxSize = tabBarItem.maxHeight;\n      } else {\n        tabBarSizer.minSize = 0;\n        tabBarSizer.maxSize = 0;\n      }\n\n      // Update the results and sizer for the current widget.\n      if (widgetItem && !widgetItem.isHidden) {\n        minWidth = Math.max(minWidth, widgetItem.minWidth);\n        minHeight += widgetItem.minHeight;\n        widgetSizer.minSize = widgetItem.minHeight;\n        widgetSizer.maxSize = Infinity;\n      } else {\n        widgetSizer.minSize = 0;\n        widgetSizer.maxSize = Infinity;\n      }\n\n      // Return the computed size limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Update the layout box values.\n      this._top = top;\n      this._left = left;\n      this._width = width;\n      this._height = height;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, height);\n\n      // Update the tab bar item using the computed size.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        let size = this.sizers[0].size;\n        tabBarItem.update(left, top, width, size);\n        top += size;\n      }\n\n      // Layout the widget using the computed size.\n      if (widgetItem && !widgetItem.isHidden) {\n        let size = this.sizers[1].size;\n        widgetItem.update(left, top, width, size);\n      }\n    }\n\n    private _top = 0;\n    private _left = 0;\n    private _width = 0;\n    private _height = 0;\n  }\n\n  /**\n   * A layout node which holds the data for a split area.\n   */\n  export class SplitLayoutNode {\n    /**\n     * Construct a new split layout node.\n     *\n     * @param orientation - The orientation of the node.\n     */\n    constructor(orientation: Orientation) {\n      this.orientation = orientation;\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * Whether the sizers have been normalized.\n     */\n    normalized = false;\n\n    /**\n     * The orientation of the node.\n     */\n    readonly orientation: Orientation;\n\n    /**\n     * The child nodes for the split node.\n     */\n    readonly children: LayoutNode[] = [];\n\n    /**\n     * The box sizers for the layout children.\n     */\n    readonly sizers: BoxSizer[] = [];\n\n    /**\n     * The handles for the layout children.\n     */\n    readonly handles: HTMLDivElement[] = [];\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterAllWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterUserWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterSelectedWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      for (const child of this.children) {\n        yield* child.iterTabBars();\n      }\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      yield* this.handles;\n      for (const child of this.children) {\n        yield* child.iterHandles();\n      }\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findTabNode(widget);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      let index = this.handles.indexOf(handle);\n      if (index !== -1) {\n        return { index, node: this };\n      }\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findSplitNode(handle);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      if (this.children.length === 0) {\n        return null;\n      }\n      return this.children[0].findFirstTabNode();\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].hitTestTabNodes(x, y);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ISplitAreaConfig {\n      let orientation = this.orientation;\n      let sizes = this.createNormalizedSizes();\n      let children = this.children.map(child => child.createConfig());\n      return { type: 'split-area', orientation, children, sizes };\n    }\n\n    /**\n     * Sync the visibility and orientation of the handles.\n     */\n    syncHandles(): void {\n      this.handles.forEach((handle, i) => {\n        handle.setAttribute('data-orientation', this.orientation);\n        if (i === this.handles.length - 1) {\n          handle.classList.add('lm-mod-hidden');\n        } else {\n          handle.classList.remove('lm-mod-hidden');\n        }\n      });\n    }\n\n    /**\n     * Hold the current sizes of the box sizers.\n     *\n     * This sets the size hint of each sizer to its current size.\n     */\n    holdSizes(): void {\n      for (const sizer of this.sizers) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      for (const child of this.children) {\n        child.holdAllSizes();\n      }\n      this.holdSizes();\n    }\n\n    /**\n     * Normalize the sizes of the split layout node.\n     */\n    normalizeSizes(): void {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return;\n      }\n\n      // Hold the current sizes of the sizers.\n      this.holdSizes();\n\n      // Compute the sum of the sizes.\n      let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint = 1 / n;\n        }\n      } else {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint /= sum;\n        }\n      }\n\n      // Mark the sizes as normalized.\n      this.normalized = true;\n    }\n\n    /**\n     * Snap the normalized sizes of the split layout node.\n     */\n    createNormalizedSizes(): number[] {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return [];\n      }\n\n      // Grab the current sizes of the sizers.\n      let sizes = this.sizers.map(sizer => sizer.size);\n\n      // Compute the sum of the sizes.\n      let sum = sizes.reduce((v, size) => v + size, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] = 1 / n;\n        }\n      } else {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] /= sum;\n        }\n      }\n\n      // Return the normalized sizes.\n      return sizes;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Compute the required fixed space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n      // Set up the limit variables.\n      let minWidth = horizontal ? fixed : 0;\n      let minHeight = horizontal ? 0 : fixed;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Fit the children and update the limits.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let limits = this.children[i].fit(spacing, items);\n        if (horizontal) {\n          minHeight = Math.max(minHeight, limits.minHeight);\n          minWidth += limits.minWidth;\n          this.sizers[i].minSize = limits.minWidth;\n        } else {\n          minWidth = Math.max(minWidth, limits.minWidth);\n          minHeight += limits.minHeight;\n          this.sizers[i].minSize = limits.minHeight;\n        }\n      }\n\n      // Return the computed limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Compute the available layout space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n      let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n      // De-normalize the sizes if needed.\n      if (this.normalized) {\n        for (const sizer of this.sizers) {\n          sizer.sizeHint *= space;\n        }\n        this.normalized = false;\n      }\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, space);\n\n      // Update the geometry of the child nodes and handles.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let child = this.children[i];\n        let size = this.sizers[i].size;\n        let handleStyle = this.handles[i].style;\n        if (horizontal) {\n          child.update(left, top, size, height, spacing, items);\n          left += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${spacing}px`;\n          handleStyle.height = `${height}px`;\n          left += spacing;\n        } else {\n          child.update(left, top, width, size, spacing, items);\n          top += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${width}px`;\n          handleStyle.height = `${spacing}px`;\n          top += spacing;\n        }\n      }\n    }\n  }\n\n  export function addAria(widget: Widget, tabBar: TabBar<Widget>): void {\n    widget.node.setAttribute('role', 'tabpanel');\n    let renderer = tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  export function removeAria(widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n  }\n\n  /**\n   * Normalize a tab area config and collect the visited widgets.\n   */\n  function normalizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.ITabAreaConfig | null {\n    // Bail early if there is no content.\n    if (config.widgets.length === 0) {\n      return null;\n    }\n\n    // Setup the filtered widgets array.\n    let widgets: Widget[] = [];\n\n    // Filter the config for unique widgets.\n    for (const widget of config.widgets) {\n      if (!widgetSet.has(widget)) {\n        widgetSet.add(widget);\n        widgets.push(widget);\n      }\n    }\n\n    // Bail if there are no effective widgets.\n    if (widgets.length === 0) {\n      return null;\n    }\n\n    // Normalize the current index.\n    let index = config.currentIndex;\n    if (index !== -1 && (index < 0 || index >= widgets.length)) {\n      index = 0;\n    }\n\n    // Return a normalized config object.\n    return { type: 'tab-area', widgets, currentIndex: index };\n  }\n\n  /**\n   * Normalize a split area config and collect the visited widgets.\n   */\n  function normalizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    // Set up the result variables.\n    let orientation = config.orientation;\n    let children: DockLayout.AreaConfig[] = [];\n    let sizes: number[] = [];\n\n    // Normalize the config children.\n    for (let i = 0, n = config.children.length; i < n; ++i) {\n      // Normalize the child config.\n      let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n      // Ignore an empty child.\n      if (!child) {\n        continue;\n      }\n\n      // Add the child or hoist its content as appropriate.\n      if (child.type === 'tab-area' || child.orientation !== orientation) {\n        children.push(child);\n        sizes.push(Math.abs(config.sizes[i] || 0));\n      } else {\n        children.push(...child.children);\n        sizes.push(...child.sizes);\n      }\n    }\n\n    // Bail if there are no effective children.\n    if (children.length === 0) {\n      return null;\n    }\n\n    // If there is only one effective child, return that child.\n    if (children.length === 1) {\n      return children[0];\n    }\n\n    // Return a normalized config object.\n    return { type: 'split-area', orientation, children, sizes };\n  }\n\n  /**\n   * Convert a normalized tab area config into a layout tree.\n   */\n  function realizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): TabLayoutNode {\n    // Create the tab bar for the layout node.\n    let tabBar = renderer.createTabBar(document);\n\n    // Hide each widget and add it to the tab bar.\n    for (const widget of config.widgets) {\n      widget.hide();\n      tabBar.addTab(widget.title);\n      Private.addAria(widget, tabBar);\n    }\n\n    // Set the current index of the tab bar.\n    tabBar.currentIndex = config.currentIndex;\n\n    // Return the new tab layout node.\n    return new TabLayoutNode(tabBar);\n  }\n\n  /**\n   * Convert a normalized split area config into a layout tree.\n   */\n  function realizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): SplitLayoutNode {\n    // Create the split layout node.\n    let node = new SplitLayoutNode(config.orientation);\n\n    // Add each child to the layout node.\n    config.children.forEach((child, i) => {\n      // Create the child data for the layout node.\n      let childNode = realizeAreaConfig(child, renderer, document);\n      let sizer = createSizer(config.sizes[i]);\n      let handle = renderer.createHandle();\n\n      // Add the child data to the layout node.\n      node.children.push(childNode);\n      node.handles.push(handle);\n      node.sizers.push(sizer);\n\n      // Update the parent for the child node.\n      childNode.parent = node;\n    });\n\n    // Synchronize the handle state for the layout node.\n    node.syncHandles();\n\n    // Normalize the sizes for the layout node.\n    node.normalizeSizes();\n\n    // Return the new layout node.\n    return node;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n  /**\n   * Construct a new dock panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: DockPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-DockPanel');\n    this._document = options.document || document;\n    this._mode = options.mode || 'multiple-document';\n    this._renderer = options.renderer || DockPanel.defaultRenderer;\n    this._edges = options.edges || Private.DEFAULT_EDGES;\n    if (options.tabsMovable !== undefined) {\n      this._tabsMovable = options.tabsMovable;\n    }\n    if (options.tabsConstrained !== undefined) {\n      this._tabsConstrained = options.tabsConstrained;\n    }\n    if (options.addButtonEnabled !== undefined) {\n      this._addButtonEnabled = options.addButtonEnabled;\n    }\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = this._mode;\n\n    // Create the delegate renderer for the layout.\n    let renderer: DockPanel.IRenderer = {\n      createTabBar: () => this._createTabBar(),\n      createHandle: () => this._createHandle()\n    };\n\n    // Set up the dock layout for the panel.\n    this.layout = new DockLayout({\n      document: this._document,\n      renderer,\n      spacing: options.spacing,\n      hiddenMode: options.hiddenMode\n    });\n\n    // Set up the overlay drop indicator.\n    this.overlay = options.overlay || new DockPanel.Overlay();\n    this.node.appendChild(this.overlay.node);\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    // Ensure the mouse is released.\n    this._releaseMouse();\n\n    // Hide the overlay.\n    this.overlay.hide(0);\n\n    // Cancel a drag if one is in progress.\n    if (this._drag) {\n      this._drag.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The method for hiding widgets.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as DockLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as DockLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when the layout configuration is modified.\n   *\n   * #### Notes\n   * This signal is emitted whenever the current layout configuration\n   * may have changed.\n   *\n   * This signal is emitted asynchronously in a collapsed fashion, so\n   * that multiple synchronous modifications results in only a single\n   * emit of the signal.\n   */\n  get layoutModified(): ISignal<this, void> {\n    return this._layoutModified;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The overlay used by the dock panel.\n   */\n  readonly overlay: DockPanel.IOverlay;\n\n  /**\n   * The renderer used by the dock panel.\n   */\n  get renderer(): DockPanel.IRenderer {\n    return (this.layout as DockLayout).renderer;\n  }\n\n  /**\n   * Get the spacing between the widgets.\n   */\n  get spacing(): number {\n    return (this.layout as DockLayout).spacing;\n  }\n\n  /**\n   * Set the spacing between the widgets.\n   */\n  set spacing(value: number) {\n    (this.layout as DockLayout).spacing = value;\n  }\n\n  /**\n   * Get the mode for the dock panel.\n   */\n  get mode(): DockPanel.Mode {\n    return this._mode;\n  }\n\n  /**\n   * Set the mode for the dock panel.\n   *\n   * #### Notes\n   * Changing the mode is a destructive operation with respect to the\n   * panel's layout configuration. If layout state must be preserved,\n   * save the current layout config before changing the mode.\n   */\n  set mode(value: DockPanel.Mode) {\n    // Bail early if the mode does not change.\n    if (this._mode === value) {\n      return;\n    }\n\n    // Update the internal mode.\n    this._mode = value;\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = value;\n\n    // Get the layout for the panel.\n    let layout = this.layout as DockLayout;\n\n    // Configure the layout for the specified mode.\n    switch (value) {\n      case 'multiple-document':\n        for (const tabBar of layout.tabBars()) {\n          tabBar.show();\n        }\n        break;\n      case 'single-document':\n        layout.restoreLayout(Private.createSingleDocumentConfig(this));\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Whether the tabs can be dragged / moved at runtime.\n   */\n  get tabsMovable(): boolean {\n    return this._tabsMovable;\n  }\n\n  /**\n   * Enable / Disable draggable / movable tabs.\n   */\n  set tabsMovable(value: boolean) {\n    this._tabsMovable = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.tabsMovable = value;\n    }\n  }\n\n  /**\n   * Whether the tabs are constrained to their source dock panel\n   */\n  get tabsConstrained(): boolean {\n    return this._tabsConstrained;\n  }\n\n  /**\n   * Constrain/Allow tabs to be dragged outside of this dock panel\n   */\n  set tabsConstrained(value: boolean) {\n    this._tabsConstrained = value;\n  }\n\n  /**\n   * Whether the add buttons for each tab bar are enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add buttons for each tab bar are enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    this._addButtonEnabled = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.addButtonEnabled = value;\n    }\n  }\n\n  /**\n   * Whether the dock panel is empty.\n   */\n  get isEmpty(): boolean {\n    return (this.layout as DockLayout).isEmpty;\n  }\n\n  /**\n   * Create an iterator over the user widgets in the panel.\n   *\n   * @returns A new iterator over the user widgets in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  *widgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).widgets();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the panel.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the panel.\n   */\n  *selectedWidgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).selectedWidgets();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the panel.\n   *\n   * @returns A new iterator over the tab bars in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  *tabBars(): IterableIterator<TabBar<Widget>> {\n    yield* (this.layout as DockLayout).tabBars();\n  }\n\n  /**\n   * Create an iterator over the handles in the panel.\n   *\n   * @returns A new iterator over the handles in the panel.\n   */\n  *handles(): IterableIterator<HTMLDivElement> {\n    yield* (this.layout as DockLayout).handles();\n  }\n\n  /**\n   * Select a specific widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will make the widget the current widget in its tab area.\n   */\n  selectWidget(widget: Widget): void {\n    // Find the tab bar which contains the widget.\n    let tabBar = find(this.tabBars(), bar => {\n      return bar.titles.indexOf(widget.title) !== -1;\n    });\n\n    // Throw an error if no tab bar is found.\n    if (!tabBar) {\n      throw new Error('Widget is not contained in the dock panel.');\n    }\n\n    // Ensure the widget is the current widget.\n    tabBar.currentTitle = widget.title;\n  }\n\n  /**\n   * Activate a specified widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will select and activate the given widget.\n   */\n  activateWidget(widget: Widget): void {\n    this.selectWidget(widget);\n    widget.activate();\n  }\n\n  /**\n   * Save the current layout configuration of the dock panel.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockPanel.ILayoutConfig {\n    return (this.layout as DockLayout).saveLayout();\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   *\n   * The dock panel automatically reverts to `'multiple-document'`\n   * mode when a layout config is restored.\n   */\n  restoreLayout(config: DockPanel.ILayoutConfig): void {\n    // Reset the mode.\n    this._mode = 'multiple-document';\n\n    // Restore the layout.\n    (this.layout as DockLayout).restoreLayout(config);\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Add a widget to the dock panel.\n   *\n   * @param widget - The widget to add to the dock panel.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * If the panel is in single document mode, the options are ignored\n   * and the widget is always added as tab in the hidden tab bar.\n   */\n  addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n    // Add the widget to the layout.\n    if (this._mode === 'single-document') {\n      (this.layout as DockLayout).addWidget(widget);\n    } else {\n      (this.layout as DockLayout).addWidget(widget, options);\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   */\n  processMessage(msg: Message): void {\n    if (msg.type === 'layout-modified') {\n      this._layoutModified.emit(undefined);\n    } else {\n      super.processMessage(msg);\n    }\n  }\n\n  /**\n   * Handle the DOM events for the dock panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'lm-dragenter':\n        this._evtDragEnter(event as Drag.Event);\n        break;\n      case 'lm-dragleave':\n        this._evtDragLeave(event as Drag.Event);\n        break;\n      case 'lm-dragover':\n        this._evtDragOver(event as Drag.Event);\n        break;\n      case 'lm-drop':\n        this._evtDrop(event as Drag.Event);\n        break;\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('lm-dragenter', this);\n    this.node.addEventListener('lm-dragleave', this);\n    this.node.addEventListener('lm-dragover', this);\n    this.node.addEventListener('lm-drop', this);\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('lm-dragenter', this);\n    this.node.removeEventListener('lm-dragleave', this);\n    this.node.removeEventListener('lm-dragover', this);\n    this.node.removeEventListener('lm-drop', this);\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Add the widget class to the child.\n    msg.child.addClass('lm-DockPanel-widget');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Remove the widget class from the child.\n    msg.child.removeClass('lm-DockPanel-widget');\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `'lm-dragenter'` event for the dock panel.\n   */\n  private _evtDragEnter(event: Drag.Event): void {\n    // If the factory mime type is present, mark the event as\n    // handled in order to get the rest of the drag events.\n    if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n  }\n\n  /**\n   * Handle the `'lm-dragleave'` event for the dock panel.\n   */\n  private _evtDragLeave(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    if (this._tabsConstrained && event.source !== this) return;\n\n    event.stopPropagation();\n\n    // The new target might be a descendant, so we might still handle the drop.\n    // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n    // hide is cancelled by the lm-dragover handler's show overlay logic.\n    this.overlay.hide(1);\n  }\n\n  /**\n   * Handle the `'lm-dragover'` event for the dock panel.\n   */\n  private _evtDragOver(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Show the drop indicator overlay and update the drop\n    // action based on the drop target zone under the mouse.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      this._showOverlay(event.clientX, event.clientY) === 'invalid'\n    ) {\n      event.dropAction = 'none';\n    } else {\n      event.stopPropagation();\n      event.dropAction = event.proposedAction;\n    }\n  }\n\n  /**\n   * Handle the `'lm-drop'` event for the dock panel.\n   */\n  private _evtDrop(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Hide the drop indicator overlay.\n    this.overlay.hide(0);\n\n    // Bail if the proposed action is to do nothing.\n    if (event.proposedAction === 'none') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the drop target under the mouse.\n    let { clientX, clientY } = event;\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // Bail if the drop zone is invalid.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      zone === 'invalid'\n    ) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory mime type has invalid data.\n    let mimeData = event.mimeData;\n    let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n    if (typeof factory !== 'function') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory does not produce a widget.\n    let widget = factory();\n    if (!(widget instanceof Widget)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the widget is an ancestor of the dock panel.\n    if (widget.contains(this)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the reference widget for the drop target.\n    let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n    // Add the widget according to the indicated drop zone.\n    switch (zone) {\n      case 'root-all':\n        this.addWidget(widget);\n        break;\n      case 'root-top':\n        this.addWidget(widget, { mode: 'split-top' });\n        break;\n      case 'root-left':\n        this.addWidget(widget, { mode: 'split-left' });\n        break;\n      case 'root-right':\n        this.addWidget(widget, { mode: 'split-right' });\n        break;\n      case 'root-bottom':\n        this.addWidget(widget, { mode: 'split-bottom' });\n        break;\n      case 'widget-all':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      case 'widget-top':\n        this.addWidget(widget, { mode: 'split-top', ref });\n        break;\n      case 'widget-left':\n        this.addWidget(widget, { mode: 'split-left', ref });\n        break;\n      case 'widget-right':\n        this.addWidget(widget, { mode: 'split-right', ref });\n        break;\n      case 'widget-bottom':\n        this.addWidget(widget, { mode: 'split-bottom', ref });\n        break;\n      case 'widget-tab':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Accept the proposed drop action.\n    event.dropAction = event.proposedAction;\n\n    // Stop propagation if we have not bailed so far.\n    event.stopPropagation();\n\n    // Activate the dropped widget.\n    this.activateWidget(widget);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the dock panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      // Finalize the mouse release.\n      this._releaseMouse();\n\n      // Schedule an emit of the layout modified signal.\n      MessageLoop.postMessage(this, Private.LayoutModified);\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the dock panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the mouse target, if any.\n    let layout = this.layout as DockLayout;\n    let target = event.target as HTMLElement;\n    let handle = find(layout.handles(), handle => handle.contains(target));\n    if (!handle) {\n      return;\n    }\n\n    // Stop the event when a handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    this._document.addEventListener('keydown', this, true);\n    this._document.addEventListener('pointerup', this, true);\n    this._document.addEventListener('pointermove', this, true);\n    this._document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset deltas for the handle press.\n    let rect = handle.getBoundingClientRect();\n    let deltaX = event.clientX - rect.left;\n    let deltaY = event.clientY - rect.top;\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!, this._document);\n    this._pressData = { handle, deltaX, deltaY, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the dock panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event when dragging a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let rect = this.node.getBoundingClientRect();\n    let xPos = event.clientX - rect.left - this._pressData.deltaX;\n    let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n    // Set the handle as close to the desired position as possible.\n    let layout = this.layout as DockLayout;\n    layout.moveHandle(this._pressData.handle, xPos, yPos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the dock panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Release the mouse grab for the dock panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra document listeners.\n    this._document.removeEventListener('keydown', this, true);\n    this._document.removeEventListener('pointerup', this, true);\n    this._document.removeEventListener('pointermove', this, true);\n    this._document.removeEventListener('contextmenu', this, true);\n  }\n\n  /**\n   * Show the overlay indicator at the given client position.\n   *\n   * Returns the drop zone at the specified client position.\n   *\n   * #### Notes\n   * If the position is not over a valid zone, the overlay is hidden.\n   */\n  private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n    // Find the dock target for the given client position.\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // If the drop zone is invalid, hide the overlay and bail.\n    if (zone === 'invalid') {\n      this.overlay.hide(100);\n      return zone;\n    }\n\n    // Setup the variables needed to compute the overlay geometry.\n    let top: number;\n    let left: number;\n    let right: number;\n    let bottom: number;\n    let box = ElementExt.boxSizing(this.node); // TODO cache this?\n    let rect = this.node.getBoundingClientRect();\n\n    // Compute the overlay geometry based on the dock zone.\n    switch (zone) {\n      case 'root-all':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-top':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = rect.height * Private.GOLDEN_RATIO;\n        break;\n      case 'root-left':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = rect.width * Private.GOLDEN_RATIO;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-right':\n        top = box.paddingTop;\n        left = rect.width * Private.GOLDEN_RATIO;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-bottom':\n        top = rect.height * Private.GOLDEN_RATIO;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'widget-all':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-top':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height / 2;\n        break;\n      case 'widget-left':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right + target!.width / 2;\n        bottom = target!.bottom;\n        break;\n      case 'widget-right':\n        top = target!.top;\n        left = target!.left + target!.width / 2;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-bottom':\n        top = target!.top + target!.height / 2;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-tab': {\n        const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height - tabHeight;\n        break;\n      }\n      default:\n        throw 'unreachable';\n    }\n\n    // Show the overlay with the computed geometry.\n    this.overlay.show({ top, left, right, bottom });\n\n    // Finally, return the computed drop zone.\n    return zone;\n  }\n\n  /**\n   * Create a new tab bar for use by the panel.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar.\n    let tabBar = this._renderer.createTabBar(this._document);\n\n    // Set the generated tab bar property for the tab bar.\n    Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n    // Hide the tab bar when in single document mode.\n    if (this._mode === 'single-document') {\n      tabBar.hide();\n    }\n\n    // Enforce necessary tab bar behavior.\n    // TODO do we really want to enforce *all* of these?\n    tabBar.tabsMovable = this._tabsMovable;\n    tabBar.allowDeselect = false;\n    tabBar.addButtonEnabled = this._addButtonEnabled;\n    tabBar.removeBehavior = 'select-previous-tab';\n    tabBar.insertBehavior = 'select-tab-if-needed';\n\n    // Connect the signal handlers for the tab bar.\n    tabBar.tabMoved.connect(this._onTabMoved, this);\n    tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n    tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n    tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for use by the panel.\n   */\n  private _createHandle(): HTMLDivElement {\n    return this._renderer.createHandle();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from a tab bar.\n   */\n  private _onTabMoved(): void {\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `currentChanged` signal from a tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousTitle, currentTitle } = args;\n\n    // Hide the previous widget.\n    if (previousTitle) {\n      previousTitle.owner.hide();\n    }\n\n    // Show the current widget.\n    if (currentTitle) {\n      currentTitle.owner.show();\n    }\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `addRequested` signal from a tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from a tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from a tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabDetachRequested` signal from a tab bar.\n   */\n  private _onTabDetachRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabDetachRequestedArgs<Widget>\n  ): void {\n    // Do nothing if a drag is already in progress.\n    if (this._drag) {\n      return;\n    }\n\n    // Release the tab bar's hold on the mouse.\n    sender.releaseMouse();\n\n    // Extract the data from the args.\n    let { title, tab, clientX, clientY, offset } = args;\n\n    // Setup the mime data for the drag operation.\n    let mimeData = new MimeData();\n    let factory = () => title.owner;\n    mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n    // Create the drag image for the drag operation.\n    let dragImage = tab.cloneNode(true) as HTMLElement;\n    if (offset) {\n      dragImage.style.top = `-${offset.y}px`;\n      dragImage.style.left = `-${offset.x}px`;\n    }\n\n    // Create the drag object to manage the drag-drop operation.\n    this._drag = new Drag({\n      document: this._document,\n      mimeData,\n      dragImage,\n      proposedAction: 'move',\n      supportedActions: 'move',\n      source: this\n    });\n\n    // Hide the tab node in the original tab.\n    tab.classList.add('lm-mod-hidden');\n    let cleanup = () => {\n      this._drag = null;\n      tab.classList.remove('lm-mod-hidden');\n    };\n\n    // Start the drag operation and cleanup when done.\n    this._drag.start(clientX, clientY).then(cleanup);\n  }\n\n  private _edges: DockPanel.IEdges;\n  private _document: Document | ShadowRoot;\n  private _mode: DockPanel.Mode;\n  private _drag: Drag | null = null;\n  private _renderer: DockPanel.IRenderer;\n  private _tabsMovable: boolean = true;\n  private _tabsConstrained: boolean = false;\n  private _addButtonEnabled: boolean = false;\n  private _pressData: Private.IPressData | null = null;\n  private _layoutModified = new Signal<this, void>(this);\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n  /**\n   * An options object for creating a dock panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n    /**\n     * The overlay to use with the dock panel.\n     *\n     * The default is a new `Overlay` instance.\n     */\n    overlay?: IOverlay;\n\n    /**\n     * The renderer to use for the dock panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The spacing between the items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The mode for the dock panel.\n     *\n     * The default is `'multiple-document'`.\n     */\n    mode?: DockPanel.Mode;\n\n    /**\n     * The sizes of the edge drop zones, in pixels.\n     * If not given, default values will be used.\n     */\n    edges?: IEdges;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * Allow tabs to be draggable / movable by user.\n     *\n     * The default is `'true'`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Constrain tabs to this dock panel\n     *\n     * The default is `'false'`.\n     */\n    tabsConstrained?: boolean;\n\n    /**\n     * Enable add buttons in each of the dock panel's tab bars.\n     *\n     * The default is `'false'`.\n     */\n    addButtonEnabled?: boolean;\n  }\n\n  /**\n   * The sizes of the edge drop zones, in pixels.\n   */\n  export interface IEdges {\n    /**\n     * The size of the top edge drop zone.\n     */\n    top: number;\n\n    /**\n     * The size of the right edge drop zone.\n     */\n    right: number;\n\n    /**\n     * The size of the bottom edge drop zone.\n     */\n    bottom: number;\n\n    /**\n     * The size of the left edge drop zone.\n     */\n    left: number;\n  }\n\n  /**\n   * A type alias for the supported dock panel modes.\n   */\n  export type Mode =\n    | /**\n     * The single document mode.\n     *\n     * In this mode, only a single widget is visible at a time, and that\n     * widget fills the available layout space. No tab bars are visible.\n     */\n    'single-document'\n\n    /**\n     * The multiple document mode.\n     *\n     * In this mode, multiple documents are displayed in separate tab\n     * areas, and those areas can be individually resized by the user.\n     */\n    | 'multiple-document';\n\n  /**\n   * A type alias for a layout configuration object.\n   */\n  export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n  /**\n   * A type alias for the supported insertion modes.\n   */\n  export type InsertMode = DockLayout.InsertMode;\n\n  /**\n   * A type alias for the add widget options.\n   */\n  export type IAddOptions = DockLayout.IAddOptions;\n\n  /**\n   * An object which holds the geometry for overlay positioning.\n   */\n  export interface IOverlayGeometry {\n    /**\n     * The distance between the overlay and parent top edges.\n     */\n    top: number;\n\n    /**\n     * The distance between the overlay and parent left edges.\n     */\n    left: number;\n\n    /**\n     * The distance between the overlay and parent right edges.\n     */\n    right: number;\n\n    /**\n     * The distance between the overlay and parent bottom edges.\n     */\n    bottom: number;\n  }\n\n  /**\n   * An object which manages the overlay node for a dock panel.\n   */\n  export interface IOverlay {\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     *\n     * #### Notes\n     * The given geometry values assume the node will use absolute\n     * positioning.\n     *\n     * This is called on every mouse move event during a drag in order\n     * to update the position of the overlay. It should be efficient.\n     */\n    show(geo: IOverlayGeometry): void;\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 should hide the overlay immediately.\n     *\n     * #### Notes\n     * This is called whenever the overlay node should been hidden.\n     */\n    hide(delay: number): void;\n  }\n\n  /**\n   * A concrete implementation of `IOverlay`.\n   *\n   * This is the default overlay implementation for a dock panel.\n   */\n  export class Overlay implements IOverlay {\n    /**\n     * Construct a new overlay.\n     */\n    constructor() {\n      this.node = document.createElement('div');\n      this.node.classList.add('lm-DockPanel-overlay');\n      this.node.classList.add('lm-mod-hidden');\n      this.node.style.position = 'absolute';\n      this.node.style.contain = 'strict';\n    }\n\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     */\n    show(geo: IOverlayGeometry): void {\n      // Update the position of the overlay.\n      let style = this.node.style;\n      style.top = `${geo.top}px`;\n      style.left = `${geo.left}px`;\n      style.right = `${geo.right}px`;\n      style.bottom = `${geo.bottom}px`;\n\n      // Clear any pending hide timer.\n      clearTimeout(this._timer);\n      this._timer = -1;\n\n      // If the overlay is already visible, we're done.\n      if (!this._hidden) {\n        return;\n      }\n\n      // Clear the hidden flag.\n      this._hidden = false;\n\n      // Finally, show the overlay.\n      this.node.classList.remove('lm-mod-hidden');\n    }\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 will hide the overlay immediately.\n     */\n    hide(delay: number): void {\n      // Do nothing if the overlay is already hidden.\n      if (this._hidden) {\n        return;\n      }\n\n      // Hide immediately if the delay is <= 0.\n      if (delay <= 0) {\n        clearTimeout(this._timer);\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n        return;\n      }\n\n      // Do nothing if a hide is already pending.\n      if (this._timer !== -1) {\n        return;\n      }\n\n      // Otherwise setup the hide timer.\n      this._timer = window.setTimeout(() => {\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n      }, delay);\n    }\n\n    private _timer = -1;\n    private _hidden = true;\n  }\n\n  /**\n   * A type alias for a dock panel renderer;\n   */\n  export type IRenderer = DockLayout.IRenderer;\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new tab bar for use with a dock panel.\n     *\n     * @returns A new tab bar for a dock panel.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget> {\n      let bar = new TabBar<Widget>({ document });\n      bar.addClass('lm-DockPanel-tabBar');\n      return bar;\n    }\n\n    /**\n     * Create a new handle node for use with a dock panel.\n     *\n     * @returns A new handle node for a dock panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-DockPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * The default sizes for the edge drop zones, in pixels.\n   */\n  export const DEFAULT_EDGES = {\n    /**\n     * The size of the top edge dock zone for the root panel, in pixels.\n     * This is different from the others to distinguish between the top\n     * tab bar and the top root zone.\n     */\n    top: 12,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    right: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    bottom: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    left: 40\n  };\n\n  /**\n   * A singleton `'layout-modified'` conflatable message.\n   */\n  export const LayoutModified = new ConflatableMessage('layout-modified');\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The handle which was pressed.\n     */\n    handle: HTMLDivElement;\n\n    /**\n     * The X offset of the press in handle coordinates.\n     */\n    deltaX: number;\n\n    /**\n     * The Y offset of the press in handle coordinates.\n     */\n    deltaY: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * A type alias for a drop zone.\n   */\n  export type DropZone =\n    | /**\n     * An invalid drop zone.\n     */\n    'invalid'\n\n    /**\n     * The entirety of the root dock area.\n     */\n    | 'root-all'\n\n    /**\n     * The top portion of the root dock area.\n     */\n    | 'root-top'\n\n    /**\n     * The left portion of the root dock area.\n     */\n    | 'root-left'\n\n    /**\n     * The right portion of the root dock area.\n     */\n    | 'root-right'\n\n    /**\n     * The bottom portion of the root dock area.\n     */\n    | 'root-bottom'\n\n    /**\n     * The entirety of a tabbed widget area.\n     */\n    | 'widget-all'\n\n    /**\n     * The top portion of tabbed widget area.\n     */\n    | 'widget-top'\n\n    /**\n     * The left portion of tabbed widget area.\n     */\n    | 'widget-left'\n\n    /**\n     * The right portion of tabbed widget area.\n     */\n    | 'widget-right'\n\n    /**\n     * The bottom portion of tabbed widget area.\n     */\n    | 'widget-bottom'\n\n    /**\n     * The the bar of a tabbed widget area.\n     */\n    | 'widget-tab';\n\n  /**\n   * An object which holds the drop target zone and widget.\n   */\n  export interface IDropTarget {\n    /**\n     * The semantic zone for the mouse position.\n     */\n    zone: DropZone;\n\n    /**\n     * The tab area geometry for the drop zone, or `null`.\n     */\n    target: DockLayout.ITabAreaGeometry | null;\n  }\n\n  /**\n   * An attached property used to track generated tab bars.\n   */\n  export const isGeneratedTabBarProperty = new AttachedProperty<\n    Widget,\n    boolean\n  >({\n    name: 'isGeneratedTabBar',\n    create: () => false\n  });\n\n  /**\n   * Create a single document config for the widgets in a dock panel.\n   */\n  export function createSingleDocumentConfig(\n    panel: DockPanel\n  ): DockPanel.ILayoutConfig {\n    // Return an empty config if the panel is empty.\n    if (panel.isEmpty) {\n      return { main: null };\n    }\n\n    // Get a flat array of the widgets in the panel.\n    let widgets = Array.from(panel.widgets());\n\n    // Get the first selected widget in the panel.\n    let selected = panel.selectedWidgets().next().value;\n\n    // Compute the current index for the new config.\n    let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n    // Return the single document config.\n    return { main: { type: 'tab-area', widgets, currentIndex } };\n  }\n\n  /**\n   * Find the drop target at the given client position.\n   */\n  export function findDropTarget(\n    panel: DockPanel,\n    clientX: number,\n    clientY: number,\n    edges: DockPanel.IEdges\n  ): IDropTarget {\n    // Bail if the mouse is not over the dock panel.\n    if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Look up the layout for the panel.\n    let layout = panel.layout as DockLayout;\n\n    // If the layout is empty, indicate the entire root drop zone.\n    if (layout.isEmpty) {\n      return { zone: 'root-all', target: null };\n    }\n\n    // Test the edge zones when in multiple document mode.\n    if (panel.mode === 'multiple-document') {\n      // Get the client rect for the dock panel.\n      let panelRect = panel.node.getBoundingClientRect();\n\n      // Compute the distance to each edge of the panel.\n      let pl = clientX - panelRect.left + 1;\n      let pt = clientY - panelRect.top + 1;\n      let pr = panelRect.right - clientX;\n      let pb = panelRect.bottom - clientY;\n\n      // Find the minimum distance to an edge.\n      let pd = Math.min(pt, pr, pb, pl);\n\n      // Return a root zone if the mouse is within an edge.\n      switch (pd) {\n        case pt:\n          if (pt < edges.top) {\n            return { zone: 'root-top', target: null };\n          }\n          break;\n        case pr:\n          if (pr < edges.right) {\n            return { zone: 'root-right', target: null };\n          }\n          break;\n        case pb:\n          if (pb < edges.bottom) {\n            return { zone: 'root-bottom', target: null };\n          }\n          break;\n        case pl:\n          if (pl < edges.left) {\n            return { zone: 'root-left', target: null };\n          }\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Hit test the dock layout at the given client position.\n    let target = layout.hitTestTabAreas(clientX, clientY);\n\n    // Bail if no target area was found.\n    if (!target) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Return the whole tab area when in single document mode.\n    if (panel.mode === 'single-document') {\n      return { zone: 'widget-all', target };\n    }\n\n    // Compute the distance to each edge of the tab area.\n    let al = target.x - target.left + 1;\n    let at = target.y - target.top + 1;\n    let ar = target.left + target.width - target.x;\n    let ab = target.top + target.height - target.y;\n\n    const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n    if (at < tabHeight) {\n      return { zone: 'widget-tab', target };\n    }\n\n    // Get the X and Y edge sizes for the area.\n    let rx = Math.round(target.width / 3);\n    let ry = Math.round(target.height / 3);\n\n    // If the mouse is not within an edge, indicate the entire area.\n    if (al > rx && ar > rx && at > ry && ab > ry) {\n      return { zone: 'widget-all', target };\n    }\n\n    // Scale the distances by the slenderness ratio.\n    al /= rx;\n    at /= ry;\n    ar /= rx;\n    ab /= ry;\n\n    // Find the minimum distance to the area edge.\n    let ad = Math.min(al, at, ar, ab);\n\n    // Find the widget zone for the area edge.\n    let zone: DropZone;\n    switch (ad) {\n      case al:\n        zone = 'widget-left';\n        break;\n      case at:\n        zone = 'widget-top';\n        break;\n      case ar:\n        zone = 'widget-right';\n        break;\n      case ab:\n        zone = 'widget-bottom';\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Return the final drop target.\n    return { zone, target };\n  }\n\n  /**\n   * Get the drop reference widget for a tab bar.\n   */\n  export function getDropRef(tabBar: TabBar<Widget>): Widget | null {\n    if (tabBar.titles.length === 0) {\n      return null;\n    }\n    if (tabBar.currentTitle) {\n      return tabBar.currentTitle.owner;\n    }\n    return tabBar.titles[tabBar.titles.length - 1].owner;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker<T extends Widget> implements IDisposable {\n  /**\n   * Dispose of the resources held by the tracker.\n   */\n  dispose(): void {\n    // Do nothing if the tracker is already disposed.\n    if (this._counter < 0) {\n      return;\n    }\n\n    // Mark the tracker as disposed.\n    this._counter = -1;\n\n    // Clear the connections for the tracker.\n    Signal.clearData(this);\n\n    // Remove all event listeners.\n    for (const widget of this._widgets) {\n      widget.node.removeEventListener('focus', this, true);\n      widget.node.removeEventListener('blur', this, true);\n    }\n\n    // Clear the internal data structures.\n    this._activeWidget = null;\n    this._currentWidget = null;\n    this._nodes.clear();\n    this._numbers.clear();\n    this._widgets.length = 0;\n  }\n\n  /**\n   * A signal emitted when the current widget has changed.\n   */\n  get currentChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when the active widget has changed.\n   */\n  get activeChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._activeChanged;\n  }\n\n  /**\n   * A flag indicating whether the tracker is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._counter < 0;\n  }\n\n  /**\n   * The current widget in the tracker.\n   *\n   * #### Notes\n   * The current widget is the widget among the tracked widgets which\n   * has the *descendant node* which has most recently been focused.\n   *\n   * The current widget will not be updated if the node loses focus. It\n   * will only be updated when a different tracked widget gains focus.\n   *\n   * If the current widget is removed from the tracker, the previous\n   * current widget will be restored.\n   *\n   * This behavior is intended to follow a user's conceptual model of\n   * a semantically \"current\" widget, where the \"last thing of type X\"\n   * to be interacted with is the \"current instance of X\", regardless\n   * of whether that instance still has focus.\n   */\n  get currentWidget(): T | null {\n    return this._currentWidget;\n  }\n\n  /**\n   * The active widget in the tracker.\n   *\n   * #### Notes\n   * The active widget is the widget among the tracked widgets which\n   * has the *descendant node* which is currently focused.\n   */\n  get activeWidget(): T | null {\n    return this._activeWidget;\n  }\n\n  /**\n   * A read only array of the widgets being tracked.\n   */\n  get widgets(): ReadonlyArray<T> {\n    return this._widgets;\n  }\n\n  /**\n   * Get the focus number for a particular widget in the tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The focus number for the given widget, or `-1` if the\n   *   widget has not had focus since being added to the tracker, or\n   *   is not contained by the tracker.\n   *\n   * #### Notes\n   * The focus number indicates the relative order in which the widgets\n   * have gained focus. A widget with a larger number has gained focus\n   * more recently than a widget with a smaller number.\n   *\n   * The `currentWidget` will always have the largest focus number.\n   *\n   * All widgets start with a focus number of `-1`, which indicates that\n   * the widget has not been focused since being added to the tracker.\n   */\n  focusNumber(widget: T): number {\n    let n = this._numbers.get(widget);\n    return n === undefined ? -1 : n;\n  }\n\n  /**\n   * Test whether the focus tracker contains a given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns `true` if the widget is tracked, `false` otherwise.\n   */\n  has(widget: T): boolean {\n    return this._numbers.has(widget);\n  }\n\n  /**\n   * Add a widget to the focus tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is already tracked, this is a no-op.\n   */\n  add(widget: T): void {\n    // Do nothing if the widget is already tracked.\n    if (this._numbers.has(widget)) {\n      return;\n    }\n\n    // Test whether the widget has focus.\n    let focused = widget.node.contains(document.activeElement);\n\n    // Set up the initial focus number.\n    let n = focused ? this._counter++ : -1;\n\n    // Add the widget to the internal data structures.\n    this._widgets.push(widget);\n    this._numbers.set(widget, n);\n    this._nodes.set(widget.node, widget);\n\n    // Set up the event listeners. The capturing phase must be used\n    // since the 'focus' and 'blur' events don't bubble and Firefox\n    // doesn't support the 'focusin' or 'focusout' events.\n    widget.node.addEventListener('focus', this, true);\n    widget.node.addEventListener('blur', this, true);\n\n    // Connect the disposed signal handler.\n    widget.disposed.connect(this._onWidgetDisposed, this);\n\n    // Set the current and active widgets if needed.\n    if (focused) {\n      this._setWidgets(widget, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the focus tracker.\n   *\n   * #### Notes\n   * If the widget is the `currentWidget`, the previous current widget\n   * will become the new `currentWidget`.\n   *\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is not tracked, this is a no-op.\n   */\n  remove(widget: T): void {\n    // Bail early if the widget is not tracked.\n    if (!this._numbers.has(widget)) {\n      return;\n    }\n\n    // Disconnect the disposed signal handler.\n    widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n    // Remove the event listeners.\n    widget.node.removeEventListener('focus', this, true);\n    widget.node.removeEventListener('blur', this, true);\n\n    // Remove the widget from the internal data structures.\n    ArrayExt.removeFirstOf(this._widgets, widget);\n    this._nodes.delete(widget.node);\n    this._numbers.delete(widget);\n\n    // Bail early if the widget is not the current widget.\n    if (this._currentWidget !== widget) {\n      return;\n    }\n\n    // Filter the widgets for those which have had focus.\n    let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n    // Get the valid widget with the max focus number.\n    let previous =\n      max(valid, (first, second) => {\n        let a = this._numbers.get(first)!;\n        let b = this._numbers.get(second)!;\n        return a - b;\n      }) || null;\n\n    // Set the current and active widgets.\n    this._setWidgets(previous, null);\n  }\n\n  /**\n   * Handle the DOM events for the focus tracker.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tracked nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'focus':\n        this._evtFocus(event as FocusEvent);\n        break;\n      case 'blur':\n        this._evtBlur(event as FocusEvent);\n        break;\n    }\n  }\n\n  /**\n   * Set the current and active widgets for the tracker.\n   */\n  private _setWidgets(current: T | null, active: T | null): void {\n    // Swap the current widget.\n    let oldCurrent = this._currentWidget;\n    this._currentWidget = current;\n\n    // Swap the active widget.\n    let oldActive = this._activeWidget;\n    this._activeWidget = active;\n\n    // Emit the `currentChanged` signal if needed.\n    if (oldCurrent !== current) {\n      this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n    }\n\n    // Emit the `activeChanged` signal if needed.\n    if (oldActive !== active) {\n      this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n    }\n  }\n\n  /**\n   * Handle the `'focus'` event for a tracked widget.\n   */\n  private _evtFocus(event: FocusEvent): void {\n    // Find the widget which gained focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Update the focus number if necessary.\n    if (widget !== this._currentWidget) {\n      this._numbers.set(widget, this._counter++);\n    }\n\n    // Set the current and active widgets.\n    this._setWidgets(widget, widget);\n  }\n\n  /**\n   * Handle the `'blur'` event for a tracked widget.\n   */\n  private _evtBlur(event: FocusEvent): void {\n    // Find the widget which lost focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Get the node which being focused after this blur.\n    let focusTarget = event.relatedTarget as HTMLElement;\n\n    // If no other node is being focused, clear the active widget.\n    if (!focusTarget) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n\n    // Bail if the focus widget is not changing.\n    if (widget.node.contains(focusTarget)) {\n      return;\n    }\n\n    // If no tracked widget is being focused, clear the active widget.\n    if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n  }\n\n  /**\n   * Handle the `disposed` signal for a tracked widget.\n   */\n  private _onWidgetDisposed(sender: T): void {\n    this.remove(sender);\n  }\n\n  private _counter = 0;\n  private _widgets: T[] = [];\n  private _activeWidget: T | null = null;\n  private _currentWidget: T | null = null;\n  private _numbers = new Map<T, number>();\n  private _nodes = new Map<HTMLElement, T>();\n  private _activeChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(this);\n  private _currentChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(\n    this\n  );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n  /**\n   * An arguments object for the changed signals.\n   */\n  export interface IChangedArgs<T extends Widget> {\n    /**\n     * The old value for the widget.\n     */\n    oldValue: T | null;\n\n    /**\n     * The new value for the widget.\n     */\n    newValue: T | null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n  /**\n   * Construct a new grid layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: GridLayout.IOptions = {}) {\n    super(options);\n    if (options.rowCount !== undefined) {\n      Private.reallocSizers(this._rowSizers, options.rowCount);\n    }\n    if (options.columnCount !== undefined) {\n      Private.reallocSizers(this._columnSizers, options.columnCount);\n    }\n    if (options.rowSpacing !== undefined) {\n      this._rowSpacing = Private.clampValue(options.rowSpacing);\n    }\n    if (options.columnSpacing !== undefined) {\n      this._columnSpacing = Private.clampValue(options.columnSpacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the widgets and layout items.\n    for (const item of this._items) {\n      let widget = item.widget;\n      item.dispose();\n      widget.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._rowStarts.length = 0;\n    this._rowSizers.length = 0;\n    this._columnStarts.length = 0;\n    this._columnSizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the number of rows in the layout.\n   */\n  get rowCount(): number {\n    return this._rowSizers.length;\n  }\n\n  /**\n   * Set the number of rows in the layout.\n   *\n   * #### Notes\n   * The minimum row count is `1`.\n   */\n  set rowCount(value: number) {\n    // Do nothing if the row count does not change.\n    if (value === this.rowCount) {\n      return;\n    }\n\n    // Reallocate the row sizers.\n    Private.reallocSizers(this._rowSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the number of columns in the layout.\n   */\n  get columnCount(): number {\n    return this._columnSizers.length;\n  }\n\n  /**\n   * Set the number of columns in the layout.\n   *\n   * #### Notes\n   * The minimum column count is `1`.\n   */\n  set columnCount(value: number) {\n    // Do nothing if the column count does not change.\n    if (value === this.columnCount) {\n      return;\n    }\n\n    // Reallocate the column sizers.\n    Private.reallocSizers(this._columnSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the row spacing for the layout.\n   */\n  get rowSpacing(): number {\n    return this._rowSpacing;\n  }\n\n  /**\n   * Set the row spacing for the layout.\n   */\n  set rowSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._rowSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._rowSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the column spacing for the layout.\n   */\n  get columnSpacing(): number {\n    return this._columnSpacing;\n  }\n\n  /**\n   * Set the col spacing for the layout.\n   */\n  set columnSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._columnSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._columnSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @returns The stretch factor for the row.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  rowStretch(index: number): number {\n    let sizer = this._rowSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @param value - The stretch factor for the row.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setRowStretch(index: number, value: number): void {\n    // Look up the row sizer.\n    let sizer = this._rowSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @returns The stretch factor for the column.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  columnStretch(index: number): number {\n    let sizer = this._columnSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @param value - The stretch factor for the column.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setColumnStretch(index: number, value: number): void {\n    // Look up the column sizer.\n    let sizer = this._columnSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    for (const item of this._items) {\n      yield item.widget;\n    }\n  }\n\n  /**\n   * Add a widget to the grid layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, this is no-op.\n   */\n  addWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is already in the layout.\n    if (i !== -1) {\n      return;\n    }\n\n    // Add the widget to the layout.\n    this._items.push(new LayoutItem(widget));\n\n    // Attach the widget to the parent.\n    if (this.parent) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the grid layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is not in the layout.\n    if (i === -1) {\n      return;\n    }\n\n    // Remove the widget from the layout.\n    let item = ArrayExt.removeAt(this._items, i)!;\n\n    // Detach the widget from the parent.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n\n    // Dispose the layout item.\n    item.dispose();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Reset the min sizes of the sizers.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      this._rowSizers[i].minSize = 0;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      this._columnSizers[i].minSize = 0;\n    }\n\n    // Filter for the visible layout items.\n    let items = this._items.filter(it => !it.isHidden);\n\n    // Fit the layout items.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      items[i].fit();\n    }\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Sort the items by row span.\n    items.sort(Private.rowSpanCmp);\n\n    // Update the min sizes of the row sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the row bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n      // Distribute the minimum height to the sizers as needed.\n      Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n    }\n\n    // Sort the items by column span.\n    items.sort(Private.columnSpanCmp);\n\n    // Update the min sizes of the column sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the column bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let c1 = Math.min(config.column, maxCol);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Distribute the minimum width to the sizers as needed.\n      Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n    }\n\n    // If no size constraint is needed, just update the parent.\n    if (this.fitPolicy === 'set-no-constraint') {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n      return;\n    }\n\n    // Set up the computed min size.\n    let minH = maxRow * this._rowSpacing;\n    let minW = maxCol * this._columnSpacing;\n\n    // Add the sizer minimums to the computed min size.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      minH += this._rowSizers[i].minSize;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      minW += this._columnSizers[i].minSize;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Compute the total fixed row and column space.\n    let fixedRowSpace = maxRow * this._rowSpacing;\n    let fixedColSpace = maxCol * this._columnSpacing;\n\n    // Distribute the available space to the box sizers.\n    BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n    BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n    // Update the row start positions.\n    for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n      this._rowStarts[i] = pos;\n      pos += this._rowSizers[i].size + this._rowSpacing;\n    }\n\n    // Update the column start positions.\n    for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n      this._columnStarts[i] = pos;\n      pos += this._columnSizers[i].size + this._columnSpacing;\n    }\n\n    // Update the geometry of the layout items.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the cell bounds for the widget.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let c1 = Math.min(config.column, maxCol);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Compute the cell geometry.\n      let x = this._columnStarts[c1];\n      let y = this._rowStarts[r1];\n      let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n      let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n      // Update the geometry of the layout item.\n      item.update(x, y, w, h);\n    }\n  }\n\n  private _dirty = false;\n  private _rowSpacing = 4;\n  private _columnSpacing = 4;\n  private _items: LayoutItem[] = [];\n  private _rowStarts: number[] = [];\n  private _columnStarts: number[] = [];\n  private _rowSizers: BoxSizer[] = [new BoxSizer()];\n  private _columnSizers: BoxSizer[] = [new BoxSizer()];\n  private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n  /**\n   * An options object for initializing a grid layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The initial row count for the layout.\n     *\n     * The default is `1`.\n     */\n    rowCount?: number;\n\n    /**\n     * The initial column count for the layout.\n     *\n     * The default is `1`.\n     */\n    columnCount?: number;\n\n    /**\n     * The spacing between rows in the layout.\n     *\n     * The default is `4`.\n     */\n    rowSpacing?: number;\n\n    /**\n     * The spacing between columns in the layout.\n     *\n     * The default is `4`.\n     */\n    columnSpacing?: number;\n  }\n\n  /**\n   * An object which holds the cell configuration for a widget.\n   */\n  export interface ICellConfig {\n    /**\n     * The row index for the widget.\n     */\n    readonly row: number;\n\n    /**\n     * The column index for the widget.\n     */\n    readonly column: number;\n\n    /**\n     * The row span for the widget.\n     */\n    readonly rowSpan: number;\n\n    /**\n     * The column span for the widget.\n     */\n    readonly columnSpan: number;\n  }\n\n  /**\n   * Get the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The cell config for the widget.\n   */\n  export function getCellConfig(widget: Widget): ICellConfig {\n    return Private.cellConfigProperty.get(widget);\n  }\n\n  /**\n   * Set the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the cell config.\n   */\n  export function setCellConfig(\n    widget: Widget,\n    value: Partial<ICellConfig>\n  ): void {\n    Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for the widget cell config.\n   */\n  export const cellConfigProperty = new AttachedProperty<\n    Widget,\n    GridLayout.ICellConfig\n  >({\n    name: 'cellConfig',\n    create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n    changed: onChildCellConfigChanged\n  });\n\n  /**\n   * Normalize a partial cell config object.\n   */\n  export function normalizeConfig(\n    config: Partial<GridLayout.ICellConfig>\n  ): GridLayout.ICellConfig {\n    let row = Math.max(0, Math.floor(config.row || 0));\n    let column = Math.max(0, Math.floor(config.column || 0));\n    let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n    let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n    return { row, column, rowSpan, columnSpan };\n  }\n\n  /**\n   * Clamp a value to an integer >= 0.\n   */\n  export function clampValue(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * A sort comparison function for row spans.\n   */\n  export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.rowSpan - c2.rowSpan;\n  }\n\n  /**\n   * A sort comparison function for column spans.\n   */\n  export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.columnSpan - c2.columnSpan;\n  }\n\n  /**\n   * Reallocate the box sizers for the given grid dimensions.\n   */\n  export function reallocSizers(sizers: BoxSizer[], count: number): void {\n    // Coerce the count to the valid range.\n    count = Math.max(1, Math.floor(count));\n\n    // Add the missing sizers.\n    while (sizers.length < count) {\n      sizers.push(new BoxSizer());\n    }\n\n    // Remove the extra sizers.\n    if (sizers.length > count) {\n      sizers.length = count;\n    }\n  }\n\n  /**\n   * Distribute a min size constraint across a range of sizers.\n   */\n  export function distributeMin(\n    sizers: BoxSizer[],\n    i1: number,\n    i2: number,\n    minSize: number\n  ): void {\n    // Sanity check the indices.\n    if (i2 < i1) {\n      return;\n    }\n\n    // Handle the simple case of no cell span.\n    if (i1 === i2) {\n      let sizer = sizers[i1];\n      sizer.minSize = Math.max(sizer.minSize, minSize);\n      return;\n    }\n\n    // Compute the total current min size of the span.\n    let totalMin = 0;\n    for (let i = i1; i <= i2; ++i) {\n      totalMin += sizers[i].minSize;\n    }\n\n    // Do nothing if the total is greater than the required.\n    if (totalMin >= minSize) {\n      return;\n    }\n\n    // Compute the portion of the space to allocate to each sizer.\n    let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n    // Add the portion to each sizer.\n    for (let i = i1; i <= i2; ++i) {\n      sizers[i].minSize += portion;\n    }\n  }\n\n  /**\n   * The change handler for the child cell config property.\n   */\n  function onChildCellConfigChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof GridLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n  /**\n   * Construct a new menu bar.\n   *\n   * @param options - The options for initializing the menu bar.\n   */\n  constructor(options: MenuBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-MenuBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.renderer = options.renderer || MenuBar.defaultRenderer;\n    this._forceItemsPosition = options.forceItemsPosition || {\n      forceX: true,\n      forceY: true\n    };\n    this._overflowMenuOptions = options.overflowMenuOptions || {\n      isVisible: true\n    };\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._closeChildMenu();\n    this._menus.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the menu bar.\n   */\n  readonly renderer: MenuBar.IRenderer;\n\n  /**\n   * The child menu of the menu bar.\n   *\n   * #### Notes\n   * This will be `null` if the menu bar does not have an open menu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The overflow index of the menu bar.\n   */\n  get overflowIndex(): number {\n    return this._overflowIndex;\n  }\n\n  /**\n   * The overflow menu of the menu bar.\n   */\n  get overflowMenu(): Menu | null {\n    return this._overflowMenu;\n  }\n\n  /**\n   * Get the menu bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu title nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-MenuBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu.\n   */\n  get activeMenu(): Menu | null {\n    return this._menus[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu.\n   *\n   * #### Notes\n   * If the menu does not exist, the menu will be set to `null`.\n   */\n  set activeMenu(value: Menu | null) {\n    this.activeIndex = value ? this._menus.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu.\n   *\n   * #### Notes\n   * This will be `-1` if no menu is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu.\n   *\n   * #### Notes\n   * If the menu cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._menus.length) {\n      value = -1;\n    }\n\n    // An empty menu cannot be active\n    if (value > -1 && this._menus[value].items.length === 0) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menus in the menu bar.\n   */\n  get menus(): ReadonlyArray<Menu> {\n    return this._menus;\n  }\n\n  /**\n   * Open the active menu and activate its first menu item.\n   *\n   * #### Notes\n   * If there is no active menu, this is a no-op.\n   */\n  openActiveMenu(): void {\n    // Bail early if there is no active item.\n    if (this._activeIndex === -1) {\n      return;\n    }\n\n    // Open the child menu.\n    this._openChildMenu();\n\n    // Activate the first item in the child menu.\n    if (this._childMenu) {\n      this._childMenu.activeIndex = -1;\n      this._childMenu.activateNextItem();\n    }\n  }\n\n  /**\n   * Add a menu to the end of the menu bar.\n   *\n   * @param menu - The menu to add to the menu bar.\n   *\n   * #### Notes\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  addMenu(menu: Menu, update: boolean = true): void {\n    this.insertMenu(this._menus.length, menu, update);\n  }\n\n  /**\n   * Insert a menu into the menu bar at the specified index.\n   *\n   * @param index - The index at which to insert the menu.\n   *\n   * @param menu - The menu to insert into the menu bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the menus.\n   *\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  insertMenu(index: number, menu: Menu, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Look up the index of the menu.\n    let i = this._menus.indexOf(menu);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._menus.length));\n\n    // If the menu is not in the array, insert it.\n    if (i === -1) {\n      // Insert the menu into the array.\n      ArrayExt.insert(this._menus, j, menu);\n\n      // Add the styling class to the menu.\n      menu.addClass('lm-MenuBar-menu');\n\n      // Connect to the menu signals.\n      menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n      menu.menuRequested.connect(this._onMenuMenuRequested, this);\n      menu.title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the items.\n      if (update) {\n        this.update();\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the menu exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._menus.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the menu to the new locations.\n    ArrayExt.move(this._menus, i, j);\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove a menu from the menu bar.\n   *\n   * @param menu - The menu to remove from the menu bar.\n   *\n   * #### Notes\n   * This is a no-op if the menu is not in the menu bar.\n   */\n  removeMenu(menu: Menu, update: boolean = true): void {\n    this.removeMenuAt(this._menus.indexOf(menu), update);\n  }\n\n  /**\n   * Remove the menu at a given index from the menu bar.\n   *\n   * @param index - The index of the menu to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeMenuAt(index: number, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Remove the menu from the array.\n    let menu = ArrayExt.removeAt(this._menus, index);\n\n    // Bail if the index is out of range.\n    if (!menu) {\n      return;\n    }\n\n    // Disconnect from the menu signals.\n    menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n    menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n    menu.title.changed.disconnect(this._onTitleChanged, this);\n\n    // Remove the styling class from the menu.\n    menu.removeClass('lm-MenuBar-menu');\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove all menus from the menu bar.\n   */\n  clearMenus(): void {\n    // Bail if there is nothing to remove.\n    if (this._menus.length === 0) {\n      return;\n    }\n\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Disconnect from the menu signals and remove the styling class.\n    for (let menu of this._menus) {\n      menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n      menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n      menu.title.changed.disconnect(this._onTitleChanged, this);\n      menu.removeClass('lm-MenuBar-menu');\n    }\n\n    // Clear the menus array.\n    this._menus.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the menu bar.\n   *\n   * @param event - The DOM event sent to the menu bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu bar's DOM nodes. It\n   * should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n      case 'mouseleave':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'focusout':\n        this._evtFocusOut(event as FocusEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mousedown', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('focusout', this);\n    this.node.addEventListener('contextmenu', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mousedown', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('focusout', this);\n    this.node.removeEventListener('contextmenu', this);\n    this._closeChildMenu();\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this._focusItemAt(0);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    this.update();\n    super.onResize(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let menus = this._menus;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let tabFocusIndex =\n      this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n        ? this._tabFocusIndex\n        : 0;\n    let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n    let totalMenuSize = 0;\n    let isVisible = false;\n\n    // Check that the overflow menu doesn't count\n    length = this._overflowMenu !== null ? length - 1 : length;\n    let content = new Array<VirtualElement>(length);\n\n    // Render visible menus\n    for (let i = 0; i < length; ++i) {\n      content[i] = renderer.renderItem({\n        title: menus[i].title,\n        active: i === activeIndex,\n        tabbable: i === tabFocusIndex,\n        disabled: menus[i].items.length === 0,\n        onfocus: () => {\n          this._tabFocusIndex = i;\n          this.activeIndex = i;\n        }\n      });\n      // Calculate size of current menu\n      totalMenuSize += this._menuItemSizes[i];\n      // Check if overflow menu is already rendered\n      if (menus[i].title.label === this._overflowMenuOptions.title) {\n        isVisible = true;\n        length--;\n      }\n    }\n    // Render overflow menu if needed and active\n    if (this._overflowMenuOptions.isVisible) {\n      if (this._overflowIndex > -1 && !isVisible) {\n        // Create overflow menu\n        if (this._overflowMenu === null) {\n          const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n          this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n          this._overflowMenu.title.label = overflowMenuTitle;\n          this._overflowMenu.title.mnemonic = 0;\n          this.addMenu(this._overflowMenu, false);\n        }\n        // Move menus to overflow menu\n        for (let i = menus.length - 2; i >= length; i--) {\n          const submenu = this.menus[i];\n          submenu.title.mnemonic = 0;\n          this._overflowMenu.insertItem(0, {\n            type: 'submenu',\n            submenu: submenu\n          });\n          this.removeMenu(submenu, false);\n        }\n        content[length] = renderer.renderItem({\n          title: this._overflowMenu.title,\n          active: length === activeIndex && menus[length].items.length !== 0,\n          tabbable: length === tabFocusIndex,\n          disabled: menus[length].items.length === 0,\n          onfocus: () => {\n            this._tabFocusIndex = length;\n            this.activeIndex = length;\n          }\n        });\n        length++;\n      } else if (this._overflowMenu !== null) {\n        // Remove submenus from overflow menu\n        let overflowMenuItems = this._overflowMenu.items;\n        let screenSize = this.node.offsetWidth;\n        let n = this._overflowMenu.items.length;\n        for (let i = 0; i < n; ++i) {\n          let index = menus.length - 1 - i;\n          if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n            let menu = overflowMenuItems[0].submenu as Menu;\n            this._overflowMenu.removeItemAt(0);\n            this.insertMenu(length, menu, false);\n            content[length] = renderer.renderItem({\n              title: menu.title,\n              active: false,\n              tabbable: length === tabFocusIndex,\n              disabled: menus[length].items.length === 0,\n              onfocus: () => {\n                this._tabFocusIndex = length;\n                this.activeIndex = length;\n              }\n            });\n            length++;\n          }\n        }\n        if (this._overflowMenu.items.length === 0) {\n          this.removeMenu(this._overflowMenu, false);\n          content.pop();\n          this._overflowMenu = null;\n          this._overflowIndex = -1;\n        }\n      }\n    }\n    VirtualDOM.render(content, this.contentNode);\n    this._updateOverflowIndex();\n  }\n\n  /**\n   * Calculate and update the current overflow index.\n   */\n  private _updateOverflowIndex(): void {\n    if (!this._overflowMenuOptions.isVisible) {\n      return;\n    }\n\n    // Get elements visible in the main menu bar\n    const itemMenus = this.contentNode.childNodes;\n    let screenSize = this.node.offsetWidth;\n    let totalMenuSize = 0;\n    let index = -1;\n    let n = itemMenus.length;\n\n    if (this._menuItemSizes.length == 0) {\n      // Check if it is the first resize and get info about menu items sizes\n      for (let i = 0; i < n; i++) {\n        let item = itemMenus[i] as HTMLLIElement;\n        // Add sizes to array\n        totalMenuSize += item.offsetWidth;\n        this._menuItemSizes.push(item.offsetWidth);\n        if (totalMenuSize > screenSize && index === -1) {\n          index = i;\n        }\n      }\n    } else {\n      // Calculate current menu size\n      for (let i = 0; i < this._menuItemSizes.length; i++) {\n        totalMenuSize += this._menuItemSizes[i];\n        if (totalMenuSize > screenSize) {\n          index = i;\n          break;\n        }\n      }\n    }\n    this._overflowIndex = index;\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu bar.\n   *\n   * #### Notes\n   * All keys are trapped except the tab key that is ignored.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Reset the active index on tab, but do not trap the tab key.\n    if (kc === 9) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // A menu bar handles all other keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Enter, Space, Up Arrow, Down Arrow\n    if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n      // The active index may have changed (for example, user hovers over an\n      // item with the mouse), so be sure to use the focus index.\n      this.activeIndex = this._tabFocusIndex;\n      if (this.activeIndex !== this._tabFocusIndex) {\n        // Bail if the setter refused to set activeIndex to tabFocusIndex\n        // because it means that the item at tabFocusIndex cannot be opened (for\n        // example, it has an empty menu)\n        return;\n      }\n      this.openActiveMenu();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this._closeChildMenu();\n      this._focusItemAt(this.activeIndex);\n      return;\n    }\n\n    // Left or Right Arrow\n    if (kc === 37 || kc === 39) {\n      let direction = kc === 37 ? -1 : 1;\n      let start = this._tabFocusIndex + direction;\n      let n = this._menus.length;\n      for (let i = 0; i < n; i++) {\n        let index = (n + start + direction * i) % n;\n        if (this._menus[index].items.length) {\n          this._focusItemAt(index);\n          return;\n        }\n      }\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._menus, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that menu is opened.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.openActiveMenu();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n      this._focusItemAt(this.activeIndex);\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n      this._focusItemAt(this.activeIndex);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the mouse press was not on the menu bar. This can occur\n    // when the document listener is installed for an active menu bar.\n    if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n      return;\n    }\n\n    // Stop the propagation of the event. Immediate propagation is\n    // also stopped so that an open menu does not handle the event.\n    event.stopPropagation();\n    event.stopImmediatePropagation();\n\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // If the press was not on an item, close the child menu.\n    if (index === -1) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // If the press was not the left mouse button, do nothing further.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Otherwise, toggle the open state of the child menu.\n    if (this._childMenu) {\n      this._closeChildMenu();\n      this.activeIndex = index;\n    } else {\n      // If we don't call preventDefault() here, then the item in the menu\n      // bar will take focus over the menu that is being opened.\n      event.preventDefault();\n      const position = this._positionForMenu(index);\n      Menu.saveWindowData();\n      // Begin DOM modifications.\n      this.activeIndex = index;\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the active index will not change.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Bail early if a child menu is open and the mouse is not over\n    // an item. This allows the child menu to be kept open when the\n    // mouse is over the empty part of the menu bar.\n    if (index === -1 && this._childMenu) {\n      return;\n    }\n\n    // Get position for the new menu >before< updating active index.\n    const position =\n      index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n    // Before any modification, update window data.\n    Menu.saveWindowData();\n\n    // Begin DOM modifications.\n\n    // Update the active index to the hovered item.\n    this.activeIndex = index;\n\n    // Open the new menu if a menu is already open.\n    if (position) {\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Find initial position for the menu based on menubar item position.\n   *\n   * NOTE: this should be called before updating active index to avoid\n   * an additional layout and style invalidation as changing active\n   * index modifies DOM.\n   */\n  private _positionForMenu(index: number): Private.IPosition {\n    let itemNode = this.contentNode.children[index];\n    let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n    return {\n      top: bottom,\n      left\n    };\n  }\n\n  /**\n   * Handle the `'focusout'` event for the menu bar.\n   */\n  private _evtFocusOut(event: FocusEvent): void {\n    // Reset the active index if there is no open menu and the menubar is losing focus.\n    if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n      this.activeIndex = -1;\n    }\n  }\n\n  /**\n   * Focus an item in the menu bar.\n   *\n   * #### Notes\n   * Does not open the associated menu.\n   */\n  private _focusItemAt(index: number): void {\n    const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n    if (itemNode) {\n      itemNode.focus();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if there is no active menu.\n   */\n  private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n    // If there is no active menu, close the current menu.\n    let newMenu = this.activeMenu;\n    if (!newMenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Bail if there is no effective menu change.\n    let oldMenu = this._childMenu;\n    if (oldMenu === newMenu) {\n      return;\n    }\n\n    // Swap the internal menu reference.\n    this._childMenu = newMenu;\n\n    // Close the current menu, or setup for the new menu.\n    if (oldMenu) {\n      oldMenu.close();\n    } else {\n      document.addEventListener('mousedown', this, true);\n    }\n\n    // Update the tab focus index and ensure the menu bar is updated.\n    this._tabFocusIndex = this.activeIndex;\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n    // Get the positioning data for the new menu.\n    let { left, top } = options;\n    if (typeof left === 'undefined' || typeof top === 'undefined') {\n      ({ left, top } = this._positionForMenu(this._activeIndex));\n    }\n    // Begin DOM modifications\n\n    if (!oldMenu) {\n      // Continue setup for new menu\n      this.addClass('lm-mod-active');\n    }\n\n    // Open the new menu at the computed location.\n    if (newMenu.items.length > 0) {\n      newMenu.open(left, top, this._forceItemsPosition);\n    }\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    // Bail if no child menu is open.\n    if (!this._childMenu) {\n      return;\n    }\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    let menu = this._childMenu;\n    this._childMenu = null;\n\n    // Close the menu.\n    menu.close();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `aboutToClose` signal of a menu.\n   */\n  private _onMenuAboutToClose(sender: Menu): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    this._childMenu = null;\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `menuRequested` signal of a child menu.\n   */\n  private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Look up the active index and menu count.\n    let i = this._activeIndex;\n    let n = this._menus.length;\n\n    // Active the next requested index.\n    switch (args) {\n      case 'next':\n        this.activeIndex = i === n - 1 ? 0 : i + 1;\n        break;\n      case 'previous':\n        this.activeIndex = i === 0 ? n - 1 : i - 1;\n        break;\n    }\n\n    // Open the active menu.\n    this.openActiveMenu();\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(): void {\n    this.update();\n  }\n\n  // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n  private _activeIndex = -1;\n  // Track which item can be focused using the TAB key. Unlike _activeIndex will\n  // always point to a menuitem. Whenever you update this value, it's important\n  // to follow it with an \"update-request\" message so that the `tabindex`\n  // attribute on each menubar item gets properly updated.\n  private _tabFocusIndex = 0;\n  private _forceItemsPosition: Menu.IOpenOptions;\n  private _overflowMenuOptions: IOverflowMenuOptions;\n  private _menus: Menu[] = [];\n  private _childMenu: Menu | null = null;\n  private _overflowMenu: Menu | null = null;\n  private _menuItemSizes: number[] = [];\n  private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n  /**\n   * An options object for creating a menu bar.\n   */\n  export interface IOptions {\n    /**\n     * A custom renderer for creating menu bar content.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n    /**\n     * Whether to force the position of the menu. The MenuBar forces the\n     * coordinates of its menus by default. With this option you can disable it.\n     *\n     * Setting to `false` will enable the logic which repositions the\n     * coordinates of the menu if it will not fit entirely on screen.\n     *\n     * The default is `true`.\n     */\n    forceItemsPosition?: Menu.IOpenOptions;\n    /**\n     * Whether to add a overflow menu if there's overflow.\n     *\n     * Setting to `true` will enable the logic that creates an overflow menu\n     * to show the menu items that don't fit entirely on the screen.\n     *\n     * The default is `true`.\n     */\n    overflowMenuOptions?: IOverflowMenuOptions;\n  }\n\n  /**\n   * An object which holds the data to render a menu bar item.\n   */\n  export interface IRenderData {\n    /**\n     * The title to be rendered.\n     */\n    readonly title: Title<Widget>;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the user can tab to the item.\n     */\n    readonly tabbable: boolean;\n\n    /**\n     * Whether the item is disabled.\n     *\n     * #### Notes\n     * A disabled item cannot be active.\n     * A disabled item cannot be focussed.\n     */\n    readonly disabled?: boolean;\n\n    readonly onfocus?: (event: FocusEvent) => void;\n  }\n\n  /**\n   * A renderer for use with a menu bar.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.title.icon is undefined, it will be ignored.\n      return h.div({ className }, data.title.icon!, data.title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n    }\n\n    /**\n     * Create the class name for the menu bar item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-item';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.active && !data.disabled) {\n        name += ' lm-mod-active';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a menu bar item.\n     *\n     * @param data - The data to use for the item.\n     *\n     * @returns The dataset for the menu bar item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the aria attributes for menu bar item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      return {\n        role: 'menuitem',\n        'aria-haspopup': 'true',\n        'aria-disabled': data.disabled ? 'true' : 'false'\n      };\n    }\n\n    /**\n     * Create the class name for the menu bar item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-itemIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.title;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n  /**\n   * Determines if a overflow menu appears when the menu items overflow.\n   *\n   * Defaults to `true`.\n   */\n  isVisible: boolean;\n  /**\n   * Determines the title of the overflow menu.\n   *\n   * Default: `...`.\n   */\n  title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a menu bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-MenuBar-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menubar');\n    return node;\n  }\n\n  /**\n   * Position for the menu relative to top-left screen corner.\n   */\n  export interface IPosition {\n    /**\n     * Pixels right from screen origin.\n     */\n    left: number;\n    /**\n     * Pixels down from screen origin.\n     */\n    top: number;\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    menus: ReadonlyArray<Menu>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = menus.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Look up the menu title.\n      let title = menus[k].title;\n\n      // Ignore titles with an empty label.\n      if (title.label.length === 0) {\n        continue;\n      }\n\n      // Look up the mnemonic index for the label.\n      let mn = title.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < title.label.length) {\n        if (title.label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n  /**\n   * Construct a new scroll bar.\n   *\n   * @param options - The options for initializing the scroll bar.\n   */\n  constructor(options: ScrollBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-ScrollBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n\n    // Set the orientation.\n    this._orientation = options.orientation || 'vertical';\n    this.dataset['orientation'] = this._orientation;\n\n    // Parse the rest of the options.\n    if (options.maximum !== undefined) {\n      this._maximum = Math.max(0, options.maximum);\n    }\n    if (options.page !== undefined) {\n      this._page = Math.max(0, options.page);\n    }\n    if (options.value !== undefined) {\n      this._value = Math.max(0, Math.min(options.value, this._maximum));\n    }\n  }\n\n  /**\n   * A signal emitted when the user moves the scroll thumb.\n   *\n   * #### Notes\n   * The payload is the current value of the scroll bar.\n   */\n  get thumbMoved(): ISignal<this, number> {\n    return this._thumbMoved;\n  }\n\n  /**\n   * A signal emitted when the user clicks a step button.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get stepRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._stepRequested;\n  }\n\n  /**\n   * A signal emitted when the user clicks the scroll track.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get pageRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._pageRequested;\n  }\n\n  /**\n   * Get the orientation of the scroll bar.\n   */\n  get orientation(): ScrollBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the scroll bar.\n   */\n  set orientation(value: ScrollBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making changes.\n    this._releaseMouse();\n\n    // Update the internal orientation.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the current value of the scroll bar.\n   */\n  get value(): number {\n    return this._value;\n  }\n\n  /**\n   * Set the current value of the scroll bar.\n   *\n   * #### Notes\n   * The value will be clamped to the range `[0, maximum]`.\n   */\n  set value(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Do nothing if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size is the amount of visible content in the scrolled\n   * region, expressed in data units. It determines the size of the\n   * scroll bar thumb.\n   */\n  get page(): number {\n    return this._page;\n  }\n\n  /**\n   * Set the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size will be clamped to the range `[0, Infinity]`.\n   */\n  set page(value: number) {\n    // Clamp the page size to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._page === value) {\n      return;\n    }\n\n    // Update the internal page size.\n    this._page = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the maximum value of the scroll bar.\n   */\n  get maximum(): number {\n    return this._maximum;\n  }\n\n  /**\n   * Set the maximum value of the scroll bar.\n   *\n   * #### Notes\n   * The max size will be clamped to the range `[0, Infinity]`.\n   */\n  set maximum(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._maximum === value) {\n      return;\n    }\n\n    // Update the internal values.\n    this._maximum = value;\n\n    // Clamp the current value to the new range.\n    this._value = Math.min(this._value, value);\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * The scroll bar decrement button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get decrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar increment button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get incrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[1] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar track node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get trackNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-track'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar thumb node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get thumbNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-thumb'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Handle the DOM events for the scroll bar.\n   *\n   * @param event - The DOM event sent to the scroll bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the scroll bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A method invoked on a 'before-attach' message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('mousedown', this);\n    this.update();\n  }\n\n  /**\n   * A method invoked on an 'after-detach' message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('mousedown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A method invoked on an 'update-request' message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    // Convert the value and page into percentages.\n    let value = (this._value * 100) / this._maximum;\n    let page = (this._page * 100) / (this._page + this._maximum);\n\n    // Clamp the value and page to the relevant range.\n    value = Math.max(0, Math.min(value, 100));\n    page = Math.max(0, Math.min(page, 100));\n\n    // Fetch the thumb style.\n    let thumbStyle = this.thumbNode.style;\n\n    // Update the thumb style for the current orientation.\n    if (this._orientation === 'horizontal') {\n      thumbStyle.top = '';\n      thumbStyle.height = '';\n      thumbStyle.left = `${value}%`;\n      thumbStyle.width = `${page}%`;\n      thumbStyle.transform = `translate(${-value}%, 0%)`;\n    } else {\n      thumbStyle.left = '';\n      thumbStyle.width = '';\n      thumbStyle.top = `${value}%`;\n      thumbStyle.height = `${page}%`;\n      thumbStyle.transform = `translate(0%, ${-value}%)`;\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the scroll bar.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Ignore anything except the `Escape` key.\n    if (event.keyCode !== 27) {\n      return;\n    }\n\n    // Fetch the previous scroll value.\n    let value = this._pressData ? this._pressData.value : -1;\n\n    // Release the mouse.\n    this._releaseMouse();\n\n    // Restore the old scroll value if possible.\n    if (value !== -1) {\n      this._moveThumb(value);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the scroll bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse press.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Send an activate request to the scroll bar. This can be\n    // used by message hooks to activate something relevant.\n    this.activate();\n\n    // Do nothing if the mouse is already captured.\n    if (this._pressData) {\n      return;\n    }\n\n    // Find the pressed scroll bar part.\n    let part = Private.findPart(this, event.target as HTMLElement);\n\n    // Do nothing if the part is not of interest.\n    if (!part) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Override the mouse cursor.\n    let override = Drag.overrideCursor('default');\n\n    // Set up the press data.\n    this._pressData = {\n      part,\n      override,\n      delta: -1,\n      value: -1,\n      mouseX: event.clientX,\n      mouseY: event.clientY\n    };\n\n    // Add the extra event listeners.\n    document.addEventListener('mousemove', this, true);\n    document.addEventListener('mouseup', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Handle a thumb press.\n    if (part === 'thumb') {\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Update the press data delta for the current orientation.\n      if (this._orientation === 'horizontal') {\n        this._pressData.delta = event.clientX - thumbRect.left;\n      } else {\n        this._pressData.delta = event.clientY - thumbRect.top;\n      }\n\n      // Add the active class to the thumb node.\n      thumbNode.classList.add('lm-mod-active');\n\n      // Store the current value in the press data.\n      this._pressData.value = this._value;\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track press.\n    if (part === 'track') {\n      // Fetch the client rect for the thumb.\n      let thumbRect = this.thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n\n    // Handle a decrement button press.\n    if (part === 'decrement') {\n      // Add the active class to the decrement node.\n      this.decrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button press.\n    if (part === 'increment') {\n      // Add the active class to the increment node.\n      this.incrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the scroll bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Update the mouse position.\n    this._pressData.mouseX = event.clientX;\n    this._pressData.mouseY = event.clientY;\n\n    // Bail if the thumb is not being dragged.\n    if (this._pressData.part !== 'thumb') {\n      return;\n    }\n\n    // Get the client rect for the thumb and track.\n    let thumbRect = this.thumbNode.getBoundingClientRect();\n    let trackRect = this.trackNode.getBoundingClientRect();\n\n    // Fetch the scroll geometry based on the orientation.\n    let trackPos: number;\n    let trackSpan: number;\n    if (this._orientation === 'horizontal') {\n      trackPos = event.clientX - trackRect.left - this._pressData.delta;\n      trackSpan = trackRect.width - thumbRect.width;\n    } else {\n      trackPos = event.clientY - trackRect.top - this._pressData.delta;\n      trackSpan = trackRect.height - thumbRect.height;\n    }\n\n    // Compute the desired value from the scroll geometry.\n    let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n    // Move the thumb to the computed value.\n    this._moveThumb(value);\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the scroll bar.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse release.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse and restore the node states.\n   */\n  private _releaseMouse(): void {\n    // Bail if there is no press data.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the repeat timer.\n    clearTimeout(this._repeatTimer);\n    this._repeatTimer = -1;\n\n    // Clear the press data.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra event listeners.\n    document.removeEventListener('mousemove', this, true);\n    document.removeEventListener('mouseup', this, true);\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('contextmenu', this, true);\n\n    // Remove the active classes from the nodes.\n    this.thumbNode.classList.remove('lm-mod-active');\n    this.decrementNode.classList.remove('lm-mod-active');\n    this.incrementNode.classList.remove('lm-mod-active');\n  }\n\n  /**\n   * Move the thumb to the specified position.\n   */\n  private _moveThumb(value: number): void {\n    // Clamp the value to the allowed range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Bail if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update of the scroll bar.\n    this.update();\n\n    // Emit the thumb moved signal.\n    this._thumbMoved.emit(value);\n  }\n\n  /**\n   * A timeout callback for repeating the mouse press.\n   */\n  private _onRepeat = () => {\n    // Clear the repeat timer id.\n    this._repeatTimer = -1;\n\n    // Bail if the mouse has been released.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Look up the part that was pressed.\n    let part = this._pressData.part;\n\n    // Bail if the thumb was pressed.\n    if (part === 'thumb') {\n      return;\n    }\n\n    // Schedule the timer for another repeat.\n    this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n    // Get the current mouse position.\n    let mouseX = this._pressData.mouseX;\n    let mouseY = this._pressData.mouseY;\n\n    // Handle a decrement button repeat.\n    if (part === 'decrement') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button repeat.\n    if (part === 'increment') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track repeat.\n    if (part === 'track') {\n      // Bail if the mouse is not over the track.\n      if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Bail if the mouse is over the thumb.\n      if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n  };\n\n  private _value = 0;\n  private _page = 10;\n  private _maximum = 100;\n  private _repeatTimer = -1;\n  private _orientation: ScrollBar.Orientation;\n  private _pressData: Private.IPressData | null = null;\n  private _thumbMoved = new Signal<this, number>(this);\n  private _stepRequested = new Signal<this, 'decrement' | 'increment'>(this);\n  private _pageRequested = new Signal<this, 'decrement' | 'increment'>(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n  /**\n   * A type alias for a scroll bar orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * An options object for creating a scroll bar.\n   */\n  export interface IOptions {\n    /**\n     * The orientation of the scroll bar.\n     *\n     * The default is `'vertical'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The value for the scroll bar.\n     *\n     * The default is `0`.\n     */\n    value?: number;\n\n    /**\n     * The page size for the scroll bar.\n     *\n     * The default is `10`.\n     */\n    page?: number;\n\n    /**\n     * The maximum value for the scroll bar.\n     *\n     * The default is `100`.\n     */\n    maximum?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A type alias for the parts of a scroll bar.\n   */\n  export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The scroll bar part which was pressed.\n     */\n    part: ScrollBarPart;\n\n    /**\n     * The offset of the press in thumb coordinates, or -1.\n     */\n    delta: number;\n\n    /**\n     * The scroll value at the time the thumb was pressed, or -1.\n     */\n    value: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n\n    /**\n     * The current X position of the mouse.\n     */\n    mouseX: number;\n\n    /**\n     * The current Y position of the mouse.\n     */\n    mouseY: number;\n  }\n\n  /**\n   * Create the DOM node for a scroll bar.\n   */\n  export function createNode(): HTMLElement {\n    let node = document.createElement('div');\n    let decrement = document.createElement('div');\n    let increment = document.createElement('div');\n    let track = document.createElement('div');\n    let thumb = document.createElement('div');\n    decrement.className = 'lm-ScrollBar-button';\n    increment.className = 'lm-ScrollBar-button';\n    decrement.dataset['action'] = 'decrement';\n    increment.dataset['action'] = 'increment';\n    track.className = 'lm-ScrollBar-track';\n    thumb.className = 'lm-ScrollBar-thumb';\n    track.appendChild(thumb);\n    node.appendChild(decrement);\n    node.appendChild(track);\n    node.appendChild(increment);\n    return node;\n  }\n\n  /**\n   * Find the scroll bar part which contains the given target.\n   */\n  export function findPart(\n    scrollBar: ScrollBar,\n    target: HTMLElement\n  ): ScrollBarPart | null {\n    // Test the thumb.\n    if (scrollBar.thumbNode.contains(target)) {\n      return 'thumb';\n    }\n\n    // Test the track.\n    if (scrollBar.trackNode.contains(target)) {\n      return 'track';\n    }\n\n    // Test the decrement button.\n    if (scrollBar.decrementNode.contains(target)) {\n      return 'decrement';\n    }\n\n    // Test the increment button.\n    if (scrollBar.incrementNode.contains(target)) {\n      return 'increment';\n    }\n\n    // Indicate no match.\n    return null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this._widget) {\n      let widget = this._widget;\n      this._widget = null;\n      widget.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * Get the child widget for the layout.\n   */\n  get widget(): Widget | null {\n    return this._widget;\n  }\n\n  /**\n   * Set the child widget for the layout.\n   *\n   * #### Notes\n   * Setting the child widget will cause the old child widget to be\n   * automatically disposed. If that is not desired, set the parent\n   * of the old child to `null` before assigning a new child.\n   */\n  set widget(widget: Widget | null) {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    if (widget) {\n      widget.parent = this.parent;\n    }\n\n    // Bail early if the widget does not change.\n    if (this._widget === widget) {\n      return;\n    }\n\n    // Dispose of the old child widget.\n    if (this._widget) {\n      this._widget.dispose();\n    }\n\n    // Update the internal widget.\n    this._widget = widget;\n\n    // Attach the new child widget if needed.\n    if (this.parent && widget) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    if (this._widget) {\n      yield this._widget;\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Bail early if the widget does not exist in the layout.\n    if (this._widget !== widget) {\n      return;\n    }\n\n    // Clear the internal widget.\n    this._widget = null;\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n  constructor(options: StackedLayout.IOptions = {}) {\n    super(options);\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    if (this.widgets.length > 1) {\n      this.widgets.forEach(w => {\n        w.hiddenMode = this._hiddenMode;\n      });\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (\n      this._hiddenMode === Widget.HiddenMode.Scale &&\n      this._items.length > 0\n    ) {\n      if (this._items.length === 1) {\n        this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n      }\n      widget.hiddenMode = Widget.HiddenMode.Scale;\n    } else {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n    }\n\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Reset the z-index for the widget.\n    item!.widget.node.style.zIndex = '';\n\n    // Reset the hidden mode for the widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n\n      // Reset the hidden mode for the first widget if necessary.\n      if (this._items.length === 1) {\n        this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n      }\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the computed minimum size.\n      minW = Math.max(minW, item.minWidth);\n      minH = Math.max(minH, item.minHeight);\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the widget stacking order and layout geometry.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Set the z-index for the widget.\n      item.widget.node.style.zIndex = `${i}`;\n\n      // Update the item geometry.\n      item.update(left, top, width, height);\n    }\n  }\n\n  private _dirty = false;\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n  /**\n   * An options object for initializing a stacked layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n  /**\n   * Construct a new stacked panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: StackedPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-StackedPanel');\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as StackedLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as StackedLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when a widget is removed from a stacked panel.\n   */\n  get widgetRemoved(): ISignal<this, Widget> {\n    return this._widgetRemoved;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-StackedPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-StackedPanel-child');\n    this._widgetRemoved.emit(msg.child);\n  }\n\n  private _widgetRemoved = new Signal<this, Widget>(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n  /**\n   * An options object for creating a stacked panel.\n   */\n  export interface IOptions {\n    /**\n     * The stacked layout to use for the stacked panel.\n     *\n     * The default is a new `StackedLayout`.\n     */\n    layout?: StackedLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a stacked layout for the given panel options.\n   */\n  export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n    return options.layout || new StackedLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n  /**\n   * Construct a new tab panel.\n   *\n   * @param options - The options for initializing the tab panel.\n   */\n  constructor(options: TabPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-TabPanel');\n\n    // Create the tab bar and stacked panel.\n    this.tabBar = new TabBar<Widget>(options);\n    this.tabBar.addClass('lm-TabPanel-tabBar');\n    this.stackedPanel = new StackedPanel();\n    this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n    // Connect the tab bar signal handlers.\n    this.tabBar.tabMoved.connect(this._onTabMoved, this);\n    this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    this.tabBar.tabActivateRequested.connect(\n      this._onTabActivateRequested,\n      this\n    );\n    this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Connect the stacked panel signal handlers.\n    this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n    // Get the data related to the placement.\n    this._tabPlacement = options.tabPlacement || 'top';\n    let direction = Private.directionFromPlacement(this._tabPlacement);\n    let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = this._tabPlacement;\n\n    // Create the box layout.\n    let layout = new BoxLayout({ direction, spacing: 0 });\n\n    // Set the stretch factors for the child widgets.\n    BoxLayout.setStretch(this.tabBar, 0);\n    BoxLayout.setStretch(this.stackedPanel, 1);\n\n    // Add the child widgets to the layout.\n    layout.addWidget(this.tabBar);\n    layout.addWidget(this.stackedPanel);\n\n    // Install the layout on the tab panel.\n    this.layout = layout;\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabPanel.ICurrentChangedArgs> {\n    return this._currentChanged;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this.tabBar.currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the index is out of range, it will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    this.tabBar.currentIndex = value;\n  }\n\n  /**\n   * Get the currently selected widget.\n   *\n   * #### Notes\n   * This will be `null` if there is no selected tab.\n   */\n  get currentWidget(): Widget | null {\n    let title = this.tabBar.currentTitle;\n    return title ? title.owner : null;\n  }\n\n  /**\n   * Set the currently selected widget.\n   *\n   * #### Notes\n   * If the widget is not in the panel, it will be set to `null`.\n   */\n  set currentWidget(value: Widget | null) {\n    this.tabBar.currentTitle = value ? value.title : null;\n  }\n\n  /**\n   * Get the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  get tabsMovable(): boolean {\n    return this.tabBar.tabsMovable;\n  }\n\n  /**\n   * Set the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  set tabsMovable(value: boolean) {\n    this.tabBar.tabsMovable = value;\n  }\n\n  /**\n   * Get the whether the add button is enabled.\n   *\n   */\n  get addButtonEnabled(): boolean {\n    return this.tabBar.addButtonEnabled;\n  }\n\n  /**\n   * Set the whether the add button is enabled.\n   *\n   */\n  set addButtonEnabled(value: boolean) {\n    this.tabBar.addButtonEnabled = value;\n  }\n\n  /**\n   * Get the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  get tabPlacement(): TabPanel.TabPlacement {\n    return this._tabPlacement;\n  }\n\n  /**\n   * Set the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  set tabPlacement(value: TabPanel.TabPlacement) {\n    // Bail if the placement does not change.\n    if (this._tabPlacement === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._tabPlacement = value;\n\n    // Get the values related to the placement.\n    let direction = Private.directionFromPlacement(value);\n    let orientation = Private.orientationFromPlacement(value);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = value;\n\n    // Update the layout direction.\n    (this.layout as BoxLayout).direction = direction;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The tab bar used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the tab bar directly can lead to undefined behavior.\n   */\n  readonly tabBar: TabBar<Widget>;\n\n  /**\n   * The stacked panel used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the panel directly can lead to undefined behavior.\n   */\n  readonly stackedPanel: StackedPanel;\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this.stackedPanel.widgets;\n  }\n\n  /**\n   * Add a widget to the end of the tab panel.\n   *\n   * @param widget - The widget to add to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this.widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the tab panel at a specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (widget !== this.currentWidget) {\n      widget.hide();\n    }\n    this.stackedPanel.insertWidget(index, widget);\n    this.tabBar.insertTab(index, widget.title);\n\n    widget.node.setAttribute('role', 'tabpanel');\n\n    let renderer = this.tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  /**\n   * Handle the `currentChanged` signal from the tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n    // Extract the widgets from the titles.\n    let previousWidget = previousTitle ? previousTitle.owner : null;\n    let currentWidget = currentTitle ? currentTitle.owner : null;\n\n    // Hide the previous widget.\n    if (previousWidget) {\n      previousWidget.hide();\n    }\n\n    // Show the current widget.\n    if (currentWidget) {\n      currentWidget.show();\n    }\n\n    // Emit the `currentChanged` signal for the tab panel.\n    this._currentChanged.emit({\n      previousIndex,\n      previousWidget,\n      currentIndex,\n      currentWidget\n    });\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n  }\n\n  /**\n   * Handle the `tabAddRequested` signal from the tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>, args: void): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from the tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from the tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from the tab bar.\n   */\n  private _onTabMoved(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabMovedArgs<Widget>\n  ): void {\n    this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n  }\n\n  /**\n   * Handle the `widgetRemoved` signal from the stacked panel.\n   */\n  private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n    this.tabBar.removeTab(widget.title);\n  }\n\n  private _tabPlacement: TabPanel.TabPlacement;\n  private _currentChanged = new Signal<this, TabPanel.ICurrentChangedArgs>(\n    this\n  );\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n  /**\n   * A type alias for tab placement in a tab bar.\n   */\n  export type TabPlacement =\n    | /**\n     * The tabs are placed as a row above the content.\n     */\n    'top'\n\n    /**\n     * The tabs are placed as a column to the left of the content.\n     */\n    | 'left'\n\n    /**\n     * The tabs are placed as a column to the right of the content.\n     */\n    | 'right'\n\n    /**\n     * The tabs are placed as a row below the content.\n     */\n    | 'bottom';\n\n  /**\n   * An options object for initializing a tab panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the tab panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether the button to add new tabs is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The placement of the tab bar relative to the content.\n     *\n     * The default is `'top'`.\n     */\n    tabPlacement?: TabPlacement;\n\n    /**\n     * The renderer for the panel's tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: TabBar.IRenderer<Widget>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs {\n    /**\n     * The previously selected index.\n     */\n    previousIndex: number;\n\n    /**\n     * The previously selected widget.\n     */\n    previousWidget: Widget | null;\n\n    /**\n     * The currently selected index.\n     */\n    currentIndex: number;\n\n    /**\n     * The currently selected widget.\n     */\n    currentWidget: Widget | null;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Convert a tab placement to tab bar orientation.\n   */\n  export function orientationFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): TabBar.Orientation {\n    return placementToOrientationMap[plc];\n  }\n\n  /**\n   * Convert a tab placement to a box layout direction.\n   */\n  export function directionFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): BoxLayout.Direction {\n    return placementToDirectionMap[plc];\n  }\n\n  /**\n   * A mapping of tab placement to tab bar orientation.\n   */\n  const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n    top: 'horizontal',\n    left: 'vertical',\n    right: 'vertical',\n    bottom: 'horizontal'\n  };\n\n  /**\n   * A mapping of tab placement to box layout direction.\n   */\n  const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n    top: 'top-to-bottom',\n    left: 'left-to-right',\n    right: 'right-to-left',\n    bottom: 'bottom-to-top'\n  };\n}\n"],"names":["Private","Utils"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;;;;;;AAM+E;AAE/E;;;;;;;;;AASG;MACU,QAA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AE,eAAe;AACrB,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,MAAM,EAAE,eAAe;KACxB,CAAC;AACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;"}
\ No newline at end of file
+{"version":3,"file":"index.es6.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n  /**\n   * The preferred size for the sizer.\n   *\n   * #### Notes\n   * The sizer will be given this initial size subject to its size\n   * bounds. The sizer will not deviate from this size unless such\n   * deviation is required to fit into the available layout space.\n   *\n   * There is no limit to this value, but it will be clamped to the\n   * bounds defined by {@link minSize} and {@link maxSize}.\n   *\n   * The default value is `0`.\n   */\n  sizeHint = 0;\n\n  /**\n   * The minimum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized less than this value, even if\n   * it means the sizer will overflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity)`\n   * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `0`.\n   */\n  minSize = 0;\n\n  /**\n   * The maximum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized greater than this value, even if\n   * it means the sizer will underflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity]`\n   * and that it is `>=` to {@link minSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `Infinity`.\n   */\n  maxSize = Infinity;\n\n  /**\n   * The stretch factor for the sizer.\n   *\n   * #### Notes\n   * This controls how much the sizer stretches relative to its sibling\n   * sizers when layout space is distributed. A stretch factor of zero\n   * is special and will cause the sizer to only be resized after all\n   * other sizers with a stretch factor greater than zero have been\n   * resized to their limits.\n   *\n   * It is assumed that this value is an integer that lies in the range\n   * `[0, Infinity)`. Failure to adhere to this constraint will yield\n   * undefined results.\n   *\n   * The default value is `1`.\n   */\n  stretch = 1;\n\n  /**\n   * The computed size of the sizer.\n   *\n   * #### Notes\n   * This value is the output of a call to {@link BoxEngine.calc}. It represents\n   * the computed size for the object along the layout orientation,\n   * and will always lie in the range `[minSize, maxSize]`.\n   *\n   * This value is output only.\n   *\n   * Changing this value will have no effect.\n   */\n  size = 0;\n\n  /**\n   * An internal storage property for the layout algorithm.\n   *\n   * #### Notes\n   * This value is used as temporary storage by the layout algorithm.\n   *\n   * Changing this value will have no effect.\n   */\n  done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n  /**\n   * Calculate the optimal layout sizes for a sequence of box sizers.\n   *\n   * This distributes the available layout space among the box sizers\n   * according to the following algorithm:\n   *\n   * 1. Initialize the sizers's size to its size hint and compute the\n   *    sums for each of size hint, min size, and max size.\n   *\n   * 2. If the total size hint equals the available space, return.\n   *\n   * 3. If the available space is less than the total min size, set all\n   *    sizers to their min size and return.\n   *\n   * 4. If the available space is greater than the total max size, set\n   *    all sizers to their max size and return.\n   *\n   * 5. If the layout space is less than the total size hint, distribute\n   *    the negative delta as follows:\n   *\n   *    a. Shrink each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the negative space and the sum of\n   *       stretch factors. If the sizer reaches its min size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains negative\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its min size,\n   *       remove it from the computation.\n   *\n   * 6. If the layout space is greater than the total size hint,\n   *    distribute the positive delta as follows:\n   *\n   *    a. Expand each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the postive space and the sum of\n   *       stretch factors. If the sizer reaches its max size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains positive\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its max size,\n   *       remove it from the computation.\n   *\n   * 7. return\n   *\n   * @param sizers - The sizers for a particular layout line.\n   *\n   * @param space - The available layout space for the sizers.\n   *\n   * @returns The delta between the provided available space and the\n   *   actual consumed space. This value will be zero if the sizers\n   *   can be adjusted to fit, negative if the available space is too\n   *   small, and positive if the available space is too large.\n   *\n   * #### Notes\n   * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n   *\n   * This function can be called at any time to recompute the layout for\n   * an existing sequence of sizers. The previously computed results will\n   * have no effect on the new output. It is therefore not necessary to\n   * create new sizer objects on each resize event.\n   */\n  export function calc(sizers: ArrayLike<BoxSizer>, space: number): number {\n    // Bail early if there is nothing to do.\n    let count = sizers.length;\n    if (count === 0) {\n      return space;\n    }\n\n    // Setup the size and stretch counters.\n    let totalMin = 0;\n    let totalMax = 0;\n    let totalSize = 0;\n    let totalStretch = 0;\n    let stretchCount = 0;\n\n    // Setup the sizers and compute the totals.\n    for (let i = 0; i < count; ++i) {\n      let sizer = sizers[i];\n      let min = sizer.minSize;\n      let max = sizer.maxSize;\n      let hint = sizer.sizeHint;\n      sizer.done = false;\n      sizer.size = Math.max(min, Math.min(hint, max));\n      totalSize += sizer.size;\n      totalMin += min;\n      totalMax += max;\n      if (sizer.stretch > 0) {\n        totalStretch += sizer.stretch;\n        stretchCount++;\n      }\n    }\n\n    // If the space is equal to the total size, return early.\n    if (space === totalSize) {\n      return 0;\n    }\n\n    // If the space is less than the total min, minimize each sizer.\n    if (space <= totalMin) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.minSize;\n      }\n      return space - totalMin;\n    }\n\n    // If the space is greater than the total max, maximize each sizer.\n    if (space >= totalMax) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.maxSize;\n      }\n      return space - totalMax;\n    }\n\n    // The loops below perform sub-pixel precision sizing. A near zero\n    // value is used for compares instead of zero to ensure that the\n    // loop terminates when the subdivided space is reasonably small.\n    let nearZero = 0.01;\n\n    // A counter which is decremented each time a sizer is resized to\n    // its limit. This ensures the loops terminate even if there is\n    // space remaining to distribute.\n    let notDoneCount = count;\n\n    // Distribute negative delta space.\n    if (space < totalSize) {\n      // Shrink each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its min size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = totalSize - space;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n    }\n    // Distribute positive delta space.\n    else {\n      // Expand each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its max size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = space - totalSize;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n    }\n\n    // Indicate that the consumed space equals the available space.\n    return 0;\n  }\n\n  /**\n   * Adjust a sizer by a delta and update its neighbors accordingly.\n   *\n   * @param sizers - The sizers which should be adjusted.\n   *\n   * @param index - The index of the sizer to grow.\n   *\n   * @param delta - The amount to adjust the sizer, positive or negative.\n   *\n   * #### Notes\n   * This will adjust the indicated sizer by the specified amount, along\n   * with the sizes of the appropriate neighbors, subject to the limits\n   * specified by each of the sizers.\n   *\n   * This is useful when implementing box layouts where the boundaries\n   * between the sizers are interactively adjustable by the user.\n   */\n  export function adjust(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Bail early when there is nothing to do.\n    if (sizers.length === 0 || delta === 0) {\n      return;\n    }\n\n    // Dispatch to the proper implementation.\n    if (delta > 0) {\n      growSizer(sizers, index, delta);\n    } else {\n      shrinkSizer(sizers, index, -delta);\n    }\n  }\n\n  /**\n   * Grow a sizer by a positive delta and adjust neighbors.\n   */\n  function growSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the left can expand.\n    let growLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the right can shrink.\n    let shrinkLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the left by the delta.\n    let grow = delta;\n    for (let i = index; i >= 0 && grow > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the right by the delta.\n    let shrink = delta;\n    for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n\n  /**\n   * Shrink a sizer by a positive delta and adjust neighbors.\n   */\n  function shrinkSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the right can expand.\n    let growLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the left can shrink.\n    let shrinkLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the right by the delta.\n    let grow = delta;\n    for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the left by the delta.\n    let shrink = delta;\n    for (let i = index; i >= 0 && shrink > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title<T> implements IDisposable {\n  /**\n   * Construct a new title.\n   *\n   * @param options - The options for initializing the title.\n   */\n  constructor(options: Title.IOptions<T>) {\n    this.owner = options.owner;\n    if (options.label !== undefined) {\n      this._label = options.label;\n    }\n    if (options.mnemonic !== undefined) {\n      this._mnemonic = options.mnemonic;\n    }\n    if (options.icon !== undefined) {\n      this._icon = options.icon;\n    }\n\n    if (options.iconClass !== undefined) {\n      this._iconClass = options.iconClass;\n    }\n    if (options.iconLabel !== undefined) {\n      this._iconLabel = options.iconLabel;\n    }\n    if (options.caption !== undefined) {\n      this._caption = options.caption;\n    }\n    if (options.className !== undefined) {\n      this._className = options.className;\n    }\n    if (options.closable !== undefined) {\n      this._closable = options.closable;\n    }\n    this._dataset = options.dataset || {};\n  }\n\n  /**\n   * A signal emitted when the state of the title changes.\n   */\n  get changed(): ISignal<this, void> {\n    return this._changed;\n  }\n\n  /**\n   * The object which owns the title.\n   */\n  readonly owner: T;\n\n  /**\n   * Get the label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get label(): string {\n    return this._label;\n  }\n\n  /**\n   * Set the label for the title.\n   */\n  set label(value: string) {\n    if (this._label === value) {\n      return;\n    }\n    this._label = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the mnemonic index for the title.\n   *\n   * #### Notes\n   * The default value is `-1`.\n   */\n  get mnemonic(): number {\n    return this._mnemonic;\n  }\n\n  /**\n   * Set the mnemonic index for the title.\n   */\n  set mnemonic(value: number) {\n    if (this._mnemonic === value) {\n      return;\n    }\n    this._mnemonic = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon renderer for the title.\n   *\n   * #### Notes\n   * The default value is undefined.\n   */\n  get icon(): VirtualElement.IRenderer | undefined {\n    return this._icon;\n  }\n\n  /**\n   * Set the icon renderer for the title.\n   *\n   * #### Notes\n   * A renderer is an object that supplies a render and unrender function.\n   */\n  set icon(value: VirtualElement.IRenderer | undefined) {\n    if (this._icon === value) {\n      return;\n    }\n    this._icon = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconClass(): string {\n    return this._iconClass;\n  }\n\n  /**\n   * Set the icon class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconClass(value: string) {\n    if (this._iconClass === value) {\n      return;\n    }\n    this._iconClass = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconLabel(): string {\n    return this._iconLabel;\n  }\n\n  /**\n   * Set the icon label for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconLabel(value: string) {\n    if (this._iconLabel === value) {\n      return;\n    }\n    this._iconLabel = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the caption for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get caption(): string {\n    return this._caption;\n  }\n\n  /**\n   * Set the caption for the title.\n   */\n  set caption(value: string) {\n    if (this._caption === value) {\n      return;\n    }\n    this._caption = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the extra class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get className(): string {\n    return this._className;\n  }\n\n  /**\n   * Set the extra class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set className(value: string) {\n    if (this._className === value) {\n      return;\n    }\n    this._className = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the closable state for the title.\n   *\n   * #### Notes\n   * The default value is `false`.\n   */\n  get closable(): boolean {\n    return this._closable;\n  }\n\n  /**\n   * Set the closable state for the title.\n   *\n   * #### Notes\n   * This controls the presence of a close icon when applicable.\n   */\n  set closable(value: boolean) {\n    if (this._closable === value) {\n      return;\n    }\n    this._closable = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the dataset for the title.\n   *\n   * #### Notes\n   * The default value is an empty dataset.\n   */\n  get dataset(): Title.Dataset {\n    return this._dataset;\n  }\n\n  /**\n   * Set the dataset for the title.\n   *\n   * #### Notes\n   * This controls the data attributes when applicable.\n   */\n  set dataset(value: Title.Dataset) {\n    if (this._dataset === value) {\n      return;\n    }\n    this._dataset = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Test whether the title has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this._isDisposed;\n  }\n\n  /**\n   * Dispose of the resources held by the title.\n   *\n   * #### Notes\n   * It is the responsibility of the owner to call the title disposal.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n    this._isDisposed = true;\n\n    Signal.clearData(this);\n  }\n\n  private _label = '';\n  private _caption = '';\n  private _mnemonic = -1;\n  private _icon: VirtualElement.IRenderer | undefined = undefined;\n  private _iconClass = '';\n  private _iconLabel = '';\n  private _className = '';\n  private _closable = false;\n  private _dataset: Title.Dataset;\n  private _changed = new Signal<this, void>(this);\n  private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n  /**\n   * A type alias for a simple immutable string dataset.\n   */\n  export type Dataset = { readonly [key: string]: string };\n\n  /**\n   * An options object for initializing a title.\n   */\n  export interface IOptions<T> {\n    /**\n     * The object which owns the title.\n     */\n    owner: T;\n\n    /**\n     * The label for the title.\n     */\n    label?: string;\n\n    /**\n     * The mnemonic index for the title.\n     */\n    mnemonic?: number;\n\n    /**\n     * The icon renderer for the title.\n     */\n    icon?: VirtualElement.IRenderer;\n\n    /**\n     * The icon class name for the title.\n     */\n    iconClass?: string;\n\n    /**\n     * The icon label for the title.\n     */\n    iconLabel?: string;\n\n    /**\n     * The caption for the title.\n     */\n    caption?: string;\n\n    /**\n     * The extra class name for the title.\n     */\n    className?: string;\n\n    /**\n     * The closable state for the title.\n     */\n    closable?: boolean;\n\n    /**\n     * The dataset for the title.\n     */\n    dataset?: Dataset;\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n  ConflatableMessage,\n  IMessageHandler,\n  Message,\n  MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n  /**\n   * Construct a new widget.\n   *\n   * @param options - The options for initializing the widget.\n   */\n  constructor(options: Widget.IOptions = {}) {\n    this.node = Private.createNode(options);\n    this.addClass('lm-Widget');\n  }\n\n  /**\n   * Dispose of the widget and its descendant widgets.\n   *\n   * #### Notes\n   * It is unsafe to use the widget after it has been disposed.\n   *\n   * All calls made to this method after the first are a no-op.\n   */\n  dispose(): void {\n    // Do nothing if the widget is already disposed.\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Set the disposed flag and emit the disposed signal.\n    this.setFlag(Widget.Flag.IsDisposed);\n    this._disposed.emit(undefined);\n\n    // Remove or detach the widget if necessary.\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n\n    // Dispose of the widget layout.\n    if (this._layout) {\n      this._layout.dispose();\n      this._layout = null;\n    }\n\n    // Dispose the title\n    this.title.dispose();\n\n    // Clear the extra data associated with the widget.\n    Signal.clearData(this);\n    MessageLoop.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * A signal emitted when the widget is disposed.\n   */\n  get disposed(): ISignal<this, void> {\n    return this._disposed;\n  }\n\n  /**\n   * Get the DOM node owned by the widget.\n   */\n  readonly node: HTMLElement;\n\n  /**\n   * Test whether the widget has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this.testFlag(Widget.Flag.IsDisposed);\n  }\n\n  /**\n   * Test whether the widget's node is attached to the DOM.\n   */\n  get isAttached(): boolean {\n    return this.testFlag(Widget.Flag.IsAttached);\n  }\n\n  /**\n   * Test whether the widget is explicitly hidden.\n   *\n   * #### Notes\n   * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n   * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n   */\n  get isHidden(): boolean {\n    return this.testFlag(Widget.Flag.IsHidden);\n  }\n\n  /**\n   * Test whether the widget is visible.\n   *\n   * #### Notes\n   * A widget is visible when it is attached to the DOM, is not\n   * explicitly hidden, and has no explicitly hidden ancestors.\n   *\n   * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n   * It recursively checks the visibility of all parent widgets.\n   */\n  get isVisible(): boolean {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let parent: Widget | null = this;\n    do {\n      if (parent.isHidden || !parent.isAttached) {\n        return false;\n      }\n      parent = parent.parent;\n    } while (parent != null);\n    return true;\n  }\n\n  /**\n   * The title object for the widget.\n   *\n   * #### Notes\n   * The title object is used by some container widgets when displaying\n   * the widget alongside some title, such as a tab panel or side bar.\n   *\n   * Since not all widgets will use the title, it is created on demand.\n   *\n   * The `owner` property of the title is set to this widget.\n   */\n  get title(): Title<Widget> {\n    return Private.titleProperty.get(this);\n  }\n\n  /**\n   * Get the id of the widget's DOM node.\n   */\n  get id(): string {\n    return this.node.id;\n  }\n\n  /**\n   * Set the id of the widget's DOM node.\n   */\n  set id(value: string) {\n    this.node.id = value;\n  }\n\n  /**\n   * The dataset for the widget's DOM node.\n   */\n  get dataset(): DOMStringMap {\n    return this.node.dataset;\n  }\n\n  /**\n   * Get the method for hiding the widget.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding the widget.\n   */\n  set hiddenMode(value: Widget.HiddenMode) {\n    if (this._hiddenMode === value) {\n      return;\n    }\n\n    if (this.isHidden) {\n      // Reset styles set by previous mode.\n      this._toggleHidden(false);\n    }\n\n    if (value == Widget.HiddenMode.Scale) {\n      this.node.style.willChange = 'transform';\n    } else {\n      this.node.style.willChange = 'auto';\n    }\n\n    this._hiddenMode = value;\n\n    if (this.isHidden) {\n      // Set styles for new mode.\n      this._toggleHidden(true);\n    }\n  }\n\n  /**\n   * Get the parent of the widget.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent of the widget.\n   *\n   * #### Notes\n   * Children are typically added to a widget by using a layout, which\n   * means user code will not normally set the parent widget directly.\n   *\n   * The widget will be automatically removed from its old parent.\n   *\n   * This is a no-op if there is no effective parent change.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (value && this.contains(value)) {\n      throw new Error('Invalid parent widget.');\n    }\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-removed', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    this._parent = value;\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-added', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    if (!this.isDisposed) {\n      MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n    }\n  }\n\n  /**\n   * Get the layout for the widget.\n   */\n  get layout(): Layout | null {\n    return this._layout;\n  }\n\n  /**\n   * Set the layout for the widget.\n   *\n   * #### Notes\n   * The layout is single-use only. It cannot be changed after the\n   * first assignment.\n   *\n   * The layout is disposed automatically when the widget is disposed.\n   */\n  set layout(value: Layout | null) {\n    if (this._layout === value) {\n      return;\n    }\n    if (this.testFlag(Widget.Flag.DisallowLayout)) {\n      throw new Error('Cannot set widget layout.');\n    }\n    if (this._layout) {\n      throw new Error('Cannot change widget layout.');\n    }\n    if (value!.parent) {\n      throw new Error('Cannot change layout parent.');\n    }\n    this._layout = value;\n    value!.parent = this;\n  }\n\n  /**\n   * Create an iterator over the widget's children.\n   *\n   * @returns A new iterator over the children of the widget.\n   *\n   * #### Notes\n   * The widget must have a populated layout in order to have children.\n   *\n   * If a layout is not installed, the returned iterator will be empty.\n   */\n  *children(): IterableIterator<Widget> {\n    if (this._layout) {\n      yield* this._layout;\n    }\n  }\n\n  /**\n   * Test whether a widget is a descendant of this widget.\n   *\n   * @param widget - The descendant widget of interest.\n   *\n   * @returns `true` if the widget is a descendant, `false` otherwise.\n   */\n  contains(widget: Widget): boolean {\n    for (let value: Widget | null = widget; value; value = value._parent) {\n      if (value === this) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Test whether the widget's DOM node has the given class name.\n   *\n   * @param name - The class name of interest.\n   *\n   * @returns `true` if the node has the class, `false` otherwise.\n   */\n  hasClass(name: string): boolean {\n    return this.node.classList.contains(name);\n  }\n\n  /**\n   * Add a class name to the widget's DOM node.\n   *\n   * @param name - The class name to add to the node.\n   *\n   * #### Notes\n   * If the class name is already added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  addClass(name: string): void {\n    this.node.classList.add(name);\n  }\n\n  /**\n   * Remove a class name from the widget's DOM node.\n   *\n   * @param name - The class name to remove from the node.\n   *\n   * #### Notes\n   * If the class name is not yet added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  removeClass(name: string): void {\n    this.node.classList.remove(name);\n  }\n\n  /**\n   * Toggle a class name on the widget's DOM node.\n   *\n   * @param name - The class name to toggle on the node.\n   *\n   * @param force - Whether to force add the class (`true`) or force\n   *   remove the class (`false`). If not provided, the presence of\n   *   the class will be toggled from its current state.\n   *\n   * @returns `true` if the class is now present, `false` otherwise.\n   *\n   * #### Notes\n   * The class name must not contain whitespace.\n   */\n  toggleClass(name: string, force?: boolean): boolean {\n    if (force === true) {\n      this.node.classList.add(name);\n      return true;\n    }\n    if (force === false) {\n      this.node.classList.remove(name);\n      return false;\n    }\n    return this.node.classList.toggle(name);\n  }\n\n  /**\n   * Post an `'update-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  update(): void {\n    MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n  }\n\n  /**\n   * Post a `'fit-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  fit(): void {\n    MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n  }\n\n  /**\n   * Post an `'activate-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  activate(): void {\n    MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n  }\n\n  /**\n   * Send a `'close-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for sending the message.\n   */\n  close(): void {\n    MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n  }\n\n  /**\n   * Show the widget and make it visible to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `false`.\n   *\n   * If the widget is not explicitly hidden, this is a no-op.\n   */\n  show(): void {\n    if (!this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n    }\n    this.clearFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(false);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-shown', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Hide the widget and make it hidden to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `true`.\n   *\n   * If the widget is explicitly hidden, this is a no-op.\n   */\n  hide(): void {\n    if (this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n    }\n    this.setFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(true);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-hidden', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Show or hide the widget according to a boolean value.\n   *\n   * @param hidden - `true` to hide the widget, or `false` to show it.\n   *\n   * #### Notes\n   * This is a convenience method for `hide()` and `show()`.\n   */\n  setHidden(hidden: boolean): void {\n    if (hidden) {\n      this.hide();\n    } else {\n      this.show();\n    }\n  }\n\n  /**\n   * Test whether the given widget flag is set.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  testFlag(flag: Widget.Flag): boolean {\n    return (this._flags & flag) !== 0;\n  }\n\n  /**\n   * Set the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  setFlag(flag: Widget.Flag): void {\n    this._flags |= flag;\n  }\n\n  /**\n   * Clear the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  clearFlag(flag: Widget.Flag): void {\n    this._flags &= ~flag;\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   *\n   * #### Notes\n   * Subclasses may reimplement this method as needed.\n   */\n  processMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.notifyLayout(msg);\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.notifyLayout(msg);\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.notifyLayout(msg);\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.notifyLayout(msg);\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.setFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.notifyLayout(msg);\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.notifyLayout(msg);\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n          this.setFlag(Widget.Flag.IsVisible);\n        }\n        this.setFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.notifyLayout(msg);\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.clearFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterDetach(msg);\n        break;\n      case 'activate-request':\n        this.notifyLayout(msg);\n        this.onActivateRequest(msg);\n        break;\n      case 'close-request':\n        this.notifyLayout(msg);\n        this.onCloseRequest(msg);\n        break;\n      case 'child-added':\n        this.notifyLayout(msg);\n        this.onChildAdded(msg as Widget.ChildMessage);\n        break;\n      case 'child-removed':\n        this.notifyLayout(msg);\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      default:\n        this.notifyLayout(msg);\n        break;\n    }\n  }\n\n  /**\n   * Invoke the message processing routine of the widget's layout.\n   *\n   * @param msg - The message to dispatch to the layout.\n   *\n   * #### Notes\n   * This is a no-op if the widget does not have a layout.\n   *\n   * This will not typically be called directly by user code.\n   */\n  protected notifyLayout(msg: Message): void {\n    if (this._layout) {\n      this._layout.processParentMessage(msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   *\n   * #### Notes\n   * The default implementation unparents or detaches the widget.\n   */\n  protected onCloseRequest(msg: Message): void {\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {}\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onUpdateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onActivateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n  private _toggleHidden(hidden: boolean) {\n    if (hidden) {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.addClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = 'scale(0)';\n          this.node.setAttribute('aria-hidden', 'true');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = 'hidden';\n          this.node.style.zIndex = '-1';\n          break;\n      }\n    } else {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.removeClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = '';\n          this.node.removeAttribute('aria-hidden');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = '';\n          this.node.style.zIndex = '';\n          break;\n      }\n    }\n  }\n\n  private _flags = 0;\n  private _layout: Layout | null = null;\n  private _parent: Widget | null = null;\n  private _disposed = new Signal<this, void>(this);\n  private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n  /**\n   * An options object for initializing a widget.\n   */\n  export interface IOptions {\n    /**\n     * The optional node to use for the widget.\n     *\n     * If a node is provided, the widget will assume full ownership\n     * and control of the node, as if it had created the node itself.\n     *\n     * The default is a new `<div>`.\n     */\n    node?: HTMLElement;\n\n    /**\n     * The optional element tag, used for constructing the widget's node.\n     *\n     * If a pre-constructed node is provided via the `node` arg, this\n     * value is ignored.\n     */\n    tag?: keyof HTMLElementTagNameMap;\n  }\n\n  /**\n   * The method for hiding the widget.\n   *\n   * The default is Display.\n   *\n   * Using `Scale` will often increase performance as most browsers will not\n   * trigger style computation for the `transform` action. This should be used\n   * sparingly and tested, since increasing the number of composition layers\n   * may slow things down.\n   *\n   * To ensure the transformation does not trigger style recomputation, you\n   * may need to set the widget CSS style `will-change: transform`. This\n   * should be used only when needed as it may overwhelm the browser with a\n   * high number of layers. See\n   * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n   */\n  export enum HiddenMode {\n    /**\n     * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n     * CSS from the standard Lumino CSS.\n     */\n    Display = 0,\n\n    /**\n     * Hide the widget by setting the `transform` to `'scale(0)'`.\n     */\n    Scale,\n\n    /**\n     *Hide the widget by setting the `content-visibility` to `'hidden'`.\n     */\n    ContentVisibility\n  }\n\n  /**\n   * An enum of widget bit flags.\n   */\n  export enum Flag {\n    /**\n     * The widget has been disposed.\n     */\n    IsDisposed = 0x1,\n\n    /**\n     * The widget is attached to the DOM.\n     */\n    IsAttached = 0x2,\n\n    /**\n     * The widget is hidden.\n     */\n    IsHidden = 0x4,\n\n    /**\n     * The widget is visible.\n     *\n     * @deprecated since 2.7.0, apply that flag consistently was not reliable\n     * so it was dropped in favor of a recursive check of the visibility of all parents.\n     */\n    IsVisible = 0x8,\n\n    /**\n     * A layout cannot be set on the widget.\n     */\n    DisallowLayout = 0x10\n  }\n\n  /**\n   * A collection of stateless messages related to widgets.\n   */\n  export namespace Msg {\n    /**\n     * A singleton `'before-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const BeforeShow = new Message('before-show');\n\n    /**\n     * A singleton `'after-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const AfterShow = new Message('after-show');\n\n    /**\n     * A singleton `'before-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const BeforeHide = new Message('before-hide');\n\n    /**\n     * A singleton `'after-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const AfterHide = new Message('after-hide');\n\n    /**\n     * A singleton `'before-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is attached.\n     */\n    export const BeforeAttach = new Message('before-attach');\n\n    /**\n     * A singleton `'after-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is attached.\n     */\n    export const AfterAttach = new Message('after-attach');\n\n    /**\n     * A singleton `'before-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is detached.\n     */\n    export const BeforeDetach = new Message('before-detach');\n\n    /**\n     * A singleton `'after-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is detached.\n     */\n    export const AfterDetach = new Message('after-detach');\n\n    /**\n     * A singleton `'parent-changed'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget when its parent has changed.\n     */\n    export const ParentChanged = new Message('parent-changed');\n\n    /**\n     * A singleton conflatable `'update-request'` message.\n     *\n     * #### Notes\n     * This message can be dispatched to supporting widgets in order to\n     * update their content based on the current widget state. Not all\n     * widgets will respond to messages of this type.\n     *\n     * For widgets with a layout, this message will inform the layout to\n     * update the position and size of its child widgets.\n     */\n    export const UpdateRequest = new ConflatableMessage('update-request');\n\n    /**\n     * A singleton conflatable `'fit-request'` message.\n     *\n     * #### Notes\n     * For widgets with a layout, this message will inform the layout to\n     * recalculate its size constraints to fit the space requirements of\n     * its child widgets, and to update their position and size. Not all\n     * layouts will respond to messages of this type.\n     */\n    export const FitRequest = new ConflatableMessage('fit-request');\n\n    /**\n     * A singleton conflatable `'activate-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should\n     * perform the actions necessary to activate the widget, which\n     * may include focusing its node or descendant node.\n     */\n    export const ActivateRequest = new ConflatableMessage('activate-request');\n\n    /**\n     * A singleton conflatable `'close-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should close\n     * and remove itself from the widget hierarchy.\n     */\n    export const CloseRequest = new ConflatableMessage('close-request');\n  }\n\n  /**\n   * A message class for child related messages.\n   */\n  export class ChildMessage extends Message {\n    /**\n     * Construct a new child message.\n     *\n     * @param type - The message type.\n     *\n     * @param child - The child widget for the message.\n     */\n    constructor(type: string, child: Widget) {\n      super(type);\n      this.child = child;\n    }\n\n    /**\n     * The child widget for the message.\n     */\n    readonly child: Widget;\n  }\n\n  /**\n   * A message class for `'resize'` messages.\n   */\n  export class ResizeMessage extends Message {\n    /**\n     * Construct a new resize message.\n     *\n     * @param width - The **offset width** of the widget, or `-1` if\n     *   the width is not known.\n     *\n     * @param height - The **offset height** of the widget, or `-1` if\n     *   the height is not known.\n     */\n    constructor(width: number, height: number) {\n      super('resize');\n      this.width = width;\n      this.height = height;\n    }\n\n    /**\n     * The offset width of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the width is unknown.\n     */\n    readonly width: number;\n\n    /**\n     * The offset height of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the height is unknown.\n     */\n    readonly height: number;\n  }\n\n  /**\n   * The namespace for the `ResizeMessage` class statics.\n   */\n  export namespace ResizeMessage {\n    /**\n     * A singleton `'resize'` message with an unknown size.\n     */\n    export const UnknownSize = new ResizeMessage(-1, -1);\n  }\n\n  /**\n   * Attach a widget to a host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param host - The DOM node to use as the widget's host.\n   *\n   * @param ref - The child of `host` to use as the reference element.\n   *   If this is provided, the widget will be inserted before this\n   *   node in the host. The default is `null`, which will cause the\n   *   widget to be added as the last child of the host.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget, if\n   * the widget is already attached, or if the host is not attached\n   * to the DOM.\n   */\n  export function attach(\n    widget: Widget,\n    host: HTMLElement,\n    ref: HTMLElement | null = null\n  ): void {\n    if (widget.parent) {\n      throw new Error('Cannot attach a child widget.');\n    }\n    if (widget.isAttached || widget.node.isConnected) {\n      throw new Error('Widget is already attached.');\n    }\n    if (!host.isConnected) {\n      throw new Error('Host is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    host.insertBefore(widget.node, ref);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n  }\n\n  /**\n   * Detach the widget from its host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget,\n   * or if the widget is not attached to the DOM.\n   */\n  export function detach(widget: Widget): void {\n    if (widget.parent) {\n      throw new Error('Cannot detach a child widget.');\n    }\n    if (!widget.isAttached || !widget.node.isConnected) {\n      throw new Error('Widget is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    widget.node.parentNode!.removeChild(widget.node);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An attached property for the widget title object.\n   */\n  export const titleProperty = new AttachedProperty<Widget, Title<Widget>>({\n    name: 'title',\n    create: owner => new Title<Widget>({ owner })\n  });\n\n  /**\n   * Create a DOM node for the given widget options.\n   */\n  export function createNode(options: Widget.IOptions): HTMLElement {\n    return options.node || document.createElement(options.tag || 'div');\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable<Widget>, IDisposable {\n  /**\n   * Construct a new layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: Layout.IOptions = {}) {\n    this._fitPolicy = options.fitPolicy || 'set-min-size';\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This should be reimplemented to clear and dispose of the widgets.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    this._parent = null;\n    this._disposed = true;\n    Signal.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * Test whether the layout is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Get the parent widget of the layout.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent widget of the layout.\n   *\n   * #### Notes\n   * This is set automatically when installing the layout on the parent\n   * widget. The parent widget should not be set directly by user code.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (this._parent) {\n      throw new Error('Cannot change parent widget.');\n    }\n    if (value!.layout !== this) {\n      throw new Error('Invalid parent widget.');\n    }\n    this._parent = value;\n    this.init();\n  }\n\n  /**\n   * Get the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  get fitPolicy(): Layout.FitPolicy {\n    return this._fitPolicy;\n  }\n\n  /**\n   * Set the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   *\n   * Changing the fit policy will clear the current size constraint\n   * for the parent widget and then re-fit the parent.\n   */\n  set fitPolicy(value: Layout.FitPolicy) {\n    // Bail if the policy does not change\n    if (this._fitPolicy === value) {\n      return;\n    }\n\n    // Update the internal policy.\n    this._fitPolicy = value;\n\n    // Clear the size constraints and schedule a fit of the parent.\n    if (this._parent) {\n      let style = this._parent.node.style;\n      style.minWidth = '';\n      style.minHeight = '';\n      style.maxWidth = '';\n      style.maxHeight = '';\n      this._parent.fit();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This abstract method must be implemented by a subclass.\n   */\n  abstract [Symbol.iterator](): IterableIterator<Widget>;\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method should *not* modify the widget's `parent`.\n   */\n  abstract removeWidget(widget: Widget): void;\n\n  /**\n   * Process a message sent to the parent widget.\n   *\n   * @param msg - The message sent to the parent widget.\n   *\n   * #### Notes\n   * This method is called by the parent widget to process a message.\n   *\n   * Subclasses may reimplement this method as needed.\n   */\n  processParentMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.onAfterDetach(msg);\n        break;\n      case 'child-removed':\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      case 'child-shown':\n        this.onChildShown(msg as Widget.ChildMessage);\n        break;\n      case 'child-hidden':\n        this.onChildHidden(msg as Widget.ChildMessage);\n        break;\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   *\n   * #### Notes\n   * This method is invoked immediately after the layout is installed\n   * on the parent widget.\n   *\n   * The default implementation reparents all of the widgets to the\n   * layout parent widget.\n   *\n   * Subclasses should reimplement this method and attach the child\n   * widget nodes to the parent widget's node.\n   */\n  protected init(): void {\n    for (const widget of this) {\n      widget.parent = this.parent;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the specified layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the available layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * This will remove the child widget from the layout.\n   *\n   * Subclasses should **not** typically reimplement this method.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    this.removeWidget(msg.child);\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n  private _disposed = false;\n  private _fitPolicy: Layout.FitPolicy;\n  private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n  /**\n   * A type alias for the layout fit policy.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  export type FitPolicy =\n    | /**\n     * No size constraint will be applied to the parent widget.\n     */\n    'set-no-constraint'\n\n    /**\n     * The computed min size will be applied to the parent widget.\n     */\n    | 'set-min-size';\n\n  /**\n   * An options object for initializing a layout.\n   */\n  export interface IOptions {\n    /**\n     * The fit policy for the layout.\n     *\n     * The default is `'set-min-size'`.\n     */\n    fitPolicy?: FitPolicy;\n  }\n\n  /**\n   * A type alias for the horizontal alignment of a widget.\n   */\n  export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n  /**\n   * A type alias for the vertical alignment of a widget.\n   */\n  export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n  /**\n   * Get the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The horizontal alignment for the widget.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   */\n  export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n    return Private.horizontalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the horizontal alignment.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setHorizontalAlignment(\n    widget: Widget,\n    value: HorizontalAlignment\n  ): void {\n    Private.horizontalAlignmentProperty.set(widget, value);\n  }\n\n  /**\n   * Get the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The vertical alignment for the widget.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   */\n  export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n    return Private.verticalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the vertical alignment.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setVerticalAlignment(\n    widget: Widget,\n    value: VerticalAlignment\n  ): void {\n    Private.verticalAlignmentProperty.set(widget, value);\n  }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n  /**\n   * Construct a new layout item.\n   *\n   * @param widget - The widget to be managed by the item.\n   *\n   * #### Notes\n   * The widget will be set to absolute positioning.\n   * The widget will use strict CSS containment.\n   */\n  constructor(widget: Widget) {\n    this.widget = widget;\n    this.widget.node.style.position = 'absolute';\n    this.widget.node.style.contain = 'strict';\n  }\n\n  /**\n   * Dispose of the the layout item.\n   *\n   * #### Notes\n   * This will reset the positioning of the widget.\n   */\n  dispose(): void {\n    // Do nothing if the item is already disposed.\n    if (this._disposed) {\n      return;\n    }\n\n    // Mark the item as disposed.\n    this._disposed = true;\n\n    // Reset the widget style.\n    let style = this.widget.node.style;\n    style.position = '';\n    style.top = '';\n    style.left = '';\n    style.width = '';\n    style.height = '';\n    style.contain = '';\n  }\n\n  /**\n   * The widget managed by the layout item.\n   */\n  readonly widget: Widget;\n\n  /**\n   * The computed minimum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minWidth(): number {\n    return this._minWidth;\n  }\n\n  /**\n   * The computed minimum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minHeight(): number {\n    return this._minHeight;\n  }\n\n  /**\n   * The computed maximum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxWidth(): number {\n    return this._maxWidth;\n  }\n\n  /**\n   * The computed maximum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxHeight(): number {\n    return this._maxHeight;\n  }\n\n  /**\n   * Whether the layout item is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Whether the managed widget is hidden.\n   */\n  get isHidden(): boolean {\n    return this.widget.isHidden;\n  }\n\n  /**\n   * Whether the managed widget is visible.\n   */\n  get isVisible(): boolean {\n    return this.widget.isVisible;\n  }\n\n  /**\n   * Whether the managed widget is attached.\n   */\n  get isAttached(): boolean {\n    return this.widget.isAttached;\n  }\n\n  /**\n   * Update the computed size limits of the managed widget.\n   */\n  fit(): void {\n    let limits = ElementExt.sizeLimits(this.widget.node);\n    this._minWidth = limits.minWidth;\n    this._minHeight = limits.minHeight;\n    this._maxWidth = limits.maxWidth;\n    this._maxHeight = limits.maxHeight;\n  }\n\n  /**\n   * Update the position and size of the managed widget.\n   *\n   * @param left - The left edge position of the layout box.\n   *\n   * @param top - The top edge position of the layout box.\n   *\n   * @param width - The width of the layout box.\n   *\n   * @param height - The height of the layout box.\n   */\n  update(left: number, top: number, width: number, height: number): void {\n    // Clamp the size to the computed size limits.\n    let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n    let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n    // Adjust the left edge for the horizontal alignment, if needed.\n    if (clampW < width) {\n      switch (Layout.getHorizontalAlignment(this.widget)) {\n        case 'left':\n          break;\n        case 'center':\n          left += (width - clampW) / 2;\n          break;\n        case 'right':\n          left += width - clampW;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Adjust the top edge for the vertical alignment, if needed.\n    if (clampH < height) {\n      switch (Layout.getVerticalAlignment(this.widget)) {\n        case 'top':\n          break;\n        case 'center':\n          top += (height - clampH) / 2;\n          break;\n        case 'bottom':\n          top += height - clampH;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Set up the resize variables.\n    let resized = false;\n    let style = this.widget.node.style;\n\n    // Update the top edge of the widget if needed.\n    if (this._top !== top) {\n      this._top = top;\n      style.top = `${top}px`;\n    }\n\n    // Update the left edge of the widget if needed.\n    if (this._left !== left) {\n      this._left = left;\n      style.left = `${left}px`;\n    }\n\n    // Update the width of the widget if needed.\n    if (this._width !== clampW) {\n      resized = true;\n      this._width = clampW;\n      style.width = `${clampW}px`;\n    }\n\n    // Update the height of the widget if needed.\n    if (this._height !== clampH) {\n      resized = true;\n      this._height = clampH;\n      style.height = `${clampH}px`;\n    }\n\n    // Send a resize message to the widget if needed.\n    if (resized) {\n      let msg = new Widget.ResizeMessage(clampW, clampH);\n      MessageLoop.sendMessage(this.widget, msg);\n    }\n  }\n\n  private _top = NaN;\n  private _left = NaN;\n  private _width = NaN;\n  private _height = NaN;\n  private _minWidth = 0;\n  private _minHeight = 0;\n  private _maxWidth = Infinity;\n  private _maxHeight = Infinity;\n  private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The attached property for a widget horizontal alignment.\n   */\n  export const horizontalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.HorizontalAlignment\n  >({\n    name: 'horizontalAlignment',\n    create: () => 'center',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The attached property for a widget vertical alignment.\n   */\n  export const verticalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.VerticalAlignment\n  >({\n    name: 'verticalAlignment',\n    create: () => 'top',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The change handler for the attached alignment properties.\n   */\n  function onAlignmentChanged(child: Widget): void {\n    if (child.parent && child.parent.layout) {\n      child.parent.update();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    while (this._widgets.length > 0) {\n      this._widgets.pop()!.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * A read-only array of the widgets in the layout.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this._widgets;\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    yield* this._widgets;\n  }\n\n  /**\n   * Add a widget to the end of the layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this._widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    widget.parent = this.parent;\n\n    // Look up the current index of the widget.\n    let i = this._widgets.indexOf(widget);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._widgets.length));\n\n    // If the widget is not in the array, insert it.\n    if (i === -1) {\n      // Insert the widget into the array.\n      ArrayExt.insert(this._widgets, j, widget);\n\n      // If the layout is parented, attach the widget to the DOM.\n      if (this.parent) {\n        this.attachWidget(j, widget);\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the widget exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._widgets.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the widget to the new location.\n    ArrayExt.move(this._widgets, i, j);\n\n    // If the layout is parented, move the widget in the DOM.\n    if (this.parent) {\n      this.moveWidget(i, j, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    this.removeWidgetAt(this._widgets.indexOf(widget));\n  }\n\n  /**\n   * Remove the widget at a given index from the layout.\n   *\n   * @param index - The index of the widget to remove.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  removeWidgetAt(index: number): void {\n    // Remove the widget from the array.\n    let widget = ArrayExt.removeAt(this._widgets, index);\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (widget && this.parent) {\n      this.detachWidget(index, widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    let index = 0;\n    for (const widget of this) {\n      this.attachWidget(index++, widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[index];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation moves the widget's node to the proper\n   * location in the parent's node and sends the appropriate attach and\n   * detach messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is moved in the parent's node.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` and  message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[toIndex];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n  /**\n   * Clamp a dimension value to an integer >= 0.\n   */\n  export function clampDimension(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n  /**\n   * Construct a new split layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: SplitLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.orientation !== undefined) {\n      this._orientation = options.orientation;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n    this._handles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the split layout.\n   */\n  readonly renderer: SplitLayout.IRenderer;\n\n  /**\n   * Get the layout orientation for the split layout.\n   */\n  get orientation(): SplitLayout.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split layout.\n   */\n  set orientation(value: SplitLayout.Orientation) {\n    if (this._orientation === value) {\n      return;\n    }\n    this._orientation = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['orientation'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  get alignment(): SplitLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  set alignment(value: SplitLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the split layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the split handles in the layout.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return this._handles;\n  }\n\n  /**\n   * Get the absolute sizes of the widgets in the layout.\n   *\n   * @returns A new array of the absolute sizes of the widgets.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  absoluteSizes(): number[] {\n    return this._sizers.map(sizer => sizer.size);\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the layout.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return Private.normalize(this._sizers.map(sizer => sizer.size));\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the layout.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    // Copy the sizes and pad with zeros as needed.\n    let n = this._sizers.length;\n    let temp = sizes.slice(0, n);\n    while (temp.length < n) {\n      temp.push(0);\n    }\n\n    // Normalize the padded sizes.\n    let normed = Private.normalize(temp);\n\n    // Apply the normalized sizes to the sizers.\n    for (let i = 0; i < n; ++i) {\n      let sizer = this._sizers[i];\n      sizer.sizeHint = normed[i];\n      sizer.size = normed[i];\n    }\n\n    // Set the flag indicating the sizes are normalized.\n    this._hasNormedSizes = true;\n\n    // Trigger an update of the parent widget.\n    if (update && this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Move the offset position of a split handle.\n   *\n   * @param index - The index of the handle of the interest.\n   *\n   * @param position - The desired offset position of the handle.\n   *\n   * #### Notes\n   * The position is relative to the offset parent.\n   *\n   * This will move the handle as close as possible to the desired\n   * position. The sibling widgets will be adjusted as necessary.\n   */\n  moveHandle(index: number, position: number): void {\n    // Bail if the index is invalid or the handle is hidden.\n    let handle = this._handles[index];\n    if (!handle || handle.classList.contains('lm-mod-hidden')) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (this._orientation === 'horizontal') {\n      delta = position - handle.offsetLeft;\n    } else {\n      delta = position - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent widget resizing unless needed.\n    for (let sizer of this._sizers) {\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(this._sizers, index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['orientation'] = this.orientation;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create the item, handle, and sizer for the new widget.\n    let item = new LayoutItem(widget);\n    let handle = Private.createHandle(this.renderer);\n    let average = Private.averageSize(this._sizers);\n    let sizer = Private.createSizer(average);\n\n    // Insert the item, handle, and sizer into the internal arrays.\n    ArrayExt.insert(this._items, index, item);\n    ArrayExt.insert(this._sizers, index, sizer);\n    ArrayExt.insert(this._handles, index, handle);\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget and handle nodes to the parent.\n    this.parent!.node.appendChild(widget.node);\n    this.parent!.node.appendChild(handle);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the item, sizer, and handle for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n    ArrayExt.move(this._handles, fromIndex, toIndex);\n\n    // Post a fit request to the parent to show/hide last handle.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the item, handle, and sizer for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n    let handle = ArrayExt.removeAt(this._handles, index);\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget and handle nodes from the parent.\n    this.parent!.node.removeChild(widget.node);\n    this.parent!.node.removeChild(handle!);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const item = this._items[i];\n    if (item.isHidden) {\n      return;\n    }\n\n    // Fetch the style for the handle.\n    let handleStyle = this._handles[i].style;\n\n    // Update the widget and handle, and advance the relevant edge.\n    if (isHorizontal) {\n      left += this.widgetOffset;\n      item.update(left, top, size, height);\n      left += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${this._spacing}px`;\n      handleStyle.height = `${height}px`;\n    } else {\n      top += this.widgetOffset;\n      item.update(left, top, width, size);\n      top += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${width}px`;\n      handleStyle.height = `${this._spacing}px`;\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Update the handles and track the visible widget count.\n    let nVisible = 0;\n    let lastHandleIndex = -1;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      if (this._items[i].isHidden) {\n        this._handles[i].classList.add('lm-mod-hidden');\n      } else {\n        this._handles[i].classList.remove('lm-mod-hidden');\n        lastHandleIndex = i;\n        nVisible++;\n      }\n    }\n\n    // Hide the handle for the last visible widget.\n    if (lastHandleIndex !== -1) {\n      this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed =\n      this._spacing * Math.max(0, nVisible - 1) +\n      this.widgetOffset * this._items.length;\n\n    // Setup the computed minimum size.\n    let horz = this._orientation === 'horizontal';\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed size limits.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // Prevent resizing unless necessary.\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the stretch factor.\n      sizer.stretch = SplitLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0 && this.widgetOffset === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Set up the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n    let horz = this._orientation === 'horizontal';\n\n    if (nVisible > 0) {\n      // Compute the adjusted layout space.\n      let space: number;\n      if (horz) {\n        // left += this.widgetOffset;\n        space = Math.max(0, width - this._fixed);\n      } else {\n        // top += this.widgetOffset;\n        space = Math.max(0, height - this._fixed);\n      }\n\n      // Scale the size hints if they are normalized.\n      if (this._hasNormedSizes) {\n        for (let sizer of this._sizers) {\n          sizer.sizeHint *= space;\n        }\n        this._hasNormedSizes = false;\n      }\n\n      // Distribute the layout space to the box sizers.\n      let delta = BoxEngine.calc(this._sizers, space);\n\n      // Account for alignment if there is extra layout space.\n      if (delta > 0) {\n        switch (this._alignment) {\n          case 'start':\n            break;\n          case 'center':\n            extra = 0;\n            offset = delta / 2;\n            break;\n          case 'end':\n            extra = 0;\n            offset = delta;\n            break;\n          case 'justify':\n            extra = delta / nVisible;\n            offset = 0;\n            break;\n          default:\n            throw 'unreachable';\n        }\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      const item = this._items[i];\n\n      // Fetch the computed size for the widget.\n      const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n      this.updateItemPosition(\n        i,\n        horz,\n        horz ? left + offset : left,\n        horz ? top : top + offset,\n        height,\n        width,\n        size\n      );\n\n      const fullOffset =\n        this.widgetOffset +\n        (this._handles[i].classList.contains('lm-mod-hidden')\n          ? 0\n          : this._spacing);\n\n      if (horz) {\n        left += size + fullOffset;\n      } else {\n        top += size + fullOffset;\n      }\n    }\n  }\n\n  protected widgetOffset = 0;\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _hasNormedSizes = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _handles: HTMLDivElement[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: SplitLayout.Alignment = 'start';\n  private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n  /**\n   * A type alias for a split layout orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a split layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a split layout.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The orientation of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Orientation}.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a split layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new handle for use with a split layout.\n     *\n     * @returns A new handle element.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * Get the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Create a new box sizer with the given size hint.\n   */\n  export function createSizer(size: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = Math.floor(size);\n    return sizer;\n  }\n\n  /**\n   * Create a new split handle node using the given renderer.\n   */\n  export function createHandle(\n    renderer: SplitLayout.IRenderer\n  ): HTMLDivElement {\n    let handle = renderer.createHandle();\n    handle.style.position = 'absolute';\n    // Do not use size containment to allow the handle to fill the available space\n    handle.style.contain = 'style';\n    return handle;\n  }\n\n  /**\n   * Compute the average size of an array of box sizers.\n   */\n  export function averageSize(sizers: BoxSizer[]): number {\n    return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n  }\n\n  /**\n   * Normalize an array of values.\n   */\n  export function normalize(values: number[]): number[] {\n    let n = values.length;\n    if (n === 0) {\n      return [];\n    }\n    let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n    return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof SplitLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n  /**\n   * Construct a new accordion layout.\n   *\n   * @param options - The options for initializing the layout.\n   *\n   * #### Notes\n   * The default orientation will be vertical.\n   *\n   * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n   */\n  constructor(options: AccordionLayout.IOptions) {\n    super({ ...options, orientation: options.orientation || 'vertical' });\n    this.titleSpace = options.titleSpace || 22;\n  }\n\n  /**\n   * The section title height or width depending on the orientation.\n   */\n  get titleSpace(): number {\n    return this.widgetOffset;\n  }\n  set titleSpace(value: number) {\n    value = Utils.clampDimension(value);\n    if (this.widgetOffset === value) {\n      return;\n    }\n    this.widgetOffset = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return this._titles;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Clear the layout state.\n    this._titles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the accordion layout.\n   */\n  readonly renderer: AccordionLayout.IRenderer;\n\n  public updateTitle(index: number, widget: Widget): void {\n    const oldTitle = this._titles[index];\n    const expanded = oldTitle.classList.contains('lm-mod-expanded');\n    const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n    this._titles[index] = newTitle;\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.replaceChild(newTitle, oldTitle);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (!widget.id) {\n      widget.id = `id-${UUID.uuid4()}`;\n    }\n    super.insertWidget(index, widget);\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    const title = Private.createTitle(this.renderer, widget.title);\n\n    ArrayExt.insert(this._titles, index, title);\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.appendChild(title);\n\n    widget.node.setAttribute('role', 'region');\n    widget.node.setAttribute('aria-labelledby', title.id);\n\n    super.attachWidget(index, widget);\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    ArrayExt.move(this._titles, fromIndex, toIndex);\n    super.moveWidget(fromIndex, toIndex, widget);\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    const title = ArrayExt.removeAt(this._titles, index);\n\n    this.parent!.node.removeChild(title!);\n\n    super.detachWidget(index, widget);\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const titleStyle = this._titles[i].style;\n\n    // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n    titleStyle.top = `${top}px`;\n    titleStyle.left = `${left}px`;\n    titleStyle.height = `${this.widgetOffset}px`;\n    if (isHorizontal) {\n      titleStyle.width = `${height}px`;\n    } else {\n      titleStyle.width = `${width}px`;\n    }\n\n    super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n  }\n\n  private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n  /**\n   * A type alias for a accordion layout orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion layout alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * An options object for initializing a accordion layout.\n   */\n  export interface IOptions extends SplitLayout.IOptions {\n    /**\n     * The renderer to use for the accordion layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The section title height or width depending on the orientation.\n     *\n     * The default is `22`.\n     */\n    titleSpace?: number;\n  }\n\n  /**\n   * A renderer for use with an accordion layout.\n   */\n  export interface IRenderer extends SplitLayout.IRenderer {\n    /**\n     * Common class name for all accordion titles.\n     */\n    readonly titleClassName: string;\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param title - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(title: Title<Widget>): HTMLElement;\n  }\n}\n\nnamespace Private {\n  /**\n   * Create the title HTML element.\n   *\n   * @param renderer Accordion renderer\n   * @param data Widget title\n   * @returns Title HTML element\n   */\n  export function createTitle(\n    renderer: AccordionLayout.IRenderer,\n    data: Title<Widget>,\n    expanded: boolean = true\n  ): HTMLElement {\n    const title = renderer.createSectionTitle(data);\n    title.style.position = 'absolute';\n    title.style.contain = 'strict';\n    title.setAttribute('aria-label', `${data.label} Section`);\n    title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n    title.setAttribute('aria-controls', data.owner.id);\n    if (expanded) {\n      title.classList.add('lm-mod-expanded');\n    }\n    return title;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n  /**\n   * Construct a new panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: Panel.IOptions = {}) {\n    super();\n    this.addClass('lm-Panel');\n    this.layout = Private.createLayout(options);\n  }\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return (this.layout as PanelLayout).widgets;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    (this.layout as PanelLayout).addWidget(widget);\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    (this.layout as PanelLayout).insertWidget(index, widget);\n  }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n  /**\n   * An options object for creating a panel.\n   */\n  export interface IOptions {\n    /**\n     * The panel layout to use for the panel.\n     *\n     * The default is a new `PanelLayout`.\n     */\n    layout?: PanelLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a panel layout for the given panel options.\n   */\n  export function createLayout(options: Panel.IOptions): PanelLayout {\n    return options.layout || new PanelLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n  /**\n   * Construct a new split panel.\n   *\n   * @param options - The options for initializing the split panel.\n   */\n  constructor(options: SplitPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-SplitPanel');\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    super.dispose();\n  }\n\n  /**\n   * Get the layout orientation for the split panel.\n   */\n  get orientation(): SplitPanel.Orientation {\n    return (this.layout as SplitLayout).orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split panel.\n   */\n  set orientation(value: SplitPanel.Orientation) {\n    (this.layout as SplitLayout).orientation = value;\n  }\n\n  /**\n   * Get the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  get alignment(): SplitPanel.Alignment {\n    return (this.layout as SplitLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  set alignment(value: SplitPanel.Alignment) {\n    (this.layout as SplitLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the split panel.\n   */\n  get spacing(): number {\n    return (this.layout as SplitLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split panel.\n   */\n  set spacing(value: number) {\n    (this.layout as SplitLayout).spacing = value;\n  }\n\n  /**\n   * The renderer used by the split panel.\n   */\n  get renderer(): SplitPanel.IRenderer {\n    return (this.layout as SplitLayout).renderer;\n  }\n\n  /**\n   * A signal emitted when a split handle has moved.\n   */\n  get handleMoved(): ISignal<this, void> {\n    return this._handleMoved;\n  }\n\n  /**\n   * A read-only array of the split handles in the panel.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return (this.layout as SplitLayout).handles;\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the panel.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return (this.layout as SplitLayout).relativeSizes();\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the panel.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n  }\n\n  /**\n   * Handle the DOM events for the split panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the `'keydown'` event for the split panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    if (this._pressData) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the split panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the primary button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the target, if any.\n    let layout = this.layout as SplitLayout;\n    let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n      return handle.contains(event.target as HTMLElement);\n    });\n\n    // Bail early if the mouse press was not on a handle.\n    if (index === -1) {\n      return;\n    }\n\n    // Stop the event when a split handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    document.addEventListener('pointerup', this, true);\n    document.addEventListener('pointermove', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset delta for the handle press.\n    let delta: number;\n    let handle = layout.handles[index];\n    let rect = handle.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      delta = event.clientX - rect.left;\n    } else {\n      delta = event.clientY - rect.top;\n    }\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!);\n    this._pressData = { index, delta, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the split panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Stop the event when dragging a split handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let pos: number;\n    let layout = this.layout as SplitLayout;\n    let rect = this.node.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      pos = event.clientX - rect.left - this._pressData!.delta;\n    } else {\n      pos = event.clientY - rect.top - this._pressData!.delta;\n    }\n\n    // Move the handle as close to the desired position as possible.\n    layout.moveHandle(this._pressData!.index, pos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the split panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the primary button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse grab for the split panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Emit the handle moved signal.\n    this._handleMoved.emit();\n\n    // Remove the extra document listeners.\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('pointerup', this, true);\n    document.removeEventListener('pointermove', this, true);\n    document.removeEventListener('contextmenu', this, true);\n  }\n\n  private _handleMoved = new Signal<any, void>(this);\n  private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n  /**\n   * A type alias for a split panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a split panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a split panel renderer.\n   */\n  export type IRenderer = SplitLayout.IRenderer;\n\n  /**\n   * An options object for initializing a split panel.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The layout orientation of the panel.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The split layout to use for the split panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `SplitLayout`.\n     */\n    layout?: SplitLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new handle for use with a split panel.\n     *\n     * @returns A new handle element for a split panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-SplitPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * Get the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return SplitLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    SplitLayout.setStretch(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The index of the pressed handle.\n     */\n    index: number;\n\n    /**\n     * The offset of the press in handle coordinates.\n     */\n    delta: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * Create a split layout for the given panel options.\n   */\n  export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n    return (\n      options.layout ||\n      new SplitLayout({\n        renderer: options.renderer || SplitPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n  /**\n   * Construct a new accordion panel.\n   *\n   * @param options - The options for initializing the accordion panel.\n   *\n   */\n  constructor(options: AccordionPanel.IOptions = {}) {\n    super({ ...options, layout: Private.createLayout(options) });\n    this.addClass('lm-AccordionPanel');\n  }\n\n  /**\n   * The renderer used by the accordion panel.\n   */\n  get renderer(): AccordionPanel.IRenderer {\n    return (this.layout as AccordionLayout).renderer;\n  }\n\n  /**\n   * The section title space.\n   *\n   * This is the height if the panel is vertical and the width if it is\n   * horizontal.\n   */\n  get titleSpace(): number {\n    return (this.layout as AccordionLayout).titleSpace;\n  }\n  set titleSpace(value: number) {\n    (this.layout as AccordionLayout).titleSpace = value;\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return (this.layout as AccordionLayout).titles;\n  }\n\n  /**\n   * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n   */\n  get expansionToggled(): ISignal<this, number> {\n    return this._expansionToggled;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    super.addWidget(widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Collapse the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  collapse(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && !widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Expand the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  expand(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    super.insertWidget(index, widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Handle the DOM events for the accordion panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    super.handleEvent(event);\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._eventKeyDown(event as KeyboardEvent);\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    super.onBeforeAttach(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    super.onAfterDetach(msg);\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<Widget>): void {\n    const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n      return widget.contains(sender.owner);\n    });\n\n    if (index >= 0) {\n      (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n      this.update();\n    }\n  }\n\n  /**\n   * Compute the size of widgets in this panel on the title click event.\n   * On closing, the size of the widget is cached and we will try to expand\n   * the last opened widget.\n   * On opening, we will use the cached size if it is available to restore the\n   * widget.\n   * In both cases, if we can not compute the size of widgets, we will let\n   * `SplitLayout` decide.\n   *\n   * @param index - The index of widget to be opened of closed\n   *\n   * @returns Relative size of widgets in this panel, if this size can\n   * not be computed, return `undefined`\n   */\n  private _computeWidgetSize(index: number): number[] | undefined {\n    const layout = this.layout as AccordionLayout;\n\n    const widget = layout.widgets[index];\n    if (!widget) {\n      return undefined;\n    }\n    const isHidden = widget.isHidden;\n    const widgetSizes = layout.absoluteSizes();\n    const delta = (isHidden ? -1 : 1) * this.spacing;\n    const totalSize = widgetSizes.reduce(\n      (prev: number, curr: number) => prev + curr\n    );\n\n    let newSize = [...widgetSizes];\n\n    if (!isHidden) {\n      // Hide the widget\n      const currentSize = widgetSizes[index];\n\n      this._widgetSizesCache.set(widget, currentSize);\n      newSize[index] = 0;\n\n      const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // All widget are closed, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n\n      newSize[widgetToCollapse] =\n        widgetSizes[widgetToCollapse] + currentSize + delta;\n    } else {\n      // Show the widget\n      const previousSize = this._widgetSizesCache.get(widget);\n      if (!previousSize) {\n        // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n      newSize[index] += previousSize;\n\n      const widgetToCollapse = newSize\n        .map(sz => sz - previousSize > 0)\n        .lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // Can not reduce the size of one widget, reduce all opened widgets\n        // proportionally with its size.\n        newSize.forEach((_, idx) => {\n          if (idx !== index) {\n            newSize[idx] -=\n              (widgetSizes[idx] / totalSize) * (previousSize - delta);\n          }\n        });\n      } else {\n        newSize[widgetToCollapse] -= previousSize - delta;\n      }\n    }\n    return newSize.map(sz => sz / (totalSize + delta));\n  }\n  /**\n   * Handle the `'click'` event for the accordion panel\n   */\n  private _evtClick(event: MouseEvent): void {\n    const target = event.target as HTMLElement | null;\n\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._toggleExpansion(index);\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the accordion panel.\n   */\n  private _eventKeyDown(event: KeyboardEvent): void {\n    if (event.defaultPrevented) {\n      return;\n    }\n\n    const target = event.target as HTMLElement | null;\n    let handled = false;\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        const keyCode = event.keyCode.toString();\n\n        // If Space or Enter is pressed on title, emulate click event\n        if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n          target.click();\n          handled = true;\n        } else if (\n          this.orientation === 'horizontal'\n            ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n            : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n        ) {\n          // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n          const direction =\n            event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n              ? -1\n              : 1;\n          const length = this.titles.length;\n          const newIndex = (index + length + direction) % length;\n\n          this.titles[newIndex].focus();\n          handled = true;\n        } else if (event.key === 'End' || keyCode === '35') {\n          // If End is pressed on title, focus on the last title\n          this.titles[this.titles.length - 1].focus();\n          handled = true;\n        } else if (event.key === 'Home' || keyCode === '36') {\n          // If Home is pressed on title, focus on the first title\n          this.titles[0].focus();\n          handled = true;\n        }\n      }\n\n      if (handled) {\n        event.preventDefault();\n      }\n    }\n  }\n\n  private _toggleExpansion(index: number) {\n    const title = this.titles[index];\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    const newSize = this._computeWidgetSize(index);\n    if (newSize) {\n      this.setRelativeSizes(newSize, false);\n    }\n\n    if (widget.isHidden) {\n      title.classList.add('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'true');\n      widget.show();\n    } else {\n      title.classList.remove('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'false');\n      widget.hide();\n    }\n\n    // Emit the expansion state signal.\n    this._expansionToggled.emit(index);\n  }\n\n  private _widgetSizesCache: WeakMap<Widget, number> = new WeakMap();\n  private _expansionToggled = new Signal<this, number>(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n  /**\n   * A type alias for a accordion panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a accordion panel renderer.\n   */\n  export type IRenderer = AccordionLayout.IRenderer;\n\n  /**\n   * An options object for initializing a accordion panel.\n   */\n  export interface IOptions extends Partial<AccordionLayout.IOptions> {\n    /**\n     * The accordion layout to use for the accordion panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `AccordionLayout`.\n     */\n    layout?: AccordionLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer extends SplitPanel.Renderer implements IRenderer {\n    constructor() {\n      super();\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches any title node in the accordion.\n     */\n    readonly titleClassName = 'lm-AccordionPanel-title';\n\n    /**\n     * Render the collapse indicator for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the collapse indicator.\n     */\n    createCollapseIcon(data: Title<Widget>): HTMLElement {\n      return document.createElement('span');\n    }\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(data: Title<Widget>): HTMLElement {\n      const handle = document.createElement('h3');\n      handle.setAttribute('tabindex', '0');\n      handle.id = this.createTitleKey(data);\n      handle.className = this.titleClassName;\n      for (const aData in data.dataset) {\n        handle.dataset[aData] = data.dataset[aData];\n      }\n\n      const collapser = handle.appendChild(this.createCollapseIcon(data));\n      collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n      const label = handle.appendChild(document.createElement('span'));\n      label.className = 'lm-AccordionPanel-titleLabel';\n      label.textContent = data.label;\n      label.title = data.caption || data.label;\n\n      return handle;\n    }\n\n    /**\n     * Create a unique render key for the title.\n     *\n     * @param data - The data to use for the title.\n     *\n     * @returns The unique render key for the title.\n     *\n     * #### Notes\n     * This method caches the key against the section title the first time\n     * the key is generated.\n     */\n    createTitleKey(data: Title<Widget>): string {\n      let key = this._titleKeys.get(data);\n      if (key === undefined) {\n        key = `title-key-${this._uuid}-${this._titleID++}`;\n        this._titleKeys.set(data, key);\n      }\n      return key;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _titleID = 0;\n    private _titleKeys = new WeakMap<Title<Widget>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n  /**\n   * Create an accordion layout for the given panel options.\n   *\n   * @param options Panel options\n   * @returns Panel layout\n   */\n  export function createLayout(\n    options: AccordionPanel.IOptions\n  ): AccordionLayout {\n    return (\n      options.layout ||\n      new AccordionLayout({\n        renderer: options.renderer || AccordionPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing,\n        titleSpace: options.titleSpace\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n  /**\n   * Construct a new box layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: BoxLayout.IOptions = {}) {\n    super();\n    if (options.direction !== undefined) {\n      this._direction = options.direction;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the layout direction for the box layout.\n   */\n  get direction(): BoxLayout.Direction {\n    return this._direction;\n  }\n\n  /**\n   * Set the layout direction for the box layout.\n   */\n  set direction(value: BoxLayout.Direction) {\n    if (this._direction === value) {\n      return;\n    }\n    this._direction = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['direction'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the box layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['direction'] = this.direction;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Create and add a new sizer for the widget.\n    ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Move the sizer for the widget.\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Remove the sizer for the widget.\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n    // Setup the computed minimum size.\n    let horz = Private.isHorizontal(this._direction);\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the size basis and stretch factor.\n      sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n      sizer.stretch = BoxLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Distribute the layout space and adjust the start position.\n    let delta: number;\n    switch (this._direction) {\n      case 'left-to-right':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        break;\n      case 'top-to-bottom':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        break;\n      case 'right-to-left':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        left += width;\n        break;\n      case 'bottom-to-top':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        top += height;\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Setup the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n\n    // Account for alignment if there is extra layout space.\n    if (delta > 0) {\n      switch (this._alignment) {\n        case 'start':\n          break;\n        case 'center':\n          extra = 0;\n          offset = delta / 2;\n          break;\n        case 'end':\n          extra = 0;\n          offset = delta;\n          break;\n        case 'justify':\n          extra = delta / nVisible;\n          offset = 0;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the computed size for the widget.\n      let size = this._sizers[i].size;\n\n      // Update the widget geometry and advance the relevant edge.\n      switch (this._direction) {\n        case 'left-to-right':\n          item.update(left + offset, top, size + extra, height);\n          left += size + extra + this._spacing;\n          break;\n        case 'top-to-bottom':\n          item.update(left, top + offset, width, size + extra);\n          top += size + extra + this._spacing;\n          break;\n        case 'right-to-left':\n          item.update(left - offset - size - extra, top, size + extra, height);\n          left -= size + extra + this._spacing;\n          break;\n        case 'bottom-to-top':\n          item.update(left, top - offset - size - extra, width, size + extra);\n          top -= size + extra + this._spacing;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n  }\n\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: BoxLayout.Alignment = 'start';\n  private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n  /**\n   * A type alias for a box layout direction.\n   */\n  export type Direction =\n    | 'left-to-right'\n    | 'right-to-left'\n    | 'top-to-bottom'\n    | 'bottom-to-top';\n\n  /**\n   * A type alias for a box layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a box layout.\n   */\n  export interface IOptions {\n    /**\n     * The direction of the layout.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * Get the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n\n  /**\n   * Get the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return Private.sizeBasisProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    Private.sizeBasisProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * The property descriptor for a widget size basis.\n   */\n  export const sizeBasisProperty = new AttachedProperty<Widget, number>({\n    name: 'sizeBasis',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Test whether a direction has horizontal orientation.\n   */\n  export function isHorizontal(dir: BoxLayout.Direction): boolean {\n    return dir === 'left-to-right' || dir === 'right-to-left';\n  }\n\n  /**\n   * Clamp a spacing value to an integer >= 0.\n   */\n  export function clampSpacing(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof BoxLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n  /**\n   * Construct a new box panel.\n   *\n   * @param options - The options for initializing the box panel.\n   */\n  constructor(options: BoxPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-BoxPanel');\n  }\n\n  /**\n   * Get the layout direction for the box panel.\n   */\n  get direction(): BoxPanel.Direction {\n    return (this.layout as BoxLayout).direction;\n  }\n\n  /**\n   * Set the layout direction for the box panel.\n   */\n  set direction(value: BoxPanel.Direction) {\n    (this.layout as BoxLayout).direction = value;\n  }\n\n  /**\n   * Get the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxPanel.Alignment {\n    return (this.layout as BoxLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxPanel.Alignment) {\n    (this.layout as BoxLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the box panel.\n   */\n  get spacing(): number {\n    return (this.layout as BoxLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box panel.\n   */\n  set spacing(value: number) {\n    (this.layout as BoxLayout).spacing = value;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-BoxPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-BoxPanel-child');\n  }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n  /**\n   * A type alias for a box panel direction.\n   */\n  export type Direction = BoxLayout.Direction;\n\n  /**\n   * A type alias for a box panel alignment.\n   */\n  export type Alignment = BoxLayout.Alignment;\n\n  /**\n   * An options object for initializing a box panel.\n   */\n  export interface IOptions {\n    /**\n     * The layout direction of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Direction}.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The box layout to use for the box panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `BoxLayout`.\n     */\n    layout?: BoxLayout;\n  }\n\n  /**\n   * Get the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return BoxLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    BoxLayout.setStretch(widget, value);\n  }\n\n  /**\n   * Get the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return BoxLayout.getSizeBasis(widget);\n  }\n\n  /**\n   * Set the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    BoxLayout.setSizeBasis(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a box layout for the given panel options.\n   */\n  export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n    return options.layout || new BoxLayout(options);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n  /**\n   * Construct a new command palette.\n   *\n   * @param options - The options for initializing the palette.\n   */\n  constructor(options: CommandPalette.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-CommandPalette');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || CommandPalette.defaultRenderer;\n    this.commands.commandChanged.connect(this._onGenericChange, this);\n    this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._items.length = 0;\n    this._results = null;\n    super.dispose();\n  }\n\n  /**\n   * The command registry used by the command palette.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the command palette.\n   */\n  readonly renderer: CommandPalette.IRenderer;\n\n  /**\n   * The command palette search node.\n   *\n   * #### Notes\n   * This is the node which contains the search-related elements.\n   */\n  get searchNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-search'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The command palette input node.\n   *\n   * #### Notes\n   * This is the actual input node for the search area.\n   */\n  get inputNode(): HTMLInputElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-input'\n    )[0] as HTMLInputElement;\n  }\n\n  /**\n   * The command palette content node.\n   *\n   * #### Notes\n   * This is the node which holds the command item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * A read-only array of the command items in the palette.\n   */\n  get items(): ReadonlyArray<CommandPalette.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Add a command item to the command palette.\n   *\n   * @param options - The options for creating the command item.\n   *\n   * @returns The command item added to the palette.\n   */\n  addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n    // Create a new command item for the options.\n    let item = Private.createItem(this.commands, options);\n\n    // Add the item to the array.\n    this._items.push(item);\n\n    // Refresh the search results.\n    this.refresh();\n\n    // Return the item added to the palette.\n    return item;\n  }\n\n  /**\n   * Adds command items to the command palette.\n   *\n   * @param items - An array of options for creating each command item.\n   *\n   * @returns The command items added to the palette.\n   */\n  addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n    const newItems = items.map(item => Private.createItem(this.commands, item));\n    newItems.forEach(item => this._items.push(item));\n    this.refresh();\n    return newItems;\n  }\n\n  /**\n   * Remove an item from the command palette.\n   *\n   * @param item - The item to remove from the palette.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the palette.\n   */\n  removeItem(item: CommandPalette.IItem): void {\n    this.removeItemAt(this._items.indexOf(item));\n  }\n\n  /**\n   * Remove the item at a given index from the command palette.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Remove all items from the command palette.\n   */\n  clearItems(): void {\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the array of items.\n    this._items.length = 0;\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Clear the search results and schedule an update.\n   *\n   * #### Notes\n   * This should be called whenever the search results of the palette\n   * should be updated.\n   *\n   * This is typically called automatically by the palette as needed,\n   * but can be called manually if the input text is programatically\n   * changed.\n   *\n   * The rendered results are updated asynchronously.\n   */\n  refresh(): void {\n    this._results = null;\n    if (this.inputNode.value !== '') {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'inherit';\n    } else {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'none';\n    }\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the command palette.\n   *\n   * @param event - The DOM event sent to the command palette.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the command palette's DOM node.\n   * It should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'input':\n        this.refresh();\n        break;\n      case 'focus':\n      case 'blur':\n        this._toggleFocused();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('input', this);\n    this.node.addEventListener('focus', this, true);\n    this.node.addEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('input', this);\n    this.node.removeEventListener('focus', this, true);\n    this.node.removeEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   */\n  protected onAfterShow(msg: Message): void {\n    this.update();\n    super.onAfterShow(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      let input = this.inputNode;\n      input.focus();\n      input.select();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (!this.isVisible) {\n      // Ensure to clear the content if the widget is hidden\n      VirtualDOM.render(null, this.contentNode);\n      return;\n    }\n\n    // Fetch the current query text and content node.\n    let query = this.inputNode.value;\n    let contentNode = this.contentNode;\n\n    // Ensure the search results are generated.\n    let results = this._results;\n    if (!results) {\n      // Generate and store the new search results.\n      results = this._results = Private.search(this._items, query);\n\n      // Reset the active index.\n      this._activeIndex = query\n        ? ArrayExt.findFirstIndex(results, Private.canActivate)\n        : -1;\n    }\n\n    // If there is no query and no results, clear the content.\n    if (!query && results.length === 0) {\n      VirtualDOM.render(null, contentNode);\n      return;\n    }\n\n    // If the is a query but no results, render the empty message.\n    if (query && results.length === 0) {\n      let content = this.renderer.renderEmptyMessage({ query });\n      VirtualDOM.render(content, contentNode);\n      return;\n    }\n\n    // Create the render content for the search results.\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let content = new Array<VirtualElement>(results.length);\n    for (let i = 0, n = results.length; i < n; ++i) {\n      let result = results[i];\n      if (result.type === 'header') {\n        let indices = result.indices;\n        let category = result.category;\n        content[i] = renderer.renderHeader({ category, indices });\n      } else {\n        let item = result.item;\n        let indices = result.indices;\n        let active = i === activeIndex;\n        content[i] = renderer.renderItem({ item, indices, active });\n      }\n    }\n\n    // Render the search result content.\n    VirtualDOM.render(content, contentNode);\n\n    // Adjust the scroll position as needed.\n    if (activeIndex < 0 || activeIndex >= results.length) {\n      contentNode.scrollTop = 0;\n    } else {\n      let element = contentNode.children[activeIndex];\n      ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n    }\n  }\n\n  /**\n   * Handle the `'click'` event for the command palette.\n   */\n  private _evtClick(event: MouseEvent): void {\n    // Bail if the click is not the left button.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Clear input if the target is clear button\n    if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n      this.inputNode.value = '';\n      this.refresh();\n      return;\n    }\n\n    // Find the index of the item which was clicked.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return node.contains(event.target as HTMLElement);\n    });\n\n    // Bail if the click was not on an item.\n    if (index === -1) {\n      return;\n    }\n\n    // Kill the event when a content item is clicked.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Execute the item if possible.\n    this._execute(index);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the command palette.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n      return;\n    }\n    switch (event.keyCode) {\n      case 13: // Enter\n        event.preventDefault();\n        event.stopPropagation();\n        this._execute(this._activeIndex);\n        break;\n      case 38: // Up Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activatePreviousItem();\n        break;\n      case 40: // Down Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activateNextItem();\n        break;\n    }\n  }\n\n  /**\n   * Activate the next enabled command item.\n   */\n  private _activateNextItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the next enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this._activeIndex = ArrayExt.findFirstIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Activate the previous enabled command item.\n   */\n  private _activatePreviousItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the previous enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this._activeIndex = ArrayExt.findLastIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Execute the command item at the given index, if possible.\n   */\n  private _execute(index: number): void {\n    // Bail if there are no search results.\n    if (!this._results) {\n      return;\n    }\n\n    // Bail if the index is out of range.\n    let part = this._results[index];\n    if (!part) {\n      return;\n    }\n\n    // Update the search text if the item is a header.\n    if (part.type === 'header') {\n      let input = this.inputNode;\n      input.value = `${part.category.toLowerCase()} `;\n      input.focus();\n      this.refresh();\n      return;\n    }\n\n    // Bail if item is not enabled.\n    if (!part.item.isEnabled) {\n      return;\n    }\n\n    // Execute the item.\n    this.commands.execute(part.item.command, part.item.args);\n\n    // Clear the query text.\n    this.inputNode.value = '';\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Toggle the focused modifier based on the input node focus state.\n   */\n  private _toggleFocused(): void {\n    let focused = document.activeElement === this.inputNode;\n    this.toggleClass('lm-mod-focused', focused);\n  }\n\n  /**\n   * A signal handler for generic command changes.\n   */\n  private _onGenericChange(): void {\n    this.refresh();\n  }\n\n  private _activeIndex = -1;\n  private _items: CommandPalette.IItem[] = [];\n  private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n  /**\n   * An options object for creating a command palette.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the command palette.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the command palette.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for creating a command item.\n   */\n  export interface IItemOptions {\n    /**\n     * The category for the item.\n     */\n    category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    command: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     *\n     * The rank is used as a tie-breaker when ordering command items\n     * for display. Items are sorted in the following order:\n     *   1. Text match (lower is better)\n     *   2. Category (locale order)\n     *   3. Rank (lower is better)\n     *   4. Label (locale order)\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n\n  /**\n   * An object which represents an item in a command palette.\n   *\n   * #### Notes\n   * Item objects are created automatically by a command palette.\n   */\n  export interface IItem {\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    readonly label: string;\n\n    /**\n     * The display caption for the command item.\n     */\n    readonly caption: string;\n\n    /**\n     * The icon renderer for the command item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the command item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the command item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The extra class name for the command item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the command item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the command item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the command item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    readonly isToggleable: boolean;\n\n    /**\n     * Whether the command item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the command item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * The render data for a command palette header.\n   */\n  export interface IHeaderRenderData {\n    /**\n     * The category of the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched characters in the category.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * The render data for a command palette item.\n   */\n  export interface IItemRenderData {\n    /**\n     * The command palette item to render.\n     */\n    readonly item: IItem;\n\n    /**\n     * The indices of the matched characters in the label.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n  }\n\n  /**\n   * The render data for a command palette empty message.\n   */\n  export interface IEmptyMessageRenderData {\n    /**\n     * The query which failed to match any commands.\n     */\n    query: string;\n  }\n\n  /**\n   * A renderer for use with a command palette.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement;\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     *\n     * #### Notes\n     * The command palette will not render invisible items.\n     */\n    renderItem(data: IItemRenderData): VirtualElement;\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement {\n      let content = this.formatHeader(data);\n      return h.li({ className: 'lm-CommandPalette-header' }, content);\n    }\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IItemRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      if (data.item.isToggleable) {\n        return h.li(\n          {\n            className,\n            dataset,\n            role: 'menuitemcheckbox',\n            'aria-checked': `${data.item.isToggled}`\n          },\n          this.renderItemIcon(data),\n          this.renderItemContent(data),\n          this.renderItemShortcut(data)\n        );\n      }\n      return h.li(\n        {\n          className,\n          dataset,\n          role: 'menuitem'\n        },\n        this.renderItemIcon(data),\n        this.renderItemContent(data),\n        this.renderItemShortcut(data)\n      );\n    }\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n      let content = this.formatEmptyMessage(data);\n      return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n    }\n\n    /**\n     * Render the icon for a command palette item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the icon.\n     */\n    renderItemIcon(data: IItemRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the content for a command palette item.\n     *\n     * @param data - The data to use for rendering the content.\n     *\n     * @returns A virtual element representing the content.\n     */\n    renderItemContent(data: IItemRenderData): VirtualElement {\n      return h.div(\n        { className: 'lm-CommandPalette-itemContent' },\n        this.renderItemLabel(data),\n        this.renderItemCaption(data)\n      );\n    }\n\n    /**\n     * Render the label for a command palette item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the label.\n     */\n    renderItemLabel(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemLabel(data);\n      return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n    }\n\n    /**\n     * Render the caption for a command palette item.\n     *\n     * @param data - The data to use for rendering the caption.\n     *\n     * @returns A virtual element representing the caption.\n     */\n    renderItemCaption(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemCaption(data);\n      return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n    }\n\n    /**\n     * Render the shortcut for a command palette item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the shortcut.\n     */\n    renderItemShortcut(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemShortcut(data);\n      return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n    }\n\n    /**\n     * Create the class name for the command palette item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the command palette item.\n     */\n    createItemClass(data: IItemRenderData): string {\n      // Set up the initial class name.\n      let name = 'lm-CommandPalette-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the command palette item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the command palette item.\n     */\n    createItemDataset(data: IItemRenderData): ElementDataset {\n      return { ...data.item.dataset, command: data.item.command };\n    }\n\n    /**\n     * Create the class name for the command item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IItemRenderData): string {\n      let name = 'lm-CommandPalette-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the header node.\n     *\n     * @param data - The data to use for the header content.\n     *\n     * @returns The content to add to the header node.\n     */\n    formatHeader(data: IHeaderRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.category;\n      }\n      return StringExt.highlight(data.category, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the empty message node.\n     *\n     * @param data - The data to use for the empty message content.\n     *\n     * @returns The content to add to the empty message node.\n     */\n    formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n      return `No commands found that match '${data.query}'`;\n    }\n\n    /**\n     * Create the render content for the item shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatItemShortcut(data: IItemRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n\n    /**\n     * Create the render content for the item label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatItemLabel(data: IItemRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.item.label;\n      }\n      return StringExt.highlight(data.item.label, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the item caption node.\n     *\n     * @param data - The data to use for the caption content.\n     *\n     * @returns The content to add to the caption node.\n     */\n    formatItemCaption(data: IItemRenderData): h.Child {\n      return data.item.caption;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a command palette.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let search = document.createElement('div');\n    let wrapper = document.createElement('div');\n    let input = document.createElement('input');\n    let content = document.createElement('ul');\n    let clear = document.createElement('button');\n    search.className = 'lm-CommandPalette-search';\n    wrapper.className = 'lm-CommandPalette-wrapper';\n    input.className = 'lm-CommandPalette-input';\n    clear.className = 'lm-close-icon';\n\n    content.className = 'lm-CommandPalette-content';\n    content.setAttribute('role', 'menu');\n    input.spellcheck = false;\n    wrapper.appendChild(input);\n    wrapper.appendChild(clear);\n    search.appendChild(wrapper);\n    node.appendChild(search);\n    node.appendChild(content);\n    return node;\n  }\n\n  /**\n   * Create a new command item from a command registry and options.\n   */\n  export function createItem(\n    commands: CommandRegistry,\n    options: CommandPalette.IItemOptions\n  ): CommandPalette.IItem {\n    return new CommandItem(commands, options);\n  }\n\n  /**\n   * A search result object for a header label.\n   */\n  export interface IHeaderResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'header';\n\n    /**\n     * The category for the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A search result object for a command item.\n   */\n  export interface IItemResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'item';\n\n    /**\n     * The command item which was matched.\n     */\n    readonly item: CommandPalette.IItem;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A type alias for a search result item.\n   */\n  export type SearchResult = IHeaderResult | IItemResult;\n\n  /**\n   * Search an array of command items for fuzzy matches.\n   */\n  export function search(\n    items: CommandPalette.IItem[],\n    query: string\n  ): SearchResult[] {\n    // Fuzzy match the items for the query.\n    let scores = matchItems(items, query);\n\n    // Sort the items based on their score.\n    scores.sort(scoreCmp);\n\n    // Create the results for the search.\n    return createResults(scores);\n  }\n\n  /**\n   * Test whether a result item can be activated.\n   */\n  export function canActivate(result: SearchResult): boolean {\n    return result.type === 'item' && result.item.isEnabled;\n  }\n\n  /**\n   * Normalize a category for a command item.\n   */\n  function normalizeCategory(category: string): string {\n    return category.trim().replace(/\\s+/g, ' ');\n  }\n\n  /**\n   * Normalize the query text for a fuzzy search.\n   */\n  function normalizeQuery(text: string): string {\n    return text.replace(/\\s+/g, '').toLowerCase();\n  }\n\n  /**\n   * An enum of the supported match types.\n   */\n  const enum MatchType {\n    Label,\n    Category,\n    Split,\n    Default\n  }\n\n  /**\n   * A text match score with associated command item.\n   */\n  interface IScore {\n    /**\n     * The numerical type for the text match.\n     */\n    matchType: MatchType;\n\n    /**\n     * The numerical score for the text match.\n     */\n    score: number;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    categoryIndices: number[] | null;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    labelIndices: number[] | null;\n\n    /**\n     * The command item associated with the match.\n     */\n    item: CommandPalette.IItem;\n  }\n\n  /**\n   * Perform a fuzzy match on an array of command items.\n   */\n  function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n    // Normalize the query text to lower case with no whitespace.\n    query = normalizeQuery(query);\n\n    // Create the array to hold the scores.\n    let scores: IScore[] = [];\n\n    // Iterate over the items and match against the query.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Ignore items which are not visible.\n      let item = items[i];\n      if (!item.isVisible) {\n        continue;\n      }\n\n      // If the query is empty, all items are matched by default.\n      if (!query) {\n        scores.push({\n          matchType: MatchType.Default,\n          categoryIndices: null,\n          labelIndices: null,\n          score: 0,\n          item\n        });\n        continue;\n      }\n\n      // Run the fuzzy search for the item and query.\n      let score = fuzzySearch(item, query);\n\n      // Ignore the item if it is not a match.\n      if (!score) {\n        continue;\n      }\n\n      // Penalize disabled items.\n      // TODO - push disabled items all the way down in sort cmp?\n      if (!item.isEnabled) {\n        score.score += 1000;\n      }\n\n      // Add the score to the results.\n      scores.push(score);\n    }\n\n    // Return the final array of scores.\n    return scores;\n  }\n\n  /**\n   * Perform a fuzzy search on a single command item.\n   */\n  function fuzzySearch(\n    item: CommandPalette.IItem,\n    query: string\n  ): IScore | null {\n    // Create the source text to be searched.\n    let category = item.category.toLowerCase();\n    let label = item.label.toLowerCase();\n    let source = `${category} ${label}`;\n\n    // Set up the match score and indices array.\n    let score = Infinity;\n    let indices: number[] | null = null;\n\n    // The regex for search word boundaries\n    let rgx = /\\b\\w/g;\n\n    // Search the source by word boundary.\n    // eslint-disable-next-line no-constant-condition\n    while (true) {\n      // Find the next word boundary in the source.\n      let rgxMatch = rgx.exec(source);\n\n      // Break if there is no more source context.\n      if (!rgxMatch) {\n        break;\n      }\n\n      // Run the string match on the relevant substring.\n      let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n      // Break if there is no match.\n      if (!match) {\n        break;\n      }\n\n      // Update the match if the score is better.\n      if (match.score <= score) {\n        score = match.score;\n        indices = match.indices;\n      }\n    }\n\n    // Bail if there was no match.\n    if (!indices || score === Infinity) {\n      return null;\n    }\n\n    // Compute the pivot index between category and label text.\n    let pivot = category.length + 1;\n\n    // Find the slice index to separate matched indices.\n    let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n    // Extract the matched category and label indices.\n    let categoryIndices = indices.slice(0, j);\n    let labelIndices = indices.slice(j);\n\n    // Adjust the label indices for the pivot offset.\n    for (let i = 0, n = labelIndices.length; i < n; ++i) {\n      labelIndices[i] -= pivot;\n    }\n\n    // Handle a pure label match.\n    if (categoryIndices.length === 0) {\n      return {\n        matchType: MatchType.Label,\n        categoryIndices: null,\n        labelIndices,\n        score,\n        item\n      };\n    }\n\n    // Handle a pure category match.\n    if (labelIndices.length === 0) {\n      return {\n        matchType: MatchType.Category,\n        categoryIndices,\n        labelIndices: null,\n        score,\n        item\n      };\n    }\n\n    // Handle a split match.\n    return {\n      matchType: MatchType.Split,\n      categoryIndices,\n      labelIndices,\n      score,\n      item\n    };\n  }\n\n  /**\n   * A sort comparison function for a match score.\n   */\n  function scoreCmp(a: IScore, b: IScore): number {\n    // First compare based on the match type\n    let m1 = a.matchType - b.matchType;\n    if (m1 !== 0) {\n      return m1;\n    }\n\n    // Otherwise, compare based on the match score.\n    let d1 = a.score - b.score;\n    if (d1 !== 0) {\n      return d1;\n    }\n\n    // Find the match index based on the match type.\n    let i1 = 0;\n    let i2 = 0;\n    switch (a.matchType) {\n      case MatchType.Label:\n        i1 = a.labelIndices![0];\n        i2 = b.labelIndices![0];\n        break;\n      case MatchType.Category:\n      case MatchType.Split:\n        i1 = a.categoryIndices![0];\n        i2 = b.categoryIndices![0];\n        break;\n    }\n\n    // Compare based on the match index.\n    if (i1 !== i2) {\n      return i1 - i2;\n    }\n\n    // Otherwise, compare by category.\n    let d2 = a.item.category.localeCompare(b.item.category);\n    if (d2 !== 0) {\n      return d2;\n    }\n\n    // Otherwise, compare by rank.\n    let r1 = a.item.rank;\n    let r2 = b.item.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity safe\n    }\n\n    // Finally, compare by label.\n    return a.item.label.localeCompare(b.item.label);\n  }\n\n  /**\n   * Create the results from an array of sorted scores.\n   */\n  function createResults(scores: IScore[]): SearchResult[] {\n    // Set up the search results array.\n    let results: SearchResult[] = [];\n\n    // Iterate over each score in the array.\n    for (let i = 0, n = scores.length; i < n; ++i) {\n      // Extract the current item and indices.\n      let { item, categoryIndices, labelIndices } = scores[i];\n\n      // Extract the category for the current item.\n      let category = item.category;\n\n      // Is this the same category as the preceding result?\n      if (i === 0 || category !== scores[i - 1].item.category) {\n        // Add the header result for the category.\n        results.push({ type: 'header', category, indices: categoryIndices });\n      }\n\n      // Create the item result for the score.\n      results.push({ type: 'item', item, indices: labelIndices });\n    }\n\n    // Return the final results.\n    return results;\n  }\n\n  /**\n   * A concrete implementation of `CommandPalette.IItem`.\n   */\n  class CommandItem implements CommandPalette.IItem {\n    /**\n     * Construct a new command item.\n     */\n    constructor(\n      commands: CommandRegistry,\n      options: CommandPalette.IItemOptions\n    ) {\n      this._commands = commands;\n      this.category = normalizeCategory(options.category);\n      this.command = options.command;\n      this.args = options.args || JSONExt.emptyObject;\n      this.rank = options.rank !== undefined ? options.rank : Infinity;\n    }\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    get label(): string {\n      return this._commands.label(this.command, this.args);\n    }\n\n    /**\n     * The icon renderer for the command item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      return this._commands.icon(this.command, this.args);\n    }\n\n    /**\n     * The icon class for the command item.\n     */\n    get iconClass(): string {\n      return this._commands.iconClass(this.command, this.args);\n    }\n\n    /**\n     * The icon label for the command item.\n     */\n    get iconLabel(): string {\n      return this._commands.iconLabel(this.command, this.args);\n    }\n\n    /**\n     * The display caption for the command item.\n     */\n    get caption(): string {\n      return this._commands.caption(this.command, this.args);\n    }\n\n    /**\n     * The extra class name for the command item.\n     */\n    get className(): string {\n      return this._commands.className(this.command, this.args);\n    }\n\n    /**\n     * The dataset for the command item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      return this._commands.dataset(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is enabled.\n     */\n    get isEnabled(): boolean {\n      return this._commands.isEnabled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggled.\n     */\n    get isToggled(): boolean {\n      return this._commands.isToggled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    get isToggleable(): boolean {\n      return this._commands.isToggleable(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is visible.\n     */\n    get isVisible(): boolean {\n      return this._commands.isVisible(this.command, this.args);\n    }\n\n    /**\n     * The key binding for the command item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      let { command, args } = this;\n      return (\n        ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n          return kb.command === command && JSONExt.deepEqual(kb.args, args);\n        }) || null\n      );\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ARIAAttrNames,\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n  pageXOffset: number;\n  pageYOffset: number;\n  clientWidth: number;\n  clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n  /**\n   * Construct a new menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: Menu.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-Menu');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || Menu.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the menu.\n   */\n  dispose(): void {\n    this.close();\n    this._items.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted just before the menu is closed.\n   *\n   * #### Notes\n   * This signal is emitted when the menu receives a `'close-request'`\n   * message, just before it removes itself from the DOM.\n   *\n   * This signal is not emitted if the menu is already detached from\n   * the DOM when it receives the `'close-request'` message.\n   */\n  get aboutToClose(): ISignal<this, void> {\n    return this._aboutToClose;\n  }\n\n  /**\n   * A signal emitted when a new menu is requested by the user.\n   *\n   * #### Notes\n   * This signal is emitted whenever the user presses the right or left\n   * arrow keys, and a submenu cannot be opened or closed in response.\n   *\n   * This signal is useful when implementing menu bars in order to open\n   * the next or previous menu in response to a user key press.\n   *\n   * This signal is only emitted for the root menu in a hierarchy.\n   */\n  get menuRequested(): ISignal<this, 'next' | 'previous'> {\n    return this._menuRequested;\n  }\n\n  /**\n   * The command registry used by the menu.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the menu.\n   */\n  readonly renderer: Menu.IRenderer;\n\n  /**\n   * The parent menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu is an open submenu.\n   */\n  get parentMenu(): Menu | null {\n    return this._parentMenu;\n  }\n\n  /**\n   * The child menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu has an open submenu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The root menu of the menu hierarchy.\n   */\n  get rootMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._parentMenu) {\n      menu = menu._parentMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The leaf menu of the menu hierarchy.\n   */\n  get leafMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._childMenu) {\n      menu = menu._childMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The menu content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-Menu-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu item.\n   */\n  get activeItem(): Menu.IItem | null {\n    return this._items[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the item will be set to `null`.\n   */\n  set activeItem(value: Menu.IItem | null) {\n    this.activeIndex = value ? this._items.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu item.\n   *\n   * #### Notes\n   * This will be `-1` if no menu item is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._items.length) {\n      value = -1;\n    }\n\n    // Ensure the item can be activated.\n    if (value !== -1 && !Private.canActivate(this._items[value])) {\n      value = -1;\n    }\n\n    // Bail if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Make active element in focus\n    if (\n      this._activeIndex >= 0 &&\n      this.contentNode.childNodes[this._activeIndex]\n    ) {\n      (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n    }\n\n    // schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menu items in the menu.\n   */\n  get items(): ReadonlyArray<Menu.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Activate the next selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activateNextItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this.activeIndex = ArrayExt.findFirstIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Activate the previous selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activatePreviousItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this.activeIndex = ArrayExt.findLastIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Trigger the active menu item.\n   *\n   * #### Notes\n   * If the active item is a submenu, it will be opened and the first\n   * item will be activated.\n   *\n   * If the active item is a command, the command will be executed.\n   *\n   * If the menu is not attached, this is a no-op.\n   *\n   * If there is no active item, this is a no-op.\n   */\n  triggerActiveItem(): void {\n    // Bail if the menu is not attached.\n    if (!this.isAttached) {\n      return;\n    }\n\n    // Bail if there is no active item.\n    let item = this.activeItem;\n    if (!item) {\n      return;\n    }\n\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // If the item is a submenu, open it.\n    if (item.type === 'submenu') {\n      this._openChildMenu(true);\n      return;\n    }\n\n    // Close the root menu before executing the command.\n    this.rootMenu.close();\n\n    // Execute the command for the item.\n    let { command, args } = item;\n    if (this.commands.isEnabled(command, args)) {\n      this.commands.execute(command, args);\n    } else {\n      console.log(`Command '${command}' is disabled.`);\n    }\n  }\n\n  /**\n   * Add a menu item to the end of the menu.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   */\n  addItem(options: Menu.IItemOptions): Menu.IItem {\n    return this.insertItem(this._items.length, options);\n  }\n\n  /**\n   * Insert a menu item into the menu at the specified index.\n   *\n   * @param index - The index at which to insert the item.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the items.\n   */\n  insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Clamp the insert index to the array bounds.\n    let i = Math.max(0, Math.min(index, this._items.length));\n\n    // Create the item for the options.\n    let item = Private.createItem(this, options);\n\n    // Insert the item into the array.\n    ArrayExt.insert(this._items, i, item);\n\n    // Schedule an update of the items.\n    this.update();\n\n    // Return the item added to the menu.\n    return item;\n  }\n\n  /**\n   * Remove an item from the menu.\n   *\n   * @param item - The item to remove from the menu.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the menu.\n   */\n  removeItem(item: Menu.IItem): void {\n    let index = this._items.indexOf(item);\n    if (index === -1) {\n      return;\n    }\n    this.removeItemAt(index);\n  }\n\n  /**\n   * Remove the item at a given index from the menu.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Remove all menu items from the menu.\n   */\n  clearItems(): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the items.\n    this._items.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Open the menu at the specified location.\n   *\n   * @param x - The client X coordinate of the menu location.\n   *\n   * @param y - The client Y coordinate of the menu location.\n   *\n   * @param options - The additional options for opening the menu.\n   *\n   * #### Notes\n   * The menu will be opened at the given location unless it will not\n   * fully fit on the screen. If it will not fit, it will be adjusted\n   * to fit naturally on the screen.\n   *\n   * The menu will be attached under the `host` element in the DOM\n   * (or `document.body` if `host` is `null`) and before the `ref`\n   * element (or as the last child of `host` if `ref` is `null`).\n   * The menu may be displayed outside of the `host` element\n   * following the rules of CSS absolute positioning.\n   *\n   * This is a no-op if the menu is already attached to the DOM.\n   */\n  open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n    // Bail early if the menu is already attached.\n    if (this.isAttached) {\n      return;\n    }\n\n    // Extract the menu options.\n    let forceX = options.forceX || false;\n    let forceY = options.forceY || false;\n    const host = options.host ?? null;\n    const ref = options.ref ?? null;\n    const horizontalAlignment =\n      options.horizontalAlignment ??\n      (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n    // Open the menu as a root menu.\n    Private.openRootMenu(\n      this,\n      x,\n      y,\n      forceX,\n      forceY,\n      horizontalAlignment,\n      host,\n      ref\n    );\n\n    // Activate the menu to accept keyboard input.\n    this.activate();\n  }\n\n  /**\n   * Handle the DOM events for the menu.\n   *\n   * @param event - The DOM event sent to the menu.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu's DOM nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseenter':\n        this._evtMouseEnter(event as MouseEvent);\n        break;\n      case 'mouseleave':\n        this._evtMouseLeave(event as MouseEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'after-attach'` message.\n   */\n  protected override onAfterAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mouseup', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseenter', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('contextmenu', this);\n    this.node.ownerDocument.addEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'before-detach'` message.\n   */\n  protected override onBeforeDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mouseup', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseenter', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('contextmenu', this);\n    this.node.ownerDocument.removeEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this.node.focus();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let items = this._items;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let collapsedFlags = Private.computeCollapsed(items);\n    let content = new Array<VirtualElement>(items.length);\n    for (let i = 0, n = items.length; i < n; ++i) {\n      let item = items[i];\n      let active = i === activeIndex;\n      let collapsed = collapsedFlags[i];\n      content[i] = renderer.renderItem({\n        item,\n        active,\n        collapsed,\n        onfocus: () => {\n          this.activeIndex = i;\n        }\n      });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   */\n  protected onCloseRequest(msg: Message): void {\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Close any open child menu.\n    let childMenu = this._childMenu;\n    if (childMenu) {\n      this._childIndex = -1;\n      this._childMenu = null;\n      childMenu._parentMenu = null;\n      childMenu.close();\n    }\n\n    // Remove this menu from its parent and activate the parent.\n    let parentMenu = this._parentMenu;\n    if (parentMenu) {\n      this._parentMenu = null;\n      parentMenu._childIndex = -1;\n      parentMenu._childMenu = null;\n      parentMenu.activate();\n    }\n\n    // Emit the `aboutToClose` signal if the menu is attached.\n    if (this.isAttached) {\n      this._aboutToClose.emit(undefined);\n    }\n\n    // Finish closing the menu.\n    super.onCloseRequest(msg);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // A menu handles all keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Enter\n    if (kc === 13) {\n      this.triggerActiveItem();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this.close();\n      return;\n    }\n\n    // Left Arrow\n    if (kc === 37) {\n      if (this._parentMenu) {\n        this.close();\n      } else {\n        this._menuRequested.emit('previous');\n      }\n      return;\n    }\n\n    // Up Arrow\n    if (kc === 38) {\n      this.activatePreviousItem();\n      return;\n    }\n\n    // Right Arrow\n    if (kc === 39) {\n      let item = this.activeItem;\n      if (item && item.type === 'submenu') {\n        this.triggerActiveItem();\n      } else {\n        this.rootMenu._menuRequested.emit('next');\n      }\n      return;\n    }\n\n    // Down Arrow\n    if (kc === 40) {\n      this.activateNextItem();\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._items, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that item is triggered.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.triggerActiveItem();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n    }\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    if (event.button !== 0) {\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n    this.triggerActiveItem();\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Hit test the item nodes for the item under the mouse.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the mouse is already over the active index.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Update and coerce the active index.\n    this.activeIndex = index;\n    index = this.activeIndex;\n\n    // If the index is the current child index, cancel the timers.\n    if (index === this._childIndex) {\n      this._cancelOpenTimer();\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // If a child menu is currently open, start the close timer.\n    if (this._childIndex !== -1) {\n      this._startCloseTimer();\n    }\n\n    // Cancel the open timer to give a full delay for opening.\n    this._cancelOpenTimer();\n\n    // Bail if the active item is not a valid submenu item.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      return;\n    }\n\n    // Start the open timer to open the active item submenu.\n    this._startOpenTimer();\n  }\n\n  /**\n   * Handle the `'mouseenter'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseEnter(event: MouseEvent): void {\n    // Synchronize the active ancestor items.\n    for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n      menu._cancelOpenTimer();\n      menu._cancelCloseTimer();\n      menu.activeIndex = menu._childIndex;\n    }\n  }\n\n  /**\n   * Handle the `'mouseleave'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseLeave(event: MouseEvent): void {\n    // Cancel any pending submenu opening.\n    this._cancelOpenTimer();\n\n    // If there is no open child menu, just reset the active index.\n    if (!this._childMenu) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // If the mouse is over the child menu, cancel the close timer.\n    let { clientX, clientY } = event;\n    if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // Otherwise, reset the active index and start the close timer.\n    this.activeIndex = -1;\n    this._startCloseTimer();\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the document node.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the menu is not a root menu.\n    if (this._parentMenu) {\n      return;\n    }\n\n    // The mouse button which is pressed is irrelevant. If the press\n    // is not on a menu, the entire hierarchy is closed and the event\n    // is allowed to propagate. This allows other code to act on the\n    // event, such as focusing the clicked element.\n    if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n      event.preventDefault();\n      event.stopPropagation();\n    } else {\n      this.close();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if the active item is not a valid submenu.\n   */\n  private _openChildMenu(activateFirst = false): void {\n    // If the item is not a valid submenu, close the child menu.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Do nothing if the child menu will not change.\n    let submenu = item.submenu;\n    if (submenu === this._childMenu) {\n      return;\n    }\n\n    // Prior to any DOM modifications save window data\n    Menu.saveWindowData();\n\n    // Ensure the current child menu is closed.\n    this._closeChildMenu();\n\n    // Update the private child state.\n    this._childMenu = submenu;\n    this._childIndex = this._activeIndex;\n\n    // Set the parent menu reference for the child.\n    submenu._parentMenu = this;\n\n    // Ensure the menu is updated and lookup the item node.\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    let itemNode = this.contentNode.children[this._activeIndex];\n\n    // Open the submenu at the active node.\n    Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n    // Activate the first item if desired.\n    if (activateFirst) {\n      submenu.activeIndex = -1;\n      submenu.activateNextItem();\n    }\n\n    // Activate the child menu.\n    submenu.activate();\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    if (this._childMenu) {\n      this._childMenu.close();\n    }\n  }\n\n  /**\n   * Start the open timer, unless it is already pending.\n   */\n  private _startOpenTimer(): void {\n    if (this._openTimerID === 0) {\n      this._openTimerID = window.setTimeout(() => {\n        this._openTimerID = 0;\n        this._openChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Start the close timer, unless it is already pending.\n   */\n  private _startCloseTimer(): void {\n    if (this._closeTimerID === 0) {\n      this._closeTimerID = window.setTimeout(() => {\n        this._closeTimerID = 0;\n        this._closeChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Cancel the open timer, if the timer is pending.\n   */\n  private _cancelOpenTimer(): void {\n    if (this._openTimerID !== 0) {\n      clearTimeout(this._openTimerID);\n      this._openTimerID = 0;\n    }\n  }\n\n  /**\n   * Cancel the close timer, if the timer is pending.\n   */\n  private _cancelCloseTimer(): void {\n    if (this._closeTimerID !== 0) {\n      clearTimeout(this._closeTimerID);\n      this._closeTimerID = 0;\n    }\n  }\n\n  /**\n   * Save window data used for menu positioning in transient cache.\n   *\n   * In order to avoid layout trashing it is recommended to invoke this\n   * method immediately prior to opening the menu and any DOM modifications\n   * (like closing previously visible menu, or adding a class to menu widget).\n   *\n   * The transient cache will be released upon `open()` call.\n   */\n  static saveWindowData(): void {\n    Private.saveWindowData();\n  }\n\n  private _childIndex = -1;\n  private _activeIndex = -1;\n  private _openTimerID = 0;\n  private _closeTimerID = 0;\n  private _items: Menu.IItem[] = [];\n  private _childMenu: Menu | null = null;\n  private _parentMenu: Menu | null = null;\n  private _aboutToClose = new Signal<this, void>(this);\n  private _menuRequested = new Signal<this, 'next' | 'previous'>(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n  /**\n   * An options object for creating a menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the menu.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for the `open` method on a menu.\n   */\n  export interface IOpenOptions {\n    /**\n     * Whether to force the X position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * X coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceX?: boolean;\n\n    /**\n     * Whether to force the Y position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * Y coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceY?: boolean;\n\n    /**\n     * The DOM node to use as the menu's host.\n     *\n     * If not specified then uses `document.body`.\n     */\n    host?: HTMLElement;\n\n    /**\n     * The child of `host` to use as the reference element.\n     * If this is provided, the menu will be inserted before this\n     * node in the host. The default is `null`, which will cause the\n     * menu to be added as the last child of the host.\n     */\n    ref?: HTMLElement;\n\n    /**\n     * The alignment of the menu.\n     *\n     * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n     */\n    horizontalAlignment?: 'left' | 'right';\n  }\n\n  /**\n   * A type alias for a menu item type.\n   */\n  export type ItemType = 'command' | 'submenu' | 'separator';\n\n  /**\n   * An options object for creating a menu item.\n   */\n  export interface IItemOptions {\n    /**\n     * The type of the menu item.\n     *\n     * The default value is `'command'`.\n     */\n    type?: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     *\n     * The default value is an empty string.\n     */\n    command?: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     *\n     * The default value is `null`.\n     */\n    submenu?: Menu | null;\n  }\n\n  /**\n   * An object which represents a menu item.\n   *\n   * #### Notes\n   * Item objects are created automatically by a menu.\n   */\n  export interface IItem {\n    /**\n     * The type of the menu item.\n     */\n    readonly type: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    readonly label: string;\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    readonly mnemonic: number;\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the menu item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the menu item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The display caption for the menu item.\n     */\n    readonly caption: string;\n\n    /**\n     * The extra class name for the menu item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the menu item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the menu item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the menu item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * An object which holds the data to render a menu item.\n   */\n  export interface IRenderData {\n    /**\n     * The item to be rendered.\n     */\n    readonly item: IItem;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the item should be collapsed.\n     */\n    readonly collapsed: boolean;\n\n    /**\n     * Handler for when element is in focus.\n     */\n    readonly onfocus?: () => void;\n  }\n\n  /**\n   * A renderer for use with a menu.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          tabindex: '0',\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data),\n        this.renderShortcut(data),\n        this.renderSubmenu(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-Menu-itemLabel' }, content);\n    }\n\n    /**\n     * Render the shortcut element for a menu item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the item shortcut.\n     */\n    renderShortcut(data: IRenderData): VirtualElement {\n      let content = this.formatShortcut(data);\n      return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n    }\n\n    /**\n     * Render the submenu icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the submenu icon.\n     *\n     * @returns A virtual element representing the submenu icon.\n     */\n    renderSubmenu(data: IRenderData): VirtualElement {\n      return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n    }\n\n    /**\n     * Create the class name for the menu item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      // Setup the initial class name.\n      let name = 'lm-Menu-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (!data.item.isVisible) {\n        name += ' lm-mod-hidden';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n      if (data.collapsed) {\n        name += ' lm-mod-collapsed';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the menu item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the menu item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      let result: ElementDataset;\n      let { type, command, dataset } = data.item;\n      if (type === 'command') {\n        result = { ...dataset, type, command };\n      } else {\n        result = { ...dataset, type };\n      }\n      return result;\n    }\n\n    /**\n     * Create the class name for the menu item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-Menu-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the aria attributes for menu item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      let aria: { [T in ARIAAttrNames]?: string } = {};\n      switch (data.item.type) {\n        case 'separator':\n          aria.role = 'presentation';\n          break;\n        case 'submenu':\n          aria['aria-haspopup'] = 'true';\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          break;\n        default:\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          if (data.item.isToggled) {\n            aria.role = 'menuitemcheckbox';\n            aria['aria-checked'] = 'true';\n          } else {\n            aria.role = 'menuitem';\n          }\n      }\n      return aria;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.item;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n\n    /**\n     * Create the render content for the shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatShortcut(data: IRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The ms delay for opening and closing a submenu.\n   */\n  export const TIMER_DELAY = 300;\n\n  /**\n   * The horizontal pixel overlap for an open submenu.\n   */\n  export const SUBMENU_OVERLAP = 3;\n\n  function getWindowData(element: HTMLElement): IWindowData {\n\n    return _getWindowData(element);\n  }\n\n  /**\n   * Store window data in transient cache.\n   *\n   * The transient cache will be released upon `getWindowData()` call.\n   * If this function is called multiple times, the cache will be\n   * retained until as many calls to `getWindowData()` were made.\n   *\n   * Note: should be called before any DOM modifications.\n   */\n  export function saveWindowData(): void {\n  }\n\n  /**\n   * Create the DOM node for a menu.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-Menu-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menu');\n    node.tabIndex = 0;\n    return node;\n  }\n\n  /**\n   * Test whether a menu item can be activated.\n   */\n  export function canActivate(item: Menu.IItem): boolean {\n    return item.type !== 'separator' && item.isEnabled && item.isVisible;\n  }\n\n  /**\n   * Create a new menu item for an owner menu.\n   */\n  export function createItem(\n    owner: Menu,\n    options: Menu.IItemOptions\n  ): Menu.IItem {\n    return new MenuItem(owner.commands, options);\n  }\n\n  /**\n   * Hit test a menu hierarchy starting at the given root.\n   */\n  export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n    for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n      if (ElementExt.hitTest(temp.node, x, y)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Compute which extra separator items should be collapsed.\n   */\n  export function computeCollapsed(\n    items: ReadonlyArray<Menu.IItem>\n  ): boolean[] {\n    // Allocate the return array and fill it with `false`.\n    let result = new Array<boolean>(items.length);\n    ArrayExt.fill(result, false);\n\n    // Collapse the leading separators.\n    let k1 = 0;\n    let n = items.length;\n    for (; k1 < n; ++k1) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k1] = true;\n    }\n\n    // Hide the trailing separators.\n    let k2 = n - 1;\n    for (; k2 >= 0; --k2) {\n      let item = items[k2];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k2] = true;\n    }\n\n    // Hide the remaining consecutive separators.\n    let hide = false;\n    while (++k1 < k2) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        hide = false;\n      } else if (hide) {\n        result[k1] = true;\n      } else {\n        hide = true;\n      }\n    }\n\n    // Return the resulting flags.\n    return result;\n  }\n\n  function _getWindowData(element: HTMLElement): IWindowData {\n    return {\n      pageXOffset: element.ownerDocument.defaultView?.window.scrollX || 0,\n      pageYOffset: element.ownerDocument.defaultView?.window.scrollY || 0,\n      clientWidth: element.ownerDocument.documentElement.clientWidth,\n      clientHeight: element.ownerDocument.documentElement.clientHeight\n    };\n  }\n\n  /**\n   * Open a menu as a root menu at the target location.\n   */\n  export function openRootMenu(\n    menu: Menu,\n    x: number,\n    y: number,\n    forceX: boolean,\n    forceY: boolean,\n    horizontalAlignment: 'left' | 'right',\n    host: HTMLElement | null,\n    ref: HTMLElement | null\n  ): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData(host || menu.node);\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before attaching and measuring.\n    MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch - (forceY ? y : 0);\n\n    // Fetch common variables.\n    let node = menu.node;\n    let style = node.style;\n    style.top = '0';\n    style.left = '0';\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(menu, host || document.body, ref);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // align the menu to the right of the target if requested or language is RTL\n    if (horizontalAlignment === 'right') {\n      x -= width;\n    }\n\n    // Adjust the X position of the menu to fit on-screen.\n    if (!forceX && x + width > px + cw) {\n      x = px + cw - width;\n    }\n\n    // Adjust the Y position of the menu to fit on-screen.\n    if (!forceY && y + height > py + ch) {\n      if (y > py + ch) {\n        y = py + ch - height;\n      } else {\n        y = y - height;\n      }\n    }\n\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * Open a menu as a submenu using an item node for positioning.\n   */\n  export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData(itemNode);\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before opening.\n    MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch;\n\n    // Fetch common variables.\n    let node = submenu.node;\n    let style = node.style;\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(submenu, itemNode.ownerDocument.body);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // Compute the box sizing for the menu.\n    let box = ElementExt.boxSizing(submenu.node);\n\n    // Get the bounding rect for the target item node.\n    let itemRect = itemNode.getBoundingClientRect();\n\n    // Compute the target X position.\n    let x = itemRect.right - SUBMENU_OVERLAP;\n\n    // Adjust the X position to fit on the screen.\n    if (x + width > px + cw) {\n      x = itemRect.left + SUBMENU_OVERLAP - width;\n    }\n\n    // Compute the target Y position.\n    let y = itemRect.top - box.borderTop - box.paddingTop;\n\n    // Adjust the Y position to fit on the screen.\n    if (y + height > py + ch) {\n      y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n    }\n\n    style.top = '0';\n    style.left = '0';\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    items: ReadonlyArray<Menu.IItem>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Lookup the item\n      let item = items[k];\n\n      // Ignore items which cannot be activated.\n      if (!canActivate(item)) {\n        continue;\n      }\n\n      // Ignore items with an empty label.\n      let label = item.label;\n      if (label.length === 0) {\n        continue;\n      }\n\n      // Lookup the mnemonic index for the label.\n      let mn = item.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < label.length) {\n        if (label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n\n  /**\n   * A concrete implementation of `Menu.IItem`.\n   */\n  class MenuItem implements Menu.IItem {\n    /**\n     * Construct a new menu item.\n     */\n    constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n      this._commands = commands;\n      this.type = options.type || 'command';\n      this.command = options.command || '';\n      this.args = options.args || JSONExt.emptyObject;\n      this.submenu = options.submenu || null;\n    }\n\n    /**\n     * The type of the menu item.\n     */\n    readonly type: Menu.ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    get label(): string {\n      if (this.type === 'command') {\n        return this._commands.label(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.label;\n      }\n      return '';\n    }\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    get mnemonic(): number {\n      if (this.type === 'command') {\n        return this._commands.mnemonic(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.mnemonic;\n      }\n      return -1;\n    }\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      if (this.type === 'command') {\n        return this._commands.icon(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.icon;\n      }\n      return undefined;\n    }\n\n    /**\n     * The icon class for the menu item.\n     */\n    get iconClass(): string {\n      if (this.type === 'command') {\n        return this._commands.iconClass(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconClass;\n      }\n      return '';\n    }\n\n    /**\n     * The icon label for the menu item.\n     */\n    get iconLabel(): string {\n      if (this.type === 'command') {\n        return this._commands.iconLabel(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconLabel;\n      }\n      return '';\n    }\n\n    /**\n     * The display caption for the menu item.\n     */\n    get caption(): string {\n      if (this.type === 'command') {\n        return this._commands.caption(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.caption;\n      }\n      return '';\n    }\n\n    /**\n     * The extra class name for the menu item.\n     */\n    get className(): string {\n      if (this.type === 'command') {\n        return this._commands.className(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.className;\n      }\n      return '';\n    }\n\n    /**\n     * The dataset for the menu item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      if (this.type === 'command') {\n        return this._commands.dataset(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.dataset;\n      }\n      return {};\n    }\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    get isEnabled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isEnabled(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    get isToggled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isToggled(this.command, this.args);\n      }\n      return false;\n    }\n\n    /**\n     * Whether the menu item is visible.\n     */\n    get isVisible(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isVisible(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * The key binding for the menu item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      if (this.type === 'command') {\n        let { command, args } = this;\n        return (\n          ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n            return kb.command === command && JSONExt.deepEqual(kb.args, args);\n          }) || null\n        );\n      }\n      return null;\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n  /**\n   * Construct a new context menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: ContextMenu.IOptions) {\n    const { groupByTarget, sortBySelector, ...others } = options;\n    this.menu = new Menu(others);\n    this._groupByTarget = groupByTarget !== false;\n    this._sortBySelector = sortBySelector !== false;\n  }\n\n  /**\n   * The menu widget which displays the matched context items.\n   */\n  readonly menu: Menu;\n\n  /**\n   * Add an item to the context menu.\n   *\n   * @param options - The options for creating the item.\n   *\n   * @returns A disposable which will remove the item from the menu.\n   */\n  addItem(options: ContextMenu.IItemOptions): IDisposable {\n    // Create an item from the given options.\n    let item = Private.createItem(options, this._idTick++);\n\n    // Add the item to the internal array.\n    this._items.push(item);\n\n    // Return a disposable which will remove the item.\n    return new DisposableDelegate(() => {\n      ArrayExt.removeFirstOf(this._items, item);\n    });\n  }\n\n  /**\n   * Open the context menu in response to a `'contextmenu'` event.\n   *\n   * @param event - The `'contextmenu'` event of interest.\n   *\n   * @returns `true` if the menu was opened, or `false` if no items\n   *   matched the event and the menu was not opened.\n   *\n   * #### Notes\n   * This method will populate the context menu with items which match\n   * the propagation path of the event, then open the menu at the mouse\n   * position indicated by the event.\n   */\n  open(event: MouseEvent): boolean {\n    // Prior to any DOM modifications update the window data.\n    Menu.saveWindowData();\n\n    // Clear the current contents of the context menu.\n    this.menu.clearItems();\n\n    // Bail early if there are no items to match.\n    if (this._items.length === 0) {\n      return false;\n    }\n\n    // Find the matching items for the event.\n    let items = Private.matchItems(\n      this._items,\n      event,\n      this._groupByTarget,\n      this._sortBySelector\n    );\n\n    // Bail if there are no matching items.\n    if (!items || items.length === 0) {\n      return false;\n    }\n\n    // Add the filtered items to the menu.\n    for (const item of items) {\n      this.menu.addItem(item);\n    }\n\n    // Open the context menu at the current mouse position.\n    this.menu.open(event.clientX, event.clientY);\n\n    // Indicate success.\n    return true;\n  }\n\n  private _groupByTarget: boolean = true;\n  private _idTick = 0;\n  private _items: Private.IItem[] = [];\n  private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n  /**\n   * An options object for initializing a context menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry to use with the context menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the context menu.\n     */\n    renderer?: Menu.IRenderer;\n\n    /**\n     * Whether to sort by selector and rank or only rank.\n     *\n     * Default true.\n     */\n    sortBySelector?: boolean;\n\n    /**\n     * Whether to group items following the DOM hierarchy.\n     *\n     * Default true.\n     *\n     * #### Note\n     * If true, when the mouse event occurs on element `span` within `div.top`,\n     * the items matching `div.top` will be shown before the ones matching `body`.\n     */\n    groupByTarget?: boolean;\n  }\n\n  /**\n   * An options object for creating a context menu item.\n   */\n  export interface IItemOptions extends Menu.IItemOptions {\n    /**\n     * The CSS selector for the context menu item.\n     *\n     * The context menu item will only be displayed in the context menu\n     * when the selector matches a node on the propagation path of the\n     * contextmenu event. This allows the menu item to be restricted to\n     * user-defined contexts.\n     *\n     * The selector must not contain commas.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     *\n     * The rank is used as a tie-breaker when ordering context menu\n     * items for display. Items are sorted in the following order:\n     *   1. Depth in the DOM tree (deeper is better)\n     *   2. Selector specificity (higher is better)\n     *   3. Rank (lower is better)\n     *   4. Insertion order\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A normalized item for a context menu.\n   */\n  export interface IItem extends Menu.IItemOptions {\n    /**\n     * The selector for the item.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     */\n    rank: number;\n\n    /**\n     * The tie-breaking id for the item.\n     */\n    id: number;\n  }\n\n  /**\n   * Create a normalized context menu item from an options object.\n   */\n  export function createItem(\n    options: ContextMenu.IItemOptions,\n    id: number\n  ): IItem {\n    let selector = validateSelector(options.selector);\n    let rank = options.rank !== undefined ? options.rank : Infinity;\n    return { ...options, selector, rank, id };\n  }\n\n  /**\n   * Find the items which match a context menu event.\n   *\n   * The results are sorted by DOM level, specificity, and rank.\n   */\n  export function matchItems(\n    items: IItem[],\n    event: MouseEvent,\n    groupByTarget: boolean,\n    sortBySelector: boolean\n  ): IItem[] | null {\n    // Look up the target of the event.\n    let target = event.target as Element | null;\n\n    // Bail if there is no target.\n    if (!target) {\n      return null;\n    }\n\n    // Look up the current target of the event.\n    let currentTarget = event.currentTarget as Element | null;\n\n    // Bail if there is no current target.\n    if (!currentTarget) {\n      return null;\n    }\n\n    // There are some third party libraries that cause the `target` to\n    // be detached from the DOM before lumino can process the event.\n    // If that happens, search for a new target node by point. If that\n    // node is still dangling, bail.\n    if (!currentTarget.contains(target)) {\n      target = document.elementFromPoint(event.clientX, event.clientY);\n      if (!target || !currentTarget.contains(target)) {\n        return null;\n      }\n    }\n\n    // Set up the result array.\n    let result: IItem[] = [];\n\n    // Copy the items array to allow in-place modification.\n    let availableItems: Array<IItem | null> = items.slice();\n\n    // Walk up the DOM hierarchy searching for matches.\n    while (target !== null) {\n      // Set up the match array for this DOM level.\n      let matches: IItem[] = [];\n\n      // Search the remaining items for matches.\n      for (let i = 0, n = availableItems.length; i < n; ++i) {\n        // Fetch the item.\n        let item = availableItems[i];\n\n        // Skip items which are already consumed.\n        if (!item) {\n          continue;\n        }\n\n        // Skip items which do not match the element.\n        if (!Selector.matches(target, item.selector)) {\n          continue;\n        }\n\n        // Add the matched item to the result for this DOM level.\n        matches.push(item);\n\n        // Mark the item as consumed.\n        availableItems[i] = null;\n      }\n\n      // Sort the matches for this level and add them to the results.\n      if (matches.length !== 0) {\n        if (groupByTarget) {\n          matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n        }\n        result.push(...matches);\n      }\n\n      // Stop searching at the limits of the DOM range.\n      if (target === currentTarget) {\n        break;\n      }\n\n      // Step to the parent DOM level.\n      target = target.parentElement;\n    }\n\n    if (!groupByTarget) {\n      result.sort(sortBySelector ? itemCmp : itemCmpRank);\n    }\n\n    // Return the matched and sorted results.\n    return result;\n  }\n\n  /**\n   * Validate the selector for a menu item.\n   *\n   * This returns the validated selector, or throws if the selector is\n   * invalid or contains commas.\n   */\n  function validateSelector(selector: string): string {\n    if (selector.indexOf(',') !== -1) {\n      throw new Error(`Selector cannot contain commas: ${selector}`);\n    }\n    if (!Selector.isValid(selector)) {\n      throw new Error(`Invalid selector: ${selector}`);\n    }\n    return selector;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by ranks.\n   */\n  function itemCmpRank(a: IItem, b: IItem): number {\n    // Sort based on rank.\n    let r1 = a.rank;\n    let r2 = b.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity-safe\n    }\n\n    // When all else fails, sort by item id.\n    return a.id - b.id;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by selectors and ranks.\n   */\n  function itemCmp(a: IItem, b: IItem): number {\n    // Sort first based on selector specificity.\n    let s1 = Selector.calculateSpecificity(a.selector);\n    let s2 = Selector.calculateSpecificity(b.selector);\n    if (s1 !== s2) {\n      return s2 - s1;\n    }\n\n    // If specificities are equal\n    return itemCmpRank(a, b);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ElementARIAAttrs,\n  ElementBaseAttrs,\n  ElementDataset,\n  ElementInlineStyle,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n  'ArrowLeft',\n  'ArrowUp',\n  'ArrowRight',\n  'ArrowDown',\n  'Home',\n  'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar<T> extends Widget {\n  /**\n   * Construct a new tab bar.\n   *\n   * @param options - The options for initializing the tab bar.\n   */\n  constructor(options: TabBar.IOptions<T> = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-TabBar');\n    this.contentNode.setAttribute('role', 'tablist');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this._document = options.document || document;\n    this.tabsMovable = options.tabsMovable || false;\n    this.titlesEditable = options.titlesEditable || false;\n    this.allowDeselect = options.allowDeselect || false;\n    this.addButtonEnabled = options.addButtonEnabled || false;\n    this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n    this.name = options.name || '';\n    this.orientation = options.orientation || 'horizontal';\n    this.removeBehavior = options.removeBehavior || 'select-tab-after';\n    this.renderer = options.renderer || TabBar.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    this._titles.length = 0;\n    this._previousTitle = null;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabBar.ICurrentChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when a tab is moved by the user.\n   *\n   * #### Notes\n   * This signal is emitted when a tab is moved by user interaction.\n   *\n   * This signal is not emitted when a tab is moved programmatically.\n   */\n  get tabMoved(): ISignal<this, TabBar.ITabMovedArgs<T>> {\n    return this._tabMoved;\n  }\n\n  /**\n   * A signal emitted when a tab is clicked by the user.\n   *\n   * #### Notes\n   * If the clicked tab is not the current tab, the clicked tab will be\n   * made current and the `currentChanged` signal will be emitted first.\n   *\n   * This signal is emitted even if the clicked tab is the current tab.\n   */\n  get tabActivateRequested(): ISignal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  > {\n    return this._tabActivateRequested;\n  }\n\n  /**\n   * A signal emitted when the tab bar add button is clicked.\n   */\n  get addRequested(): ISignal<this, void> {\n    return this._addRequested;\n  }\n\n  /**\n   * A signal emitted when a tab close icon is clicked.\n   *\n   * #### Notes\n   * This signal is not emitted unless the tab title is `closable`.\n   */\n  get tabCloseRequested(): ISignal<this, TabBar.ITabCloseRequestedArgs<T>> {\n    return this._tabCloseRequested;\n  }\n\n  /**\n   * A signal emitted when a tab is dragged beyond the detach threshold.\n   *\n   * #### Notes\n   * This signal is emitted when the user drags a tab with the mouse,\n   * and mouse is dragged beyond the detach threshold.\n   *\n   * The consumer of the signal should call `releaseMouse` and remove\n   * the tab in order to complete the detach.\n   *\n   * This signal is only emitted once per drag cycle.\n   */\n  get tabDetachRequested(): ISignal<this, TabBar.ITabDetachRequestedArgs<T>> {\n    return this._tabDetachRequested;\n  }\n\n  /**\n   * The renderer used by the tab bar.\n   */\n  readonly renderer: TabBar.IRenderer<T>;\n\n  /**\n   * The document to use with the tab bar.\n   *\n   * The default is the global `document` instance.\n   */\n  get document(): Document | ShadowRoot {\n    return this._document;\n  }\n\n  /**\n   * Whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  tabsMovable: boolean;\n\n  /**\n   * Whether the titles can be user-edited.\n   *\n   */\n  get titlesEditable(): boolean {\n    return this._titlesEditable;\n  }\n\n  /**\n   * Set whether titles can be user edited.\n   *\n   */\n  set titlesEditable(value: boolean) {\n    this._titlesEditable = value;\n  }\n\n  /**\n   * Whether a tab can be deselected by the user.\n   *\n   * #### Notes\n   * Tabs can be always be deselected programmatically.\n   */\n  allowDeselect: boolean;\n\n  /**\n   * The selection behavior when inserting a tab.\n   */\n  insertBehavior: TabBar.InsertBehavior;\n\n  /**\n   * The selection behavior when removing a tab.\n   */\n  removeBehavior: TabBar.RemoveBehavior;\n\n  /**\n   * Get the currently selected title.\n   *\n   * #### Notes\n   * This will be `null` if no tab is selected.\n   */\n  get currentTitle(): Title<T> | null {\n    return this._titles[this._currentIndex] || null;\n  }\n\n  /**\n   * Set the currently selected title.\n   *\n   * #### Notes\n   * If the title does not exist, the title will be set to `null`.\n   */\n  set currentTitle(value: Title<T> | null) {\n    this.currentIndex = value ? this._titles.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this._currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the value is out of range, the index will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    // Adjust for an out of range index.\n    if (value < 0 || value >= this._titles.length) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._currentIndex === value) {\n      return;\n    }\n\n    // Look up the previous index and title.\n    let pi = this._currentIndex;\n    let pt = this._titles[pi] || null;\n\n    // Look up the current index and title.\n    let ci = value;\n    let ct = this._titles[ci] || null;\n\n    // Update the current index and previous title.\n    this._currentIndex = ci;\n    this._previousTitle = pt;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: ci,\n      currentTitle: ct\n    });\n  }\n\n  /**\n   * Get the name of the tab bar.\n   */\n  get name(): string {\n    return this._name;\n  }\n\n  /**\n   * Set the name of the tab bar.\n   */\n  set name(value: string) {\n    this._name = value;\n    if (value) {\n      this.contentNode.setAttribute('aria-label', value);\n    } else {\n      this.contentNode.removeAttribute('aria-label');\n    }\n  }\n\n  /**\n   * Get the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  get orientation(): TabBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  set orientation(value: TabBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Toggle the orientation values.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n    this.contentNode.setAttribute('aria-orientation', value);\n  }\n\n  /**\n   * Whether the add button is enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add button is enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    // Do nothing if the value does not change.\n    if (this._addButtonEnabled === value) {\n      return;\n    }\n\n    this._addButtonEnabled = value;\n    if (value) {\n      this.addButtonNode.classList.remove('lm-mod-hidden');\n    } else {\n      this.addButtonNode.classList.add('lm-mod-hidden');\n    }\n  }\n\n  /**\n   * A read-only array of the titles in the tab bar.\n   */\n  get titles(): ReadonlyArray<Title<T>> {\n    return this._titles;\n  }\n\n  /**\n   * The tab bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the tab nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * The tab bar add button node.\n   *\n   * #### Notes\n   * This is the node which holds the add button.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get addButtonNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-addButton'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Add a tab to the end of the tab bar.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  addTab(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return this.insertTab(this._titles.length, value);\n  }\n\n  /**\n   * Insert a tab into the tab bar at the specified index.\n   *\n   * @param index - The index at which to insert the tab.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the tabs.\n   *\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  insertTab(index: number, value: Title<T> | Title.IOptions<T>): Title<T> {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Coerce the value to a title.\n    let title = Private.asTitle(value);\n\n    // Look up the index of the title.\n    let i = this._titles.indexOf(title);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._titles.length));\n\n    // If the title is not in the array, insert it.\n    if (i === -1) {\n      // Insert the title into the array.\n      ArrayExt.insert(this._titles, j, title);\n\n      // Connect to the title changed signal.\n      title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the tabs.\n      this.update();\n\n      // Adjust the current index for the insert.\n      this._adjustCurrentForInsert(j, title);\n\n      // Return the title added to the tab bar.\n      return title;\n    }\n\n    // Otherwise, the title exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._titles.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return title;\n    }\n\n    // Move the title to the new location.\n    ArrayExt.move(this._titles, i, j);\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the move.\n    this._adjustCurrentForMove(i, j);\n\n    // Return the title added to the tab bar.\n    return title;\n  }\n\n  /**\n   * Remove a tab from the tab bar.\n   *\n   * @param title - The title for the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the title is not in the tab bar.\n   */\n  removeTab(title: Title<T>): void {\n    this.removeTabAt(this._titles.indexOf(title));\n  }\n\n  /**\n   * Remove the tab at a given index from the tab bar.\n   *\n   * @param index - The index of the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeTabAt(index: number): void {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Remove the title from the array.\n    let title = ArrayExt.removeAt(this._titles, index);\n\n    // Bail if the index is out of range.\n    if (!title) {\n      return;\n    }\n\n    // Disconnect from the title changed signal.\n    title.changed.disconnect(this._onTitleChanged, this);\n\n    // Clear the previous title if it's being removed.\n    if (title === this._previousTitle) {\n      this._previousTitle = null;\n    }\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the remove.\n    this._adjustCurrentForRemove(index, title);\n  }\n\n  /**\n   * Remove all tabs from the tab bar.\n   */\n  clearTabs(): void {\n    // Bail if there is nothing to remove.\n    if (this._titles.length === 0) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Disconnect from the title changed signals.\n    for (let title of this._titles) {\n      title.changed.disconnect(this._onTitleChanged, this);\n    }\n\n    // Get the current index and title.\n    let pi = this.currentIndex;\n    let pt = this.currentTitle;\n\n    // Reset the current index and previous title.\n    this._currentIndex = -1;\n    this._previousTitle = null;\n\n    // Clear the title array.\n    this._titles.length = 0;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // If no tab was selected, there's nothing else to do.\n    if (pi === -1) {\n      return;\n    }\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   *\n   * #### Notes\n   * This will cause the tab bar to stop handling mouse events and to\n   * restore the tabs to their non-dragged positions.\n   */\n  releaseMouse(): void {\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the DOM events for the tab bar.\n   *\n   * @param event - The DOM event sent to the tab bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tab bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'dblclick':\n        this._evtDblClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        event.eventPhase === Event.CAPTURING_PHASE\n          ? this._evtKeyDownCapturing(event as KeyboardEvent)\n          : this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n    this.node.addEventListener('dblclick', this);\n    this.node.addEventListener('keydown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this.node.removeEventListener('dblclick', this);\n    this.node.removeEventListener('keydown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let titles = this._titles;\n    let renderer = this.renderer;\n    let currentTitle = this.currentTitle;\n    let content = new Array<VirtualElement>(titles.length);\n    // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n    // If the add button handles it, no need to do anything. If no element of the tab\n    // bar handles it, set it on the current or the first tab to ensure one element\n    // handles it after update.\n    const tabHandlingTabindex =\n      this._getCurrentTabindex() ??\n      (this._currentIndex > -1 ? this._currentIndex : 0);\n\n    for (let i = 0, n = titles.length; i < n; ++i) {\n      let title = titles[i];\n      let current = title === currentTitle;\n      let zIndex = current ? n : n - i - 1;\n      let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n      content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * Get the index of the tab which handles tabindex=\"0\".\n   * If the add button handles tabindex=\"0\", -1 is returned.\n   * If none of the previous handles tabindex=\"0\", null is returned.\n   */\n  private _getCurrentTabindex(): number | null {\n    let index = null;\n    const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n    if (elemTabindex) {\n      index = [...this.contentNode.children].indexOf(elemTabindex);\n    } else if (\n      this._addButtonEnabled &&\n      this.addButtonNode.getAttribute('tabindex') === '0'\n    ) {\n      index = -1;\n    }\n    return index;\n  }\n\n  /**\n   * Handle the `'dblclick'` event for the tab bar.\n   */\n  private _evtDblClick(event: MouseEvent): void {\n    // Do nothing if titles are not editable\n    if (!this.titlesEditable) {\n      return;\n    }\n\n    let tabs = this.contentNode.children;\n\n    // Find the index of the targeted tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab.\n    if (index === -1) {\n      return;\n    }\n\n    let title = this.titles[index];\n    let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n    if (label && label.contains(event.target as HTMLElement)) {\n      let value = title.label || '';\n\n      // Clear the label element\n      let oldValue = label.innerHTML;\n      label.innerHTML = '';\n\n      let input = document.createElement('input');\n      input.classList.add('lm-TabBar-tabInput');\n      input.value = value;\n      label.appendChild(input);\n\n      let onblur = () => {\n        input.removeEventListener('blur', onblur);\n        label.innerHTML = oldValue;\n        this.node.addEventListener('keydown', this);\n      };\n\n      input.addEventListener('dblclick', (event: Event) =>\n        event.stopPropagation()\n      );\n      input.addEventListener('blur', onblur);\n      input.addEventListener('keydown', (event: KeyboardEvent) => {\n        if (event.key === 'Enter') {\n          if (input.value !== '') {\n            title.label = title.caption = input.value;\n          }\n          onblur();\n        } else if (event.key === 'Escape') {\n          onblur();\n        }\n      });\n      this.node.removeEventListener('keydown', this);\n      input.select();\n      input.focus();\n\n      if (label.children.length > 0) {\n        (label.children[0] as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at capturing phase.\n   */\n  private _evtKeyDownCapturing(event: KeyboardEvent): void {\n    if (event.eventPhase !== Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.key === 'Escape') {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at target phase.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Allow for navigation using tab key\n    if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Check if Enter or Spacebar key has been pressed and open that tab\n    if (\n      event.key === 'Enter' ||\n      event.key === 'Spacebar' ||\n      event.key === ' '\n    ) {\n      // Get focus element that is in focus by the tab key\n      const focusedElement = document.activeElement;\n\n      // Test first if the focus is on the add button node\n      if (\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(focusedElement)\n      ) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._addRequested.emit();\n      } else {\n        const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n          tab.contains(focusedElement)\n        );\n        if (index >= 0) {\n          event.preventDefault();\n          event.stopPropagation();\n          this.currentIndex = index;\n        }\n      }\n      // Handle the arrow keys to switch tabs.\n    } else if (ARROW_KEYS.includes(event.key)) {\n      // Create a list of all focusable elements in the tab bar.\n      const focusable: Element[] = [...this.contentNode.children];\n      if (this.addButtonEnabled) {\n        focusable.push(this.addButtonNode);\n      }\n      // If the tab bar contains only one element, nothing to do.\n      if (focusable.length <= 1) {\n        return;\n      }\n      event.preventDefault();\n      event.stopPropagation();\n\n      // Get the current focused element.\n      let focusedIndex = focusable.indexOf(document.activeElement as Element);\n      if (focusedIndex === -1) {\n        focusedIndex = this._currentIndex;\n      }\n\n      // Find the next element to focus on.\n      let nextFocused: Element | null | undefined;\n      if (\n        (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowDown' && this._orientation === 'vertical')\n      ) {\n        nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n      } else if (\n        (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowUp' && this._orientation === 'vertical')\n      ) {\n        nextFocused =\n          focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n      } else if (event.key === 'Home') {\n        nextFocused = focusable[0];\n      } else if (event.key === 'End') {\n        nextFocused = focusable[focusable.length - 1];\n      }\n\n      // Change the focused element and the tabindex value.\n      if (nextFocused) {\n        focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n        nextFocused?.setAttribute('tabindex', '0');\n        (nextFocused as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the tab bar.\n   */\n  private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse press.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if a drag is in progress.\n    if (this._dragData) {\n      return;\n    }\n\n    // Do nothing if a title editable input was clicked.\n    if (\n      (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n    ) {\n      return;\n    }\n\n    // Check if the add button was clicked.\n    let addButtonClicked =\n      this.addButtonEnabled &&\n      this.addButtonNode.contains(event.target as HTMLElement);\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Find the index of the pressed tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab or the add button.\n    if (index === -1 && !addButtonClicked) {\n      return;\n    }\n\n    // Pressing on a tab stops the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Initialize the non-measured parts of the drag data.\n    this._dragData = {\n      tab: tabs[index] as HTMLElement,\n      index: index,\n      pressX: event.clientX,\n      pressY: event.clientY,\n      tabPos: -1,\n      tabSize: -1,\n      tabPressPos: -1,\n      targetIndex: -1,\n      tabLayout: null,\n      contentRect: null,\n      override: null,\n      dragActive: false,\n      dragAborted: false,\n      detachRequested: false\n    };\n\n    // Add the document pointer up listener.\n    this.document.addEventListener('pointerup', this, true);\n\n    // Do nothing else if the middle button or add button is clicked.\n    if (event.button === 1 || addButtonClicked) {\n      return;\n    }\n\n    // Do nothing else if the close icon is clicked.\n    let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n    if (icon && icon.contains(event.target as HTMLElement)) {\n      return;\n    }\n\n    // Add the extra listeners if the tabs are movable.\n    if (this.tabsMovable) {\n      this.document.addEventListener('pointermove', this, true);\n      this.document.addEventListener('keydown', this, true);\n      this.document.addEventListener('contextmenu', this, true);\n    }\n\n    // Update the current index as appropriate.\n    if (this.allowDeselect && this.currentIndex === index) {\n      this.currentIndex = -1;\n    } else {\n      this.currentIndex = index;\n    }\n\n    // Do nothing else if there is no current tab.\n    if (this.currentIndex === -1) {\n      return;\n    }\n\n    // Emit the tab activate request signal.\n    this._tabActivateRequested.emit({\n      index: this.currentIndex,\n      title: this.currentTitle!\n    });\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the tab bar.\n   */\n  private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Suppress the event during a drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Bail early if the drag threshold has not been met.\n    if (!data.dragActive && !Private.dragExceeded(data, event)) {\n      return;\n    }\n\n    // Activate the drag if necessary.\n    if (!data.dragActive) {\n      // Fill in the rest of the drag data measurements.\n      let tabRect = data.tab.getBoundingClientRect();\n      if (this._orientation === 'horizontal') {\n        data.tabPos = data.tab.offsetLeft;\n        data.tabSize = tabRect.width;\n        data.tabPressPos = data.pressX - tabRect.left;\n      } else {\n        data.tabPos = data.tab.offsetTop;\n        data.tabSize = tabRect.height;\n        data.tabPressPos = data.pressY - tabRect.top;\n      }\n      data.tabPressOffset = {\n        x: data.pressX - tabRect.left,\n        y: data.pressY - tabRect.top\n      };\n      data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n      data.contentRect = this.contentNode.getBoundingClientRect();\n      data.override = Drag.overrideCursor('default');\n\n      // Add the dragging style classes.\n      data.tab.classList.add('lm-mod-dragging');\n      this.addClass('lm-mod-dragging');\n\n      // Mark the drag as active.\n      data.dragActive = true;\n    }\n\n    // Emit the detach requested signal if the threshold is exceeded.\n    if (!data.detachRequested && Private.detachExceeded(data, event)) {\n      // Only emit the signal once per drag cycle.\n      data.detachRequested = true;\n\n      // Setup the arguments for the signal.\n      let index = data.index;\n      let clientX = event.clientX;\n      let clientY = event.clientY;\n      let tab = tabs[index] as HTMLElement;\n      let title = this._titles[index];\n\n      // Emit the tab detach requested signal.\n      this._tabDetachRequested.emit({\n        index,\n        title,\n        tab,\n        clientX,\n        clientY,\n        offset: data.tabPressOffset\n      });\n\n      // Bail if the signal handler aborted the drag.\n      if (data.dragAborted) {\n        return;\n      }\n    }\n\n    // Update the positions of the tabs.\n    Private.layoutTabs(tabs, data, event, this._orientation);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the document.\n   */\n  private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse release.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if no drag is in progress.\n    const data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Remove the extra mouse event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Handle a release when the drag is not active.\n    if (!data.dragActive) {\n      // Clear the drag data.\n      this._dragData = null;\n\n      // Handle clicking the add button.\n      let addButtonClicked =\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(event.target as HTMLElement);\n      if (addButtonClicked) {\n        this._addRequested.emit(undefined);\n        return;\n      }\n\n      // Lookup the tab nodes.\n      let tabs = this.contentNode.children;\n\n      // Find the index of the released tab.\n      let index = ArrayExt.findFirstIndex(tabs, tab => {\n        return ElementExt.hitTest(tab, event.clientX, event.clientY);\n      });\n\n      // Do nothing if the release is not on the original pressed tab.\n      if (index !== data.index) {\n        return;\n      }\n\n      // Ignore the release if the title is not closable.\n      let title = this._titles[index];\n      if (!title.closable) {\n        return;\n      }\n\n      // Emit the close requested signal if the middle button is released.\n      if (event.button === 1) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Emit the close requested signal if the close icon was released.\n      let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n      if (icon && icon.contains(event.target as HTMLElement)) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Otherwise, there is nothing left to do.\n      return;\n    }\n\n    // Do nothing if the left button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Position the tab at its final resting position.\n    Private.finalizeTabPosition(data, this._orientation);\n\n    // Remove the dragging class from the tab so it can be transitioned.\n    data.tab.classList.remove('lm-mod-dragging');\n\n    // Parse the transition duration for releasing the tab.\n    let duration = Private.parseTransitionDuration(data.tab);\n\n    // Complete the release on a timer to allow the tab to transition.\n    setTimeout(() => {\n      // Do nothing if the drag has been aborted.\n      if (data.dragAborted) {\n        return;\n      }\n\n      // Clear the drag data reference.\n      this._dragData = null;\n\n      // Reset the positions of the tabs.\n      Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n      // Clear the cursor grab.\n      data.override!.dispose();\n\n      // Remove the remaining dragging style.\n      this.removeClass('lm-mod-dragging');\n\n      // If the tab was not moved, there is nothing else to do.\n      let i = data.index;\n      let j = data.targetIndex;\n      if (j === -1 || i === j) {\n        return;\n      }\n\n      // Move the title to the new locations.\n      ArrayExt.move(this._titles, i, j);\n\n      // Adjust the current index for the move.\n      this._adjustCurrentForMove(i, j);\n\n      // Emit the tab moved signal.\n      this._tabMoved.emit({\n        fromIndex: i,\n        toIndex: j,\n        title: this._titles[j]\n      });\n\n      // Update the tabs immediately to prevent flicker.\n      MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    }, duration);\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   */\n  private _releaseMouse(): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Clear the drag data reference.\n    this._dragData = null;\n\n    // Remove the extra document event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Indicate the drag has been aborted. This allows the mouse\n    // event handlers to return early when the drag is canceled.\n    data.dragAborted = true;\n\n    // If the drag is not active, there's nothing more to do.\n    if (!data.dragActive) {\n      return;\n    }\n\n    // Reset the tabs to their non-dragged positions.\n    Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n    // Clear the cursor override.\n    data.override!.dispose();\n\n    // Clear the dragging style classes.\n    data.tab.classList.remove('lm-mod-dragging');\n    this.removeClass('lm-mod-dragging');\n  }\n\n  /**\n   * Adjust the current index for a tab insert operation.\n   *\n   * This method accounts for the tab bar's insertion behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForInsert(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ct = this.currentTitle;\n    let ci = this._currentIndex;\n    let bh = this.insertBehavior;\n\n    // TODO: do we need to do an update to update the aria-selected attribute?\n\n    // Handle the behavior where the new tab is always selected,\n    // or the behavior where the new tab is selected if needed.\n    if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n      this._currentIndex = i;\n      this._previousTitle = ct;\n      this._currentChanged.emit({\n        previousIndex: ci,\n        previousTitle: ct,\n        currentIndex: i,\n        currentTitle: title\n      });\n      return;\n    }\n\n    // Otherwise, silently adjust the current index if needed.\n    if (ci >= i) {\n      this._currentIndex++;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab move operation.\n   *\n   * This method will not cause the actual current tab to change.\n   * It silently adjusts the index to account for the given move.\n   */\n  private _adjustCurrentForMove(i: number, j: number): void {\n    if (this._currentIndex === i) {\n      this._currentIndex = j;\n    } else if (this._currentIndex < i && this._currentIndex >= j) {\n      this._currentIndex++;\n    } else if (this._currentIndex > i && this._currentIndex <= j) {\n      this._currentIndex--;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab remove operation.\n   *\n   * This method accounts for the tab bar's remove behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForRemove(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ci = this._currentIndex;\n    let bh = this.removeBehavior;\n\n    // Silently adjust the index if the current tab is not removed.\n    if (ci !== i) {\n      if (ci > i) {\n        this._currentIndex--;\n      }\n      return;\n    }\n\n    // TODO: do we need to do an update to adjust the aria-selected value?\n\n    // No tab gets selected if the tab bar is empty.\n    if (this._titles.length === 0) {\n      this._currentIndex = -1;\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: -1,\n        currentTitle: null\n      });\n      return;\n    }\n\n    // Handle behavior where the next sibling tab is selected.\n    if (bh === 'select-tab-after') {\n      this._currentIndex = Math.min(i, this._titles.length - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous sibling tab is selected.\n    if (bh === 'select-tab-before') {\n      this._currentIndex = Math.max(0, i - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous history tab is selected.\n    if (bh === 'select-previous-tab') {\n      if (this._previousTitle) {\n        this._currentIndex = this._titles.indexOf(this._previousTitle);\n        this._previousTitle = null;\n      } else {\n        this._currentIndex = Math.min(i, this._titles.length - 1);\n      }\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Otherwise, no tab gets selected.\n    this._currentIndex = -1;\n    this._currentChanged.emit({\n      previousIndex: i,\n      previousTitle: title,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<T>): void {\n    this.update();\n  }\n\n  private _name: string;\n  private _currentIndex = -1;\n  private _titles: Title<T>[] = [];\n  private _orientation: TabBar.Orientation;\n  private _document: Document | ShadowRoot;\n  private _titlesEditable: boolean = false;\n  private _previousTitle: Title<T> | null = null;\n  private _dragData: Private.IDragData | null = null;\n  private _addButtonEnabled: boolean = false;\n  private _tabMoved = new Signal<this, TabBar.ITabMovedArgs<T>>(this);\n  private _currentChanged = new Signal<this, TabBar.ICurrentChangedArgs<T>>(\n    this\n  );\n  private _addRequested = new Signal<this, void>(this);\n  private _tabCloseRequested = new Signal<\n    this,\n    TabBar.ITabCloseRequestedArgs<T>\n  >(this);\n  private _tabDetachRequested = new Signal<\n    this,\n    TabBar.ITabDetachRequestedArgs<T>\n  >(this);\n  private _tabActivateRequested = new Signal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n  /**\n   * A type alias for a tab bar orientation.\n   */\n  export type Orientation =\n    | /**\n     * The tabs are arranged in a single row, left-to-right.\n     *\n     * The tab text orientation is horizontal.\n     */\n    'horizontal'\n\n    /**\n     * The tabs are arranged in a single column, top-to-bottom.\n     *\n     * The tab text orientation is horizontal.\n     */\n    | 'vertical';\n\n  /**\n   * A type alias for the selection behavior on tab insert.\n   */\n  export type InsertBehavior =\n    | /**\n     * The selected tab will not be changed.\n     */\n    'none'\n\n    /**\n     * The inserted tab will be selected.\n     */\n    | 'select-tab'\n\n    /**\n     * The inserted tab will be selected if the current tab is null.\n     */\n    | 'select-tab-if-needed';\n\n  /**\n   * A type alias for the selection behavior on tab remove.\n   */\n  export type RemoveBehavior =\n    | /**\n     * No tab will be selected.\n     */\n    'none'\n\n    /**\n     * The tab after the removed tab will be selected if possible.\n     */\n    | 'select-tab-after'\n\n    /**\n     * The tab before the removed tab will be selected if possible.\n     */\n    | 'select-tab-before'\n\n    /**\n     * The previously selected tab will be selected if possible.\n     */\n    | 'select-previous-tab';\n\n  /**\n   * An options object for creating a tab bar.\n   */\n  export interface IOptions<T> {\n    /**\n     * The document to use with the tab bar.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n\n    /**\n     * Name of the tab bar.\n     *\n     * This is used for accessibility reasons. The default is the empty string.\n     */\n    name?: string;\n\n    /**\n     * The layout orientation of the tab bar.\n     *\n     * The default is `horizontal`.\n     */\n    orientation?: TabBar.Orientation;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether a tab can be deselected by the user.\n     *\n     * The default is `false`.\n     */\n    allowDeselect?: boolean;\n\n    /**\n     * Whether the titles can be directly edited by the user.\n     *\n     * The default is `false`.\n     */\n    titlesEditable?: boolean;\n\n    /**\n     * Whether the add button is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The selection behavior when inserting a tab.\n     *\n     * The default is `'select-tab-if-needed'`.\n     */\n    insertBehavior?: TabBar.InsertBehavior;\n\n    /**\n     * The selection behavior when removing a tab.\n     *\n     * The default is `'select-tab-after'`.\n     */\n    removeBehavior?: TabBar.RemoveBehavior;\n\n    /**\n     * A renderer to use with the tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer<T>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs<T> {\n    /**\n     * The previously selected index.\n     */\n    readonly previousIndex: number;\n\n    /**\n     * The previously selected title.\n     */\n    readonly previousTitle: Title<T> | null;\n\n    /**\n     * The currently selected index.\n     */\n    readonly currentIndex: number;\n\n    /**\n     * The currently selected title.\n     */\n    readonly currentTitle: Title<T> | null;\n  }\n\n  /**\n   * The arguments object for the `tabMoved` signal.\n   */\n  export interface ITabMovedArgs<T> {\n    /**\n     * The previous index of the tab.\n     */\n    readonly fromIndex: number;\n\n    /**\n     * The current index of the tab.\n     */\n    readonly toIndex: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabActivateRequested` signal.\n   */\n  export interface ITabActivateRequestedArgs<T> {\n    /**\n     * The index of the tab to activate.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabCloseRequested` signal.\n   */\n  export interface ITabCloseRequestedArgs<T> {\n    /**\n     * The index of the tab to close.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabDetachRequested` signal.\n   */\n  export interface ITabDetachRequestedArgs<T> {\n    /**\n     * The index of the tab to detach.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * The node representing the tab.\n     */\n    readonly tab: HTMLElement;\n\n    /**\n     * The current client X position of the mouse.\n     */\n    readonly clientX: number;\n\n    /**\n     * The current client Y position of the mouse.\n     */\n    readonly clientY: number;\n\n    /**\n     * The mouse position in the tab coordinate.\n     */\n    readonly offset?: { x: number; y: number };\n  }\n\n  /**\n   * An object which holds the data to render a tab.\n   */\n  export interface IRenderData<T> {\n    /**\n     * The title associated with the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * Whether the tab is the current tab.\n     */\n    readonly current: boolean;\n\n    /**\n     * The z-index for the tab.\n     */\n    readonly zIndex: number;\n\n    /**\n     * The tabindex value for the tab.\n     */\n    readonly tabIndex?: number;\n  }\n\n  /**\n   * A renderer for use with a tab bar.\n   */\n  export interface IRenderer<T> {\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector: string;\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<T>): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer<any> {\n    constructor() {\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<any>): VirtualElement {\n      let title = data.title.caption;\n      let key = this.createTabKey(data);\n      let id = key;\n      let style = this.createTabStyle(data);\n      let className = this.createTabClass(data);\n      let dataset = this.createTabDataset(data);\n      let aria = this.createTabARIA(data);\n      if (data.title.closable) {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data),\n          this.renderCloseIcon(data)\n        );\n      } else {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data)\n        );\n      }\n    }\n\n    /**\n     * Render the icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab icon.\n     */\n    renderIcon(data: IRenderData<any>): VirtualElement {\n      const { title } = data;\n      let className = this.createIconClass(data);\n\n      // If title.icon is undefined, it will be ignored.\n      return h.div({ className }, title.icon!, title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab label.\n     */\n    renderLabel(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n    }\n\n    /**\n     * Render the close icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab close icon.\n     */\n    renderCloseIcon(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n    }\n\n    /**\n     * Create a unique render key for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The unique render key for the tab.\n     *\n     * #### Notes\n     * This method caches the key against the tab title the first time\n     * the key is generated. This enables efficient rendering of moved\n     * tabs and avoids subtle hover style artifacts.\n     */\n    createTabKey(data: IRenderData<any>): string {\n      let key = this._tabKeys.get(data.title);\n      if (key === undefined) {\n        key = `tab-key-${this._uuid}-${this._tabID++}`;\n        this._tabKeys.set(data.title, key);\n      }\n      return key;\n    }\n\n    /**\n     * Create the inline style object for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The inline style data for the tab.\n     */\n    createTabStyle(data: IRenderData<any>): ElementInlineStyle {\n      return { zIndex: `${data.zIndex}` };\n    }\n\n    /**\n     * Create the class name for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab.\n     */\n    createTabClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tab';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.title.closable) {\n        name += ' lm-mod-closable';\n      }\n      if (data.current) {\n        name += ' lm-mod-current';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The dataset for the tab.\n     */\n    createTabDataset(data: IRenderData<any>): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the ARIA attributes for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The ARIA attributes for the tab.\n     */\n    createTabARIA(data: IRenderData<any>): ElementARIAAttrs | ElementBaseAttrs {\n      return {\n        role: 'tab',\n        'aria-selected': data.current.toString(),\n        tabindex: `${data.tabIndex ?? '-1'}`\n      };\n    }\n\n    /**\n     * Create the class name for the tab icon.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab icon.\n     */\n    createIconClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tabIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _tabID = 0;\n    private _tabKeys = new WeakMap<Title<any>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * A selector which matches the add button node in the tab bar.\n   */\n  export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The start drag distance threshold.\n   */\n  export const DRAG_THRESHOLD = 5;\n\n  /**\n   * The detach distance threshold.\n   */\n  export const DETACH_THRESHOLD = 20;\n\n  /**\n   * A struct which holds the drag data for a tab bar.\n   */\n  export interface IDragData {\n    /**\n     * The tab node being dragged.\n     */\n    tab: HTMLElement;\n\n    /**\n     * The index of the tab being dragged.\n     */\n    index: number;\n\n    /**\n     * The mouse press client X position.\n     */\n    pressX: number;\n\n    /**\n     * The mouse press client Y position.\n     */\n    pressY: number;\n\n    /**\n     * The offset left/top of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPos: number;\n\n    /**\n     * The offset width/height of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabSize: number;\n\n    /**\n     * The original mouse X/Y position in tab coordinates.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPressPos: number;\n\n    /**\n     * The original mouse position in tab coordinates.\n     *\n     * This is undefined if the drag is not active.\n     */\n    tabPressOffset?: { x: number; y: number };\n\n    /**\n     * The tab target index upon mouse release.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    targetIndex: number;\n\n    /**\n     * The array of tab layout objects snapped at drag start.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    tabLayout: ITabLayout[] | null;\n\n    /**\n     * The bounding client rect of the tab bar content node.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    contentRect: DOMRect | null;\n\n    /**\n     * The disposable to clean up the cursor override.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    override: IDisposable | null;\n\n    /**\n     * Whether the drag is currently active.\n     */\n    dragActive: boolean;\n\n    /**\n     * Whether the drag has been aborted.\n     */\n    dragAborted: boolean;\n\n    /**\n     * Whether a detach request as been made.\n     */\n    detachRequested: boolean;\n  }\n\n  /**\n   * An object which holds layout data for a tab.\n   */\n  export interface ITabLayout {\n    /**\n     * The left/top margin value for the tab.\n     */\n    margin: number;\n\n    /**\n     * The offset left/top position of the tab.\n     */\n    pos: number;\n\n    /**\n     * The offset width/height of the tab.\n     */\n    size: number;\n  }\n\n  /**\n   * Create the DOM node for a tab bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.setAttribute('role', 'tablist');\n    content.className = 'lm-TabBar-content';\n    node.appendChild(content);\n\n    let add = document.createElement('div');\n    add.className = 'lm-TabBar-addButton lm-mod-hidden';\n    add.setAttribute('tabindex', '-1');\n    add.setAttribute('role', 'button');\n    node.appendChild(add);\n    return node;\n  }\n\n  /**\n   * Coerce a title or options into a real title.\n   */\n  export function asTitle<T>(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return value instanceof Title ? value : new Title<T>(value);\n  }\n\n  /**\n   * Parse the transition duration for a tab node.\n   */\n  export function parseTransitionDuration(tab: HTMLElement): number {\n    let style = window.getComputedStyle(tab);\n    return 1000 * (parseFloat(style.transitionDuration!) || 0);\n  }\n\n  /**\n   * Get a snapshot of the current tab layout values.\n   */\n  export function snapTabLayout(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): ITabLayout[] {\n    let layout = new Array<ITabLayout>(tabs.length);\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let node = tabs[i] as HTMLElement;\n      let style = window.getComputedStyle(node);\n      if (orientation === 'horizontal') {\n        layout[i] = {\n          pos: node.offsetLeft,\n          size: node.offsetWidth,\n          margin: parseFloat(style.marginLeft!) || 0\n        };\n      } else {\n        layout[i] = {\n          pos: node.offsetTop,\n          size: node.offsetHeight,\n          margin: parseFloat(style.marginTop!) || 0\n        };\n      }\n    }\n    return layout;\n  }\n\n  /**\n   * Test if the event exceeds the drag threshold.\n   */\n  export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n    let dx = Math.abs(event.clientX - data.pressX);\n    let dy = Math.abs(event.clientY - data.pressY);\n    return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n  }\n\n  /**\n   * Test if the event exceeds the drag detach threshold.\n   */\n  export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n    let rect = data.contentRect!;\n    return (\n      event.clientX < rect.left - DETACH_THRESHOLD ||\n      event.clientX >= rect.right + DETACH_THRESHOLD ||\n      event.clientY < rect.top - DETACH_THRESHOLD ||\n      event.clientY >= rect.bottom + DETACH_THRESHOLD\n    );\n  }\n\n  /**\n   * Update the relative tab positions and computed target index.\n   */\n  export function layoutTabs(\n    tabs: HTMLCollection,\n    data: IDragData,\n    event: MouseEvent,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive values.\n    let pressPos: number;\n    let localPos: number;\n    let clientPos: number;\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      pressPos = data.pressX;\n      localPos = event.clientX - data.contentRect!.left;\n      clientPos = event.clientX;\n      clientSize = data.contentRect!.width;\n    } else {\n      pressPos = data.pressY;\n      localPos = event.clientY - data.contentRect!.top;\n      clientPos = event.clientY;\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the target data.\n    let targetIndex = data.index;\n    let targetPos = localPos - data.tabPressPos;\n    let targetEnd = targetPos + data.tabSize;\n\n    // Update the relative tab positions.\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let pxPos: string;\n      let layout = data.tabLayout![i];\n      let threshold = layout.pos + (layout.size >> 1);\n      if (i < data.index && targetPos < threshold) {\n        pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n        targetIndex = Math.min(targetIndex, i);\n      } else if (i > data.index && targetEnd > threshold) {\n        pxPos = `${-data.tabSize - layout.margin}px`;\n        targetIndex = Math.max(targetIndex, i);\n      } else if (i === data.index) {\n        let ideal = clientPos - pressPos;\n        let limit = clientSize - (data.tabPos + data.tabSize);\n        pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n      } else {\n        pxPos = '';\n      }\n      if (orientation === 'horizontal') {\n        (tabs[i] as HTMLElement).style.left = pxPos;\n      } else {\n        (tabs[i] as HTMLElement).style.top = pxPos;\n      }\n    }\n\n    // Update the computed target index.\n    data.targetIndex = targetIndex;\n  }\n\n  /**\n   * Position the drag tab at its final resting relative position.\n   */\n  export function finalizeTabPosition(\n    data: IDragData,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive client size.\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      clientSize = data.contentRect!.width;\n    } else {\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the ideal final tab position.\n    let ideal: number;\n    if (data.targetIndex === data.index) {\n      ideal = 0;\n    } else if (data.targetIndex > data.index) {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n    } else {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos - data.tabPos;\n    }\n\n    // Compute the tab position limit.\n    let limit = clientSize - (data.tabPos + data.tabSize);\n    let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n    // Set the final orientation-sensitive position.\n    if (orientation === 'horizontal') {\n      data.tab.style.left = `${final}px`;\n    } else {\n      data.tab.style.top = `${final}px`;\n    }\n  }\n\n  /**\n   * Reset the relative positions of the given tabs.\n   */\n  export function resetTabPositions(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): void {\n    for (const tab of tabs) {\n      if (orientation === 'horizontal') {\n        (tab as HTMLElement).style.left = '';\n      } else {\n        (tab as HTMLElement).style.top = '';\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n  /**\n   * Construct a new dock layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: DockLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n    this._document = options.document || document;\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   */\n  dispose(): void {\n    // Get an iterator over the widgets in the layout.\n    let widgets = this[Symbol.iterator]();\n\n    // Dispose of the layout items.\n    this._items.forEach(item => {\n      item.dispose();\n    });\n\n    // Clear the layout state before disposing the widgets.\n    this._box = null;\n    this._root = null;\n    this._items.clear();\n\n    // Dispose of the widgets contained in the old layout root.\n    for (const widget of widgets) {\n      widget.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the dock layout.\n   */\n  readonly renderer: DockLayout.IRenderer;\n\n  /**\n   * The method for hiding child widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    for (const bar of this.tabBars()) {\n      if (bar.titles.length > 1) {\n        for (const title of bar.titles) {\n          title.owner.hiddenMode = this._hiddenMode;\n        }\n      }\n    }\n  }\n\n  /**\n   * Get the inter-element spacing for the dock layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the dock layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Whether the dock layout is empty.\n   */\n  get isEmpty(): boolean {\n    return this._root === null;\n  }\n\n  /**\n   * Create an iterator over all widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This iterator includes the generated tab bars.\n   */\n  [Symbol.iterator](): IterableIterator<Widget> {\n    return this._root ? this._root.iterAllWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the user widgets in the layout.\n   *\n   * @returns A new iterator over the user widgets in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  widgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterUserWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the layout.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the layout.\n   */\n  selectedWidgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterSelectedWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the layout.\n   *\n   * @returns A new iterator over the tab bars in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  tabBars(): IterableIterator<TabBar<Widget>> {\n    return this._root ? this._root.iterTabBars() : empty();\n  }\n\n  /**\n   * Create an iterator over the handles in the layout.\n   *\n   * @returns A new iterator over the handles in the layout.\n   */\n  handles(): IterableIterator<HTMLDivElement> {\n    return this._root ? this._root.iterHandles() : empty();\n  }\n\n  /**\n   * Move a handle to the given offset position.\n   *\n   * @param handle - The handle to move.\n   *\n   * @param offsetX - The desired offset X position of the handle.\n   *\n   * @param offsetY - The desired offset Y position of the handle.\n   *\n   * #### Notes\n   * If the given handle is not contained in the layout, this is no-op.\n   *\n   * The handle will be moved as close as possible to the desired\n   * position without violating any of the layout constraints.\n   *\n   * Only one of the coordinates is used depending on the orientation\n   * of the handle. This method accepts both coordinates to make it\n   * easy to invoke from a mouse move event without needing to know\n   * the handle orientation.\n   */\n  moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n    // Bail early if there is no root or if the handle is hidden.\n    let hidden = handle.classList.contains('lm-mod-hidden');\n    if (!this._root || hidden) {\n      return;\n    }\n\n    // Lookup the split node for the handle.\n    let data = this._root.findSplitNode(handle);\n    if (!data) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (data.node.orientation === 'horizontal') {\n      delta = offsetX - handle.offsetLeft;\n    } else {\n      delta = offsetY - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent sibling resizing unless needed.\n    data.node.holdSizes();\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Save the current configuration of the dock layout.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockLayout.ILayoutConfig {\n    // Bail early if there is no root.\n    if (!this._root) {\n      return { main: null };\n    }\n\n    // Hold the current sizes in the layout tree.\n    this._root.holdAllSizes();\n\n    // Return the layout config.\n    return { main: this._root.createConfig() };\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   */\n  restoreLayout(config: DockLayout.ILayoutConfig): void {\n    // Create the widget set for validating the config.\n    let widgetSet = new Set<Widget>();\n\n    // Normalize the main area config and collect the widgets.\n    let mainConfig: DockLayout.AreaConfig | null;\n    if (config.main) {\n      mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n    } else {\n      mainConfig = null;\n    }\n\n    // Create iterators over the old content.\n    let oldWidgets = this.widgets();\n    let oldTabBars = this.tabBars();\n    let oldHandles = this.handles();\n\n    // Clear the root before removing the old content.\n    this._root = null;\n\n    // Unparent the old widgets which are not in the new config.\n    for (const widget of oldWidgets) {\n      if (!widgetSet.has(widget)) {\n        widget.parent = null;\n      }\n    }\n\n    // Dispose of the old tab bars.\n    for (const tabBar of oldTabBars) {\n      tabBar.dispose();\n    }\n\n    // Remove the old handles.\n    for (const handle of oldHandles) {\n      if (handle.parentNode) {\n        handle.parentNode.removeChild(handle);\n      }\n    }\n\n    // Reparent the new widgets to the current parent.\n    for (const widget of widgetSet) {\n      widget.parent = this.parent;\n    }\n\n    // Create the root node for the new config.\n    if (mainConfig) {\n      this._root = Private.realizeAreaConfig(\n        mainConfig,\n        {\n          // Ignoring optional `document` argument as we must reuse `this._document`\n          createTabBar: (document?: Document | ShadowRoot) =>\n            this._createTabBar(),\n          createHandle: () => this._createHandle()\n        },\n        this._document\n      );\n    } else {\n      this._root = null;\n    }\n\n    // If there is no parent, there is nothing more to do.\n    if (!this.parent) {\n      return;\n    }\n\n    // Attach the new widgets to the parent.\n    widgetSet.forEach(widget => {\n      this.attachWidget(widget);\n    });\n\n    // Post a fit request to the parent.\n    this.parent.fit();\n  }\n\n  /**\n   * Add a widget to the dock layout.\n   *\n   * @param widget - The widget to add to the dock layout.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * The widget will be moved if it is already contained in the layout.\n   *\n   * An error will be thrown if the reference widget is invalid.\n   */\n  addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n    // Parse the options.\n    let ref = options.ref || null;\n    let mode = options.mode || 'tab-after';\n\n    // Find the tab node which holds the reference widget.\n    let refNode: Private.TabLayoutNode | null = null;\n    if (this._root && ref) {\n      refNode = this._root.findTabNode(ref);\n    }\n\n    // Throw an error if the reference widget is invalid.\n    if (ref && !refNode) {\n      throw new Error('Reference widget is not in the layout.');\n    }\n\n    // Reparent the widget to the current layout parent.\n    widget.parent = this.parent;\n\n    // Insert the widget according to the insert mode.\n    switch (mode) {\n      case 'tab-after':\n        this._insertTab(widget, ref, refNode, true);\n        break;\n      case 'tab-before':\n        this._insertTab(widget, ref, refNode, false);\n        break;\n      case 'split-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false);\n        break;\n      case 'split-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false);\n        break;\n      case 'split-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true);\n        break;\n      case 'split-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true);\n        break;\n      case 'merge-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n        break;\n      case 'merge-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n        break;\n      case 'merge-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n        break;\n      case 'merge-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n        break;\n    }\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Ensure the widget is attached to the parent widget.\n    this.attachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Remove the widget from its current layout location.\n    this._removeWidget(widget);\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Detach the widget from the parent widget.\n    this.detachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Find the tab area which contains the given client position.\n   *\n   * @param clientX - The client X position of interest.\n   *\n   * @param clientY - The client Y position of interest.\n   *\n   * @returns The geometry of the tab area at the given position, or\n   *   `null` if there is no tab area at the given position.\n   */\n  hitTestTabAreas(\n    clientX: number,\n    clientY: number\n  ): DockLayout.ITabAreaGeometry | null {\n    // Bail early if hit testing cannot produce valid results.\n    if (!this._root || !this.parent || !this.parent.isVisible) {\n      return null;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent.node);\n    }\n\n    // Convert from client to local coordinates.\n    let rect = this.parent.node.getBoundingClientRect();\n    let x = clientX - rect.left - this._box.borderLeft;\n    let y = clientY - rect.top - this._box.borderTop;\n\n    // Find the tab layout node at the local position.\n    let tabNode = this._root.hitTestTabNodes(x, y);\n\n    // Bail if a tab layout node was not found.\n    if (!tabNode) {\n      return null;\n    }\n\n    // Extract the data from the tab node.\n    let { tabBar, top, left, width, height } = tabNode;\n\n    // Compute the right and bottom edges of the tab area.\n    let borderWidth = this._box.borderLeft + this._box.borderRight;\n    let borderHeight = this._box.borderTop + this._box.borderBottom;\n    let right = rect.width - borderWidth - (left + width);\n    let bottom = rect.height - borderHeight - (top + height);\n\n    // Return the hit test results.\n    return { tabBar, x, y, top, left, right, bottom, width, height };\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    // Perform superclass initialization.\n    super.init();\n\n    // Attach each widget to the parent.\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n\n    // Attach each handle to the parent.\n    for (const handle of this.handles()) {\n      this.parent!.node.appendChild(handle);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Attach the widget to the layout parent widget.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is already attached.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Do nothing if the widget is already attached.\n    if (this.parent!.node === widget.node.parentNode) {\n      return;\n    }\n\n    // Create the layout item for the widget.\n    this._items.set(widget, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach the widget from the layout parent widget.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not attached.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Do nothing if the widget is not attached.\n    if (this.parent!.node !== widget.node.parentNode) {\n      return;\n    }\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Delete the layout item for the widget.\n    let item = this._items.get(widget);\n    if (item) {\n      this._items.delete(widget);\n      item.dispose();\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Remove the specified widget from the layout structure.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not in the layout tree.\n   *\n   * This does not detach the widget from the parent node.\n   */\n  private _removeWidget(widget: Widget): void {\n    // Bail early if there is no layout root.\n    if (!this._root) {\n      return;\n    }\n\n    // Find the tab node which contains the given widget.\n    let tabNode = this._root.findTabNode(widget);\n\n    // Bail early if the tab node is not found.\n    if (!tabNode) {\n      return;\n    }\n\n    Private.removeAria(widget);\n\n    // If there are multiple tabs, just remove the widget's tab.\n    if (tabNode.tabBar.titles.length > 1) {\n      tabNode.tabBar.removeTab(widget.title);\n      if (\n        this._hiddenMode === Widget.HiddenMode.Scale &&\n        tabNode.tabBar.titles.length == 1\n      ) {\n        const existingWidget = tabNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Display;\n      }\n      return;\n    }\n\n    // Otherwise, the tab node needs to be removed...\n\n    // Dispose the tab bar.\n    tabNode.tabBar.dispose();\n\n    // Handle the case where the tab node is the root.\n    if (this._root === tabNode) {\n      this._root = null;\n      return;\n    }\n\n    // Otherwise, remove the tab node from its parent...\n\n    // Prevent widget resizing unless needed.\n    this._root.holdAllSizes();\n\n    // Clear the parent reference on the tab node.\n    let splitNode = tabNode.parent!;\n    tabNode.parent = null;\n\n    // Remove the tab node from its parent split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n    let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n    ArrayExt.removeAt(splitNode.sizers, i);\n\n    // Remove the handle from its parent DOM node.\n    if (handle.parentNode) {\n      handle.parentNode.removeChild(handle);\n    }\n\n    // If there are multiple children, just update the handles.\n    if (splitNode.children.length > 1) {\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Otherwise, the split node also needs to be removed...\n\n    // Clear the parent reference on the split node.\n    let maybeParent = splitNode.parent;\n    splitNode.parent = null;\n\n    // Lookup the remaining child node and handle.\n    let childNode = splitNode.children[0];\n    let childHandle = splitNode.handles[0];\n\n    // Clear the split node data.\n    splitNode.children.length = 0;\n    splitNode.handles.length = 0;\n    splitNode.sizers.length = 0;\n\n    // Remove the child handle from its parent node.\n    if (childHandle.parentNode) {\n      childHandle.parentNode.removeChild(childHandle);\n    }\n\n    // Handle the case where the split node is the root.\n    if (this._root === splitNode) {\n      childNode.parent = null;\n      this._root = childNode;\n      return;\n    }\n\n    // Otherwise, move the child node to the parent node...\n    let parentNode = maybeParent!;\n\n    // Lookup the index of the split node.\n    let j = parentNode.children.indexOf(splitNode);\n\n    // Handle the case where the child node is a tab node.\n    if (childNode instanceof Private.TabLayoutNode) {\n      childNode.parent = parentNode;\n      parentNode.children[j] = childNode;\n      return;\n    }\n\n    // Remove the split data from the parent.\n    let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n    ArrayExt.removeAt(parentNode.children, j);\n    ArrayExt.removeAt(parentNode.sizers, j);\n\n    // Remove the handle from its parent node.\n    if (splitHandle.parentNode) {\n      splitHandle.parentNode.removeChild(splitHandle);\n    }\n\n    // The child node and the split parent node will have the same\n    // orientation. Merge the grand-children with the parent node.\n    for (let i = 0, n = childNode.children.length; i < n; ++i) {\n      let gChild = childNode.children[i];\n      let gHandle = childNode.handles[i];\n      let gSizer = childNode.sizers[i];\n      ArrayExt.insert(parentNode.children, j + i, gChild);\n      ArrayExt.insert(parentNode.handles, j + i, gHandle);\n      ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n      gChild.parent = parentNode;\n    }\n\n    // Clear the child node.\n    childNode.children.length = 0;\n    childNode.handles.length = 0;\n    childNode.sizers.length = 0;\n    childNode.parent = null;\n\n    // Sync the handles on the parent node.\n    parentNode.syncHandles();\n  }\n\n  /**\n   * Create the tab layout node to hold the widget.\n   */\n  private _createTabNode(widget: Widget): Private.TabLayoutNode {\n    let tabNode = new Private.TabLayoutNode(this._createTabBar());\n    tabNode.tabBar.addTab(widget.title);\n    Private.addAria(widget, tabNode.tabBar);\n    return tabNode;\n  }\n\n  /**\n   * Insert a widget next to an existing tab.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertTab(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    after: boolean\n  ): void {\n    // Do nothing if the tab is inserted next to itself.\n    if (widget === ref) {\n      return;\n    }\n\n    // Create the root if it does not exist.\n    if (!this._root) {\n      let tabNode = new Private.TabLayoutNode(this._createTabBar());\n      tabNode.tabBar.addTab(widget.title);\n      this._root = tabNode;\n      Private.addAria(widget, tabNode.tabBar);\n      return;\n    }\n\n    // Use the first tab node as the ref node if needed.\n    if (!refNode) {\n      refNode = this._root.findFirstTabNode()!;\n    }\n\n    // If the widget is not contained in the ref node, ensure it is\n    // removed from the layout and hidden before being added again.\n    if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n      this._removeWidget(widget);\n      widget.hide();\n    }\n\n    // Lookup the target index for inserting the tab.\n    let index: number;\n    if (ref) {\n      index = refNode.tabBar.titles.indexOf(ref.title);\n    } else {\n      index = refNode.tabBar.currentIndex;\n    }\n\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      if (refNode.tabBar.titles.length === 0) {\n        // Singular tab should use display mode to limit number of layers.\n        widget.hiddenMode = Widget.HiddenMode.Display;\n      } else if (refNode.tabBar.titles.length == 1) {\n        // If we are adding a second tab, switch the existing tab back to scale.\n        const existingWidget = refNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n      } else {\n        // For the third and subsequent tabs no special action is needed.\n        widget.hiddenMode = Widget.HiddenMode.Scale;\n      }\n    } else {\n      // For all other modes just propagate the current mode.\n      widget.hiddenMode = this._hiddenMode;\n    }\n\n    // Insert the widget's tab relative to the target index.\n    refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n    Private.addAria(widget, refNode.tabBar);\n  }\n\n  /**\n   * Insert a widget as a new split area.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertSplit(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    orientation: Private.Orientation,\n    after: boolean,\n    merge: boolean = false\n  ): void {\n    // Do nothing if there is no effective split.\n    if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n      return;\n    }\n\n    // Ensure the widget is removed from the current layout.\n    this._removeWidget(widget);\n\n    // Set the root if it does not exist.\n    if (!this._root) {\n      this._root = this._createTabNode(widget);\n      return;\n    }\n\n    // If the ref node parent is null, split the root.\n    if (!refNode || !refNode.parent) {\n      // Ensure the root is split with the correct orientation.\n      let root = this._splitRoot(orientation);\n\n      // Determine the insert index for the new tab node.\n      let i = after ? root.children.length : 0;\n\n      // Normalize the split node.\n      root.normalizeSizes();\n\n      // Create the sizer for new tab node.\n      let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n      // Insert the tab node sized to the golden ratio.\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(root.children, i, tabNode);\n      ArrayExt.insert(root.sizers, i, sizer);\n      ArrayExt.insert(root.handles, i, this._createHandle());\n      tabNode.parent = root;\n\n      // Re-normalize the split node to maintain the ratios.\n      root.normalizeSizes();\n\n      // Finally, synchronize the visibility of the handles.\n      root.syncHandles();\n      return;\n    }\n\n    // Lookup the split node for the ref widget.\n    let splitNode = refNode.parent;\n\n    // If the split node already had the correct orientation,\n    // the widget can be inserted into the split node directly.\n    if (splitNode.orientation === orientation) {\n      // Find the index of the ref node.\n      let i = splitNode.children.indexOf(refNode);\n\n      // Conditionally reuse a tab layout found in the wanted position.\n      if (merge) {\n        let j = i + (after ? 1 : -1);\n        let sibling = splitNode.children[j];\n        if (sibling instanceof Private.TabLayoutNode) {\n          this._insertTab(widget, null, sibling, true);\n          ++sibling.tabBar.currentIndex;\n          return;\n        }\n      }\n\n      // Normalize the split node.\n      splitNode.normalizeSizes();\n\n      // Consume half the space for the insert location.\n      let s = (splitNode.sizers[i].sizeHint /= 2);\n\n      // Insert the tab node sized to the other half.\n      let j = i + (after ? 1 : 0);\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(splitNode.children, j, tabNode);\n      ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n      ArrayExt.insert(splitNode.handles, j, this._createHandle());\n      tabNode.parent = splitNode;\n\n      // Finally, synchronize the visibility of the handles.\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Remove the ref node from the split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n    // Create a new normalized split node for the children.\n    let childNode = new Private.SplitLayoutNode(orientation);\n    childNode.normalized = true;\n\n    // Add the ref node sized to half the space.\n    childNode.children.push(refNode);\n    childNode.sizers.push(Private.createSizer(0.5));\n    childNode.handles.push(this._createHandle());\n    refNode.parent = childNode;\n\n    // Add the tab node sized to the other half.\n    let j = after ? 1 : 0;\n    let tabNode = this._createTabNode(widget);\n    ArrayExt.insert(childNode.children, j, tabNode);\n    ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n    ArrayExt.insert(childNode.handles, j, this._createHandle());\n    tabNode.parent = childNode;\n\n    // Synchronize the visibility of the handles.\n    childNode.syncHandles();\n\n    // Finally, add the new child node to the original split node.\n    ArrayExt.insert(splitNode.children, i, childNode);\n    childNode.parent = splitNode;\n  }\n\n  /**\n   * Ensure the root is a split node with the given orientation.\n   */\n  private _splitRoot(\n    orientation: Private.Orientation\n  ): Private.SplitLayoutNode {\n    // Bail early if the root already meets the requirements.\n    let oldRoot = this._root;\n    if (oldRoot instanceof Private.SplitLayoutNode) {\n      if (oldRoot.orientation === orientation) {\n        return oldRoot;\n      }\n    }\n\n    // Create a new root node with the specified orientation.\n    let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n    // Add the old root to the new root.\n    if (oldRoot) {\n      newRoot.children.push(oldRoot);\n      newRoot.sizers.push(Private.createSizer(0));\n      newRoot.handles.push(this._createHandle());\n      oldRoot.parent = newRoot;\n    }\n\n    // Return the new root as a convenience.\n    return newRoot;\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the size limits for the layout tree.\n    if (this._root) {\n      let limits = this._root.fit(this._spacing, this._items);\n      minW = limits.minWidth;\n      minH = limits.minHeight;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Bail early if there is no root layout node.\n    if (!this._root) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let x = this._box.paddingTop;\n    let y = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the geometry of the layout tree.\n    this._root.update(x, y, width, height, this._spacing, this._items);\n  }\n\n  /**\n   * Create a new tab bar for use by the dock layout.\n   *\n   * #### Notes\n   * The tab bar will be attached to the parent if it exists.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar using the renderer.\n    let tabBar = this.renderer.createTabBar(this._document);\n\n    // Enforce necessary tab bar behavior.\n    tabBar.orientation = 'horizontal';\n\n    // Attach the tab bar to the parent if possible.\n    if (this.parent) {\n      this.attachWidget(tabBar);\n    }\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for the dock layout.\n   *\n   * #### Notes\n   * The handle will be attached to the parent if it exists.\n   */\n  private _createHandle(): HTMLDivElement {\n    // Create the handle using the renderer.\n    let handle = this.renderer.createHandle();\n\n    // Initialize the handle layout behavior.\n    let style = handle.style;\n    style.position = 'absolute';\n    style.contain = 'strict';\n    style.top = '0';\n    style.left = '0';\n    style.width = '0';\n    style.height = '0';\n\n    // Attach the handle to the parent if it exists.\n    if (this.parent) {\n      this.parent.node.appendChild(handle);\n    }\n\n    // Return the initialized handle.\n    return handle;\n  }\n\n  private _spacing = 4;\n  private _dirty = false;\n  private _root: Private.LayoutNode | null = null;\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _document: Document | ShadowRoot;\n  private _hiddenMode: Widget.HiddenMode;\n  private _items: Private.ItemMap = new Map<Widget, LayoutItem>();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n  /**\n   * An options object for creating a dock layout.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * The renderer to use for the dock layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a dock layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new tab bar for use with a dock layout.\n     *\n     * @returns A new tab bar for a dock layout.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget>;\n\n    /**\n     * Create a new handle node for use with a dock layout.\n     *\n     * @returns A new handle node for a dock layout.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * A type alias for the supported insertion modes.\n   *\n   * An insert mode is used to specify how a widget should be added\n   * to the dock layout relative to a reference widget.\n   */\n  export type InsertMode =\n    | /**\n     * The area to the top of the reference widget.\n     *\n     * The widget will be inserted just above the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the top edge of the dock layout.\n     */\n    'split-top'\n\n    /**\n     * The area to the left of the reference widget.\n     *\n     * The widget will be inserted just left of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the left edge of the dock layout.\n     */\n    | 'split-left'\n\n    /**\n     * The area to the right of the reference widget.\n     *\n     * The widget will be inserted just right of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted  at the right edge of the dock layout.\n     */\n    | 'split-right'\n\n    /**\n     * The area to the bottom of the reference widget.\n     *\n     * The widget will be inserted just below the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the bottom edge of the dock layout.\n     */\n    | 'split-bottom'\n\n    /**\n     * Like `split-top` but if a tab layout exists above the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-top'\n\n    /**\n     * Like `split-left` but if a tab layout exists left of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-left'\n\n    /**\n     * Like `split-right` but if a tab layout exists right of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-right'\n\n    /**\n     * Like `split-bottom` but if a tab layout exists below the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-bottom'\n\n    /**\n     * The tab position before the reference widget.\n     *\n     * The widget will be added as a tab before the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-before'\n\n    /**\n     * The tab position after the reference widget.\n     *\n     * The widget will be added as a tab after the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-after';\n\n  /**\n   * An options object for adding a widget to the dock layout.\n   */\n  export interface IAddOptions {\n    /**\n     * The insertion mode for adding the widget.\n     *\n     * The default is `'tab-after'`.\n     */\n    mode?: InsertMode;\n\n    /**\n     * The reference widget for the insert location.\n     *\n     * The default is `null`.\n     */\n    ref?: Widget | null;\n  }\n\n  /**\n   * A layout config object for a tab area.\n   */\n  export interface ITabAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'tab-area';\n\n    /**\n     * The widgets contained in the tab area.\n     */\n    widgets: Widget[];\n\n    /**\n     * The index of the selected tab.\n     */\n    currentIndex: number;\n  }\n\n  /**\n   * A layout config object for a split area.\n   */\n  export interface ISplitAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'split-area';\n\n    /**\n     * The orientation of the split area.\n     */\n    orientation: 'horizontal' | 'vertical';\n\n    /**\n     * The children in the split area.\n     */\n    children: AreaConfig[];\n\n    /**\n     * The relative sizes of the children.\n     */\n    sizes: number[];\n  }\n\n  /**\n   * A type alias for a general area config.\n   */\n  export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n  /**\n   * A dock layout configuration object.\n   */\n  export interface ILayoutConfig {\n    /**\n     * The layout config for the main dock area.\n     */\n    main: AreaConfig | null;\n  }\n\n  /**\n   * An object which represents the geometry of a tab area.\n   */\n  export interface ITabAreaGeometry {\n    /**\n     * The tab bar for the tab area.\n     */\n    tabBar: TabBar<Widget>;\n\n    /**\n     * The local X position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the local X coordinate of the hit test query.\n     */\n    x: number;\n\n    /**\n     * The local Y position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the local Y coordinate of the hit test query.\n     */\n    y: number;\n\n    /**\n     * The local coordinate of the top edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the top edge of the tab area.\n     */\n    top: number;\n\n    /**\n     * The local coordinate of the left edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the left edge of the tab area.\n     */\n    left: number;\n\n    /**\n     * The local coordinate of the right edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the right edge of the layout parent\n     * widget, to the right edge of the tab area.\n     */\n    right: number;\n\n    /**\n     * The local coordinate of the bottom edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the bottom edge of the layout parent\n     * widget, to the bottom edge of the tab area.\n     */\n    bottom: number;\n\n    /**\n     * The width of the tab area.\n     *\n     * #### Notes\n     * This is total width allocated for the tab area.\n     */\n    width: number;\n\n    /**\n     * The height of the tab area.\n     *\n     * #### Notes\n     * This is total height allocated for the tab area.\n     */\n    height: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * A type alias for a dock layout node.\n   */\n  export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n  /**\n   * A type alias for the orientation of a split layout node.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a layout item map.\n   */\n  export type ItemMap = Map<Widget, LayoutItem>;\n\n  /**\n   * Create a box sizer with an initial size hint.\n   */\n  export function createSizer(hint: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = hint;\n    sizer.size = hint;\n    return sizer;\n  }\n\n  /**\n   * Normalize an area config object and collect the visited widgets.\n   */\n  export function normalizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    let result: DockLayout.AreaConfig | null;\n    if (config.type === 'tab-area') {\n      result = normalizeTabAreaConfig(config, widgetSet);\n    } else {\n      result = normalizeSplitAreaConfig(config, widgetSet);\n    }\n    return result;\n  }\n\n  /**\n   * Convert a normalized area config into a layout tree.\n   */\n  export function realizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): LayoutNode {\n    let node: LayoutNode;\n    if (config.type === 'tab-area') {\n      node = realizeTabAreaConfig(config, renderer, document);\n    } else {\n      node = realizeSplitAreaConfig(config, renderer, document);\n    }\n    return node;\n  }\n\n  /**\n   * A layout node which holds the data for a tabbed area.\n   */\n  export class TabLayoutNode {\n    /**\n     * Construct a new tab layout node.\n     *\n     * @param tabBar - The tab bar to use for the layout node.\n     */\n    constructor(tabBar: TabBar<Widget>) {\n      let tabSizer = new BoxSizer();\n      let widgetSizer = new BoxSizer();\n      tabSizer.stretch = 0;\n      widgetSizer.stretch = 1;\n      this.tabBar = tabBar;\n      this.sizers = [tabSizer, widgetSizer];\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * The tab bar for the layout node.\n     */\n    readonly tabBar: TabBar<Widget>;\n\n    /**\n     * The sizers for the layout node.\n     */\n    readonly sizers: [BoxSizer, BoxSizer];\n\n    /**\n     * The most recent value for the `top` edge of the layout box.\n     */\n    get top(): number {\n      return this._top;\n    }\n\n    /**\n     * The most recent value for the `left` edge of the layout box.\n     */\n    get left(): number {\n      return this._left;\n    }\n\n    /**\n     * The most recent value for the `width` of the layout box.\n     */\n    get width(): number {\n      return this._width;\n    }\n\n    /**\n     * The most recent value for the `height` of the layout box.\n     */\n    get height(): number {\n      return this._height;\n    }\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      yield this.tabBar;\n      yield* this.iterUserWidgets();\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const title of this.tabBar.titles) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      let title = this.tabBar.currentTitle;\n      if (title) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      yield this.tabBar;\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    // eslint-disable-next-line require-yield\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      return;\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      return this;\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      if (x < this._left || x >= this._left + this._width) {\n        return null;\n      }\n      if (y < this._top || y >= this._top + this._height) {\n        return null;\n      }\n      return this;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ITabAreaConfig {\n      let widgets = this.tabBar.titles.map(title => title.owner);\n      let currentIndex = this.tabBar.currentIndex;\n      return { type: 'tab-area', widgets, currentIndex };\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      return;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Set up the limit variables.\n      let minWidth = 0;\n      let minHeight = 0;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Lookup the tab bar and widget sizers.\n      let [tabBarSizer, widgetSizer] = this.sizers;\n\n      // Update the tab bar limits.\n      if (tabBarItem) {\n        tabBarItem.fit();\n      }\n\n      // Update the widget limits.\n      if (widgetItem) {\n        widgetItem.fit();\n      }\n\n      // Update the results and sizer for the tab bar.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        minWidth = Math.max(minWidth, tabBarItem.minWidth);\n        minHeight += tabBarItem.minHeight;\n        tabBarSizer.minSize = tabBarItem.minHeight;\n        tabBarSizer.maxSize = tabBarItem.maxHeight;\n      } else {\n        tabBarSizer.minSize = 0;\n        tabBarSizer.maxSize = 0;\n      }\n\n      // Update the results and sizer for the current widget.\n      if (widgetItem && !widgetItem.isHidden) {\n        minWidth = Math.max(minWidth, widgetItem.minWidth);\n        minHeight += widgetItem.minHeight;\n        widgetSizer.minSize = widgetItem.minHeight;\n        widgetSizer.maxSize = Infinity;\n      } else {\n        widgetSizer.minSize = 0;\n        widgetSizer.maxSize = Infinity;\n      }\n\n      // Return the computed size limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Update the layout box values.\n      this._top = top;\n      this._left = left;\n      this._width = width;\n      this._height = height;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, height);\n\n      // Update the tab bar item using the computed size.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        let size = this.sizers[0].size;\n        tabBarItem.update(left, top, width, size);\n        top += size;\n      }\n\n      // Layout the widget using the computed size.\n      if (widgetItem && !widgetItem.isHidden) {\n        let size = this.sizers[1].size;\n        widgetItem.update(left, top, width, size);\n      }\n    }\n\n    private _top = 0;\n    private _left = 0;\n    private _width = 0;\n    private _height = 0;\n  }\n\n  /**\n   * A layout node which holds the data for a split area.\n   */\n  export class SplitLayoutNode {\n    /**\n     * Construct a new split layout node.\n     *\n     * @param orientation - The orientation of the node.\n     */\n    constructor(orientation: Orientation) {\n      this.orientation = orientation;\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * Whether the sizers have been normalized.\n     */\n    normalized = false;\n\n    /**\n     * The orientation of the node.\n     */\n    readonly orientation: Orientation;\n\n    /**\n     * The child nodes for the split node.\n     */\n    readonly children: LayoutNode[] = [];\n\n    /**\n     * The box sizers for the layout children.\n     */\n    readonly sizers: BoxSizer[] = [];\n\n    /**\n     * The handles for the layout children.\n     */\n    readonly handles: HTMLDivElement[] = [];\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterAllWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterUserWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterSelectedWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      for (const child of this.children) {\n        yield* child.iterTabBars();\n      }\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      yield* this.handles;\n      for (const child of this.children) {\n        yield* child.iterHandles();\n      }\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findTabNode(widget);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      let index = this.handles.indexOf(handle);\n      if (index !== -1) {\n        return { index, node: this };\n      }\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findSplitNode(handle);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      if (this.children.length === 0) {\n        return null;\n      }\n      return this.children[0].findFirstTabNode();\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].hitTestTabNodes(x, y);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ISplitAreaConfig {\n      let orientation = this.orientation;\n      let sizes = this.createNormalizedSizes();\n      let children = this.children.map(child => child.createConfig());\n      return { type: 'split-area', orientation, children, sizes };\n    }\n\n    /**\n     * Sync the visibility and orientation of the handles.\n     */\n    syncHandles(): void {\n      this.handles.forEach((handle, i) => {\n        handle.setAttribute('data-orientation', this.orientation);\n        if (i === this.handles.length - 1) {\n          handle.classList.add('lm-mod-hidden');\n        } else {\n          handle.classList.remove('lm-mod-hidden');\n        }\n      });\n    }\n\n    /**\n     * Hold the current sizes of the box sizers.\n     *\n     * This sets the size hint of each sizer to its current size.\n     */\n    holdSizes(): void {\n      for (const sizer of this.sizers) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      for (const child of this.children) {\n        child.holdAllSizes();\n      }\n      this.holdSizes();\n    }\n\n    /**\n     * Normalize the sizes of the split layout node.\n     */\n    normalizeSizes(): void {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return;\n      }\n\n      // Hold the current sizes of the sizers.\n      this.holdSizes();\n\n      // Compute the sum of the sizes.\n      let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint = 1 / n;\n        }\n      } else {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint /= sum;\n        }\n      }\n\n      // Mark the sizes as normalized.\n      this.normalized = true;\n    }\n\n    /**\n     * Snap the normalized sizes of the split layout node.\n     */\n    createNormalizedSizes(): number[] {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return [];\n      }\n\n      // Grab the current sizes of the sizers.\n      let sizes = this.sizers.map(sizer => sizer.size);\n\n      // Compute the sum of the sizes.\n      let sum = sizes.reduce((v, size) => v + size, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] = 1 / n;\n        }\n      } else {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] /= sum;\n        }\n      }\n\n      // Return the normalized sizes.\n      return sizes;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Compute the required fixed space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n      // Set up the limit variables.\n      let minWidth = horizontal ? fixed : 0;\n      let minHeight = horizontal ? 0 : fixed;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Fit the children and update the limits.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let limits = this.children[i].fit(spacing, items);\n        if (horizontal) {\n          minHeight = Math.max(minHeight, limits.minHeight);\n          minWidth += limits.minWidth;\n          this.sizers[i].minSize = limits.minWidth;\n        } else {\n          minWidth = Math.max(minWidth, limits.minWidth);\n          minHeight += limits.minHeight;\n          this.sizers[i].minSize = limits.minHeight;\n        }\n      }\n\n      // Return the computed limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Compute the available layout space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n      let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n      // De-normalize the sizes if needed.\n      if (this.normalized) {\n        for (const sizer of this.sizers) {\n          sizer.sizeHint *= space;\n        }\n        this.normalized = false;\n      }\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, space);\n\n      // Update the geometry of the child nodes and handles.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let child = this.children[i];\n        let size = this.sizers[i].size;\n        let handleStyle = this.handles[i].style;\n        if (horizontal) {\n          child.update(left, top, size, height, spacing, items);\n          left += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${spacing}px`;\n          handleStyle.height = `${height}px`;\n          left += spacing;\n        } else {\n          child.update(left, top, width, size, spacing, items);\n          top += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${width}px`;\n          handleStyle.height = `${spacing}px`;\n          top += spacing;\n        }\n      }\n    }\n  }\n\n  export function addAria(widget: Widget, tabBar: TabBar<Widget>): void {\n    widget.node.setAttribute('role', 'tabpanel');\n    let renderer = tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  export function removeAria(widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n  }\n\n  /**\n   * Normalize a tab area config and collect the visited widgets.\n   */\n  function normalizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.ITabAreaConfig | null {\n    // Bail early if there is no content.\n    if (config.widgets.length === 0) {\n      return null;\n    }\n\n    // Setup the filtered widgets array.\n    let widgets: Widget[] = [];\n\n    // Filter the config for unique widgets.\n    for (const widget of config.widgets) {\n      if (!widgetSet.has(widget)) {\n        widgetSet.add(widget);\n        widgets.push(widget);\n      }\n    }\n\n    // Bail if there are no effective widgets.\n    if (widgets.length === 0) {\n      return null;\n    }\n\n    // Normalize the current index.\n    let index = config.currentIndex;\n    if (index !== -1 && (index < 0 || index >= widgets.length)) {\n      index = 0;\n    }\n\n    // Return a normalized config object.\n    return { type: 'tab-area', widgets, currentIndex: index };\n  }\n\n  /**\n   * Normalize a split area config and collect the visited widgets.\n   */\n  function normalizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    // Set up the result variables.\n    let orientation = config.orientation;\n    let children: DockLayout.AreaConfig[] = [];\n    let sizes: number[] = [];\n\n    // Normalize the config children.\n    for (let i = 0, n = config.children.length; i < n; ++i) {\n      // Normalize the child config.\n      let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n      // Ignore an empty child.\n      if (!child) {\n        continue;\n      }\n\n      // Add the child or hoist its content as appropriate.\n      if (child.type === 'tab-area' || child.orientation !== orientation) {\n        children.push(child);\n        sizes.push(Math.abs(config.sizes[i] || 0));\n      } else {\n        children.push(...child.children);\n        sizes.push(...child.sizes);\n      }\n    }\n\n    // Bail if there are no effective children.\n    if (children.length === 0) {\n      return null;\n    }\n\n    // If there is only one effective child, return that child.\n    if (children.length === 1) {\n      return children[0];\n    }\n\n    // Return a normalized config object.\n    return { type: 'split-area', orientation, children, sizes };\n  }\n\n  /**\n   * Convert a normalized tab area config into a layout tree.\n   */\n  function realizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): TabLayoutNode {\n    // Create the tab bar for the layout node.\n    let tabBar = renderer.createTabBar(document);\n\n    // Hide each widget and add it to the tab bar.\n    for (const widget of config.widgets) {\n      widget.hide();\n      tabBar.addTab(widget.title);\n      Private.addAria(widget, tabBar);\n    }\n\n    // Set the current index of the tab bar.\n    tabBar.currentIndex = config.currentIndex;\n\n    // Return the new tab layout node.\n    return new TabLayoutNode(tabBar);\n  }\n\n  /**\n   * Convert a normalized split area config into a layout tree.\n   */\n  function realizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): SplitLayoutNode {\n    // Create the split layout node.\n    let node = new SplitLayoutNode(config.orientation);\n\n    // Add each child to the layout node.\n    config.children.forEach((child, i) => {\n      // Create the child data for the layout node.\n      let childNode = realizeAreaConfig(child, renderer, document);\n      let sizer = createSizer(config.sizes[i]);\n      let handle = renderer.createHandle();\n\n      // Add the child data to the layout node.\n      node.children.push(childNode);\n      node.handles.push(handle);\n      node.sizers.push(sizer);\n\n      // Update the parent for the child node.\n      childNode.parent = node;\n    });\n\n    // Synchronize the handle state for the layout node.\n    node.syncHandles();\n\n    // Normalize the sizes for the layout node.\n    node.normalizeSizes();\n\n    // Return the new layout node.\n    return node;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n  /**\n   * Construct a new dock panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: DockPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-DockPanel');\n    this._document = options.document || document;\n    this._mode = options.mode || 'multiple-document';\n    this._renderer = options.renderer || DockPanel.defaultRenderer;\n    this._edges = options.edges || Private.DEFAULT_EDGES;\n    if (options.tabsMovable !== undefined) {\n      this._tabsMovable = options.tabsMovable;\n    }\n    if (options.tabsConstrained !== undefined) {\n      this._tabsConstrained = options.tabsConstrained;\n    }\n    if (options.addButtonEnabled !== undefined) {\n      this._addButtonEnabled = options.addButtonEnabled;\n    }\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = this._mode;\n\n    // Create the delegate renderer for the layout.\n    let renderer: DockPanel.IRenderer = {\n      createTabBar: () => this._createTabBar(),\n      createHandle: () => this._createHandle()\n    };\n\n    // Set up the dock layout for the panel.\n    this.layout = new DockLayout({\n      document: this._document,\n      renderer,\n      spacing: options.spacing,\n      hiddenMode: options.hiddenMode\n    });\n\n    // Set up the overlay drop indicator.\n    this.overlay = options.overlay || new DockPanel.Overlay();\n    this.node.appendChild(this.overlay.node);\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    // Ensure the mouse is released.\n    this._releaseMouse();\n\n    // Hide the overlay.\n    this.overlay.hide(0);\n\n    // Cancel a drag if one is in progress.\n    if (this._drag) {\n      this._drag.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The method for hiding widgets.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as DockLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as DockLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when the layout configuration is modified.\n   *\n   * #### Notes\n   * This signal is emitted whenever the current layout configuration\n   * may have changed.\n   *\n   * This signal is emitted asynchronously in a collapsed fashion, so\n   * that multiple synchronous modifications results in only a single\n   * emit of the signal.\n   */\n  get layoutModified(): ISignal<this, void> {\n    return this._layoutModified;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The overlay used by the dock panel.\n   */\n  readonly overlay: DockPanel.IOverlay;\n\n  /**\n   * The renderer used by the dock panel.\n   */\n  get renderer(): DockPanel.IRenderer {\n    return (this.layout as DockLayout).renderer;\n  }\n\n  /**\n   * Get the spacing between the widgets.\n   */\n  get spacing(): number {\n    return (this.layout as DockLayout).spacing;\n  }\n\n  /**\n   * Set the spacing between the widgets.\n   */\n  set spacing(value: number) {\n    (this.layout as DockLayout).spacing = value;\n  }\n\n  /**\n   * Get the mode for the dock panel.\n   */\n  get mode(): DockPanel.Mode {\n    return this._mode;\n  }\n\n  /**\n   * Set the mode for the dock panel.\n   *\n   * #### Notes\n   * Changing the mode is a destructive operation with respect to the\n   * panel's layout configuration. If layout state must be preserved,\n   * save the current layout config before changing the mode.\n   */\n  set mode(value: DockPanel.Mode) {\n    // Bail early if the mode does not change.\n    if (this._mode === value) {\n      return;\n    }\n\n    // Update the internal mode.\n    this._mode = value;\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = value;\n\n    // Get the layout for the panel.\n    let layout = this.layout as DockLayout;\n\n    // Configure the layout for the specified mode.\n    switch (value) {\n      case 'multiple-document':\n        for (const tabBar of layout.tabBars()) {\n          tabBar.show();\n        }\n        break;\n      case 'single-document':\n        layout.restoreLayout(Private.createSingleDocumentConfig(this));\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Whether the tabs can be dragged / moved at runtime.\n   */\n  get tabsMovable(): boolean {\n    return this._tabsMovable;\n  }\n\n  /**\n   * Enable / Disable draggable / movable tabs.\n   */\n  set tabsMovable(value: boolean) {\n    this._tabsMovable = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.tabsMovable = value;\n    }\n  }\n\n  /**\n   * Whether the tabs are constrained to their source dock panel\n   */\n  get tabsConstrained(): boolean {\n    return this._tabsConstrained;\n  }\n\n  /**\n   * Constrain/Allow tabs to be dragged outside of this dock panel\n   */\n  set tabsConstrained(value: boolean) {\n    this._tabsConstrained = value;\n  }\n\n  /**\n   * Whether the add buttons for each tab bar are enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add buttons for each tab bar are enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    this._addButtonEnabled = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.addButtonEnabled = value;\n    }\n  }\n\n  /**\n   * Whether the dock panel is empty.\n   */\n  get isEmpty(): boolean {\n    return (this.layout as DockLayout).isEmpty;\n  }\n\n  /**\n   * Create an iterator over the user widgets in the panel.\n   *\n   * @returns A new iterator over the user widgets in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  *widgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).widgets();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the panel.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the panel.\n   */\n  *selectedWidgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).selectedWidgets();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the panel.\n   *\n   * @returns A new iterator over the tab bars in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  *tabBars(): IterableIterator<TabBar<Widget>> {\n    yield* (this.layout as DockLayout).tabBars();\n  }\n\n  /**\n   * Create an iterator over the handles in the panel.\n   *\n   * @returns A new iterator over the handles in the panel.\n   */\n  *handles(): IterableIterator<HTMLDivElement> {\n    yield* (this.layout as DockLayout).handles();\n  }\n\n  /**\n   * Select a specific widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will make the widget the current widget in its tab area.\n   */\n  selectWidget(widget: Widget): void {\n    // Find the tab bar which contains the widget.\n    let tabBar = find(this.tabBars(), bar => {\n      return bar.titles.indexOf(widget.title) !== -1;\n    });\n\n    // Throw an error if no tab bar is found.\n    if (!tabBar) {\n      throw new Error('Widget is not contained in the dock panel.');\n    }\n\n    // Ensure the widget is the current widget.\n    tabBar.currentTitle = widget.title;\n  }\n\n  /**\n   * Activate a specified widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will select and activate the given widget.\n   */\n  activateWidget(widget: Widget): void {\n    this.selectWidget(widget);\n    widget.activate();\n  }\n\n  /**\n   * Save the current layout configuration of the dock panel.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockPanel.ILayoutConfig {\n    return (this.layout as DockLayout).saveLayout();\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   *\n   * The dock panel automatically reverts to `'multiple-document'`\n   * mode when a layout config is restored.\n   */\n  restoreLayout(config: DockPanel.ILayoutConfig): void {\n    // Reset the mode.\n    this._mode = 'multiple-document';\n\n    // Restore the layout.\n    (this.layout as DockLayout).restoreLayout(config);\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Add a widget to the dock panel.\n   *\n   * @param widget - The widget to add to the dock panel.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * If the panel is in single document mode, the options are ignored\n   * and the widget is always added as tab in the hidden tab bar.\n   */\n  addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n    // Add the widget to the layout.\n    if (this._mode === 'single-document') {\n      (this.layout as DockLayout).addWidget(widget);\n    } else {\n      (this.layout as DockLayout).addWidget(widget, options);\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   */\n  processMessage(msg: Message): void {\n    if (msg.type === 'layout-modified') {\n      this._layoutModified.emit(undefined);\n    } else {\n      super.processMessage(msg);\n    }\n  }\n\n  /**\n   * Handle the DOM events for the dock panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'lm-dragenter':\n        this._evtDragEnter(event as Drag.Event);\n        break;\n      case 'lm-dragleave':\n        this._evtDragLeave(event as Drag.Event);\n        break;\n      case 'lm-dragover':\n        this._evtDragOver(event as Drag.Event);\n        break;\n      case 'lm-drop':\n        this._evtDrop(event as Drag.Event);\n        break;\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('lm-dragenter', this);\n    this.node.addEventListener('lm-dragleave', this);\n    this.node.addEventListener('lm-dragover', this);\n    this.node.addEventListener('lm-drop', this);\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('lm-dragenter', this);\n    this.node.removeEventListener('lm-dragleave', this);\n    this.node.removeEventListener('lm-dragover', this);\n    this.node.removeEventListener('lm-drop', this);\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Add the widget class to the child.\n    msg.child.addClass('lm-DockPanel-widget');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Remove the widget class from the child.\n    msg.child.removeClass('lm-DockPanel-widget');\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `'lm-dragenter'` event for the dock panel.\n   */\n  private _evtDragEnter(event: Drag.Event): void {\n    // If the factory mime type is present, mark the event as\n    // handled in order to get the rest of the drag events.\n    if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n  }\n\n  /**\n   * Handle the `'lm-dragleave'` event for the dock panel.\n   */\n  private _evtDragLeave(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    if (this._tabsConstrained && event.source !== this) return;\n\n    event.stopPropagation();\n\n    // The new target might be a descendant, so we might still handle the drop.\n    // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n    // hide is cancelled by the lm-dragover handler's show overlay logic.\n    this.overlay.hide(1);\n  }\n\n  /**\n   * Handle the `'lm-dragover'` event for the dock panel.\n   */\n  private _evtDragOver(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Show the drop indicator overlay and update the drop\n    // action based on the drop target zone under the mouse.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      this._showOverlay(event.clientX, event.clientY) === 'invalid'\n    ) {\n      event.dropAction = 'none';\n    } else {\n      event.stopPropagation();\n      event.dropAction = event.proposedAction;\n    }\n  }\n\n  /**\n   * Handle the `'lm-drop'` event for the dock panel.\n   */\n  private _evtDrop(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Hide the drop indicator overlay.\n    this.overlay.hide(0);\n\n    // Bail if the proposed action is to do nothing.\n    if (event.proposedAction === 'none') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the drop target under the mouse.\n    let { clientX, clientY } = event;\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // Bail if the drop zone is invalid.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      zone === 'invalid'\n    ) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory mime type has invalid data.\n    let mimeData = event.mimeData;\n    let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n    if (typeof factory !== 'function') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory does not produce a widget.\n    let widget = factory();\n    if (!(widget instanceof Widget)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the widget is an ancestor of the dock panel.\n    if (widget.contains(this)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the reference widget for the drop target.\n    let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n    // Add the widget according to the indicated drop zone.\n    switch (zone) {\n      case 'root-all':\n        this.addWidget(widget);\n        break;\n      case 'root-top':\n        this.addWidget(widget, { mode: 'split-top' });\n        break;\n      case 'root-left':\n        this.addWidget(widget, { mode: 'split-left' });\n        break;\n      case 'root-right':\n        this.addWidget(widget, { mode: 'split-right' });\n        break;\n      case 'root-bottom':\n        this.addWidget(widget, { mode: 'split-bottom' });\n        break;\n      case 'widget-all':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      case 'widget-top':\n        this.addWidget(widget, { mode: 'split-top', ref });\n        break;\n      case 'widget-left':\n        this.addWidget(widget, { mode: 'split-left', ref });\n        break;\n      case 'widget-right':\n        this.addWidget(widget, { mode: 'split-right', ref });\n        break;\n      case 'widget-bottom':\n        this.addWidget(widget, { mode: 'split-bottom', ref });\n        break;\n      case 'widget-tab':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Accept the proposed drop action.\n    event.dropAction = event.proposedAction;\n\n    // Stop propagation if we have not bailed so far.\n    event.stopPropagation();\n\n    // Activate the dropped widget.\n    this.activateWidget(widget);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the dock panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      // Finalize the mouse release.\n      this._releaseMouse();\n\n      // Schedule an emit of the layout modified signal.\n      MessageLoop.postMessage(this, Private.LayoutModified);\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the dock panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the mouse target, if any.\n    let layout = this.layout as DockLayout;\n    let target = event.target as HTMLElement;\n    let handle = find(layout.handles(), handle => handle.contains(target));\n    if (!handle) {\n      return;\n    }\n\n    // Stop the event when a handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    this._document.addEventListener('keydown', this, true);\n    this._document.addEventListener('pointerup', this, true);\n    this._document.addEventListener('pointermove', this, true);\n    this._document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset deltas for the handle press.\n    let rect = handle.getBoundingClientRect();\n    let deltaX = event.clientX - rect.left;\n    let deltaY = event.clientY - rect.top;\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!, this._document);\n    this._pressData = { handle, deltaX, deltaY, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the dock panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event when dragging a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let rect = this.node.getBoundingClientRect();\n    let xPos = event.clientX - rect.left - this._pressData.deltaX;\n    let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n    // Set the handle as close to the desired position as possible.\n    let layout = this.layout as DockLayout;\n    layout.moveHandle(this._pressData.handle, xPos, yPos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the dock panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Release the mouse grab for the dock panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra document listeners.\n    this._document.removeEventListener('keydown', this, true);\n    this._document.removeEventListener('pointerup', this, true);\n    this._document.removeEventListener('pointermove', this, true);\n    this._document.removeEventListener('contextmenu', this, true);\n  }\n\n  /**\n   * Show the overlay indicator at the given client position.\n   *\n   * Returns the drop zone at the specified client position.\n   *\n   * #### Notes\n   * If the position is not over a valid zone, the overlay is hidden.\n   */\n  private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n    // Find the dock target for the given client position.\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // If the drop zone is invalid, hide the overlay and bail.\n    if (zone === 'invalid') {\n      this.overlay.hide(100);\n      return zone;\n    }\n\n    // Setup the variables needed to compute the overlay geometry.\n    let top: number;\n    let left: number;\n    let right: number;\n    let bottom: number;\n    let box = ElementExt.boxSizing(this.node); // TODO cache this?\n    let rect = this.node.getBoundingClientRect();\n\n    // Compute the overlay geometry based on the dock zone.\n    switch (zone) {\n      case 'root-all':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-top':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = rect.height * Private.GOLDEN_RATIO;\n        break;\n      case 'root-left':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = rect.width * Private.GOLDEN_RATIO;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-right':\n        top = box.paddingTop;\n        left = rect.width * Private.GOLDEN_RATIO;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-bottom':\n        top = rect.height * Private.GOLDEN_RATIO;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'widget-all':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-top':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height / 2;\n        break;\n      case 'widget-left':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right + target!.width / 2;\n        bottom = target!.bottom;\n        break;\n      case 'widget-right':\n        top = target!.top;\n        left = target!.left + target!.width / 2;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-bottom':\n        top = target!.top + target!.height / 2;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-tab': {\n        const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height - tabHeight;\n        break;\n      }\n      default:\n        throw 'unreachable';\n    }\n\n    // Show the overlay with the computed geometry.\n    this.overlay.show({ top, left, right, bottom });\n\n    // Finally, return the computed drop zone.\n    return zone;\n  }\n\n  /**\n   * Create a new tab bar for use by the panel.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar.\n    let tabBar = this._renderer.createTabBar(this._document);\n\n    // Set the generated tab bar property for the tab bar.\n    Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n    // Hide the tab bar when in single document mode.\n    if (this._mode === 'single-document') {\n      tabBar.hide();\n    }\n\n    // Enforce necessary tab bar behavior.\n    // TODO do we really want to enforce *all* of these?\n    tabBar.tabsMovable = this._tabsMovable;\n    tabBar.allowDeselect = false;\n    tabBar.addButtonEnabled = this._addButtonEnabled;\n    tabBar.removeBehavior = 'select-previous-tab';\n    tabBar.insertBehavior = 'select-tab-if-needed';\n\n    // Connect the signal handlers for the tab bar.\n    tabBar.tabMoved.connect(this._onTabMoved, this);\n    tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n    tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n    tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for use by the panel.\n   */\n  private _createHandle(): HTMLDivElement {\n    return this._renderer.createHandle();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from a tab bar.\n   */\n  private _onTabMoved(): void {\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `currentChanged` signal from a tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousTitle, currentTitle } = args;\n\n    // Hide the previous widget.\n    if (previousTitle) {\n      previousTitle.owner.hide();\n    }\n\n    // Show the current widget.\n    if (currentTitle) {\n      currentTitle.owner.show();\n    }\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `addRequested` signal from a tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from a tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from a tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabDetachRequested` signal from a tab bar.\n   */\n  private _onTabDetachRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabDetachRequestedArgs<Widget>\n  ): void {\n    // Do nothing if a drag is already in progress.\n    if (this._drag) {\n      return;\n    }\n\n    // Release the tab bar's hold on the mouse.\n    sender.releaseMouse();\n\n    // Extract the data from the args.\n    let { title, tab, clientX, clientY, offset } = args;\n\n    // Setup the mime data for the drag operation.\n    let mimeData = new MimeData();\n    let factory = () => title.owner;\n    mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n    // Create the drag image for the drag operation.\n    let dragImage = tab.cloneNode(true) as HTMLElement;\n    if (offset) {\n      dragImage.style.top = `-${offset.y}px`;\n      dragImage.style.left = `-${offset.x}px`;\n    }\n\n    // Create the drag object to manage the drag-drop operation.\n    this._drag = new Drag({\n      document: this._document,\n      mimeData,\n      dragImage,\n      proposedAction: 'move',\n      supportedActions: 'move',\n      source: this\n    });\n\n    // Hide the tab node in the original tab.\n    tab.classList.add('lm-mod-hidden');\n    let cleanup = () => {\n      this._drag = null;\n      tab.classList.remove('lm-mod-hidden');\n    };\n\n    // Start the drag operation and cleanup when done.\n    this._drag.start(clientX, clientY).then(cleanup);\n  }\n\n  private _edges: DockPanel.IEdges;\n  private _document: Document | ShadowRoot;\n  private _mode: DockPanel.Mode;\n  private _drag: Drag | null = null;\n  private _renderer: DockPanel.IRenderer;\n  private _tabsMovable: boolean = true;\n  private _tabsConstrained: boolean = false;\n  private _addButtonEnabled: boolean = false;\n  private _pressData: Private.IPressData | null = null;\n  private _layoutModified = new Signal<this, void>(this);\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n  /**\n   * An options object for creating a dock panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n    /**\n     * The overlay to use with the dock panel.\n     *\n     * The default is a new `Overlay` instance.\n     */\n    overlay?: IOverlay;\n\n    /**\n     * The renderer to use for the dock panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The spacing between the items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The mode for the dock panel.\n     *\n     * The default is `'multiple-document'`.\n     */\n    mode?: DockPanel.Mode;\n\n    /**\n     * The sizes of the edge drop zones, in pixels.\n     * If not given, default values will be used.\n     */\n    edges?: IEdges;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * Allow tabs to be draggable / movable by user.\n     *\n     * The default is `'true'`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Constrain tabs to this dock panel\n     *\n     * The default is `'false'`.\n     */\n    tabsConstrained?: boolean;\n\n    /**\n     * Enable add buttons in each of the dock panel's tab bars.\n     *\n     * The default is `'false'`.\n     */\n    addButtonEnabled?: boolean;\n  }\n\n  /**\n   * The sizes of the edge drop zones, in pixels.\n   */\n  export interface IEdges {\n    /**\n     * The size of the top edge drop zone.\n     */\n    top: number;\n\n    /**\n     * The size of the right edge drop zone.\n     */\n    right: number;\n\n    /**\n     * The size of the bottom edge drop zone.\n     */\n    bottom: number;\n\n    /**\n     * The size of the left edge drop zone.\n     */\n    left: number;\n  }\n\n  /**\n   * A type alias for the supported dock panel modes.\n   */\n  export type Mode =\n    | /**\n     * The single document mode.\n     *\n     * In this mode, only a single widget is visible at a time, and that\n     * widget fills the available layout space. No tab bars are visible.\n     */\n    'single-document'\n\n    /**\n     * The multiple document mode.\n     *\n     * In this mode, multiple documents are displayed in separate tab\n     * areas, and those areas can be individually resized by the user.\n     */\n    | 'multiple-document';\n\n  /**\n   * A type alias for a layout configuration object.\n   */\n  export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n  /**\n   * A type alias for the supported insertion modes.\n   */\n  export type InsertMode = DockLayout.InsertMode;\n\n  /**\n   * A type alias for the add widget options.\n   */\n  export type IAddOptions = DockLayout.IAddOptions;\n\n  /**\n   * An object which holds the geometry for overlay positioning.\n   */\n  export interface IOverlayGeometry {\n    /**\n     * The distance between the overlay and parent top edges.\n     */\n    top: number;\n\n    /**\n     * The distance between the overlay and parent left edges.\n     */\n    left: number;\n\n    /**\n     * The distance between the overlay and parent right edges.\n     */\n    right: number;\n\n    /**\n     * The distance between the overlay and parent bottom edges.\n     */\n    bottom: number;\n  }\n\n  /**\n   * An object which manages the overlay node for a dock panel.\n   */\n  export interface IOverlay {\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     *\n     * #### Notes\n     * The given geometry values assume the node will use absolute\n     * positioning.\n     *\n     * This is called on every mouse move event during a drag in order\n     * to update the position of the overlay. It should be efficient.\n     */\n    show(geo: IOverlayGeometry): void;\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 should hide the overlay immediately.\n     *\n     * #### Notes\n     * This is called whenever the overlay node should been hidden.\n     */\n    hide(delay: number): void;\n  }\n\n  /**\n   * A concrete implementation of `IOverlay`.\n   *\n   * This is the default overlay implementation for a dock panel.\n   */\n  export class Overlay implements IOverlay {\n    /**\n     * Construct a new overlay.\n     */\n    constructor() {\n      this.node = document.createElement('div');\n      this.node.classList.add('lm-DockPanel-overlay');\n      this.node.classList.add('lm-mod-hidden');\n      this.node.style.position = 'absolute';\n      this.node.style.contain = 'strict';\n    }\n\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     */\n    show(geo: IOverlayGeometry): void {\n      // Update the position of the overlay.\n      let style = this.node.style;\n      style.top = `${geo.top}px`;\n      style.left = `${geo.left}px`;\n      style.right = `${geo.right}px`;\n      style.bottom = `${geo.bottom}px`;\n\n      // Clear any pending hide timer.\n      clearTimeout(this._timer);\n      this._timer = -1;\n\n      // If the overlay is already visible, we're done.\n      if (!this._hidden) {\n        return;\n      }\n\n      // Clear the hidden flag.\n      this._hidden = false;\n\n      // Finally, show the overlay.\n      this.node.classList.remove('lm-mod-hidden');\n    }\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 will hide the overlay immediately.\n     */\n    hide(delay: number): void {\n      // Do nothing if the overlay is already hidden.\n      if (this._hidden) {\n        return;\n      }\n\n      // Hide immediately if the delay is <= 0.\n      if (delay <= 0) {\n        clearTimeout(this._timer);\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n        return;\n      }\n\n      // Do nothing if a hide is already pending.\n      if (this._timer !== -1) {\n        return;\n      }\n\n      // Otherwise setup the hide timer.\n      this._timer = window.setTimeout(() => {\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n      }, delay);\n    }\n\n    private _timer = -1;\n    private _hidden = true;\n  }\n\n  /**\n   * A type alias for a dock panel renderer;\n   */\n  export type IRenderer = DockLayout.IRenderer;\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new tab bar for use with a dock panel.\n     *\n     * @returns A new tab bar for a dock panel.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget> {\n      let bar = new TabBar<Widget>({ document });\n      bar.addClass('lm-DockPanel-tabBar');\n      return bar;\n    }\n\n    /**\n     * Create a new handle node for use with a dock panel.\n     *\n     * @returns A new handle node for a dock panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-DockPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * The default sizes for the edge drop zones, in pixels.\n   */\n  export const DEFAULT_EDGES = {\n    /**\n     * The size of the top edge dock zone for the root panel, in pixels.\n     * This is different from the others to distinguish between the top\n     * tab bar and the top root zone.\n     */\n    top: 12,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    right: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    bottom: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    left: 40\n  };\n\n  /**\n   * A singleton `'layout-modified'` conflatable message.\n   */\n  export const LayoutModified = new ConflatableMessage('layout-modified');\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The handle which was pressed.\n     */\n    handle: HTMLDivElement;\n\n    /**\n     * The X offset of the press in handle coordinates.\n     */\n    deltaX: number;\n\n    /**\n     * The Y offset of the press in handle coordinates.\n     */\n    deltaY: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * A type alias for a drop zone.\n   */\n  export type DropZone =\n    | /**\n     * An invalid drop zone.\n     */\n    'invalid'\n\n    /**\n     * The entirety of the root dock area.\n     */\n    | 'root-all'\n\n    /**\n     * The top portion of the root dock area.\n     */\n    | 'root-top'\n\n    /**\n     * The left portion of the root dock area.\n     */\n    | 'root-left'\n\n    /**\n     * The right portion of the root dock area.\n     */\n    | 'root-right'\n\n    /**\n     * The bottom portion of the root dock area.\n     */\n    | 'root-bottom'\n\n    /**\n     * The entirety of a tabbed widget area.\n     */\n    | 'widget-all'\n\n    /**\n     * The top portion of tabbed widget area.\n     */\n    | 'widget-top'\n\n    /**\n     * The left portion of tabbed widget area.\n     */\n    | 'widget-left'\n\n    /**\n     * The right portion of tabbed widget area.\n     */\n    | 'widget-right'\n\n    /**\n     * The bottom portion of tabbed widget area.\n     */\n    | 'widget-bottom'\n\n    /**\n     * The the bar of a tabbed widget area.\n     */\n    | 'widget-tab';\n\n  /**\n   * An object which holds the drop target zone and widget.\n   */\n  export interface IDropTarget {\n    /**\n     * The semantic zone for the mouse position.\n     */\n    zone: DropZone;\n\n    /**\n     * The tab area geometry for the drop zone, or `null`.\n     */\n    target: DockLayout.ITabAreaGeometry | null;\n  }\n\n  /**\n   * An attached property used to track generated tab bars.\n   */\n  export const isGeneratedTabBarProperty = new AttachedProperty<\n    Widget,\n    boolean\n  >({\n    name: 'isGeneratedTabBar',\n    create: () => false\n  });\n\n  /**\n   * Create a single document config for the widgets in a dock panel.\n   */\n  export function createSingleDocumentConfig(\n    panel: DockPanel\n  ): DockPanel.ILayoutConfig {\n    // Return an empty config if the panel is empty.\n    if (panel.isEmpty) {\n      return { main: null };\n    }\n\n    // Get a flat array of the widgets in the panel.\n    let widgets = Array.from(panel.widgets());\n\n    // Get the first selected widget in the panel.\n    let selected = panel.selectedWidgets().next().value;\n\n    // Compute the current index for the new config.\n    let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n    // Return the single document config.\n    return { main: { type: 'tab-area', widgets, currentIndex } };\n  }\n\n  /**\n   * Find the drop target at the given client position.\n   */\n  export function findDropTarget(\n    panel: DockPanel,\n    clientX: number,\n    clientY: number,\n    edges: DockPanel.IEdges\n  ): IDropTarget {\n    // Bail if the mouse is not over the dock panel.\n    if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Look up the layout for the panel.\n    let layout = panel.layout as DockLayout;\n\n    // If the layout is empty, indicate the entire root drop zone.\n    if (layout.isEmpty) {\n      return { zone: 'root-all', target: null };\n    }\n\n    // Test the edge zones when in multiple document mode.\n    if (panel.mode === 'multiple-document') {\n      // Get the client rect for the dock panel.\n      let panelRect = panel.node.getBoundingClientRect();\n\n      // Compute the distance to each edge of the panel.\n      let pl = clientX - panelRect.left + 1;\n      let pt = clientY - panelRect.top + 1;\n      let pr = panelRect.right - clientX;\n      let pb = panelRect.bottom - clientY;\n\n      // Find the minimum distance to an edge.\n      let pd = Math.min(pt, pr, pb, pl);\n\n      // Return a root zone if the mouse is within an edge.\n      switch (pd) {\n        case pt:\n          if (pt < edges.top) {\n            return { zone: 'root-top', target: null };\n          }\n          break;\n        case pr:\n          if (pr < edges.right) {\n            return { zone: 'root-right', target: null };\n          }\n          break;\n        case pb:\n          if (pb < edges.bottom) {\n            return { zone: 'root-bottom', target: null };\n          }\n          break;\n        case pl:\n          if (pl < edges.left) {\n            return { zone: 'root-left', target: null };\n          }\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Hit test the dock layout at the given client position.\n    let target = layout.hitTestTabAreas(clientX, clientY);\n\n    // Bail if no target area was found.\n    if (!target) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Return the whole tab area when in single document mode.\n    if (panel.mode === 'single-document') {\n      return { zone: 'widget-all', target };\n    }\n\n    // Compute the distance to each edge of the tab area.\n    let al = target.x - target.left + 1;\n    let at = target.y - target.top + 1;\n    let ar = target.left + target.width - target.x;\n    let ab = target.top + target.height - target.y;\n\n    const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n    if (at < tabHeight) {\n      return { zone: 'widget-tab', target };\n    }\n\n    // Get the X and Y edge sizes for the area.\n    let rx = Math.round(target.width / 3);\n    let ry = Math.round(target.height / 3);\n\n    // If the mouse is not within an edge, indicate the entire area.\n    if (al > rx && ar > rx && at > ry && ab > ry) {\n      return { zone: 'widget-all', target };\n    }\n\n    // Scale the distances by the slenderness ratio.\n    al /= rx;\n    at /= ry;\n    ar /= rx;\n    ab /= ry;\n\n    // Find the minimum distance to the area edge.\n    let ad = Math.min(al, at, ar, ab);\n\n    // Find the widget zone for the area edge.\n    let zone: DropZone;\n    switch (ad) {\n      case al:\n        zone = 'widget-left';\n        break;\n      case at:\n        zone = 'widget-top';\n        break;\n      case ar:\n        zone = 'widget-right';\n        break;\n      case ab:\n        zone = 'widget-bottom';\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Return the final drop target.\n    return { zone, target };\n  }\n\n  /**\n   * Get the drop reference widget for a tab bar.\n   */\n  export function getDropRef(tabBar: TabBar<Widget>): Widget | null {\n    if (tabBar.titles.length === 0) {\n      return null;\n    }\n    if (tabBar.currentTitle) {\n      return tabBar.currentTitle.owner;\n    }\n    return tabBar.titles[tabBar.titles.length - 1].owner;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker<T extends Widget> implements IDisposable {\n  /**\n   * Dispose of the resources held by the tracker.\n   */\n  dispose(): void {\n    // Do nothing if the tracker is already disposed.\n    if (this._counter < 0) {\n      return;\n    }\n\n    // Mark the tracker as disposed.\n    this._counter = -1;\n\n    // Clear the connections for the tracker.\n    Signal.clearData(this);\n\n    // Remove all event listeners.\n    for (const widget of this._widgets) {\n      widget.node.removeEventListener('focus', this, true);\n      widget.node.removeEventListener('blur', this, true);\n    }\n\n    // Clear the internal data structures.\n    this._activeWidget = null;\n    this._currentWidget = null;\n    this._nodes.clear();\n    this._numbers.clear();\n    this._widgets.length = 0;\n  }\n\n  /**\n   * A signal emitted when the current widget has changed.\n   */\n  get currentChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when the active widget has changed.\n   */\n  get activeChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._activeChanged;\n  }\n\n  /**\n   * A flag indicating whether the tracker is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._counter < 0;\n  }\n\n  /**\n   * The current widget in the tracker.\n   *\n   * #### Notes\n   * The current widget is the widget among the tracked widgets which\n   * has the *descendant node* which has most recently been focused.\n   *\n   * The current widget will not be updated if the node loses focus. It\n   * will only be updated when a different tracked widget gains focus.\n   *\n   * If the current widget is removed from the tracker, the previous\n   * current widget will be restored.\n   *\n   * This behavior is intended to follow a user's conceptual model of\n   * a semantically \"current\" widget, where the \"last thing of type X\"\n   * to be interacted with is the \"current instance of X\", regardless\n   * of whether that instance still has focus.\n   */\n  get currentWidget(): T | null {\n    return this._currentWidget;\n  }\n\n  /**\n   * The active widget in the tracker.\n   *\n   * #### Notes\n   * The active widget is the widget among the tracked widgets which\n   * has the *descendant node* which is currently focused.\n   */\n  get activeWidget(): T | null {\n    return this._activeWidget;\n  }\n\n  /**\n   * A read only array of the widgets being tracked.\n   */\n  get widgets(): ReadonlyArray<T> {\n    return this._widgets;\n  }\n\n  /**\n   * Get the focus number for a particular widget in the tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The focus number for the given widget, or `-1` if the\n   *   widget has not had focus since being added to the tracker, or\n   *   is not contained by the tracker.\n   *\n   * #### Notes\n   * The focus number indicates the relative order in which the widgets\n   * have gained focus. A widget with a larger number has gained focus\n   * more recently than a widget with a smaller number.\n   *\n   * The `currentWidget` will always have the largest focus number.\n   *\n   * All widgets start with a focus number of `-1`, which indicates that\n   * the widget has not been focused since being added to the tracker.\n   */\n  focusNumber(widget: T): number {\n    let n = this._numbers.get(widget);\n    return n === undefined ? -1 : n;\n  }\n\n  /**\n   * Test whether the focus tracker contains a given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns `true` if the widget is tracked, `false` otherwise.\n   */\n  has(widget: T): boolean {\n    return this._numbers.has(widget);\n  }\n\n  /**\n   * Add a widget to the focus tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is already tracked, this is a no-op.\n   */\n  add(widget: T): void {\n    // Do nothing if the widget is already tracked.\n    if (this._numbers.has(widget)) {\n      return;\n    }\n\n    // Test whether the widget has focus.\n    let focused = widget.node.contains(document.activeElement);\n\n    // Set up the initial focus number.\n    let n = focused ? this._counter++ : -1;\n\n    // Add the widget to the internal data structures.\n    this._widgets.push(widget);\n    this._numbers.set(widget, n);\n    this._nodes.set(widget.node, widget);\n\n    // Set up the event listeners. The capturing phase must be used\n    // since the 'focus' and 'blur' events don't bubble and Firefox\n    // doesn't support the 'focusin' or 'focusout' events.\n    widget.node.addEventListener('focus', this, true);\n    widget.node.addEventListener('blur', this, true);\n\n    // Connect the disposed signal handler.\n    widget.disposed.connect(this._onWidgetDisposed, this);\n\n    // Set the current and active widgets if needed.\n    if (focused) {\n      this._setWidgets(widget, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the focus tracker.\n   *\n   * #### Notes\n   * If the widget is the `currentWidget`, the previous current widget\n   * will become the new `currentWidget`.\n   *\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is not tracked, this is a no-op.\n   */\n  remove(widget: T): void {\n    // Bail early if the widget is not tracked.\n    if (!this._numbers.has(widget)) {\n      return;\n    }\n\n    // Disconnect the disposed signal handler.\n    widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n    // Remove the event listeners.\n    widget.node.removeEventListener('focus', this, true);\n    widget.node.removeEventListener('blur', this, true);\n\n    // Remove the widget from the internal data structures.\n    ArrayExt.removeFirstOf(this._widgets, widget);\n    this._nodes.delete(widget.node);\n    this._numbers.delete(widget);\n\n    // Bail early if the widget is not the current widget.\n    if (this._currentWidget !== widget) {\n      return;\n    }\n\n    // Filter the widgets for those which have had focus.\n    let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n    // Get the valid widget with the max focus number.\n    let previous =\n      max(valid, (first, second) => {\n        let a = this._numbers.get(first)!;\n        let b = this._numbers.get(second)!;\n        return a - b;\n      }) || null;\n\n    // Set the current and active widgets.\n    this._setWidgets(previous, null);\n  }\n\n  /**\n   * Handle the DOM events for the focus tracker.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tracked nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'focus':\n        this._evtFocus(event as FocusEvent);\n        break;\n      case 'blur':\n        this._evtBlur(event as FocusEvent);\n        break;\n    }\n  }\n\n  /**\n   * Set the current and active widgets for the tracker.\n   */\n  private _setWidgets(current: T | null, active: T | null): void {\n    // Swap the current widget.\n    let oldCurrent = this._currentWidget;\n    this._currentWidget = current;\n\n    // Swap the active widget.\n    let oldActive = this._activeWidget;\n    this._activeWidget = active;\n\n    // Emit the `currentChanged` signal if needed.\n    if (oldCurrent !== current) {\n      this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n    }\n\n    // Emit the `activeChanged` signal if needed.\n    if (oldActive !== active) {\n      this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n    }\n  }\n\n  /**\n   * Handle the `'focus'` event for a tracked widget.\n   */\n  private _evtFocus(event: FocusEvent): void {\n    // Find the widget which gained focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Update the focus number if necessary.\n    if (widget !== this._currentWidget) {\n      this._numbers.set(widget, this._counter++);\n    }\n\n    // Set the current and active widgets.\n    this._setWidgets(widget, widget);\n  }\n\n  /**\n   * Handle the `'blur'` event for a tracked widget.\n   */\n  private _evtBlur(event: FocusEvent): void {\n    // Find the widget which lost focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Get the node which being focused after this blur.\n    let focusTarget = event.relatedTarget as HTMLElement;\n\n    // If no other node is being focused, clear the active widget.\n    if (!focusTarget) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n\n    // Bail if the focus widget is not changing.\n    if (widget.node.contains(focusTarget)) {\n      return;\n    }\n\n    // If no tracked widget is being focused, clear the active widget.\n    if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n  }\n\n  /**\n   * Handle the `disposed` signal for a tracked widget.\n   */\n  private _onWidgetDisposed(sender: T): void {\n    this.remove(sender);\n  }\n\n  private _counter = 0;\n  private _widgets: T[] = [];\n  private _activeWidget: T | null = null;\n  private _currentWidget: T | null = null;\n  private _numbers = new Map<T, number>();\n  private _nodes = new Map<HTMLElement, T>();\n  private _activeChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(this);\n  private _currentChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(\n    this\n  );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n  /**\n   * An arguments object for the changed signals.\n   */\n  export interface IChangedArgs<T extends Widget> {\n    /**\n     * The old value for the widget.\n     */\n    oldValue: T | null;\n\n    /**\n     * The new value for the widget.\n     */\n    newValue: T | null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n  /**\n   * Construct a new grid layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: GridLayout.IOptions = {}) {\n    super(options);\n    if (options.rowCount !== undefined) {\n      Private.reallocSizers(this._rowSizers, options.rowCount);\n    }\n    if (options.columnCount !== undefined) {\n      Private.reallocSizers(this._columnSizers, options.columnCount);\n    }\n    if (options.rowSpacing !== undefined) {\n      this._rowSpacing = Private.clampValue(options.rowSpacing);\n    }\n    if (options.columnSpacing !== undefined) {\n      this._columnSpacing = Private.clampValue(options.columnSpacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the widgets and layout items.\n    for (const item of this._items) {\n      let widget = item.widget;\n      item.dispose();\n      widget.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._rowStarts.length = 0;\n    this._rowSizers.length = 0;\n    this._columnStarts.length = 0;\n    this._columnSizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the number of rows in the layout.\n   */\n  get rowCount(): number {\n    return this._rowSizers.length;\n  }\n\n  /**\n   * Set the number of rows in the layout.\n   *\n   * #### Notes\n   * The minimum row count is `1`.\n   */\n  set rowCount(value: number) {\n    // Do nothing if the row count does not change.\n    if (value === this.rowCount) {\n      return;\n    }\n\n    // Reallocate the row sizers.\n    Private.reallocSizers(this._rowSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the number of columns in the layout.\n   */\n  get columnCount(): number {\n    return this._columnSizers.length;\n  }\n\n  /**\n   * Set the number of columns in the layout.\n   *\n   * #### Notes\n   * The minimum column count is `1`.\n   */\n  set columnCount(value: number) {\n    // Do nothing if the column count does not change.\n    if (value === this.columnCount) {\n      return;\n    }\n\n    // Reallocate the column sizers.\n    Private.reallocSizers(this._columnSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the row spacing for the layout.\n   */\n  get rowSpacing(): number {\n    return this._rowSpacing;\n  }\n\n  /**\n   * Set the row spacing for the layout.\n   */\n  set rowSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._rowSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._rowSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the column spacing for the layout.\n   */\n  get columnSpacing(): number {\n    return this._columnSpacing;\n  }\n\n  /**\n   * Set the col spacing for the layout.\n   */\n  set columnSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._columnSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._columnSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @returns The stretch factor for the row.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  rowStretch(index: number): number {\n    let sizer = this._rowSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @param value - The stretch factor for the row.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setRowStretch(index: number, value: number): void {\n    // Look up the row sizer.\n    let sizer = this._rowSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @returns The stretch factor for the column.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  columnStretch(index: number): number {\n    let sizer = this._columnSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @param value - The stretch factor for the column.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setColumnStretch(index: number, value: number): void {\n    // Look up the column sizer.\n    let sizer = this._columnSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    for (const item of this._items) {\n      yield item.widget;\n    }\n  }\n\n  /**\n   * Add a widget to the grid layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, this is no-op.\n   */\n  addWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is already in the layout.\n    if (i !== -1) {\n      return;\n    }\n\n    // Add the widget to the layout.\n    this._items.push(new LayoutItem(widget));\n\n    // Attach the widget to the parent.\n    if (this.parent) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the grid layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is not in the layout.\n    if (i === -1) {\n      return;\n    }\n\n    // Remove the widget from the layout.\n    let item = ArrayExt.removeAt(this._items, i)!;\n\n    // Detach the widget from the parent.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n\n    // Dispose the layout item.\n    item.dispose();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Reset the min sizes of the sizers.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      this._rowSizers[i].minSize = 0;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      this._columnSizers[i].minSize = 0;\n    }\n\n    // Filter for the visible layout items.\n    let items = this._items.filter(it => !it.isHidden);\n\n    // Fit the layout items.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      items[i].fit();\n    }\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Sort the items by row span.\n    items.sort(Private.rowSpanCmp);\n\n    // Update the min sizes of the row sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the row bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n      // Distribute the minimum height to the sizers as needed.\n      Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n    }\n\n    // Sort the items by column span.\n    items.sort(Private.columnSpanCmp);\n\n    // Update the min sizes of the column sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the column bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let c1 = Math.min(config.column, maxCol);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Distribute the minimum width to the sizers as needed.\n      Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n    }\n\n    // If no size constraint is needed, just update the parent.\n    if (this.fitPolicy === 'set-no-constraint') {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n      return;\n    }\n\n    // Set up the computed min size.\n    let minH = maxRow * this._rowSpacing;\n    let minW = maxCol * this._columnSpacing;\n\n    // Add the sizer minimums to the computed min size.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      minH += this._rowSizers[i].minSize;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      minW += this._columnSizers[i].minSize;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Compute the total fixed row and column space.\n    let fixedRowSpace = maxRow * this._rowSpacing;\n    let fixedColSpace = maxCol * this._columnSpacing;\n\n    // Distribute the available space to the box sizers.\n    BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n    BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n    // Update the row start positions.\n    for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n      this._rowStarts[i] = pos;\n      pos += this._rowSizers[i].size + this._rowSpacing;\n    }\n\n    // Update the column start positions.\n    for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n      this._columnStarts[i] = pos;\n      pos += this._columnSizers[i].size + this._columnSpacing;\n    }\n\n    // Update the geometry of the layout items.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the cell bounds for the widget.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let c1 = Math.min(config.column, maxCol);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Compute the cell geometry.\n      let x = this._columnStarts[c1];\n      let y = this._rowStarts[r1];\n      let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n      let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n      // Update the geometry of the layout item.\n      item.update(x, y, w, h);\n    }\n  }\n\n  private _dirty = false;\n  private _rowSpacing = 4;\n  private _columnSpacing = 4;\n  private _items: LayoutItem[] = [];\n  private _rowStarts: number[] = [];\n  private _columnStarts: number[] = [];\n  private _rowSizers: BoxSizer[] = [new BoxSizer()];\n  private _columnSizers: BoxSizer[] = [new BoxSizer()];\n  private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n  /**\n   * An options object for initializing a grid layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The initial row count for the layout.\n     *\n     * The default is `1`.\n     */\n    rowCount?: number;\n\n    /**\n     * The initial column count for the layout.\n     *\n     * The default is `1`.\n     */\n    columnCount?: number;\n\n    /**\n     * The spacing between rows in the layout.\n     *\n     * The default is `4`.\n     */\n    rowSpacing?: number;\n\n    /**\n     * The spacing between columns in the layout.\n     *\n     * The default is `4`.\n     */\n    columnSpacing?: number;\n  }\n\n  /**\n   * An object which holds the cell configuration for a widget.\n   */\n  export interface ICellConfig {\n    /**\n     * The row index for the widget.\n     */\n    readonly row: number;\n\n    /**\n     * The column index for the widget.\n     */\n    readonly column: number;\n\n    /**\n     * The row span for the widget.\n     */\n    readonly rowSpan: number;\n\n    /**\n     * The column span for the widget.\n     */\n    readonly columnSpan: number;\n  }\n\n  /**\n   * Get the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The cell config for the widget.\n   */\n  export function getCellConfig(widget: Widget): ICellConfig {\n    return Private.cellConfigProperty.get(widget);\n  }\n\n  /**\n   * Set the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the cell config.\n   */\n  export function setCellConfig(\n    widget: Widget,\n    value: Partial<ICellConfig>\n  ): void {\n    Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for the widget cell config.\n   */\n  export const cellConfigProperty = new AttachedProperty<\n    Widget,\n    GridLayout.ICellConfig\n  >({\n    name: 'cellConfig',\n    create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n    changed: onChildCellConfigChanged\n  });\n\n  /**\n   * Normalize a partial cell config object.\n   */\n  export function normalizeConfig(\n    config: Partial<GridLayout.ICellConfig>\n  ): GridLayout.ICellConfig {\n    let row = Math.max(0, Math.floor(config.row || 0));\n    let column = Math.max(0, Math.floor(config.column || 0));\n    let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n    let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n    return { row, column, rowSpan, columnSpan };\n  }\n\n  /**\n   * Clamp a value to an integer >= 0.\n   */\n  export function clampValue(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * A sort comparison function for row spans.\n   */\n  export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.rowSpan - c2.rowSpan;\n  }\n\n  /**\n   * A sort comparison function for column spans.\n   */\n  export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.columnSpan - c2.columnSpan;\n  }\n\n  /**\n   * Reallocate the box sizers for the given grid dimensions.\n   */\n  export function reallocSizers(sizers: BoxSizer[], count: number): void {\n    // Coerce the count to the valid range.\n    count = Math.max(1, Math.floor(count));\n\n    // Add the missing sizers.\n    while (sizers.length < count) {\n      sizers.push(new BoxSizer());\n    }\n\n    // Remove the extra sizers.\n    if (sizers.length > count) {\n      sizers.length = count;\n    }\n  }\n\n  /**\n   * Distribute a min size constraint across a range of sizers.\n   */\n  export function distributeMin(\n    sizers: BoxSizer[],\n    i1: number,\n    i2: number,\n    minSize: number\n  ): void {\n    // Sanity check the indices.\n    if (i2 < i1) {\n      return;\n    }\n\n    // Handle the simple case of no cell span.\n    if (i1 === i2) {\n      let sizer = sizers[i1];\n      sizer.minSize = Math.max(sizer.minSize, minSize);\n      return;\n    }\n\n    // Compute the total current min size of the span.\n    let totalMin = 0;\n    for (let i = i1; i <= i2; ++i) {\n      totalMin += sizers[i].minSize;\n    }\n\n    // Do nothing if the total is greater than the required.\n    if (totalMin >= minSize) {\n      return;\n    }\n\n    // Compute the portion of the space to allocate to each sizer.\n    let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n    // Add the portion to each sizer.\n    for (let i = i1; i <= i2; ++i) {\n      sizers[i].minSize += portion;\n    }\n  }\n\n  /**\n   * The change handler for the child cell config property.\n   */\n  function onChildCellConfigChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof GridLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n  /**\n   * Construct a new menu bar.\n   *\n   * @param options - The options for initializing the menu bar.\n   */\n  constructor(options: MenuBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-MenuBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.renderer = options.renderer || MenuBar.defaultRenderer;\n    this._forceItemsPosition = options.forceItemsPosition || {\n      forceX: true,\n      forceY: true\n    };\n    this._overflowMenuOptions = options.overflowMenuOptions || {\n      isVisible: true\n    };\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._closeChildMenu();\n    this._menus.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the menu bar.\n   */\n  readonly renderer: MenuBar.IRenderer;\n\n  /**\n   * The child menu of the menu bar.\n   *\n   * #### Notes\n   * This will be `null` if the menu bar does not have an open menu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The overflow index of the menu bar.\n   */\n  get overflowIndex(): number {\n    return this._overflowIndex;\n  }\n\n  /**\n   * The overflow menu of the menu bar.\n   */\n  get overflowMenu(): Menu | null {\n    return this._overflowMenu;\n  }\n\n  /**\n   * Get the menu bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu title nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-MenuBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu.\n   */\n  get activeMenu(): Menu | null {\n    return this._menus[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu.\n   *\n   * #### Notes\n   * If the menu does not exist, the menu will be set to `null`.\n   */\n  set activeMenu(value: Menu | null) {\n    this.activeIndex = value ? this._menus.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu.\n   *\n   * #### Notes\n   * This will be `-1` if no menu is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu.\n   *\n   * #### Notes\n   * If the menu cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._menus.length) {\n      value = -1;\n    }\n\n    // An empty menu cannot be active\n    if (value > -1 && this._menus[value].items.length === 0) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menus in the menu bar.\n   */\n  get menus(): ReadonlyArray<Menu> {\n    return this._menus;\n  }\n\n  /**\n   * Open the active menu and activate its first menu item.\n   *\n   * #### Notes\n   * If there is no active menu, this is a no-op.\n   */\n  openActiveMenu(): void {\n    // Bail early if there is no active item.\n    if (this._activeIndex === -1) {\n      return;\n    }\n\n    // Open the child menu.\n    this._openChildMenu();\n\n    // Activate the first item in the child menu.\n    if (this._childMenu) {\n      this._childMenu.activeIndex = -1;\n      this._childMenu.activateNextItem();\n    }\n  }\n\n  /**\n   * Add a menu to the end of the menu bar.\n   *\n   * @param menu - The menu to add to the menu bar.\n   *\n   * #### Notes\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  addMenu(menu: Menu, update: boolean = true): void {\n    this.insertMenu(this._menus.length, menu, update);\n  }\n\n  /**\n   * Insert a menu into the menu bar at the specified index.\n   *\n   * @param index - The index at which to insert the menu.\n   *\n   * @param menu - The menu to insert into the menu bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the menus.\n   *\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  insertMenu(index: number, menu: Menu, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Look up the index of the menu.\n    let i = this._menus.indexOf(menu);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._menus.length));\n\n    // If the menu is not in the array, insert it.\n    if (i === -1) {\n      // Insert the menu into the array.\n      ArrayExt.insert(this._menus, j, menu);\n\n      // Add the styling class to the menu.\n      menu.addClass('lm-MenuBar-menu');\n\n      // Connect to the menu signals.\n      menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n      menu.menuRequested.connect(this._onMenuMenuRequested, this);\n      menu.title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the items.\n      if (update) {\n        this.update();\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the menu exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._menus.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the menu to the new locations.\n    ArrayExt.move(this._menus, i, j);\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove a menu from the menu bar.\n   *\n   * @param menu - The menu to remove from the menu bar.\n   *\n   * #### Notes\n   * This is a no-op if the menu is not in the menu bar.\n   */\n  removeMenu(menu: Menu, update: boolean = true): void {\n    this.removeMenuAt(this._menus.indexOf(menu), update);\n  }\n\n  /**\n   * Remove the menu at a given index from the menu bar.\n   *\n   * @param index - The index of the menu to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeMenuAt(index: number, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Remove the menu from the array.\n    let menu = ArrayExt.removeAt(this._menus, index);\n\n    // Bail if the index is out of range.\n    if (!menu) {\n      return;\n    }\n\n    // Disconnect from the menu signals.\n    menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n    menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n    menu.title.changed.disconnect(this._onTitleChanged, this);\n\n    // Remove the styling class from the menu.\n    menu.removeClass('lm-MenuBar-menu');\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove all menus from the menu bar.\n   */\n  clearMenus(): void {\n    // Bail if there is nothing to remove.\n    if (this._menus.length === 0) {\n      return;\n    }\n\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Disconnect from the menu signals and remove the styling class.\n    for (let menu of this._menus) {\n      menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n      menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n      menu.title.changed.disconnect(this._onTitleChanged, this);\n      menu.removeClass('lm-MenuBar-menu');\n    }\n\n    // Clear the menus array.\n    this._menus.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the menu bar.\n   *\n   * @param event - The DOM event sent to the menu bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu bar's DOM nodes. It\n   * should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n      case 'mouseleave':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'focusout':\n        this._evtFocusOut(event as FocusEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mousedown', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('focusout', this);\n    this.node.addEventListener('contextmenu', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mousedown', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('focusout', this);\n    this.node.removeEventListener('contextmenu', this);\n    this._closeChildMenu();\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this._focusItemAt(0);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    this.update();\n    super.onResize(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let menus = this._menus;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let tabFocusIndex =\n      this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n        ? this._tabFocusIndex\n        : 0;\n    let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n    let totalMenuSize = 0;\n    let isVisible = false;\n\n    // Check that the overflow menu doesn't count\n    length = this._overflowMenu !== null ? length - 1 : length;\n    let content = new Array<VirtualElement>(length);\n\n    // Render visible menus\n    for (let i = 0; i < length; ++i) {\n      content[i] = renderer.renderItem({\n        title: menus[i].title,\n        active: i === activeIndex,\n        tabbable: i === tabFocusIndex,\n        disabled: menus[i].items.length === 0,\n        onfocus: () => {\n          this._tabFocusIndex = i;\n          this.activeIndex = i;\n        }\n      });\n      // Calculate size of current menu\n      totalMenuSize += this._menuItemSizes[i];\n      // Check if overflow menu is already rendered\n      if (menus[i].title.label === this._overflowMenuOptions.title) {\n        isVisible = true;\n        length--;\n      }\n    }\n    // Render overflow menu if needed and active\n    if (this._overflowMenuOptions.isVisible) {\n      if (this._overflowIndex > -1 && !isVisible) {\n        // Create overflow menu\n        if (this._overflowMenu === null) {\n          const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n          this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n          this._overflowMenu.title.label = overflowMenuTitle;\n          this._overflowMenu.title.mnemonic = 0;\n          this.addMenu(this._overflowMenu, false);\n        }\n        // Move menus to overflow menu\n        for (let i = menus.length - 2; i >= length; i--) {\n          const submenu = this.menus[i];\n          submenu.title.mnemonic = 0;\n          this._overflowMenu.insertItem(0, {\n            type: 'submenu',\n            submenu: submenu\n          });\n          this.removeMenu(submenu, false);\n        }\n        content[length] = renderer.renderItem({\n          title: this._overflowMenu.title,\n          active: length === activeIndex && menus[length].items.length !== 0,\n          tabbable: length === tabFocusIndex,\n          disabled: menus[length].items.length === 0,\n          onfocus: () => {\n            this._tabFocusIndex = length;\n            this.activeIndex = length;\n          }\n        });\n        length++;\n      } else if (this._overflowMenu !== null) {\n        // Remove submenus from overflow menu\n        let overflowMenuItems = this._overflowMenu.items;\n        let screenSize = this.node.offsetWidth;\n        let n = this._overflowMenu.items.length;\n        for (let i = 0; i < n; ++i) {\n          let index = menus.length - 1 - i;\n          if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n            let menu = overflowMenuItems[0].submenu as Menu;\n            this._overflowMenu.removeItemAt(0);\n            this.insertMenu(length, menu, false);\n            content[length] = renderer.renderItem({\n              title: menu.title,\n              active: false,\n              tabbable: length === tabFocusIndex,\n              disabled: menus[length].items.length === 0,\n              onfocus: () => {\n                this._tabFocusIndex = length;\n                this.activeIndex = length;\n              }\n            });\n            length++;\n          }\n        }\n        if (this._overflowMenu.items.length === 0) {\n          this.removeMenu(this._overflowMenu, false);\n          content.pop();\n          this._overflowMenu = null;\n          this._overflowIndex = -1;\n        }\n      }\n    }\n    VirtualDOM.render(content, this.contentNode);\n    this._updateOverflowIndex();\n  }\n\n  /**\n   * Calculate and update the current overflow index.\n   */\n  private _updateOverflowIndex(): void {\n    if (!this._overflowMenuOptions.isVisible) {\n      return;\n    }\n\n    // Get elements visible in the main menu bar\n    const itemMenus = this.contentNode.childNodes;\n    let screenSize = this.node.offsetWidth;\n    let totalMenuSize = 0;\n    let index = -1;\n    let n = itemMenus.length;\n\n    if (this._menuItemSizes.length == 0) {\n      // Check if it is the first resize and get info about menu items sizes\n      for (let i = 0; i < n; i++) {\n        let item = itemMenus[i] as HTMLLIElement;\n        // Add sizes to array\n        totalMenuSize += item.offsetWidth;\n        this._menuItemSizes.push(item.offsetWidth);\n        if (totalMenuSize > screenSize && index === -1) {\n          index = i;\n        }\n      }\n    } else {\n      // Calculate current menu size\n      for (let i = 0; i < this._menuItemSizes.length; i++) {\n        totalMenuSize += this._menuItemSizes[i];\n        if (totalMenuSize > screenSize) {\n          index = i;\n          break;\n        }\n      }\n    }\n    this._overflowIndex = index;\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu bar.\n   *\n   * #### Notes\n   * All keys are trapped except the tab key that is ignored.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Reset the active index on tab, but do not trap the tab key.\n    if (kc === 9) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // A menu bar handles all other keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Enter, Space, Up Arrow, Down Arrow\n    if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n      // The active index may have changed (for example, user hovers over an\n      // item with the mouse), so be sure to use the focus index.\n      this.activeIndex = this._tabFocusIndex;\n      if (this.activeIndex !== this._tabFocusIndex) {\n        // Bail if the setter refused to set activeIndex to tabFocusIndex\n        // because it means that the item at tabFocusIndex cannot be opened (for\n        // example, it has an empty menu)\n        return;\n      }\n      this.openActiveMenu();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this._closeChildMenu();\n      this._focusItemAt(this.activeIndex);\n      return;\n    }\n\n    // Left or Right Arrow\n    if (kc === 37 || kc === 39) {\n      let direction = kc === 37 ? -1 : 1;\n      let start = this._tabFocusIndex + direction;\n      let n = this._menus.length;\n      for (let i = 0; i < n; i++) {\n        let index = (n + start + direction * i) % n;\n        if (this._menus[index].items.length) {\n          this._focusItemAt(index);\n          return;\n        }\n      }\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._menus, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that menu is opened.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.openActiveMenu();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n      this._focusItemAt(this.activeIndex);\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n      this._focusItemAt(this.activeIndex);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the mouse press was not on the menu bar. This can occur\n    // when the document listener is installed for an active menu bar.\n    if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n      return;\n    }\n\n    // Stop the propagation of the event. Immediate propagation is\n    // also stopped so that an open menu does not handle the event.\n    event.stopPropagation();\n    event.stopImmediatePropagation();\n\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // If the press was not on an item, close the child menu.\n    if (index === -1) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // If the press was not the left mouse button, do nothing further.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Otherwise, toggle the open state of the child menu.\n    if (this._childMenu) {\n      this._closeChildMenu();\n      this.activeIndex = index;\n    } else {\n      // If we don't call preventDefault() here, then the item in the menu\n      // bar will take focus over the menu that is being opened.\n      event.preventDefault();\n      const position = this._positionForMenu(index);\n      Menu.saveWindowData();\n      // Begin DOM modifications.\n      this.activeIndex = index;\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the active index will not change.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Bail early if a child menu is open and the mouse is not over\n    // an item. This allows the child menu to be kept open when the\n    // mouse is over the empty part of the menu bar.\n    if (index === -1 && this._childMenu) {\n      return;\n    }\n\n    // Get position for the new menu >before< updating active index.\n    const position =\n      index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n    // Before any modification, update window data.\n    Menu.saveWindowData();\n\n    // Begin DOM modifications.\n\n    // Update the active index to the hovered item.\n    this.activeIndex = index;\n\n    // Open the new menu if a menu is already open.\n    if (position) {\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Find initial position for the menu based on menubar item position.\n   *\n   * NOTE: this should be called before updating active index to avoid\n   * an additional layout and style invalidation as changing active\n   * index modifies DOM.\n   */\n  private _positionForMenu(index: number): Private.IPosition {\n    let itemNode = this.contentNode.children[index];\n    let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n    return {\n      top: bottom,\n      left\n    };\n  }\n\n  /**\n   * Handle the `'focusout'` event for the menu bar.\n   */\n  private _evtFocusOut(event: FocusEvent): void {\n    // Reset the active index if there is no open menu and the menubar is losing focus.\n    if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n      this.activeIndex = -1;\n    }\n  }\n\n  /**\n   * Focus an item in the menu bar.\n   *\n   * #### Notes\n   * Does not open the associated menu.\n   */\n  private _focusItemAt(index: number): void {\n    const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n    if (itemNode) {\n      itemNode.focus();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if there is no active menu.\n   */\n  private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n    // If there is no active menu, close the current menu.\n    let newMenu = this.activeMenu;\n    if (!newMenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Bail if there is no effective menu change.\n    let oldMenu = this._childMenu;\n    if (oldMenu === newMenu) {\n      return;\n    }\n\n    // Swap the internal menu reference.\n    this._childMenu = newMenu;\n\n    // Close the current menu, or setup for the new menu.\n    if (oldMenu) {\n      oldMenu.close();\n    } else {\n      document.addEventListener('mousedown', this, true);\n    }\n\n    // Update the tab focus index and ensure the menu bar is updated.\n    this._tabFocusIndex = this.activeIndex;\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n    // Get the positioning data for the new menu.\n    let { left, top } = options;\n    if (typeof left === 'undefined' || typeof top === 'undefined') {\n      ({ left, top } = this._positionForMenu(this._activeIndex));\n    }\n    // Begin DOM modifications\n\n    if (!oldMenu) {\n      // Continue setup for new menu\n      this.addClass('lm-mod-active');\n    }\n\n    // Open the new menu at the computed location.\n    if (newMenu.items.length > 0) {\n      newMenu.open(left, top, this._forceItemsPosition);\n    }\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    // Bail if no child menu is open.\n    if (!this._childMenu) {\n      return;\n    }\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    let menu = this._childMenu;\n    this._childMenu = null;\n\n    // Close the menu.\n    menu.close();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `aboutToClose` signal of a menu.\n   */\n  private _onMenuAboutToClose(sender: Menu): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    this._childMenu = null;\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `menuRequested` signal of a child menu.\n   */\n  private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Look up the active index and menu count.\n    let i = this._activeIndex;\n    let n = this._menus.length;\n\n    // Active the next requested index.\n    switch (args) {\n      case 'next':\n        this.activeIndex = i === n - 1 ? 0 : i + 1;\n        break;\n      case 'previous':\n        this.activeIndex = i === 0 ? n - 1 : i - 1;\n        break;\n    }\n\n    // Open the active menu.\n    this.openActiveMenu();\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(): void {\n    this.update();\n  }\n\n  // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n  private _activeIndex = -1;\n  // Track which item can be focused using the TAB key. Unlike _activeIndex will\n  // always point to a menuitem. Whenever you update this value, it's important\n  // to follow it with an \"update-request\" message so that the `tabindex`\n  // attribute on each menubar item gets properly updated.\n  private _tabFocusIndex = 0;\n  private _forceItemsPosition: Menu.IOpenOptions;\n  private _overflowMenuOptions: IOverflowMenuOptions;\n  private _menus: Menu[] = [];\n  private _childMenu: Menu | null = null;\n  private _overflowMenu: Menu | null = null;\n  private _menuItemSizes: number[] = [];\n  private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n  /**\n   * An options object for creating a menu bar.\n   */\n  export interface IOptions {\n    /**\n     * A custom renderer for creating menu bar content.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n    /**\n     * Whether to force the position of the menu. The MenuBar forces the\n     * coordinates of its menus by default. With this option you can disable it.\n     *\n     * Setting to `false` will enable the logic which repositions the\n     * coordinates of the menu if it will not fit entirely on screen.\n     *\n     * The default is `true`.\n     */\n    forceItemsPosition?: Menu.IOpenOptions;\n    /**\n     * Whether to add a overflow menu if there's overflow.\n     *\n     * Setting to `true` will enable the logic that creates an overflow menu\n     * to show the menu items that don't fit entirely on the screen.\n     *\n     * The default is `true`.\n     */\n    overflowMenuOptions?: IOverflowMenuOptions;\n  }\n\n  /**\n   * An object which holds the data to render a menu bar item.\n   */\n  export interface IRenderData {\n    /**\n     * The title to be rendered.\n     */\n    readonly title: Title<Widget>;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the user can tab to the item.\n     */\n    readonly tabbable: boolean;\n\n    /**\n     * Whether the item is disabled.\n     *\n     * #### Notes\n     * A disabled item cannot be active.\n     * A disabled item cannot be focussed.\n     */\n    readonly disabled?: boolean;\n\n    readonly onfocus?: (event: FocusEvent) => void;\n  }\n\n  /**\n   * A renderer for use with a menu bar.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.title.icon is undefined, it will be ignored.\n      return h.div({ className }, data.title.icon!, data.title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n    }\n\n    /**\n     * Create the class name for the menu bar item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-item';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.active && !data.disabled) {\n        name += ' lm-mod-active';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a menu bar item.\n     *\n     * @param data - The data to use for the item.\n     *\n     * @returns The dataset for the menu bar item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the aria attributes for menu bar item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      return {\n        role: 'menuitem',\n        'aria-haspopup': 'true',\n        'aria-disabled': data.disabled ? 'true' : 'false'\n      };\n    }\n\n    /**\n     * Create the class name for the menu bar item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-itemIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.title;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n  /**\n   * Determines if a overflow menu appears when the menu items overflow.\n   *\n   * Defaults to `true`.\n   */\n  isVisible: boolean;\n  /**\n   * Determines the title of the overflow menu.\n   *\n   * Default: `...`.\n   */\n  title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a menu bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-MenuBar-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menubar');\n    return node;\n  }\n\n  /**\n   * Position for the menu relative to top-left screen corner.\n   */\n  export interface IPosition {\n    /**\n     * Pixels right from screen origin.\n     */\n    left: number;\n    /**\n     * Pixels down from screen origin.\n     */\n    top: number;\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    menus: ReadonlyArray<Menu>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = menus.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Look up the menu title.\n      let title = menus[k].title;\n\n      // Ignore titles with an empty label.\n      if (title.label.length === 0) {\n        continue;\n      }\n\n      // Look up the mnemonic index for the label.\n      let mn = title.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < title.label.length) {\n        if (title.label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n  /**\n   * Construct a new scroll bar.\n   *\n   * @param options - The options for initializing the scroll bar.\n   */\n  constructor(options: ScrollBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-ScrollBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n\n    // Set the orientation.\n    this._orientation = options.orientation || 'vertical';\n    this.dataset['orientation'] = this._orientation;\n\n    // Parse the rest of the options.\n    if (options.maximum !== undefined) {\n      this._maximum = Math.max(0, options.maximum);\n    }\n    if (options.page !== undefined) {\n      this._page = Math.max(0, options.page);\n    }\n    if (options.value !== undefined) {\n      this._value = Math.max(0, Math.min(options.value, this._maximum));\n    }\n  }\n\n  /**\n   * A signal emitted when the user moves the scroll thumb.\n   *\n   * #### Notes\n   * The payload is the current value of the scroll bar.\n   */\n  get thumbMoved(): ISignal<this, number> {\n    return this._thumbMoved;\n  }\n\n  /**\n   * A signal emitted when the user clicks a step button.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get stepRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._stepRequested;\n  }\n\n  /**\n   * A signal emitted when the user clicks the scroll track.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get pageRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._pageRequested;\n  }\n\n  /**\n   * Get the orientation of the scroll bar.\n   */\n  get orientation(): ScrollBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the scroll bar.\n   */\n  set orientation(value: ScrollBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making changes.\n    this._releaseMouse();\n\n    // Update the internal orientation.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the current value of the scroll bar.\n   */\n  get value(): number {\n    return this._value;\n  }\n\n  /**\n   * Set the current value of the scroll bar.\n   *\n   * #### Notes\n   * The value will be clamped to the range `[0, maximum]`.\n   */\n  set value(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Do nothing if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size is the amount of visible content in the scrolled\n   * region, expressed in data units. It determines the size of the\n   * scroll bar thumb.\n   */\n  get page(): number {\n    return this._page;\n  }\n\n  /**\n   * Set the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size will be clamped to the range `[0, Infinity]`.\n   */\n  set page(value: number) {\n    // Clamp the page size to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._page === value) {\n      return;\n    }\n\n    // Update the internal page size.\n    this._page = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the maximum value of the scroll bar.\n   */\n  get maximum(): number {\n    return this._maximum;\n  }\n\n  /**\n   * Set the maximum value of the scroll bar.\n   *\n   * #### Notes\n   * The max size will be clamped to the range `[0, Infinity]`.\n   */\n  set maximum(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._maximum === value) {\n      return;\n    }\n\n    // Update the internal values.\n    this._maximum = value;\n\n    // Clamp the current value to the new range.\n    this._value = Math.min(this._value, value);\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * The scroll bar decrement button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get decrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar increment button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get incrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[1] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar track node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get trackNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-track'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar thumb node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get thumbNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-thumb'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Handle the DOM events for the scroll bar.\n   *\n   * @param event - The DOM event sent to the scroll bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the scroll bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A method invoked on a 'before-attach' message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('mousedown', this);\n    this.update();\n  }\n\n  /**\n   * A method invoked on an 'after-detach' message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('mousedown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A method invoked on an 'update-request' message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    // Convert the value and page into percentages.\n    let value = (this._value * 100) / this._maximum;\n    let page = (this._page * 100) / (this._page + this._maximum);\n\n    // Clamp the value and page to the relevant range.\n    value = Math.max(0, Math.min(value, 100));\n    page = Math.max(0, Math.min(page, 100));\n\n    // Fetch the thumb style.\n    let thumbStyle = this.thumbNode.style;\n\n    // Update the thumb style for the current orientation.\n    if (this._orientation === 'horizontal') {\n      thumbStyle.top = '';\n      thumbStyle.height = '';\n      thumbStyle.left = `${value}%`;\n      thumbStyle.width = `${page}%`;\n      thumbStyle.transform = `translate(${-value}%, 0%)`;\n    } else {\n      thumbStyle.left = '';\n      thumbStyle.width = '';\n      thumbStyle.top = `${value}%`;\n      thumbStyle.height = `${page}%`;\n      thumbStyle.transform = `translate(0%, ${-value}%)`;\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the scroll bar.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Ignore anything except the `Escape` key.\n    if (event.keyCode !== 27) {\n      return;\n    }\n\n    // Fetch the previous scroll value.\n    let value = this._pressData ? this._pressData.value : -1;\n\n    // Release the mouse.\n    this._releaseMouse();\n\n    // Restore the old scroll value if possible.\n    if (value !== -1) {\n      this._moveThumb(value);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the scroll bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse press.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Send an activate request to the scroll bar. This can be\n    // used by message hooks to activate something relevant.\n    this.activate();\n\n    // Do nothing if the mouse is already captured.\n    if (this._pressData) {\n      return;\n    }\n\n    // Find the pressed scroll bar part.\n    let part = Private.findPart(this, event.target as HTMLElement);\n\n    // Do nothing if the part is not of interest.\n    if (!part) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Override the mouse cursor.\n    let override = Drag.overrideCursor('default');\n\n    // Set up the press data.\n    this._pressData = {\n      part,\n      override,\n      delta: -1,\n      value: -1,\n      mouseX: event.clientX,\n      mouseY: event.clientY\n    };\n\n    // Add the extra event listeners.\n    document.addEventListener('mousemove', this, true);\n    document.addEventListener('mouseup', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Handle a thumb press.\n    if (part === 'thumb') {\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Update the press data delta for the current orientation.\n      if (this._orientation === 'horizontal') {\n        this._pressData.delta = event.clientX - thumbRect.left;\n      } else {\n        this._pressData.delta = event.clientY - thumbRect.top;\n      }\n\n      // Add the active class to the thumb node.\n      thumbNode.classList.add('lm-mod-active');\n\n      // Store the current value in the press data.\n      this._pressData.value = this._value;\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track press.\n    if (part === 'track') {\n      // Fetch the client rect for the thumb.\n      let thumbRect = this.thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n\n    // Handle a decrement button press.\n    if (part === 'decrement') {\n      // Add the active class to the decrement node.\n      this.decrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button press.\n    if (part === 'increment') {\n      // Add the active class to the increment node.\n      this.incrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the scroll bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Update the mouse position.\n    this._pressData.mouseX = event.clientX;\n    this._pressData.mouseY = event.clientY;\n\n    // Bail if the thumb is not being dragged.\n    if (this._pressData.part !== 'thumb') {\n      return;\n    }\n\n    // Get the client rect for the thumb and track.\n    let thumbRect = this.thumbNode.getBoundingClientRect();\n    let trackRect = this.trackNode.getBoundingClientRect();\n\n    // Fetch the scroll geometry based on the orientation.\n    let trackPos: number;\n    let trackSpan: number;\n    if (this._orientation === 'horizontal') {\n      trackPos = event.clientX - trackRect.left - this._pressData.delta;\n      trackSpan = trackRect.width - thumbRect.width;\n    } else {\n      trackPos = event.clientY - trackRect.top - this._pressData.delta;\n      trackSpan = trackRect.height - thumbRect.height;\n    }\n\n    // Compute the desired value from the scroll geometry.\n    let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n    // Move the thumb to the computed value.\n    this._moveThumb(value);\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the scroll bar.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse release.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse and restore the node states.\n   */\n  private _releaseMouse(): void {\n    // Bail if there is no press data.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the repeat timer.\n    clearTimeout(this._repeatTimer);\n    this._repeatTimer = -1;\n\n    // Clear the press data.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra event listeners.\n    document.removeEventListener('mousemove', this, true);\n    document.removeEventListener('mouseup', this, true);\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('contextmenu', this, true);\n\n    // Remove the active classes from the nodes.\n    this.thumbNode.classList.remove('lm-mod-active');\n    this.decrementNode.classList.remove('lm-mod-active');\n    this.incrementNode.classList.remove('lm-mod-active');\n  }\n\n  /**\n   * Move the thumb to the specified position.\n   */\n  private _moveThumb(value: number): void {\n    // Clamp the value to the allowed range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Bail if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update of the scroll bar.\n    this.update();\n\n    // Emit the thumb moved signal.\n    this._thumbMoved.emit(value);\n  }\n\n  /**\n   * A timeout callback for repeating the mouse press.\n   */\n  private _onRepeat = () => {\n    // Clear the repeat timer id.\n    this._repeatTimer = -1;\n\n    // Bail if the mouse has been released.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Look up the part that was pressed.\n    let part = this._pressData.part;\n\n    // Bail if the thumb was pressed.\n    if (part === 'thumb') {\n      return;\n    }\n\n    // Schedule the timer for another repeat.\n    this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n    // Get the current mouse position.\n    let mouseX = this._pressData.mouseX;\n    let mouseY = this._pressData.mouseY;\n\n    // Handle a decrement button repeat.\n    if (part === 'decrement') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button repeat.\n    if (part === 'increment') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track repeat.\n    if (part === 'track') {\n      // Bail if the mouse is not over the track.\n      if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Bail if the mouse is over the thumb.\n      if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n  };\n\n  private _value = 0;\n  private _page = 10;\n  private _maximum = 100;\n  private _repeatTimer = -1;\n  private _orientation: ScrollBar.Orientation;\n  private _pressData: Private.IPressData | null = null;\n  private _thumbMoved = new Signal<this, number>(this);\n  private _stepRequested = new Signal<this, 'decrement' | 'increment'>(this);\n  private _pageRequested = new Signal<this, 'decrement' | 'increment'>(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n  /**\n   * A type alias for a scroll bar orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * An options object for creating a scroll bar.\n   */\n  export interface IOptions {\n    /**\n     * The orientation of the scroll bar.\n     *\n     * The default is `'vertical'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The value for the scroll bar.\n     *\n     * The default is `0`.\n     */\n    value?: number;\n\n    /**\n     * The page size for the scroll bar.\n     *\n     * The default is `10`.\n     */\n    page?: number;\n\n    /**\n     * The maximum value for the scroll bar.\n     *\n     * The default is `100`.\n     */\n    maximum?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A type alias for the parts of a scroll bar.\n   */\n  export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The scroll bar part which was pressed.\n     */\n    part: ScrollBarPart;\n\n    /**\n     * The offset of the press in thumb coordinates, or -1.\n     */\n    delta: number;\n\n    /**\n     * The scroll value at the time the thumb was pressed, or -1.\n     */\n    value: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n\n    /**\n     * The current X position of the mouse.\n     */\n    mouseX: number;\n\n    /**\n     * The current Y position of the mouse.\n     */\n    mouseY: number;\n  }\n\n  /**\n   * Create the DOM node for a scroll bar.\n   */\n  export function createNode(): HTMLElement {\n    let node = document.createElement('div');\n    let decrement = document.createElement('div');\n    let increment = document.createElement('div');\n    let track = document.createElement('div');\n    let thumb = document.createElement('div');\n    decrement.className = 'lm-ScrollBar-button';\n    increment.className = 'lm-ScrollBar-button';\n    decrement.dataset['action'] = 'decrement';\n    increment.dataset['action'] = 'increment';\n    track.className = 'lm-ScrollBar-track';\n    thumb.className = 'lm-ScrollBar-thumb';\n    track.appendChild(thumb);\n    node.appendChild(decrement);\n    node.appendChild(track);\n    node.appendChild(increment);\n    return node;\n  }\n\n  /**\n   * Find the scroll bar part which contains the given target.\n   */\n  export function findPart(\n    scrollBar: ScrollBar,\n    target: HTMLElement\n  ): ScrollBarPart | null {\n    // Test the thumb.\n    if (scrollBar.thumbNode.contains(target)) {\n      return 'thumb';\n    }\n\n    // Test the track.\n    if (scrollBar.trackNode.contains(target)) {\n      return 'track';\n    }\n\n    // Test the decrement button.\n    if (scrollBar.decrementNode.contains(target)) {\n      return 'decrement';\n    }\n\n    // Test the increment button.\n    if (scrollBar.incrementNode.contains(target)) {\n      return 'increment';\n    }\n\n    // Indicate no match.\n    return null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this._widget) {\n      let widget = this._widget;\n      this._widget = null;\n      widget.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * Get the child widget for the layout.\n   */\n  get widget(): Widget | null {\n    return this._widget;\n  }\n\n  /**\n   * Set the child widget for the layout.\n   *\n   * #### Notes\n   * Setting the child widget will cause the old child widget to be\n   * automatically disposed. If that is not desired, set the parent\n   * of the old child to `null` before assigning a new child.\n   */\n  set widget(widget: Widget | null) {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    if (widget) {\n      widget.parent = this.parent;\n    }\n\n    // Bail early if the widget does not change.\n    if (this._widget === widget) {\n      return;\n    }\n\n    // Dispose of the old child widget.\n    if (this._widget) {\n      this._widget.dispose();\n    }\n\n    // Update the internal widget.\n    this._widget = widget;\n\n    // Attach the new child widget if needed.\n    if (this.parent && widget) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    if (this._widget) {\n      yield this._widget;\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Bail early if the widget does not exist in the layout.\n    if (this._widget !== widget) {\n      return;\n    }\n\n    // Clear the internal widget.\n    this._widget = null;\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n  constructor(options: StackedLayout.IOptions = {}) {\n    super(options);\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    if (this.widgets.length > 1) {\n      this.widgets.forEach(w => {\n        w.hiddenMode = this._hiddenMode;\n      });\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (\n      this._hiddenMode === Widget.HiddenMode.Scale &&\n      this._items.length > 0\n    ) {\n      if (this._items.length === 1) {\n        this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n      }\n      widget.hiddenMode = Widget.HiddenMode.Scale;\n    } else {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n    }\n\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Reset the z-index for the widget.\n    item!.widget.node.style.zIndex = '';\n\n    // Reset the hidden mode for the widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n\n      // Reset the hidden mode for the first widget if necessary.\n      if (this._items.length === 1) {\n        this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n      }\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the computed minimum size.\n      minW = Math.max(minW, item.minWidth);\n      minH = Math.max(minH, item.minHeight);\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the widget stacking order and layout geometry.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Set the z-index for the widget.\n      item.widget.node.style.zIndex = `${i}`;\n\n      // Update the item geometry.\n      item.update(left, top, width, height);\n    }\n  }\n\n  private _dirty = false;\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n  /**\n   * An options object for initializing a stacked layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n  /**\n   * Construct a new stacked panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: StackedPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-StackedPanel');\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as StackedLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as StackedLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when a widget is removed from a stacked panel.\n   */\n  get widgetRemoved(): ISignal<this, Widget> {\n    return this._widgetRemoved;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-StackedPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-StackedPanel-child');\n    this._widgetRemoved.emit(msg.child);\n  }\n\n  private _widgetRemoved = new Signal<this, Widget>(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n  /**\n   * An options object for creating a stacked panel.\n   */\n  export interface IOptions {\n    /**\n     * The stacked layout to use for the stacked panel.\n     *\n     * The default is a new `StackedLayout`.\n     */\n    layout?: StackedLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a stacked layout for the given panel options.\n   */\n  export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n    return options.layout || new StackedLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n  /**\n   * Construct a new tab panel.\n   *\n   * @param options - The options for initializing the tab panel.\n   */\n  constructor(options: TabPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-TabPanel');\n\n    // Create the tab bar and stacked panel.\n    this.tabBar = new TabBar<Widget>(options);\n    this.tabBar.addClass('lm-TabPanel-tabBar');\n    this.stackedPanel = new StackedPanel();\n    this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n    // Connect the tab bar signal handlers.\n    this.tabBar.tabMoved.connect(this._onTabMoved, this);\n    this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    this.tabBar.tabActivateRequested.connect(\n      this._onTabActivateRequested,\n      this\n    );\n    this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Connect the stacked panel signal handlers.\n    this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n    // Get the data related to the placement.\n    this._tabPlacement = options.tabPlacement || 'top';\n    let direction = Private.directionFromPlacement(this._tabPlacement);\n    let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = this._tabPlacement;\n\n    // Create the box layout.\n    let layout = new BoxLayout({ direction, spacing: 0 });\n\n    // Set the stretch factors for the child widgets.\n    BoxLayout.setStretch(this.tabBar, 0);\n    BoxLayout.setStretch(this.stackedPanel, 1);\n\n    // Add the child widgets to the layout.\n    layout.addWidget(this.tabBar);\n    layout.addWidget(this.stackedPanel);\n\n    // Install the layout on the tab panel.\n    this.layout = layout;\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabPanel.ICurrentChangedArgs> {\n    return this._currentChanged;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this.tabBar.currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the index is out of range, it will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    this.tabBar.currentIndex = value;\n  }\n\n  /**\n   * Get the currently selected widget.\n   *\n   * #### Notes\n   * This will be `null` if there is no selected tab.\n   */\n  get currentWidget(): Widget | null {\n    let title = this.tabBar.currentTitle;\n    return title ? title.owner : null;\n  }\n\n  /**\n   * Set the currently selected widget.\n   *\n   * #### Notes\n   * If the widget is not in the panel, it will be set to `null`.\n   */\n  set currentWidget(value: Widget | null) {\n    this.tabBar.currentTitle = value ? value.title : null;\n  }\n\n  /**\n   * Get the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  get tabsMovable(): boolean {\n    return this.tabBar.tabsMovable;\n  }\n\n  /**\n   * Set the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  set tabsMovable(value: boolean) {\n    this.tabBar.tabsMovable = value;\n  }\n\n  /**\n   * Get the whether the add button is enabled.\n   *\n   */\n  get addButtonEnabled(): boolean {\n    return this.tabBar.addButtonEnabled;\n  }\n\n  /**\n   * Set the whether the add button is enabled.\n   *\n   */\n  set addButtonEnabled(value: boolean) {\n    this.tabBar.addButtonEnabled = value;\n  }\n\n  /**\n   * Get the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  get tabPlacement(): TabPanel.TabPlacement {\n    return this._tabPlacement;\n  }\n\n  /**\n   * Set the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  set tabPlacement(value: TabPanel.TabPlacement) {\n    // Bail if the placement does not change.\n    if (this._tabPlacement === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._tabPlacement = value;\n\n    // Get the values related to the placement.\n    let direction = Private.directionFromPlacement(value);\n    let orientation = Private.orientationFromPlacement(value);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = value;\n\n    // Update the layout direction.\n    (this.layout as BoxLayout).direction = direction;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The tab bar used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the tab bar directly can lead to undefined behavior.\n   */\n  readonly tabBar: TabBar<Widget>;\n\n  /**\n   * The stacked panel used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the panel directly can lead to undefined behavior.\n   */\n  readonly stackedPanel: StackedPanel;\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this.stackedPanel.widgets;\n  }\n\n  /**\n   * Add a widget to the end of the tab panel.\n   *\n   * @param widget - The widget to add to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this.widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the tab panel at a specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (widget !== this.currentWidget) {\n      widget.hide();\n    }\n    this.stackedPanel.insertWidget(index, widget);\n    this.tabBar.insertTab(index, widget.title);\n\n    widget.node.setAttribute('role', 'tabpanel');\n\n    let renderer = this.tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  /**\n   * Handle the `currentChanged` signal from the tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n    // Extract the widgets from the titles.\n    let previousWidget = previousTitle ? previousTitle.owner : null;\n    let currentWidget = currentTitle ? currentTitle.owner : null;\n\n    // Hide the previous widget.\n    if (previousWidget) {\n      previousWidget.hide();\n    }\n\n    // Show the current widget.\n    if (currentWidget) {\n      currentWidget.show();\n    }\n\n    // Emit the `currentChanged` signal for the tab panel.\n    this._currentChanged.emit({\n      previousIndex,\n      previousWidget,\n      currentIndex,\n      currentWidget\n    });\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n  }\n\n  /**\n   * Handle the `tabAddRequested` signal from the tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>, args: void): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from the tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from the tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from the tab bar.\n   */\n  private _onTabMoved(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabMovedArgs<Widget>\n  ): void {\n    this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n  }\n\n  /**\n   * Handle the `widgetRemoved` signal from the stacked panel.\n   */\n  private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n    this.tabBar.removeTab(widget.title);\n  }\n\n  private _tabPlacement: TabPanel.TabPlacement;\n  private _currentChanged = new Signal<this, TabPanel.ICurrentChangedArgs>(\n    this\n  );\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n  /**\n   * A type alias for tab placement in a tab bar.\n   */\n  export type TabPlacement =\n    | /**\n     * The tabs are placed as a row above the content.\n     */\n    'top'\n\n    /**\n     * The tabs are placed as a column to the left of the content.\n     */\n    | 'left'\n\n    /**\n     * The tabs are placed as a column to the right of the content.\n     */\n    | 'right'\n\n    /**\n     * The tabs are placed as a row below the content.\n     */\n    | 'bottom';\n\n  /**\n   * An options object for initializing a tab panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the tab panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether the button to add new tabs is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The placement of the tab bar relative to the content.\n     *\n     * The default is `'top'`.\n     */\n    tabPlacement?: TabPlacement;\n\n    /**\n     * The renderer for the panel's tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: TabBar.IRenderer<Widget>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs {\n    /**\n     * The previously selected index.\n     */\n    previousIndex: number;\n\n    /**\n     * The previously selected widget.\n     */\n    previousWidget: Widget | null;\n\n    /**\n     * The currently selected index.\n     */\n    currentIndex: number;\n\n    /**\n     * The currently selected widget.\n     */\n    currentWidget: Widget | null;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Convert a tab placement to tab bar orientation.\n   */\n  export function orientationFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): TabBar.Orientation {\n    return placementToOrientationMap[plc];\n  }\n\n  /**\n   * Convert a tab placement to a box layout direction.\n   */\n  export function directionFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): BoxLayout.Direction {\n    return placementToDirectionMap[plc];\n  }\n\n  /**\n   * A mapping of tab placement to tab bar orientation.\n   */\n  const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n    top: 'horizontal',\n    left: 'vertical',\n    right: 'vertical',\n    bottom: 'horizontal'\n  };\n\n  /**\n   * A mapping of tab placement to box layout direction.\n   */\n  const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n    top: 'top-to-bottom',\n    left: 'left-to-right',\n    right: 'right-to-left',\n    bottom: 'bottom-to-top'\n  };\n}\n"],"names":["Private","Utils"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;;;;;;AAM+E;AAE/E;;;;;;;;;AASG;MACU,QAAQ,CAAA;AAArB,IAAA,WAAA,GAAA;AACE;;;;;;;;;;;;AAYG;QACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;AAEb;;;;;;;;;;;;AAYG;QACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;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AAG,EAAE,YAAY;AACjB,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,KAAK,EAAE,UAAU;AACjB,QAAA,MAAM,EAAE,YAAY;KACrB,CAAC;AAEF;;AAEG;AACH,IAAA,MAAM,uBAAuB,GAA2C;AACtE,QAAA,GAAG,EAAE,eAAe;AACpB,QAAA,IAAI,EAAE,eAAe;AACrB,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,MAAM,EAAE,eAAe;KACxB,CAAC;AACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;"}
\ No newline at end of file
diff --git a/node_modules/@lumino/widgets/dist/index.js b/node_modules/@lumino/widgets/dist/index.js
index becc2ab..df84ed2 100644
--- a/node_modules/@lumino/widgets/dist/index.js
+++ b/node_modules/@lumino/widgets/dist/index.js
@@ -6550,28 +6550,28 @@
             }
         }
         /**
-         * A message handler invoked on a `'before-attach'` message.
+         * A message handler invoked on a `'after-attach'` message.
          */
-        onBeforeAttach(msg) {
+        onAfterAttach(msg) {
             this.node.addEventListener('keydown', this);
             this.node.addEventListener('mouseup', this);
             this.node.addEventListener('mousemove', this);
             this.node.addEventListener('mouseenter', this);
             this.node.addEventListener('mouseleave', this);
             this.node.addEventListener('contextmenu', this);
-            document.addEventListener('mousedown', this, true);
+            this.node.ownerDocument.addEventListener('mousedown', this, true);
         }
         /**
-         * A message handler invoked on an `'after-detach'` message.
+         * A message handler invoked on an `'before-detach'` message.
          */
-        onAfterDetach(msg) {
+        onBeforeDetach(msg) {
             this.node.removeEventListener('keydown', this);
             this.node.removeEventListener('mouseup', this);
             this.node.removeEventListener('mousemove', this);
             this.node.removeEventListener('mouseenter', this);
             this.node.removeEventListener('mouseleave', this);
             this.node.removeEventListener('contextmenu', this);
-            document.removeEventListener('mousedown', this, true);
+            this.node.ownerDocument.removeEventListener('mousedown', this, true);
         }
         /**
          * A message handler invoked on an `'activate-request'` message.
@@ -7155,15 +7155,8 @@
          * The horizontal pixel overlap for an open submenu.
          */
         Private.SUBMENU_OVERLAP = 3;
-        let transientWindowDataCache = null;
-        let transientCacheCounter = 0;
-        function getWindowData() {
-            // if transient cache is in use, take one from it
-            if (transientCacheCounter > 0) {
-                transientCacheCounter--;
-                return transientWindowDataCache;
-            }
-            return _getWindowData();
+        function getWindowData(element) {
+            return _getWindowData(element);
         }
         /**
          * Store window data in transient cache.
@@ -7175,8 +7168,6 @@
          * Note: should be called before any DOM modifications.
          */
         function saveWindowData() {
-            transientWindowDataCache = _getWindowData();
-            transientCacheCounter++;
         }
         Private.saveWindowData = saveWindowData;
         /**
@@ -7271,12 +7262,13 @@
             return result;
         }
         Private.computeCollapsed = computeCollapsed;
-        function _getWindowData() {
+        function _getWindowData(element) {
+            var _a, _b;
             return {
-                pageXOffset: window.pageXOffset,
-                pageYOffset: window.pageYOffset,
-                clientWidth: document.documentElement.clientWidth,
-                clientHeight: document.documentElement.clientHeight
+                pageXOffset: ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.window.scrollX) || 0,
+                pageYOffset: ((_b = element.ownerDocument.defaultView) === null || _b === void 0 ? void 0 : _b.window.scrollY) || 0,
+                clientWidth: element.ownerDocument.documentElement.clientWidth,
+                clientHeight: element.ownerDocument.documentElement.clientHeight
             };
         }
         /**
@@ -7284,7 +7276,7 @@
          */
         function openRootMenu(menu, x, y, forceX, forceY, horizontalAlignment, host, ref) {
             // Get the current position and size of the main viewport.
-            const windowData = getWindowData();
+            const windowData = getWindowData(host || menu.node);
             let px = windowData.pageXOffset;
             let py = windowData.pageYOffset;
             let cw = windowData.clientWidth;
@@ -7296,6 +7288,8 @@
             // Fetch common variables.
             let node = menu.node;
             let style = node.style;
+            style.top = '0';
+            style.left = '0';
             // Clear the menu geometry and prepare it for measuring.
             style.opacity = '0';
             style.maxHeight = `${maxHeight}px`;
@@ -7331,7 +7325,7 @@
          */
         function openSubmenu(submenu, itemNode) {
             // Get the current position and size of the main viewport.
-            const windowData = getWindowData();
+            const windowData = getWindowData(itemNode);
             let px = windowData.pageXOffset;
             let py = windowData.pageYOffset;
             let cw = windowData.clientWidth;
@@ -7347,7 +7341,7 @@
             style.opacity = '0';
             style.maxHeight = `${maxHeight}px`;
             // Attach the menu to the document.
-            Widget.attach(submenu, document.body);
+            Widget.attach(submenu, itemNode.ownerDocument.body);
             // Measure the size of the menu.
             let { width, height } = node.getBoundingClientRect();
             // Compute the box sizing for the menu.
@@ -7366,6 +7360,8 @@
             if (y + height > py + ch) {
                 y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;
             }
+            style.top = '0';
+            style.left = '0';
             // Update the position of the menu to the computed position.
             style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;
             // Finally, make the menu visible on the screen.
diff --git a/node_modules/@lumino/widgets/dist/index.js.map b/node_modules/@lumino/widgets/dist/index.js.map
index 363e9cf..ba9c0a7 100644
--- a/node_modules/@lumino/widgets/dist/index.js.map
+++ b/node_modules/@lumino/widgets/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n  /**\n   * The preferred size for the sizer.\n   *\n   * #### Notes\n   * The sizer will be given this initial size subject to its size\n   * bounds. The sizer will not deviate from this size unless such\n   * deviation is required to fit into the available layout space.\n   *\n   * There is no limit to this value, but it will be clamped to the\n   * bounds defined by {@link minSize} and {@link maxSize}.\n   *\n   * The default value is `0`.\n   */\n  sizeHint = 0;\n\n  /**\n   * The minimum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized less than this value, even if\n   * it means the sizer will overflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity)`\n   * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `0`.\n   */\n  minSize = 0;\n\n  /**\n   * The maximum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized greater than this value, even if\n   * it means the sizer will underflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity]`\n   * and that it is `>=` to {@link minSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `Infinity`.\n   */\n  maxSize = Infinity;\n\n  /**\n   * The stretch factor for the sizer.\n   *\n   * #### Notes\n   * This controls how much the sizer stretches relative to its sibling\n   * sizers when layout space is distributed. A stretch factor of zero\n   * is special and will cause the sizer to only be resized after all\n   * other sizers with a stretch factor greater than zero have been\n   * resized to their limits.\n   *\n   * It is assumed that this value is an integer that lies in the range\n   * `[0, Infinity)`. Failure to adhere to this constraint will yield\n   * undefined results.\n   *\n   * The default value is `1`.\n   */\n  stretch = 1;\n\n  /**\n   * The computed size of the sizer.\n   *\n   * #### Notes\n   * This value is the output of a call to {@link BoxEngine.calc}. It represents\n   * the computed size for the object along the layout orientation,\n   * and will always lie in the range `[minSize, maxSize]`.\n   *\n   * This value is output only.\n   *\n   * Changing this value will have no effect.\n   */\n  size = 0;\n\n  /**\n   * An internal storage property for the layout algorithm.\n   *\n   * #### Notes\n   * This value is used as temporary storage by the layout algorithm.\n   *\n   * Changing this value will have no effect.\n   */\n  done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n  /**\n   * Calculate the optimal layout sizes for a sequence of box sizers.\n   *\n   * This distributes the available layout space among the box sizers\n   * according to the following algorithm:\n   *\n   * 1. Initialize the sizers's size to its size hint and compute the\n   *    sums for each of size hint, min size, and max size.\n   *\n   * 2. If the total size hint equals the available space, return.\n   *\n   * 3. If the available space is less than the total min size, set all\n   *    sizers to their min size and return.\n   *\n   * 4. If the available space is greater than the total max size, set\n   *    all sizers to their max size and return.\n   *\n   * 5. If the layout space is less than the total size hint, distribute\n   *    the negative delta as follows:\n   *\n   *    a. Shrink each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the negative space and the sum of\n   *       stretch factors. If the sizer reaches its min size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains negative\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its min size,\n   *       remove it from the computation.\n   *\n   * 6. If the layout space is greater than the total size hint,\n   *    distribute the positive delta as follows:\n   *\n   *    a. Expand each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the postive space and the sum of\n   *       stretch factors. If the sizer reaches its max size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains positive\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its max size,\n   *       remove it from the computation.\n   *\n   * 7. return\n   *\n   * @param sizers - The sizers for a particular layout line.\n   *\n   * @param space - The available layout space for the sizers.\n   *\n   * @returns The delta between the provided available space and the\n   *   actual consumed space. This value will be zero if the sizers\n   *   can be adjusted to fit, negative if the available space is too\n   *   small, and positive if the available space is too large.\n   *\n   * #### Notes\n   * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n   *\n   * This function can be called at any time to recompute the layout for\n   * an existing sequence of sizers. The previously computed results will\n   * have no effect on the new output. It is therefore not necessary to\n   * create new sizer objects on each resize event.\n   */\n  export function calc(sizers: ArrayLike<BoxSizer>, space: number): number {\n    // Bail early if there is nothing to do.\n    let count = sizers.length;\n    if (count === 0) {\n      return space;\n    }\n\n    // Setup the size and stretch counters.\n    let totalMin = 0;\n    let totalMax = 0;\n    let totalSize = 0;\n    let totalStretch = 0;\n    let stretchCount = 0;\n\n    // Setup the sizers and compute the totals.\n    for (let i = 0; i < count; ++i) {\n      let sizer = sizers[i];\n      let min = sizer.minSize;\n      let max = sizer.maxSize;\n      let hint = sizer.sizeHint;\n      sizer.done = false;\n      sizer.size = Math.max(min, Math.min(hint, max));\n      totalSize += sizer.size;\n      totalMin += min;\n      totalMax += max;\n      if (sizer.stretch > 0) {\n        totalStretch += sizer.stretch;\n        stretchCount++;\n      }\n    }\n\n    // If the space is equal to the total size, return early.\n    if (space === totalSize) {\n      return 0;\n    }\n\n    // If the space is less than the total min, minimize each sizer.\n    if (space <= totalMin) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.minSize;\n      }\n      return space - totalMin;\n    }\n\n    // If the space is greater than the total max, maximize each sizer.\n    if (space >= totalMax) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.maxSize;\n      }\n      return space - totalMax;\n    }\n\n    // The loops below perform sub-pixel precision sizing. A near zero\n    // value is used for compares instead of zero to ensure that the\n    // loop terminates when the subdivided space is reasonably small.\n    let nearZero = 0.01;\n\n    // A counter which is decremented each time a sizer is resized to\n    // its limit. This ensures the loops terminate even if there is\n    // space remaining to distribute.\n    let notDoneCount = count;\n\n    // Distribute negative delta space.\n    if (space < totalSize) {\n      // Shrink each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its min size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = totalSize - space;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n    }\n    // Distribute positive delta space.\n    else {\n      // Expand each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its max size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = space - totalSize;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n    }\n\n    // Indicate that the consumed space equals the available space.\n    return 0;\n  }\n\n  /**\n   * Adjust a sizer by a delta and update its neighbors accordingly.\n   *\n   * @param sizers - The sizers which should be adjusted.\n   *\n   * @param index - The index of the sizer to grow.\n   *\n   * @param delta - The amount to adjust the sizer, positive or negative.\n   *\n   * #### Notes\n   * This will adjust the indicated sizer by the specified amount, along\n   * with the sizes of the appropriate neighbors, subject to the limits\n   * specified by each of the sizers.\n   *\n   * This is useful when implementing box layouts where the boundaries\n   * between the sizers are interactively adjustable by the user.\n   */\n  export function adjust(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Bail early when there is nothing to do.\n    if (sizers.length === 0 || delta === 0) {\n      return;\n    }\n\n    // Dispatch to the proper implementation.\n    if (delta > 0) {\n      growSizer(sizers, index, delta);\n    } else {\n      shrinkSizer(sizers, index, -delta);\n    }\n  }\n\n  /**\n   * Grow a sizer by a positive delta and adjust neighbors.\n   */\n  function growSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the left can expand.\n    let growLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the right can shrink.\n    let shrinkLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the left by the delta.\n    let grow = delta;\n    for (let i = index; i >= 0 && grow > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the right by the delta.\n    let shrink = delta;\n    for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n\n  /**\n   * Shrink a sizer by a positive delta and adjust neighbors.\n   */\n  function shrinkSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the right can expand.\n    let growLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the left can shrink.\n    let shrinkLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the right by the delta.\n    let grow = delta;\n    for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the left by the delta.\n    let shrink = delta;\n    for (let i = index; i >= 0 && shrink > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title<T> implements IDisposable {\n  /**\n   * Construct a new title.\n   *\n   * @param options - The options for initializing the title.\n   */\n  constructor(options: Title.IOptions<T>) {\n    this.owner = options.owner;\n    if (options.label !== undefined) {\n      this._label = options.label;\n    }\n    if (options.mnemonic !== undefined) {\n      this._mnemonic = options.mnemonic;\n    }\n    if (options.icon !== undefined) {\n      this._icon = options.icon;\n    }\n\n    if (options.iconClass !== undefined) {\n      this._iconClass = options.iconClass;\n    }\n    if (options.iconLabel !== undefined) {\n      this._iconLabel = options.iconLabel;\n    }\n    if (options.caption !== undefined) {\n      this._caption = options.caption;\n    }\n    if (options.className !== undefined) {\n      this._className = options.className;\n    }\n    if (options.closable !== undefined) {\n      this._closable = options.closable;\n    }\n    this._dataset = options.dataset || {};\n  }\n\n  /**\n   * A signal emitted when the state of the title changes.\n   */\n  get changed(): ISignal<this, void> {\n    return this._changed;\n  }\n\n  /**\n   * The object which owns the title.\n   */\n  readonly owner: T;\n\n  /**\n   * Get the label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get label(): string {\n    return this._label;\n  }\n\n  /**\n   * Set the label for the title.\n   */\n  set label(value: string) {\n    if (this._label === value) {\n      return;\n    }\n    this._label = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the mnemonic index for the title.\n   *\n   * #### Notes\n   * The default value is `-1`.\n   */\n  get mnemonic(): number {\n    return this._mnemonic;\n  }\n\n  /**\n   * Set the mnemonic index for the title.\n   */\n  set mnemonic(value: number) {\n    if (this._mnemonic === value) {\n      return;\n    }\n    this._mnemonic = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon renderer for the title.\n   *\n   * #### Notes\n   * The default value is undefined.\n   */\n  get icon(): VirtualElement.IRenderer | undefined {\n    return this._icon;\n  }\n\n  /**\n   * Set the icon renderer for the title.\n   *\n   * #### Notes\n   * A renderer is an object that supplies a render and unrender function.\n   */\n  set icon(value: VirtualElement.IRenderer | undefined) {\n    if (this._icon === value) {\n      return;\n    }\n    this._icon = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconClass(): string {\n    return this._iconClass;\n  }\n\n  /**\n   * Set the icon class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconClass(value: string) {\n    if (this._iconClass === value) {\n      return;\n    }\n    this._iconClass = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconLabel(): string {\n    return this._iconLabel;\n  }\n\n  /**\n   * Set the icon label for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconLabel(value: string) {\n    if (this._iconLabel === value) {\n      return;\n    }\n    this._iconLabel = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the caption for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get caption(): string {\n    return this._caption;\n  }\n\n  /**\n   * Set the caption for the title.\n   */\n  set caption(value: string) {\n    if (this._caption === value) {\n      return;\n    }\n    this._caption = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the extra class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get className(): string {\n    return this._className;\n  }\n\n  /**\n   * Set the extra class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set className(value: string) {\n    if (this._className === value) {\n      return;\n    }\n    this._className = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the closable state for the title.\n   *\n   * #### Notes\n   * The default value is `false`.\n   */\n  get closable(): boolean {\n    return this._closable;\n  }\n\n  /**\n   * Set the closable state for the title.\n   *\n   * #### Notes\n   * This controls the presence of a close icon when applicable.\n   */\n  set closable(value: boolean) {\n    if (this._closable === value) {\n      return;\n    }\n    this._closable = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the dataset for the title.\n   *\n   * #### Notes\n   * The default value is an empty dataset.\n   */\n  get dataset(): Title.Dataset {\n    return this._dataset;\n  }\n\n  /**\n   * Set the dataset for the title.\n   *\n   * #### Notes\n   * This controls the data attributes when applicable.\n   */\n  set dataset(value: Title.Dataset) {\n    if (this._dataset === value) {\n      return;\n    }\n    this._dataset = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Test whether the title has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this._isDisposed;\n  }\n\n  /**\n   * Dispose of the resources held by the title.\n   *\n   * #### Notes\n   * It is the responsibility of the owner to call the title disposal.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n    this._isDisposed = true;\n\n    Signal.clearData(this);\n  }\n\n  private _label = '';\n  private _caption = '';\n  private _mnemonic = -1;\n  private _icon: VirtualElement.IRenderer | undefined = undefined;\n  private _iconClass = '';\n  private _iconLabel = '';\n  private _className = '';\n  private _closable = false;\n  private _dataset: Title.Dataset;\n  private _changed = new Signal<this, void>(this);\n  private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n  /**\n   * A type alias for a simple immutable string dataset.\n   */\n  export type Dataset = { readonly [key: string]: string };\n\n  /**\n   * An options object for initializing a title.\n   */\n  export interface IOptions<T> {\n    /**\n     * The object which owns the title.\n     */\n    owner: T;\n\n    /**\n     * The label for the title.\n     */\n    label?: string;\n\n    /**\n     * The mnemonic index for the title.\n     */\n    mnemonic?: number;\n\n    /**\n     * The icon renderer for the title.\n     */\n    icon?: VirtualElement.IRenderer;\n\n    /**\n     * The icon class name for the title.\n     */\n    iconClass?: string;\n\n    /**\n     * The icon label for the title.\n     */\n    iconLabel?: string;\n\n    /**\n     * The caption for the title.\n     */\n    caption?: string;\n\n    /**\n     * The extra class name for the title.\n     */\n    className?: string;\n\n    /**\n     * The closable state for the title.\n     */\n    closable?: boolean;\n\n    /**\n     * The dataset for the title.\n     */\n    dataset?: Dataset;\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n  ConflatableMessage,\n  IMessageHandler,\n  Message,\n  MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n  /**\n   * Construct a new widget.\n   *\n   * @param options - The options for initializing the widget.\n   */\n  constructor(options: Widget.IOptions = {}) {\n    this.node = Private.createNode(options);\n    this.addClass('lm-Widget');\n  }\n\n  /**\n   * Dispose of the widget and its descendant widgets.\n   *\n   * #### Notes\n   * It is unsafe to use the widget after it has been disposed.\n   *\n   * All calls made to this method after the first are a no-op.\n   */\n  dispose(): void {\n    // Do nothing if the widget is already disposed.\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Set the disposed flag and emit the disposed signal.\n    this.setFlag(Widget.Flag.IsDisposed);\n    this._disposed.emit(undefined);\n\n    // Remove or detach the widget if necessary.\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n\n    // Dispose of the widget layout.\n    if (this._layout) {\n      this._layout.dispose();\n      this._layout = null;\n    }\n\n    // Dispose the title\n    this.title.dispose();\n\n    // Clear the extra data associated with the widget.\n    Signal.clearData(this);\n    MessageLoop.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * A signal emitted when the widget is disposed.\n   */\n  get disposed(): ISignal<this, void> {\n    return this._disposed;\n  }\n\n  /**\n   * Get the DOM node owned by the widget.\n   */\n  readonly node: HTMLElement;\n\n  /**\n   * Test whether the widget has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this.testFlag(Widget.Flag.IsDisposed);\n  }\n\n  /**\n   * Test whether the widget's node is attached to the DOM.\n   */\n  get isAttached(): boolean {\n    return this.testFlag(Widget.Flag.IsAttached);\n  }\n\n  /**\n   * Test whether the widget is explicitly hidden.\n   *\n   * #### Notes\n   * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n   * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n   */\n  get isHidden(): boolean {\n    return this.testFlag(Widget.Flag.IsHidden);\n  }\n\n  /**\n   * Test whether the widget is visible.\n   *\n   * #### Notes\n   * A widget is visible when it is attached to the DOM, is not\n   * explicitly hidden, and has no explicitly hidden ancestors.\n   *\n   * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n   * It recursively checks the visibility of all parent widgets.\n   */\n  get isVisible(): boolean {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let parent: Widget | null = this;\n    do {\n      if (parent.isHidden || !parent.isAttached) {\n        return false;\n      }\n      parent = parent.parent;\n    } while (parent != null);\n    return true;\n  }\n\n  /**\n   * The title object for the widget.\n   *\n   * #### Notes\n   * The title object is used by some container widgets when displaying\n   * the widget alongside some title, such as a tab panel or side bar.\n   *\n   * Since not all widgets will use the title, it is created on demand.\n   *\n   * The `owner` property of the title is set to this widget.\n   */\n  get title(): Title<Widget> {\n    return Private.titleProperty.get(this);\n  }\n\n  /**\n   * Get the id of the widget's DOM node.\n   */\n  get id(): string {\n    return this.node.id;\n  }\n\n  /**\n   * Set the id of the widget's DOM node.\n   */\n  set id(value: string) {\n    this.node.id = value;\n  }\n\n  /**\n   * The dataset for the widget's DOM node.\n   */\n  get dataset(): DOMStringMap {\n    return this.node.dataset;\n  }\n\n  /**\n   * Get the method for hiding the widget.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding the widget.\n   */\n  set hiddenMode(value: Widget.HiddenMode) {\n    if (this._hiddenMode === value) {\n      return;\n    }\n\n    if (this.isHidden) {\n      // Reset styles set by previous mode.\n      this._toggleHidden(false);\n    }\n\n    if (value == Widget.HiddenMode.Scale) {\n      this.node.style.willChange = 'transform';\n    } else {\n      this.node.style.willChange = 'auto';\n    }\n\n    this._hiddenMode = value;\n\n    if (this.isHidden) {\n      // Set styles for new mode.\n      this._toggleHidden(true);\n    }\n  }\n\n  /**\n   * Get the parent of the widget.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent of the widget.\n   *\n   * #### Notes\n   * Children are typically added to a widget by using a layout, which\n   * means user code will not normally set the parent widget directly.\n   *\n   * The widget will be automatically removed from its old parent.\n   *\n   * This is a no-op if there is no effective parent change.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (value && this.contains(value)) {\n      throw new Error('Invalid parent widget.');\n    }\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-removed', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    this._parent = value;\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-added', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    if (!this.isDisposed) {\n      MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n    }\n  }\n\n  /**\n   * Get the layout for the widget.\n   */\n  get layout(): Layout | null {\n    return this._layout;\n  }\n\n  /**\n   * Set the layout for the widget.\n   *\n   * #### Notes\n   * The layout is single-use only. It cannot be changed after the\n   * first assignment.\n   *\n   * The layout is disposed automatically when the widget is disposed.\n   */\n  set layout(value: Layout | null) {\n    if (this._layout === value) {\n      return;\n    }\n    if (this.testFlag(Widget.Flag.DisallowLayout)) {\n      throw new Error('Cannot set widget layout.');\n    }\n    if (this._layout) {\n      throw new Error('Cannot change widget layout.');\n    }\n    if (value!.parent) {\n      throw new Error('Cannot change layout parent.');\n    }\n    this._layout = value;\n    value!.parent = this;\n  }\n\n  /**\n   * Create an iterator over the widget's children.\n   *\n   * @returns A new iterator over the children of the widget.\n   *\n   * #### Notes\n   * The widget must have a populated layout in order to have children.\n   *\n   * If a layout is not installed, the returned iterator will be empty.\n   */\n  *children(): IterableIterator<Widget> {\n    if (this._layout) {\n      yield* this._layout;\n    }\n  }\n\n  /**\n   * Test whether a widget is a descendant of this widget.\n   *\n   * @param widget - The descendant widget of interest.\n   *\n   * @returns `true` if the widget is a descendant, `false` otherwise.\n   */\n  contains(widget: Widget): boolean {\n    for (let value: Widget | null = widget; value; value = value._parent) {\n      if (value === this) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Test whether the widget's DOM node has the given class name.\n   *\n   * @param name - The class name of interest.\n   *\n   * @returns `true` if the node has the class, `false` otherwise.\n   */\n  hasClass(name: string): boolean {\n    return this.node.classList.contains(name);\n  }\n\n  /**\n   * Add a class name to the widget's DOM node.\n   *\n   * @param name - The class name to add to the node.\n   *\n   * #### Notes\n   * If the class name is already added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  addClass(name: string): void {\n    this.node.classList.add(name);\n  }\n\n  /**\n   * Remove a class name from the widget's DOM node.\n   *\n   * @param name - The class name to remove from the node.\n   *\n   * #### Notes\n   * If the class name is not yet added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  removeClass(name: string): void {\n    this.node.classList.remove(name);\n  }\n\n  /**\n   * Toggle a class name on the widget's DOM node.\n   *\n   * @param name - The class name to toggle on the node.\n   *\n   * @param force - Whether to force add the class (`true`) or force\n   *   remove the class (`false`). If not provided, the presence of\n   *   the class will be toggled from its current state.\n   *\n   * @returns `true` if the class is now present, `false` otherwise.\n   *\n   * #### Notes\n   * The class name must not contain whitespace.\n   */\n  toggleClass(name: string, force?: boolean): boolean {\n    if (force === true) {\n      this.node.classList.add(name);\n      return true;\n    }\n    if (force === false) {\n      this.node.classList.remove(name);\n      return false;\n    }\n    return this.node.classList.toggle(name);\n  }\n\n  /**\n   * Post an `'update-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  update(): void {\n    MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n  }\n\n  /**\n   * Post a `'fit-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  fit(): void {\n    MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n  }\n\n  /**\n   * Post an `'activate-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  activate(): void {\n    MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n  }\n\n  /**\n   * Send a `'close-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for sending the message.\n   */\n  close(): void {\n    MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n  }\n\n  /**\n   * Show the widget and make it visible to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `false`.\n   *\n   * If the widget is not explicitly hidden, this is a no-op.\n   */\n  show(): void {\n    if (!this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n    }\n    this.clearFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(false);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-shown', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Hide the widget and make it hidden to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `true`.\n   *\n   * If the widget is explicitly hidden, this is a no-op.\n   */\n  hide(): void {\n    if (this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n    }\n    this.setFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(true);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-hidden', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Show or hide the widget according to a boolean value.\n   *\n   * @param hidden - `true` to hide the widget, or `false` to show it.\n   *\n   * #### Notes\n   * This is a convenience method for `hide()` and `show()`.\n   */\n  setHidden(hidden: boolean): void {\n    if (hidden) {\n      this.hide();\n    } else {\n      this.show();\n    }\n  }\n\n  /**\n   * Test whether the given widget flag is set.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  testFlag(flag: Widget.Flag): boolean {\n    return (this._flags & flag) !== 0;\n  }\n\n  /**\n   * Set the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  setFlag(flag: Widget.Flag): void {\n    this._flags |= flag;\n  }\n\n  /**\n   * Clear the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  clearFlag(flag: Widget.Flag): void {\n    this._flags &= ~flag;\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   *\n   * #### Notes\n   * Subclasses may reimplement this method as needed.\n   */\n  processMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.notifyLayout(msg);\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.notifyLayout(msg);\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.notifyLayout(msg);\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.notifyLayout(msg);\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.setFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.notifyLayout(msg);\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.notifyLayout(msg);\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n          this.setFlag(Widget.Flag.IsVisible);\n        }\n        this.setFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.notifyLayout(msg);\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.clearFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterDetach(msg);\n        break;\n      case 'activate-request':\n        this.notifyLayout(msg);\n        this.onActivateRequest(msg);\n        break;\n      case 'close-request':\n        this.notifyLayout(msg);\n        this.onCloseRequest(msg);\n        break;\n      case 'child-added':\n        this.notifyLayout(msg);\n        this.onChildAdded(msg as Widget.ChildMessage);\n        break;\n      case 'child-removed':\n        this.notifyLayout(msg);\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      default:\n        this.notifyLayout(msg);\n        break;\n    }\n  }\n\n  /**\n   * Invoke the message processing routine of the widget's layout.\n   *\n   * @param msg - The message to dispatch to the layout.\n   *\n   * #### Notes\n   * This is a no-op if the widget does not have a layout.\n   *\n   * This will not typically be called directly by user code.\n   */\n  protected notifyLayout(msg: Message): void {\n    if (this._layout) {\n      this._layout.processParentMessage(msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   *\n   * #### Notes\n   * The default implementation unparents or detaches the widget.\n   */\n  protected onCloseRequest(msg: Message): void {\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {}\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onUpdateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onActivateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n  private _toggleHidden(hidden: boolean) {\n    if (hidden) {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.addClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = 'scale(0)';\n          this.node.setAttribute('aria-hidden', 'true');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = 'hidden';\n          this.node.style.zIndex = '-1';\n          break;\n      }\n    } else {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.removeClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = '';\n          this.node.removeAttribute('aria-hidden');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = '';\n          this.node.style.zIndex = '';\n          break;\n      }\n    }\n  }\n\n  private _flags = 0;\n  private _layout: Layout | null = null;\n  private _parent: Widget | null = null;\n  private _disposed = new Signal<this, void>(this);\n  private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n  /**\n   * An options object for initializing a widget.\n   */\n  export interface IOptions {\n    /**\n     * The optional node to use for the widget.\n     *\n     * If a node is provided, the widget will assume full ownership\n     * and control of the node, as if it had created the node itself.\n     *\n     * The default is a new `<div>`.\n     */\n    node?: HTMLElement;\n\n    /**\n     * The optional element tag, used for constructing the widget's node.\n     *\n     * If a pre-constructed node is provided via the `node` arg, this\n     * value is ignored.\n     */\n    tag?: keyof HTMLElementTagNameMap;\n  }\n\n  /**\n   * The method for hiding the widget.\n   *\n   * The default is Display.\n   *\n   * Using `Scale` will often increase performance as most browsers will not\n   * trigger style computation for the `transform` action. This should be used\n   * sparingly and tested, since increasing the number of composition layers\n   * may slow things down.\n   *\n   * To ensure the transformation does not trigger style recomputation, you\n   * may need to set the widget CSS style `will-change: transform`. This\n   * should be used only when needed as it may overwhelm the browser with a\n   * high number of layers. See\n   * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n   */\n  export enum HiddenMode {\n    /**\n     * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n     * CSS from the standard Lumino CSS.\n     */\n    Display = 0,\n\n    /**\n     * Hide the widget by setting the `transform` to `'scale(0)'`.\n     */\n    Scale,\n\n    /**\n     *Hide the widget by setting the `content-visibility` to `'hidden'`.\n     */\n    ContentVisibility\n  }\n\n  /**\n   * An enum of widget bit flags.\n   */\n  export enum Flag {\n    /**\n     * The widget has been disposed.\n     */\n    IsDisposed = 0x1,\n\n    /**\n     * The widget is attached to the DOM.\n     */\n    IsAttached = 0x2,\n\n    /**\n     * The widget is hidden.\n     */\n    IsHidden = 0x4,\n\n    /**\n     * The widget is visible.\n     *\n     * @deprecated since 2.7.0, apply that flag consistently was not reliable\n     * so it was dropped in favor of a recursive check of the visibility of all parents.\n     */\n    IsVisible = 0x8,\n\n    /**\n     * A layout cannot be set on the widget.\n     */\n    DisallowLayout = 0x10\n  }\n\n  /**\n   * A collection of stateless messages related to widgets.\n   */\n  export namespace Msg {\n    /**\n     * A singleton `'before-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const BeforeShow = new Message('before-show');\n\n    /**\n     * A singleton `'after-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const AfterShow = new Message('after-show');\n\n    /**\n     * A singleton `'before-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const BeforeHide = new Message('before-hide');\n\n    /**\n     * A singleton `'after-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const AfterHide = new Message('after-hide');\n\n    /**\n     * A singleton `'before-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is attached.\n     */\n    export const BeforeAttach = new Message('before-attach');\n\n    /**\n     * A singleton `'after-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is attached.\n     */\n    export const AfterAttach = new Message('after-attach');\n\n    /**\n     * A singleton `'before-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is detached.\n     */\n    export const BeforeDetach = new Message('before-detach');\n\n    /**\n     * A singleton `'after-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is detached.\n     */\n    export const AfterDetach = new Message('after-detach');\n\n    /**\n     * A singleton `'parent-changed'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget when its parent has changed.\n     */\n    export const ParentChanged = new Message('parent-changed');\n\n    /**\n     * A singleton conflatable `'update-request'` message.\n     *\n     * #### Notes\n     * This message can be dispatched to supporting widgets in order to\n     * update their content based on the current widget state. Not all\n     * widgets will respond to messages of this type.\n     *\n     * For widgets with a layout, this message will inform the layout to\n     * update the position and size of its child widgets.\n     */\n    export const UpdateRequest = new ConflatableMessage('update-request');\n\n    /**\n     * A singleton conflatable `'fit-request'` message.\n     *\n     * #### Notes\n     * For widgets with a layout, this message will inform the layout to\n     * recalculate its size constraints to fit the space requirements of\n     * its child widgets, and to update their position and size. Not all\n     * layouts will respond to messages of this type.\n     */\n    export const FitRequest = new ConflatableMessage('fit-request');\n\n    /**\n     * A singleton conflatable `'activate-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should\n     * perform the actions necessary to activate the widget, which\n     * may include focusing its node or descendant node.\n     */\n    export const ActivateRequest = new ConflatableMessage('activate-request');\n\n    /**\n     * A singleton conflatable `'close-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should close\n     * and remove itself from the widget hierarchy.\n     */\n    export const CloseRequest = new ConflatableMessage('close-request');\n  }\n\n  /**\n   * A message class for child related messages.\n   */\n  export class ChildMessage extends Message {\n    /**\n     * Construct a new child message.\n     *\n     * @param type - The message type.\n     *\n     * @param child - The child widget for the message.\n     */\n    constructor(type: string, child: Widget) {\n      super(type);\n      this.child = child;\n    }\n\n    /**\n     * The child widget for the message.\n     */\n    readonly child: Widget;\n  }\n\n  /**\n   * A message class for `'resize'` messages.\n   */\n  export class ResizeMessage extends Message {\n    /**\n     * Construct a new resize message.\n     *\n     * @param width - The **offset width** of the widget, or `-1` if\n     *   the width is not known.\n     *\n     * @param height - The **offset height** of the widget, or `-1` if\n     *   the height is not known.\n     */\n    constructor(width: number, height: number) {\n      super('resize');\n      this.width = width;\n      this.height = height;\n    }\n\n    /**\n     * The offset width of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the width is unknown.\n     */\n    readonly width: number;\n\n    /**\n     * The offset height of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the height is unknown.\n     */\n    readonly height: number;\n  }\n\n  /**\n   * The namespace for the `ResizeMessage` class statics.\n   */\n  export namespace ResizeMessage {\n    /**\n     * A singleton `'resize'` message with an unknown size.\n     */\n    export const UnknownSize = new ResizeMessage(-1, -1);\n  }\n\n  /**\n   * Attach a widget to a host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param host - The DOM node to use as the widget's host.\n   *\n   * @param ref - The child of `host` to use as the reference element.\n   *   If this is provided, the widget will be inserted before this\n   *   node in the host. The default is `null`, which will cause the\n   *   widget to be added as the last child of the host.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget, if\n   * the widget is already attached, or if the host is not attached\n   * to the DOM.\n   */\n  export function attach(\n    widget: Widget,\n    host: HTMLElement,\n    ref: HTMLElement | null = null\n  ): void {\n    if (widget.parent) {\n      throw new Error('Cannot attach a child widget.');\n    }\n    if (widget.isAttached || widget.node.isConnected) {\n      throw new Error('Widget is already attached.');\n    }\n    if (!host.isConnected) {\n      throw new Error('Host is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    host.insertBefore(widget.node, ref);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n  }\n\n  /**\n   * Detach the widget from its host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget,\n   * or if the widget is not attached to the DOM.\n   */\n  export function detach(widget: Widget): void {\n    if (widget.parent) {\n      throw new Error('Cannot detach a child widget.');\n    }\n    if (!widget.isAttached || !widget.node.isConnected) {\n      throw new Error('Widget is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    widget.node.parentNode!.removeChild(widget.node);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An attached property for the widget title object.\n   */\n  export const titleProperty = new AttachedProperty<Widget, Title<Widget>>({\n    name: 'title',\n    create: owner => new Title<Widget>({ owner })\n  });\n\n  /**\n   * Create a DOM node for the given widget options.\n   */\n  export function createNode(options: Widget.IOptions): HTMLElement {\n    return options.node || document.createElement(options.tag || 'div');\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable<Widget>, IDisposable {\n  /**\n   * Construct a new layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: Layout.IOptions = {}) {\n    this._fitPolicy = options.fitPolicy || 'set-min-size';\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This should be reimplemented to clear and dispose of the widgets.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    this._parent = null;\n    this._disposed = true;\n    Signal.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * Test whether the layout is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Get the parent widget of the layout.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent widget of the layout.\n   *\n   * #### Notes\n   * This is set automatically when installing the layout on the parent\n   * widget. The parent widget should not be set directly by user code.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (this._parent) {\n      throw new Error('Cannot change parent widget.');\n    }\n    if (value!.layout !== this) {\n      throw new Error('Invalid parent widget.');\n    }\n    this._parent = value;\n    this.init();\n  }\n\n  /**\n   * Get the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  get fitPolicy(): Layout.FitPolicy {\n    return this._fitPolicy;\n  }\n\n  /**\n   * Set the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   *\n   * Changing the fit policy will clear the current size constraint\n   * for the parent widget and then re-fit the parent.\n   */\n  set fitPolicy(value: Layout.FitPolicy) {\n    // Bail if the policy does not change\n    if (this._fitPolicy === value) {\n      return;\n    }\n\n    // Update the internal policy.\n    this._fitPolicy = value;\n\n    // Clear the size constraints and schedule a fit of the parent.\n    if (this._parent) {\n      let style = this._parent.node.style;\n      style.minWidth = '';\n      style.minHeight = '';\n      style.maxWidth = '';\n      style.maxHeight = '';\n      this._parent.fit();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This abstract method must be implemented by a subclass.\n   */\n  abstract [Symbol.iterator](): IterableIterator<Widget>;\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method should *not* modify the widget's `parent`.\n   */\n  abstract removeWidget(widget: Widget): void;\n\n  /**\n   * Process a message sent to the parent widget.\n   *\n   * @param msg - The message sent to the parent widget.\n   *\n   * #### Notes\n   * This method is called by the parent widget to process a message.\n   *\n   * Subclasses may reimplement this method as needed.\n   */\n  processParentMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.onAfterDetach(msg);\n        break;\n      case 'child-removed':\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      case 'child-shown':\n        this.onChildShown(msg as Widget.ChildMessage);\n        break;\n      case 'child-hidden':\n        this.onChildHidden(msg as Widget.ChildMessage);\n        break;\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   *\n   * #### Notes\n   * This method is invoked immediately after the layout is installed\n   * on the parent widget.\n   *\n   * The default implementation reparents all of the widgets to the\n   * layout parent widget.\n   *\n   * Subclasses should reimplement this method and attach the child\n   * widget nodes to the parent widget's node.\n   */\n  protected init(): void {\n    for (const widget of this) {\n      widget.parent = this.parent;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the specified layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the available layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * This will remove the child widget from the layout.\n   *\n   * Subclasses should **not** typically reimplement this method.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    this.removeWidget(msg.child);\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n  private _disposed = false;\n  private _fitPolicy: Layout.FitPolicy;\n  private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n  /**\n   * A type alias for the layout fit policy.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  export type FitPolicy =\n    | /**\n     * No size constraint will be applied to the parent widget.\n     */\n    'set-no-constraint'\n\n    /**\n     * The computed min size will be applied to the parent widget.\n     */\n    | 'set-min-size';\n\n  /**\n   * An options object for initializing a layout.\n   */\n  export interface IOptions {\n    /**\n     * The fit policy for the layout.\n     *\n     * The default is `'set-min-size'`.\n     */\n    fitPolicy?: FitPolicy;\n  }\n\n  /**\n   * A type alias for the horizontal alignment of a widget.\n   */\n  export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n  /**\n   * A type alias for the vertical alignment of a widget.\n   */\n  export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n  /**\n   * Get the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The horizontal alignment for the widget.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   */\n  export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n    return Private.horizontalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the horizontal alignment.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setHorizontalAlignment(\n    widget: Widget,\n    value: HorizontalAlignment\n  ): void {\n    Private.horizontalAlignmentProperty.set(widget, value);\n  }\n\n  /**\n   * Get the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The vertical alignment for the widget.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   */\n  export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n    return Private.verticalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the vertical alignment.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setVerticalAlignment(\n    widget: Widget,\n    value: VerticalAlignment\n  ): void {\n    Private.verticalAlignmentProperty.set(widget, value);\n  }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n  /**\n   * Construct a new layout item.\n   *\n   * @param widget - The widget to be managed by the item.\n   *\n   * #### Notes\n   * The widget will be set to absolute positioning.\n   * The widget will use strict CSS containment.\n   */\n  constructor(widget: Widget) {\n    this.widget = widget;\n    this.widget.node.style.position = 'absolute';\n    this.widget.node.style.contain = 'strict';\n  }\n\n  /**\n   * Dispose of the the layout item.\n   *\n   * #### Notes\n   * This will reset the positioning of the widget.\n   */\n  dispose(): void {\n    // Do nothing if the item is already disposed.\n    if (this._disposed) {\n      return;\n    }\n\n    // Mark the item as disposed.\n    this._disposed = true;\n\n    // Reset the widget style.\n    let style = this.widget.node.style;\n    style.position = '';\n    style.top = '';\n    style.left = '';\n    style.width = '';\n    style.height = '';\n    style.contain = '';\n  }\n\n  /**\n   * The widget managed by the layout item.\n   */\n  readonly widget: Widget;\n\n  /**\n   * The computed minimum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minWidth(): number {\n    return this._minWidth;\n  }\n\n  /**\n   * The computed minimum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minHeight(): number {\n    return this._minHeight;\n  }\n\n  /**\n   * The computed maximum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxWidth(): number {\n    return this._maxWidth;\n  }\n\n  /**\n   * The computed maximum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxHeight(): number {\n    return this._maxHeight;\n  }\n\n  /**\n   * Whether the layout item is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Whether the managed widget is hidden.\n   */\n  get isHidden(): boolean {\n    return this.widget.isHidden;\n  }\n\n  /**\n   * Whether the managed widget is visible.\n   */\n  get isVisible(): boolean {\n    return this.widget.isVisible;\n  }\n\n  /**\n   * Whether the managed widget is attached.\n   */\n  get isAttached(): boolean {\n    return this.widget.isAttached;\n  }\n\n  /**\n   * Update the computed size limits of the managed widget.\n   */\n  fit(): void {\n    let limits = ElementExt.sizeLimits(this.widget.node);\n    this._minWidth = limits.minWidth;\n    this._minHeight = limits.minHeight;\n    this._maxWidth = limits.maxWidth;\n    this._maxHeight = limits.maxHeight;\n  }\n\n  /**\n   * Update the position and size of the managed widget.\n   *\n   * @param left - The left edge position of the layout box.\n   *\n   * @param top - The top edge position of the layout box.\n   *\n   * @param width - The width of the layout box.\n   *\n   * @param height - The height of the layout box.\n   */\n  update(left: number, top: number, width: number, height: number): void {\n    // Clamp the size to the computed size limits.\n    let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n    let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n    // Adjust the left edge for the horizontal alignment, if needed.\n    if (clampW < width) {\n      switch (Layout.getHorizontalAlignment(this.widget)) {\n        case 'left':\n          break;\n        case 'center':\n          left += (width - clampW) / 2;\n          break;\n        case 'right':\n          left += width - clampW;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Adjust the top edge for the vertical alignment, if needed.\n    if (clampH < height) {\n      switch (Layout.getVerticalAlignment(this.widget)) {\n        case 'top':\n          break;\n        case 'center':\n          top += (height - clampH) / 2;\n          break;\n        case 'bottom':\n          top += height - clampH;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Set up the resize variables.\n    let resized = false;\n    let style = this.widget.node.style;\n\n    // Update the top edge of the widget if needed.\n    if (this._top !== top) {\n      this._top = top;\n      style.top = `${top}px`;\n    }\n\n    // Update the left edge of the widget if needed.\n    if (this._left !== left) {\n      this._left = left;\n      style.left = `${left}px`;\n    }\n\n    // Update the width of the widget if needed.\n    if (this._width !== clampW) {\n      resized = true;\n      this._width = clampW;\n      style.width = `${clampW}px`;\n    }\n\n    // Update the height of the widget if needed.\n    if (this._height !== clampH) {\n      resized = true;\n      this._height = clampH;\n      style.height = `${clampH}px`;\n    }\n\n    // Send a resize message to the widget if needed.\n    if (resized) {\n      let msg = new Widget.ResizeMessage(clampW, clampH);\n      MessageLoop.sendMessage(this.widget, msg);\n    }\n  }\n\n  private _top = NaN;\n  private _left = NaN;\n  private _width = NaN;\n  private _height = NaN;\n  private _minWidth = 0;\n  private _minHeight = 0;\n  private _maxWidth = Infinity;\n  private _maxHeight = Infinity;\n  private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The attached property for a widget horizontal alignment.\n   */\n  export const horizontalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.HorizontalAlignment\n  >({\n    name: 'horizontalAlignment',\n    create: () => 'center',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The attached property for a widget vertical alignment.\n   */\n  export const verticalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.VerticalAlignment\n  >({\n    name: 'verticalAlignment',\n    create: () => 'top',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The change handler for the attached alignment properties.\n   */\n  function onAlignmentChanged(child: Widget): void {\n    if (child.parent && child.parent.layout) {\n      child.parent.update();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    while (this._widgets.length > 0) {\n      this._widgets.pop()!.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * A read-only array of the widgets in the layout.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this._widgets;\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    yield* this._widgets;\n  }\n\n  /**\n   * Add a widget to the end of the layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this._widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    widget.parent = this.parent;\n\n    // Look up the current index of the widget.\n    let i = this._widgets.indexOf(widget);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._widgets.length));\n\n    // If the widget is not in the array, insert it.\n    if (i === -1) {\n      // Insert the widget into the array.\n      ArrayExt.insert(this._widgets, j, widget);\n\n      // If the layout is parented, attach the widget to the DOM.\n      if (this.parent) {\n        this.attachWidget(j, widget);\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the widget exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._widgets.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the widget to the new location.\n    ArrayExt.move(this._widgets, i, j);\n\n    // If the layout is parented, move the widget in the DOM.\n    if (this.parent) {\n      this.moveWidget(i, j, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    this.removeWidgetAt(this._widgets.indexOf(widget));\n  }\n\n  /**\n   * Remove the widget at a given index from the layout.\n   *\n   * @param index - The index of the widget to remove.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  removeWidgetAt(index: number): void {\n    // Remove the widget from the array.\n    let widget = ArrayExt.removeAt(this._widgets, index);\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (widget && this.parent) {\n      this.detachWidget(index, widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    let index = 0;\n    for (const widget of this) {\n      this.attachWidget(index++, widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[index];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation moves the widget's node to the proper\n   * location in the parent's node and sends the appropriate attach and\n   * detach messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is moved in the parent's node.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` and  message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[toIndex];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n  /**\n   * Clamp a dimension value to an integer >= 0.\n   */\n  export function clampDimension(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n  /**\n   * Construct a new split layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: SplitLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.orientation !== undefined) {\n      this._orientation = options.orientation;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n    this._handles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the split layout.\n   */\n  readonly renderer: SplitLayout.IRenderer;\n\n  /**\n   * Get the layout orientation for the split layout.\n   */\n  get orientation(): SplitLayout.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split layout.\n   */\n  set orientation(value: SplitLayout.Orientation) {\n    if (this._orientation === value) {\n      return;\n    }\n    this._orientation = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['orientation'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  get alignment(): SplitLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  set alignment(value: SplitLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the split layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the split handles in the layout.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return this._handles;\n  }\n\n  /**\n   * Get the absolute sizes of the widgets in the layout.\n   *\n   * @returns A new array of the absolute sizes of the widgets.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  absoluteSizes(): number[] {\n    return this._sizers.map(sizer => sizer.size);\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the layout.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return Private.normalize(this._sizers.map(sizer => sizer.size));\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the layout.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    // Copy the sizes and pad with zeros as needed.\n    let n = this._sizers.length;\n    let temp = sizes.slice(0, n);\n    while (temp.length < n) {\n      temp.push(0);\n    }\n\n    // Normalize the padded sizes.\n    let normed = Private.normalize(temp);\n\n    // Apply the normalized sizes to the sizers.\n    for (let i = 0; i < n; ++i) {\n      let sizer = this._sizers[i];\n      sizer.sizeHint = normed[i];\n      sizer.size = normed[i];\n    }\n\n    // Set the flag indicating the sizes are normalized.\n    this._hasNormedSizes = true;\n\n    // Trigger an update of the parent widget.\n    if (update && this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Move the offset position of a split handle.\n   *\n   * @param index - The index of the handle of the interest.\n   *\n   * @param position - The desired offset position of the handle.\n   *\n   * #### Notes\n   * The position is relative to the offset parent.\n   *\n   * This will move the handle as close as possible to the desired\n   * position. The sibling widgets will be adjusted as necessary.\n   */\n  moveHandle(index: number, position: number): void {\n    // Bail if the index is invalid or the handle is hidden.\n    let handle = this._handles[index];\n    if (!handle || handle.classList.contains('lm-mod-hidden')) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (this._orientation === 'horizontal') {\n      delta = position - handle.offsetLeft;\n    } else {\n      delta = position - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent widget resizing unless needed.\n    for (let sizer of this._sizers) {\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(this._sizers, index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['orientation'] = this.orientation;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create the item, handle, and sizer for the new widget.\n    let item = new LayoutItem(widget);\n    let handle = Private.createHandle(this.renderer);\n    let average = Private.averageSize(this._sizers);\n    let sizer = Private.createSizer(average);\n\n    // Insert the item, handle, and sizer into the internal arrays.\n    ArrayExt.insert(this._items, index, item);\n    ArrayExt.insert(this._sizers, index, sizer);\n    ArrayExt.insert(this._handles, index, handle);\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget and handle nodes to the parent.\n    this.parent!.node.appendChild(widget.node);\n    this.parent!.node.appendChild(handle);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the item, sizer, and handle for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n    ArrayExt.move(this._handles, fromIndex, toIndex);\n\n    // Post a fit request to the parent to show/hide last handle.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the item, handle, and sizer for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n    let handle = ArrayExt.removeAt(this._handles, index);\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget and handle nodes from the parent.\n    this.parent!.node.removeChild(widget.node);\n    this.parent!.node.removeChild(handle!);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const item = this._items[i];\n    if (item.isHidden) {\n      return;\n    }\n\n    // Fetch the style for the handle.\n    let handleStyle = this._handles[i].style;\n\n    // Update the widget and handle, and advance the relevant edge.\n    if (isHorizontal) {\n      left += this.widgetOffset;\n      item.update(left, top, size, height);\n      left += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${this._spacing}px`;\n      handleStyle.height = `${height}px`;\n    } else {\n      top += this.widgetOffset;\n      item.update(left, top, width, size);\n      top += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${width}px`;\n      handleStyle.height = `${this._spacing}px`;\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Update the handles and track the visible widget count.\n    let nVisible = 0;\n    let lastHandleIndex = -1;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      if (this._items[i].isHidden) {\n        this._handles[i].classList.add('lm-mod-hidden');\n      } else {\n        this._handles[i].classList.remove('lm-mod-hidden');\n        lastHandleIndex = i;\n        nVisible++;\n      }\n    }\n\n    // Hide the handle for the last visible widget.\n    if (lastHandleIndex !== -1) {\n      this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed =\n      this._spacing * Math.max(0, nVisible - 1) +\n      this.widgetOffset * this._items.length;\n\n    // Setup the computed minimum size.\n    let horz = this._orientation === 'horizontal';\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed size limits.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // Prevent resizing unless necessary.\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the stretch factor.\n      sizer.stretch = SplitLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0 && this.widgetOffset === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Set up the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n    let horz = this._orientation === 'horizontal';\n\n    if (nVisible > 0) {\n      // Compute the adjusted layout space.\n      let space: number;\n      if (horz) {\n        // left += this.widgetOffset;\n        space = Math.max(0, width - this._fixed);\n      } else {\n        // top += this.widgetOffset;\n        space = Math.max(0, height - this._fixed);\n      }\n\n      // Scale the size hints if they are normalized.\n      if (this._hasNormedSizes) {\n        for (let sizer of this._sizers) {\n          sizer.sizeHint *= space;\n        }\n        this._hasNormedSizes = false;\n      }\n\n      // Distribute the layout space to the box sizers.\n      let delta = BoxEngine.calc(this._sizers, space);\n\n      // Account for alignment if there is extra layout space.\n      if (delta > 0) {\n        switch (this._alignment) {\n          case 'start':\n            break;\n          case 'center':\n            extra = 0;\n            offset = delta / 2;\n            break;\n          case 'end':\n            extra = 0;\n            offset = delta;\n            break;\n          case 'justify':\n            extra = delta / nVisible;\n            offset = 0;\n            break;\n          default:\n            throw 'unreachable';\n        }\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      const item = this._items[i];\n\n      // Fetch the computed size for the widget.\n      const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n      this.updateItemPosition(\n        i,\n        horz,\n        horz ? left + offset : left,\n        horz ? top : top + offset,\n        height,\n        width,\n        size\n      );\n\n      const fullOffset =\n        this.widgetOffset +\n        (this._handles[i].classList.contains('lm-mod-hidden')\n          ? 0\n          : this._spacing);\n\n      if (horz) {\n        left += size + fullOffset;\n      } else {\n        top += size + fullOffset;\n      }\n    }\n  }\n\n  protected widgetOffset = 0;\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _hasNormedSizes = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _handles: HTMLDivElement[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: SplitLayout.Alignment = 'start';\n  private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n  /**\n   * A type alias for a split layout orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a split layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a split layout.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The orientation of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Orientation}.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a split layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new handle for use with a split layout.\n     *\n     * @returns A new handle element.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * Get the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Create a new box sizer with the given size hint.\n   */\n  export function createSizer(size: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = Math.floor(size);\n    return sizer;\n  }\n\n  /**\n   * Create a new split handle node using the given renderer.\n   */\n  export function createHandle(\n    renderer: SplitLayout.IRenderer\n  ): HTMLDivElement {\n    let handle = renderer.createHandle();\n    handle.style.position = 'absolute';\n    // Do not use size containment to allow the handle to fill the available space\n    handle.style.contain = 'style';\n    return handle;\n  }\n\n  /**\n   * Compute the average size of an array of box sizers.\n   */\n  export function averageSize(sizers: BoxSizer[]): number {\n    return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n  }\n\n  /**\n   * Normalize an array of values.\n   */\n  export function normalize(values: number[]): number[] {\n    let n = values.length;\n    if (n === 0) {\n      return [];\n    }\n    let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n    return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof SplitLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n  /**\n   * Construct a new accordion layout.\n   *\n   * @param options - The options for initializing the layout.\n   *\n   * #### Notes\n   * The default orientation will be vertical.\n   *\n   * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n   */\n  constructor(options: AccordionLayout.IOptions) {\n    super({ ...options, orientation: options.orientation || 'vertical' });\n    this.titleSpace = options.titleSpace || 22;\n  }\n\n  /**\n   * The section title height or width depending on the orientation.\n   */\n  get titleSpace(): number {\n    return this.widgetOffset;\n  }\n  set titleSpace(value: number) {\n    value = Utils.clampDimension(value);\n    if (this.widgetOffset === value) {\n      return;\n    }\n    this.widgetOffset = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return this._titles;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Clear the layout state.\n    this._titles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the accordion layout.\n   */\n  readonly renderer: AccordionLayout.IRenderer;\n\n  public updateTitle(index: number, widget: Widget): void {\n    const oldTitle = this._titles[index];\n    const expanded = oldTitle.classList.contains('lm-mod-expanded');\n    const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n    this._titles[index] = newTitle;\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.replaceChild(newTitle, oldTitle);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (!widget.id) {\n      widget.id = `id-${UUID.uuid4()}`;\n    }\n    super.insertWidget(index, widget);\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    const title = Private.createTitle(this.renderer, widget.title);\n\n    ArrayExt.insert(this._titles, index, title);\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.appendChild(title);\n\n    widget.node.setAttribute('role', 'region');\n    widget.node.setAttribute('aria-labelledby', title.id);\n\n    super.attachWidget(index, widget);\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    ArrayExt.move(this._titles, fromIndex, toIndex);\n    super.moveWidget(fromIndex, toIndex, widget);\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    const title = ArrayExt.removeAt(this._titles, index);\n\n    this.parent!.node.removeChild(title!);\n\n    super.detachWidget(index, widget);\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const titleStyle = this._titles[i].style;\n\n    // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n    titleStyle.top = `${top}px`;\n    titleStyle.left = `${left}px`;\n    titleStyle.height = `${this.widgetOffset}px`;\n    if (isHorizontal) {\n      titleStyle.width = `${height}px`;\n    } else {\n      titleStyle.width = `${width}px`;\n    }\n\n    super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n  }\n\n  private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n  /**\n   * A type alias for a accordion layout orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion layout alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * An options object for initializing a accordion layout.\n   */\n  export interface IOptions extends SplitLayout.IOptions {\n    /**\n     * The renderer to use for the accordion layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The section title height or width depending on the orientation.\n     *\n     * The default is `22`.\n     */\n    titleSpace?: number;\n  }\n\n  /**\n   * A renderer for use with an accordion layout.\n   */\n  export interface IRenderer extends SplitLayout.IRenderer {\n    /**\n     * Common class name for all accordion titles.\n     */\n    readonly titleClassName: string;\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param title - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(title: Title<Widget>): HTMLElement;\n  }\n}\n\nnamespace Private {\n  /**\n   * Create the title HTML element.\n   *\n   * @param renderer Accordion renderer\n   * @param data Widget title\n   * @returns Title HTML element\n   */\n  export function createTitle(\n    renderer: AccordionLayout.IRenderer,\n    data: Title<Widget>,\n    expanded: boolean = true\n  ): HTMLElement {\n    const title = renderer.createSectionTitle(data);\n    title.style.position = 'absolute';\n    title.style.contain = 'strict';\n    title.setAttribute('aria-label', `${data.label} Section`);\n    title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n    title.setAttribute('aria-controls', data.owner.id);\n    if (expanded) {\n      title.classList.add('lm-mod-expanded');\n    }\n    return title;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n  /**\n   * Construct a new panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: Panel.IOptions = {}) {\n    super();\n    this.addClass('lm-Panel');\n    this.layout = Private.createLayout(options);\n  }\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return (this.layout as PanelLayout).widgets;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    (this.layout as PanelLayout).addWidget(widget);\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    (this.layout as PanelLayout).insertWidget(index, widget);\n  }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n  /**\n   * An options object for creating a panel.\n   */\n  export interface IOptions {\n    /**\n     * The panel layout to use for the panel.\n     *\n     * The default is a new `PanelLayout`.\n     */\n    layout?: PanelLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a panel layout for the given panel options.\n   */\n  export function createLayout(options: Panel.IOptions): PanelLayout {\n    return options.layout || new PanelLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n  /**\n   * Construct a new split panel.\n   *\n   * @param options - The options for initializing the split panel.\n   */\n  constructor(options: SplitPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-SplitPanel');\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    super.dispose();\n  }\n\n  /**\n   * Get the layout orientation for the split panel.\n   */\n  get orientation(): SplitPanel.Orientation {\n    return (this.layout as SplitLayout).orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split panel.\n   */\n  set orientation(value: SplitPanel.Orientation) {\n    (this.layout as SplitLayout).orientation = value;\n  }\n\n  /**\n   * Get the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  get alignment(): SplitPanel.Alignment {\n    return (this.layout as SplitLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  set alignment(value: SplitPanel.Alignment) {\n    (this.layout as SplitLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the split panel.\n   */\n  get spacing(): number {\n    return (this.layout as SplitLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split panel.\n   */\n  set spacing(value: number) {\n    (this.layout as SplitLayout).spacing = value;\n  }\n\n  /**\n   * The renderer used by the split panel.\n   */\n  get renderer(): SplitPanel.IRenderer {\n    return (this.layout as SplitLayout).renderer;\n  }\n\n  /**\n   * A signal emitted when a split handle has moved.\n   */\n  get handleMoved(): ISignal<this, void> {\n    return this._handleMoved;\n  }\n\n  /**\n   * A read-only array of the split handles in the panel.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return (this.layout as SplitLayout).handles;\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the panel.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return (this.layout as SplitLayout).relativeSizes();\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the panel.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n  }\n\n  /**\n   * Handle the DOM events for the split panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the `'keydown'` event for the split panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    if (this._pressData) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the split panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the primary button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the target, if any.\n    let layout = this.layout as SplitLayout;\n    let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n      return handle.contains(event.target as HTMLElement);\n    });\n\n    // Bail early if the mouse press was not on a handle.\n    if (index === -1) {\n      return;\n    }\n\n    // Stop the event when a split handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    document.addEventListener('pointerup', this, true);\n    document.addEventListener('pointermove', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset delta for the handle press.\n    let delta: number;\n    let handle = layout.handles[index];\n    let rect = handle.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      delta = event.clientX - rect.left;\n    } else {\n      delta = event.clientY - rect.top;\n    }\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!);\n    this._pressData = { index, delta, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the split panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Stop the event when dragging a split handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let pos: number;\n    let layout = this.layout as SplitLayout;\n    let rect = this.node.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      pos = event.clientX - rect.left - this._pressData!.delta;\n    } else {\n      pos = event.clientY - rect.top - this._pressData!.delta;\n    }\n\n    // Move the handle as close to the desired position as possible.\n    layout.moveHandle(this._pressData!.index, pos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the split panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the primary button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse grab for the split panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Emit the handle moved signal.\n    this._handleMoved.emit();\n\n    // Remove the extra document listeners.\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('pointerup', this, true);\n    document.removeEventListener('pointermove', this, true);\n    document.removeEventListener('contextmenu', this, true);\n  }\n\n  private _handleMoved = new Signal<any, void>(this);\n  private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n  /**\n   * A type alias for a split panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a split panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a split panel renderer.\n   */\n  export type IRenderer = SplitLayout.IRenderer;\n\n  /**\n   * An options object for initializing a split panel.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The layout orientation of the panel.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The split layout to use for the split panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `SplitLayout`.\n     */\n    layout?: SplitLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new handle for use with a split panel.\n     *\n     * @returns A new handle element for a split panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-SplitPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * Get the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return SplitLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    SplitLayout.setStretch(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The index of the pressed handle.\n     */\n    index: number;\n\n    /**\n     * The offset of the press in handle coordinates.\n     */\n    delta: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * Create a split layout for the given panel options.\n   */\n  export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n    return (\n      options.layout ||\n      new SplitLayout({\n        renderer: options.renderer || SplitPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n  /**\n   * Construct a new accordion panel.\n   *\n   * @param options - The options for initializing the accordion panel.\n   *\n   */\n  constructor(options: AccordionPanel.IOptions = {}) {\n    super({ ...options, layout: Private.createLayout(options) });\n    this.addClass('lm-AccordionPanel');\n  }\n\n  /**\n   * The renderer used by the accordion panel.\n   */\n  get renderer(): AccordionPanel.IRenderer {\n    return (this.layout as AccordionLayout).renderer;\n  }\n\n  /**\n   * The section title space.\n   *\n   * This is the height if the panel is vertical and the width if it is\n   * horizontal.\n   */\n  get titleSpace(): number {\n    return (this.layout as AccordionLayout).titleSpace;\n  }\n  set titleSpace(value: number) {\n    (this.layout as AccordionLayout).titleSpace = value;\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return (this.layout as AccordionLayout).titles;\n  }\n\n  /**\n   * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n   */\n  get expansionToggled(): ISignal<this, number> {\n    return this._expansionToggled;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    super.addWidget(widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Collapse the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  collapse(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && !widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Expand the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  expand(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    super.insertWidget(index, widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Handle the DOM events for the accordion panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    super.handleEvent(event);\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._eventKeyDown(event as KeyboardEvent);\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    super.onBeforeAttach(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    super.onAfterDetach(msg);\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<Widget>): void {\n    const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n      return widget.contains(sender.owner);\n    });\n\n    if (index >= 0) {\n      (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n      this.update();\n    }\n  }\n\n  /**\n   * Compute the size of widgets in this panel on the title click event.\n   * On closing, the size of the widget is cached and we will try to expand\n   * the last opened widget.\n   * On opening, we will use the cached size if it is available to restore the\n   * widget.\n   * In both cases, if we can not compute the size of widgets, we will let\n   * `SplitLayout` decide.\n   *\n   * @param index - The index of widget to be opened of closed\n   *\n   * @returns Relative size of widgets in this panel, if this size can\n   * not be computed, return `undefined`\n   */\n  private _computeWidgetSize(index: number): number[] | undefined {\n    const layout = this.layout as AccordionLayout;\n\n    const widget = layout.widgets[index];\n    if (!widget) {\n      return undefined;\n    }\n    const isHidden = widget.isHidden;\n    const widgetSizes = layout.absoluteSizes();\n    const delta = (isHidden ? -1 : 1) * this.spacing;\n    const totalSize = widgetSizes.reduce(\n      (prev: number, curr: number) => prev + curr\n    );\n\n    let newSize = [...widgetSizes];\n\n    if (!isHidden) {\n      // Hide the widget\n      const currentSize = widgetSizes[index];\n\n      this._widgetSizesCache.set(widget, currentSize);\n      newSize[index] = 0;\n\n      const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // All widget are closed, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n\n      newSize[widgetToCollapse] =\n        widgetSizes[widgetToCollapse] + currentSize + delta;\n    } else {\n      // Show the widget\n      const previousSize = this._widgetSizesCache.get(widget);\n      if (!previousSize) {\n        // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n      newSize[index] += previousSize;\n\n      const widgetToCollapse = newSize\n        .map(sz => sz - previousSize > 0)\n        .lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // Can not reduce the size of one widget, reduce all opened widgets\n        // proportionally with its size.\n        newSize.forEach((_, idx) => {\n          if (idx !== index) {\n            newSize[idx] -=\n              (widgetSizes[idx] / totalSize) * (previousSize - delta);\n          }\n        });\n      } else {\n        newSize[widgetToCollapse] -= previousSize - delta;\n      }\n    }\n    return newSize.map(sz => sz / (totalSize + delta));\n  }\n  /**\n   * Handle the `'click'` event for the accordion panel\n   */\n  private _evtClick(event: MouseEvent): void {\n    const target = event.target as HTMLElement | null;\n\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._toggleExpansion(index);\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the accordion panel.\n   */\n  private _eventKeyDown(event: KeyboardEvent): void {\n    if (event.defaultPrevented) {\n      return;\n    }\n\n    const target = event.target as HTMLElement | null;\n    let handled = false;\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        const keyCode = event.keyCode.toString();\n\n        // If Space or Enter is pressed on title, emulate click event\n        if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n          target.click();\n          handled = true;\n        } else if (\n          this.orientation === 'horizontal'\n            ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n            : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n        ) {\n          // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n          const direction =\n            event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n              ? -1\n              : 1;\n          const length = this.titles.length;\n          const newIndex = (index + length + direction) % length;\n\n          this.titles[newIndex].focus();\n          handled = true;\n        } else if (event.key === 'End' || keyCode === '35') {\n          // If End is pressed on title, focus on the last title\n          this.titles[this.titles.length - 1].focus();\n          handled = true;\n        } else if (event.key === 'Home' || keyCode === '36') {\n          // If Home is pressed on title, focus on the first title\n          this.titles[0].focus();\n          handled = true;\n        }\n      }\n\n      if (handled) {\n        event.preventDefault();\n      }\n    }\n  }\n\n  private _toggleExpansion(index: number) {\n    const title = this.titles[index];\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    const newSize = this._computeWidgetSize(index);\n    if (newSize) {\n      this.setRelativeSizes(newSize, false);\n    }\n\n    if (widget.isHidden) {\n      title.classList.add('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'true');\n      widget.show();\n    } else {\n      title.classList.remove('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'false');\n      widget.hide();\n    }\n\n    // Emit the expansion state signal.\n    this._expansionToggled.emit(index);\n  }\n\n  private _widgetSizesCache: WeakMap<Widget, number> = new WeakMap();\n  private _expansionToggled = new Signal<this, number>(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n  /**\n   * A type alias for a accordion panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a accordion panel renderer.\n   */\n  export type IRenderer = AccordionLayout.IRenderer;\n\n  /**\n   * An options object for initializing a accordion panel.\n   */\n  export interface IOptions extends Partial<AccordionLayout.IOptions> {\n    /**\n     * The accordion layout to use for the accordion panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `AccordionLayout`.\n     */\n    layout?: AccordionLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer extends SplitPanel.Renderer implements IRenderer {\n    constructor() {\n      super();\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches any title node in the accordion.\n     */\n    readonly titleClassName = 'lm-AccordionPanel-title';\n\n    /**\n     * Render the collapse indicator for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the collapse indicator.\n     */\n    createCollapseIcon(data: Title<Widget>): HTMLElement {\n      return document.createElement('span');\n    }\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(data: Title<Widget>): HTMLElement {\n      const handle = document.createElement('h3');\n      handle.setAttribute('tabindex', '0');\n      handle.id = this.createTitleKey(data);\n      handle.className = this.titleClassName;\n      for (const aData in data.dataset) {\n        handle.dataset[aData] = data.dataset[aData];\n      }\n\n      const collapser = handle.appendChild(this.createCollapseIcon(data));\n      collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n      const label = handle.appendChild(document.createElement('span'));\n      label.className = 'lm-AccordionPanel-titleLabel';\n      label.textContent = data.label;\n      label.title = data.caption || data.label;\n\n      return handle;\n    }\n\n    /**\n     * Create a unique render key for the title.\n     *\n     * @param data - The data to use for the title.\n     *\n     * @returns The unique render key for the title.\n     *\n     * #### Notes\n     * This method caches the key against the section title the first time\n     * the key is generated.\n     */\n    createTitleKey(data: Title<Widget>): string {\n      let key = this._titleKeys.get(data);\n      if (key === undefined) {\n        key = `title-key-${this._uuid}-${this._titleID++}`;\n        this._titleKeys.set(data, key);\n      }\n      return key;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _titleID = 0;\n    private _titleKeys = new WeakMap<Title<Widget>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n  /**\n   * Create an accordion layout for the given panel options.\n   *\n   * @param options Panel options\n   * @returns Panel layout\n   */\n  export function createLayout(\n    options: AccordionPanel.IOptions\n  ): AccordionLayout {\n    return (\n      options.layout ||\n      new AccordionLayout({\n        renderer: options.renderer || AccordionPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing,\n        titleSpace: options.titleSpace\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n  /**\n   * Construct a new box layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: BoxLayout.IOptions = {}) {\n    super();\n    if (options.direction !== undefined) {\n      this._direction = options.direction;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the layout direction for the box layout.\n   */\n  get direction(): BoxLayout.Direction {\n    return this._direction;\n  }\n\n  /**\n   * Set the layout direction for the box layout.\n   */\n  set direction(value: BoxLayout.Direction) {\n    if (this._direction === value) {\n      return;\n    }\n    this._direction = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['direction'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the box layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['direction'] = this.direction;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Create and add a new sizer for the widget.\n    ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Move the sizer for the widget.\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Remove the sizer for the widget.\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n    // Setup the computed minimum size.\n    let horz = Private.isHorizontal(this._direction);\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the size basis and stretch factor.\n      sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n      sizer.stretch = BoxLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Distribute the layout space and adjust the start position.\n    let delta: number;\n    switch (this._direction) {\n      case 'left-to-right':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        break;\n      case 'top-to-bottom':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        break;\n      case 'right-to-left':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        left += width;\n        break;\n      case 'bottom-to-top':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        top += height;\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Setup the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n\n    // Account for alignment if there is extra layout space.\n    if (delta > 0) {\n      switch (this._alignment) {\n        case 'start':\n          break;\n        case 'center':\n          extra = 0;\n          offset = delta / 2;\n          break;\n        case 'end':\n          extra = 0;\n          offset = delta;\n          break;\n        case 'justify':\n          extra = delta / nVisible;\n          offset = 0;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the computed size for the widget.\n      let size = this._sizers[i].size;\n\n      // Update the widget geometry and advance the relevant edge.\n      switch (this._direction) {\n        case 'left-to-right':\n          item.update(left + offset, top, size + extra, height);\n          left += size + extra + this._spacing;\n          break;\n        case 'top-to-bottom':\n          item.update(left, top + offset, width, size + extra);\n          top += size + extra + this._spacing;\n          break;\n        case 'right-to-left':\n          item.update(left - offset - size - extra, top, size + extra, height);\n          left -= size + extra + this._spacing;\n          break;\n        case 'bottom-to-top':\n          item.update(left, top - offset - size - extra, width, size + extra);\n          top -= size + extra + this._spacing;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n  }\n\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: BoxLayout.Alignment = 'start';\n  private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n  /**\n   * A type alias for a box layout direction.\n   */\n  export type Direction =\n    | 'left-to-right'\n    | 'right-to-left'\n    | 'top-to-bottom'\n    | 'bottom-to-top';\n\n  /**\n   * A type alias for a box layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a box layout.\n   */\n  export interface IOptions {\n    /**\n     * The direction of the layout.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * Get the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n\n  /**\n   * Get the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return Private.sizeBasisProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    Private.sizeBasisProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * The property descriptor for a widget size basis.\n   */\n  export const sizeBasisProperty = new AttachedProperty<Widget, number>({\n    name: 'sizeBasis',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Test whether a direction has horizontal orientation.\n   */\n  export function isHorizontal(dir: BoxLayout.Direction): boolean {\n    return dir === 'left-to-right' || dir === 'right-to-left';\n  }\n\n  /**\n   * Clamp a spacing value to an integer >= 0.\n   */\n  export function clampSpacing(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof BoxLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n  /**\n   * Construct a new box panel.\n   *\n   * @param options - The options for initializing the box panel.\n   */\n  constructor(options: BoxPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-BoxPanel');\n  }\n\n  /**\n   * Get the layout direction for the box panel.\n   */\n  get direction(): BoxPanel.Direction {\n    return (this.layout as BoxLayout).direction;\n  }\n\n  /**\n   * Set the layout direction for the box panel.\n   */\n  set direction(value: BoxPanel.Direction) {\n    (this.layout as BoxLayout).direction = value;\n  }\n\n  /**\n   * Get the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxPanel.Alignment {\n    return (this.layout as BoxLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxPanel.Alignment) {\n    (this.layout as BoxLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the box panel.\n   */\n  get spacing(): number {\n    return (this.layout as BoxLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box panel.\n   */\n  set spacing(value: number) {\n    (this.layout as BoxLayout).spacing = value;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-BoxPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-BoxPanel-child');\n  }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n  /**\n   * A type alias for a box panel direction.\n   */\n  export type Direction = BoxLayout.Direction;\n\n  /**\n   * A type alias for a box panel alignment.\n   */\n  export type Alignment = BoxLayout.Alignment;\n\n  /**\n   * An options object for initializing a box panel.\n   */\n  export interface IOptions {\n    /**\n     * The layout direction of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Direction}.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The box layout to use for the box panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `BoxLayout`.\n     */\n    layout?: BoxLayout;\n  }\n\n  /**\n   * Get the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return BoxLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    BoxLayout.setStretch(widget, value);\n  }\n\n  /**\n   * Get the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return BoxLayout.getSizeBasis(widget);\n  }\n\n  /**\n   * Set the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    BoxLayout.setSizeBasis(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a box layout for the given panel options.\n   */\n  export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n    return options.layout || new BoxLayout(options);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n  /**\n   * Construct a new command palette.\n   *\n   * @param options - The options for initializing the palette.\n   */\n  constructor(options: CommandPalette.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-CommandPalette');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || CommandPalette.defaultRenderer;\n    this.commands.commandChanged.connect(this._onGenericChange, this);\n    this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._items.length = 0;\n    this._results = null;\n    super.dispose();\n  }\n\n  /**\n   * The command registry used by the command palette.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the command palette.\n   */\n  readonly renderer: CommandPalette.IRenderer;\n\n  /**\n   * The command palette search node.\n   *\n   * #### Notes\n   * This is the node which contains the search-related elements.\n   */\n  get searchNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-search'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The command palette input node.\n   *\n   * #### Notes\n   * This is the actual input node for the search area.\n   */\n  get inputNode(): HTMLInputElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-input'\n    )[0] as HTMLInputElement;\n  }\n\n  /**\n   * The command palette content node.\n   *\n   * #### Notes\n   * This is the node which holds the command item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * A read-only array of the command items in the palette.\n   */\n  get items(): ReadonlyArray<CommandPalette.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Add a command item to the command palette.\n   *\n   * @param options - The options for creating the command item.\n   *\n   * @returns The command item added to the palette.\n   */\n  addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n    // Create a new command item for the options.\n    let item = Private.createItem(this.commands, options);\n\n    // Add the item to the array.\n    this._items.push(item);\n\n    // Refresh the search results.\n    this.refresh();\n\n    // Return the item added to the palette.\n    return item;\n  }\n\n  /**\n   * Adds command items to the command palette.\n   *\n   * @param items - An array of options for creating each command item.\n   *\n   * @returns The command items added to the palette.\n   */\n  addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n    const newItems = items.map(item => Private.createItem(this.commands, item));\n    newItems.forEach(item => this._items.push(item));\n    this.refresh();\n    return newItems;\n  }\n\n  /**\n   * Remove an item from the command palette.\n   *\n   * @param item - The item to remove from the palette.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the palette.\n   */\n  removeItem(item: CommandPalette.IItem): void {\n    this.removeItemAt(this._items.indexOf(item));\n  }\n\n  /**\n   * Remove the item at a given index from the command palette.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Remove all items from the command palette.\n   */\n  clearItems(): void {\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the array of items.\n    this._items.length = 0;\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Clear the search results and schedule an update.\n   *\n   * #### Notes\n   * This should be called whenever the search results of the palette\n   * should be updated.\n   *\n   * This is typically called automatically by the palette as needed,\n   * but can be called manually if the input text is programatically\n   * changed.\n   *\n   * The rendered results are updated asynchronously.\n   */\n  refresh(): void {\n    this._results = null;\n    if (this.inputNode.value !== '') {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'inherit';\n    } else {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'none';\n    }\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the command palette.\n   *\n   * @param event - The DOM event sent to the command palette.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the command palette's DOM node.\n   * It should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'input':\n        this.refresh();\n        break;\n      case 'focus':\n      case 'blur':\n        this._toggleFocused();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('input', this);\n    this.node.addEventListener('focus', this, true);\n    this.node.addEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('input', this);\n    this.node.removeEventListener('focus', this, true);\n    this.node.removeEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   */\n  protected onAfterShow(msg: Message): void {\n    this.update();\n    super.onAfterShow(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      let input = this.inputNode;\n      input.focus();\n      input.select();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (!this.isVisible) {\n      // Ensure to clear the content if the widget is hidden\n      VirtualDOM.render(null, this.contentNode);\n      return;\n    }\n\n    // Fetch the current query text and content node.\n    let query = this.inputNode.value;\n    let contentNode = this.contentNode;\n\n    // Ensure the search results are generated.\n    let results = this._results;\n    if (!results) {\n      // Generate and store the new search results.\n      results = this._results = Private.search(this._items, query);\n\n      // Reset the active index.\n      this._activeIndex = query\n        ? ArrayExt.findFirstIndex(results, Private.canActivate)\n        : -1;\n    }\n\n    // If there is no query and no results, clear the content.\n    if (!query && results.length === 0) {\n      VirtualDOM.render(null, contentNode);\n      return;\n    }\n\n    // If the is a query but no results, render the empty message.\n    if (query && results.length === 0) {\n      let content = this.renderer.renderEmptyMessage({ query });\n      VirtualDOM.render(content, contentNode);\n      return;\n    }\n\n    // Create the render content for the search results.\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let content = new Array<VirtualElement>(results.length);\n    for (let i = 0, n = results.length; i < n; ++i) {\n      let result = results[i];\n      if (result.type === 'header') {\n        let indices = result.indices;\n        let category = result.category;\n        content[i] = renderer.renderHeader({ category, indices });\n      } else {\n        let item = result.item;\n        let indices = result.indices;\n        let active = i === activeIndex;\n        content[i] = renderer.renderItem({ item, indices, active });\n      }\n    }\n\n    // Render the search result content.\n    VirtualDOM.render(content, contentNode);\n\n    // Adjust the scroll position as needed.\n    if (activeIndex < 0 || activeIndex >= results.length) {\n      contentNode.scrollTop = 0;\n    } else {\n      let element = contentNode.children[activeIndex];\n      ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n    }\n  }\n\n  /**\n   * Handle the `'click'` event for the command palette.\n   */\n  private _evtClick(event: MouseEvent): void {\n    // Bail if the click is not the left button.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Clear input if the target is clear button\n    if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n      this.inputNode.value = '';\n      this.refresh();\n      return;\n    }\n\n    // Find the index of the item which was clicked.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return node.contains(event.target as HTMLElement);\n    });\n\n    // Bail if the click was not on an item.\n    if (index === -1) {\n      return;\n    }\n\n    // Kill the event when a content item is clicked.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Execute the item if possible.\n    this._execute(index);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the command palette.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n      return;\n    }\n    switch (event.keyCode) {\n      case 13: // Enter\n        event.preventDefault();\n        event.stopPropagation();\n        this._execute(this._activeIndex);\n        break;\n      case 38: // Up Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activatePreviousItem();\n        break;\n      case 40: // Down Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activateNextItem();\n        break;\n    }\n  }\n\n  /**\n   * Activate the next enabled command item.\n   */\n  private _activateNextItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the next enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this._activeIndex = ArrayExt.findFirstIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Activate the previous enabled command item.\n   */\n  private _activatePreviousItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the previous enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this._activeIndex = ArrayExt.findLastIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Execute the command item at the given index, if possible.\n   */\n  private _execute(index: number): void {\n    // Bail if there are no search results.\n    if (!this._results) {\n      return;\n    }\n\n    // Bail if the index is out of range.\n    let part = this._results[index];\n    if (!part) {\n      return;\n    }\n\n    // Update the search text if the item is a header.\n    if (part.type === 'header') {\n      let input = this.inputNode;\n      input.value = `${part.category.toLowerCase()} `;\n      input.focus();\n      this.refresh();\n      return;\n    }\n\n    // Bail if item is not enabled.\n    if (!part.item.isEnabled) {\n      return;\n    }\n\n    // Execute the item.\n    this.commands.execute(part.item.command, part.item.args);\n\n    // Clear the query text.\n    this.inputNode.value = '';\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Toggle the focused modifier based on the input node focus state.\n   */\n  private _toggleFocused(): void {\n    let focused = document.activeElement === this.inputNode;\n    this.toggleClass('lm-mod-focused', focused);\n  }\n\n  /**\n   * A signal handler for generic command changes.\n   */\n  private _onGenericChange(): void {\n    this.refresh();\n  }\n\n  private _activeIndex = -1;\n  private _items: CommandPalette.IItem[] = [];\n  private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n  /**\n   * An options object for creating a command palette.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the command palette.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the command palette.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for creating a command item.\n   */\n  export interface IItemOptions {\n    /**\n     * The category for the item.\n     */\n    category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    command: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     *\n     * The rank is used as a tie-breaker when ordering command items\n     * for display. Items are sorted in the following order:\n     *   1. Text match (lower is better)\n     *   2. Category (locale order)\n     *   3. Rank (lower is better)\n     *   4. Label (locale order)\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n\n  /**\n   * An object which represents an item in a command palette.\n   *\n   * #### Notes\n   * Item objects are created automatically by a command palette.\n   */\n  export interface IItem {\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    readonly label: string;\n\n    /**\n     * The display caption for the command item.\n     */\n    readonly caption: string;\n\n    /**\n     * The icon renderer for the command item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the command item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the command item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The extra class name for the command item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the command item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the command item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the command item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    readonly isToggleable: boolean;\n\n    /**\n     * Whether the command item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the command item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * The render data for a command palette header.\n   */\n  export interface IHeaderRenderData {\n    /**\n     * The category of the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched characters in the category.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * The render data for a command palette item.\n   */\n  export interface IItemRenderData {\n    /**\n     * The command palette item to render.\n     */\n    readonly item: IItem;\n\n    /**\n     * The indices of the matched characters in the label.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n  }\n\n  /**\n   * The render data for a command palette empty message.\n   */\n  export interface IEmptyMessageRenderData {\n    /**\n     * The query which failed to match any commands.\n     */\n    query: string;\n  }\n\n  /**\n   * A renderer for use with a command palette.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement;\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     *\n     * #### Notes\n     * The command palette will not render invisible items.\n     */\n    renderItem(data: IItemRenderData): VirtualElement;\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement {\n      let content = this.formatHeader(data);\n      return h.li({ className: 'lm-CommandPalette-header' }, content);\n    }\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IItemRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      if (data.item.isToggleable) {\n        return h.li(\n          {\n            className,\n            dataset,\n            role: 'menuitemcheckbox',\n            'aria-checked': `${data.item.isToggled}`\n          },\n          this.renderItemIcon(data),\n          this.renderItemContent(data),\n          this.renderItemShortcut(data)\n        );\n      }\n      return h.li(\n        {\n          className,\n          dataset,\n          role: 'menuitem'\n        },\n        this.renderItemIcon(data),\n        this.renderItemContent(data),\n        this.renderItemShortcut(data)\n      );\n    }\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n      let content = this.formatEmptyMessage(data);\n      return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n    }\n\n    /**\n     * Render the icon for a command palette item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the icon.\n     */\n    renderItemIcon(data: IItemRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the content for a command palette item.\n     *\n     * @param data - The data to use for rendering the content.\n     *\n     * @returns A virtual element representing the content.\n     */\n    renderItemContent(data: IItemRenderData): VirtualElement {\n      return h.div(\n        { className: 'lm-CommandPalette-itemContent' },\n        this.renderItemLabel(data),\n        this.renderItemCaption(data)\n      );\n    }\n\n    /**\n     * Render the label for a command palette item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the label.\n     */\n    renderItemLabel(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemLabel(data);\n      return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n    }\n\n    /**\n     * Render the caption for a command palette item.\n     *\n     * @param data - The data to use for rendering the caption.\n     *\n     * @returns A virtual element representing the caption.\n     */\n    renderItemCaption(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemCaption(data);\n      return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n    }\n\n    /**\n     * Render the shortcut for a command palette item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the shortcut.\n     */\n    renderItemShortcut(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemShortcut(data);\n      return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n    }\n\n    /**\n     * Create the class name for the command palette item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the command palette item.\n     */\n    createItemClass(data: IItemRenderData): string {\n      // Set up the initial class name.\n      let name = 'lm-CommandPalette-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the command palette item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the command palette item.\n     */\n    createItemDataset(data: IItemRenderData): ElementDataset {\n      return { ...data.item.dataset, command: data.item.command };\n    }\n\n    /**\n     * Create the class name for the command item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IItemRenderData): string {\n      let name = 'lm-CommandPalette-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the header node.\n     *\n     * @param data - The data to use for the header content.\n     *\n     * @returns The content to add to the header node.\n     */\n    formatHeader(data: IHeaderRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.category;\n      }\n      return StringExt.highlight(data.category, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the empty message node.\n     *\n     * @param data - The data to use for the empty message content.\n     *\n     * @returns The content to add to the empty message node.\n     */\n    formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n      return `No commands found that match '${data.query}'`;\n    }\n\n    /**\n     * Create the render content for the item shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatItemShortcut(data: IItemRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n\n    /**\n     * Create the render content for the item label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatItemLabel(data: IItemRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.item.label;\n      }\n      return StringExt.highlight(data.item.label, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the item caption node.\n     *\n     * @param data - The data to use for the caption content.\n     *\n     * @returns The content to add to the caption node.\n     */\n    formatItemCaption(data: IItemRenderData): h.Child {\n      return data.item.caption;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a command palette.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let search = document.createElement('div');\n    let wrapper = document.createElement('div');\n    let input = document.createElement('input');\n    let content = document.createElement('ul');\n    let clear = document.createElement('button');\n    search.className = 'lm-CommandPalette-search';\n    wrapper.className = 'lm-CommandPalette-wrapper';\n    input.className = 'lm-CommandPalette-input';\n    clear.className = 'lm-close-icon';\n\n    content.className = 'lm-CommandPalette-content';\n    content.setAttribute('role', 'menu');\n    input.spellcheck = false;\n    wrapper.appendChild(input);\n    wrapper.appendChild(clear);\n    search.appendChild(wrapper);\n    node.appendChild(search);\n    node.appendChild(content);\n    return node;\n  }\n\n  /**\n   * Create a new command item from a command registry and options.\n   */\n  export function createItem(\n    commands: CommandRegistry,\n    options: CommandPalette.IItemOptions\n  ): CommandPalette.IItem {\n    return new CommandItem(commands, options);\n  }\n\n  /**\n   * A search result object for a header label.\n   */\n  export interface IHeaderResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'header';\n\n    /**\n     * The category for the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A search result object for a command item.\n   */\n  export interface IItemResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'item';\n\n    /**\n     * The command item which was matched.\n     */\n    readonly item: CommandPalette.IItem;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A type alias for a search result item.\n   */\n  export type SearchResult = IHeaderResult | IItemResult;\n\n  /**\n   * Search an array of command items for fuzzy matches.\n   */\n  export function search(\n    items: CommandPalette.IItem[],\n    query: string\n  ): SearchResult[] {\n    // Fuzzy match the items for the query.\n    let scores = matchItems(items, query);\n\n    // Sort the items based on their score.\n    scores.sort(scoreCmp);\n\n    // Create the results for the search.\n    return createResults(scores);\n  }\n\n  /**\n   * Test whether a result item can be activated.\n   */\n  export function canActivate(result: SearchResult): boolean {\n    return result.type === 'item' && result.item.isEnabled;\n  }\n\n  /**\n   * Normalize a category for a command item.\n   */\n  function normalizeCategory(category: string): string {\n    return category.trim().replace(/\\s+/g, ' ');\n  }\n\n  /**\n   * Normalize the query text for a fuzzy search.\n   */\n  function normalizeQuery(text: string): string {\n    return text.replace(/\\s+/g, '').toLowerCase();\n  }\n\n  /**\n   * An enum of the supported match types.\n   */\n  const enum MatchType {\n    Label,\n    Category,\n    Split,\n    Default\n  }\n\n  /**\n   * A text match score with associated command item.\n   */\n  interface IScore {\n    /**\n     * The numerical type for the text match.\n     */\n    matchType: MatchType;\n\n    /**\n     * The numerical score for the text match.\n     */\n    score: number;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    categoryIndices: number[] | null;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    labelIndices: number[] | null;\n\n    /**\n     * The command item associated with the match.\n     */\n    item: CommandPalette.IItem;\n  }\n\n  /**\n   * Perform a fuzzy match on an array of command items.\n   */\n  function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n    // Normalize the query text to lower case with no whitespace.\n    query = normalizeQuery(query);\n\n    // Create the array to hold the scores.\n    let scores: IScore[] = [];\n\n    // Iterate over the items and match against the query.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Ignore items which are not visible.\n      let item = items[i];\n      if (!item.isVisible) {\n        continue;\n      }\n\n      // If the query is empty, all items are matched by default.\n      if (!query) {\n        scores.push({\n          matchType: MatchType.Default,\n          categoryIndices: null,\n          labelIndices: null,\n          score: 0,\n          item\n        });\n        continue;\n      }\n\n      // Run the fuzzy search for the item and query.\n      let score = fuzzySearch(item, query);\n\n      // Ignore the item if it is not a match.\n      if (!score) {\n        continue;\n      }\n\n      // Penalize disabled items.\n      // TODO - push disabled items all the way down in sort cmp?\n      if (!item.isEnabled) {\n        score.score += 1000;\n      }\n\n      // Add the score to the results.\n      scores.push(score);\n    }\n\n    // Return the final array of scores.\n    return scores;\n  }\n\n  /**\n   * Perform a fuzzy search on a single command item.\n   */\n  function fuzzySearch(\n    item: CommandPalette.IItem,\n    query: string\n  ): IScore | null {\n    // Create the source text to be searched.\n    let category = item.category.toLowerCase();\n    let label = item.label.toLowerCase();\n    let source = `${category} ${label}`;\n\n    // Set up the match score and indices array.\n    let score = Infinity;\n    let indices: number[] | null = null;\n\n    // The regex for search word boundaries\n    let rgx = /\\b\\w/g;\n\n    // Search the source by word boundary.\n    // eslint-disable-next-line no-constant-condition\n    while (true) {\n      // Find the next word boundary in the source.\n      let rgxMatch = rgx.exec(source);\n\n      // Break if there is no more source context.\n      if (!rgxMatch) {\n        break;\n      }\n\n      // Run the string match on the relevant substring.\n      let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n      // Break if there is no match.\n      if (!match) {\n        break;\n      }\n\n      // Update the match if the score is better.\n      if (match.score <= score) {\n        score = match.score;\n        indices = match.indices;\n      }\n    }\n\n    // Bail if there was no match.\n    if (!indices || score === Infinity) {\n      return null;\n    }\n\n    // Compute the pivot index between category and label text.\n    let pivot = category.length + 1;\n\n    // Find the slice index to separate matched indices.\n    let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n    // Extract the matched category and label indices.\n    let categoryIndices = indices.slice(0, j);\n    let labelIndices = indices.slice(j);\n\n    // Adjust the label indices for the pivot offset.\n    for (let i = 0, n = labelIndices.length; i < n; ++i) {\n      labelIndices[i] -= pivot;\n    }\n\n    // Handle a pure label match.\n    if (categoryIndices.length === 0) {\n      return {\n        matchType: MatchType.Label,\n        categoryIndices: null,\n        labelIndices,\n        score,\n        item\n      };\n    }\n\n    // Handle a pure category match.\n    if (labelIndices.length === 0) {\n      return {\n        matchType: MatchType.Category,\n        categoryIndices,\n        labelIndices: null,\n        score,\n        item\n      };\n    }\n\n    // Handle a split match.\n    return {\n      matchType: MatchType.Split,\n      categoryIndices,\n      labelIndices,\n      score,\n      item\n    };\n  }\n\n  /**\n   * A sort comparison function for a match score.\n   */\n  function scoreCmp(a: IScore, b: IScore): number {\n    // First compare based on the match type\n    let m1 = a.matchType - b.matchType;\n    if (m1 !== 0) {\n      return m1;\n    }\n\n    // Otherwise, compare based on the match score.\n    let d1 = a.score - b.score;\n    if (d1 !== 0) {\n      return d1;\n    }\n\n    // Find the match index based on the match type.\n    let i1 = 0;\n    let i2 = 0;\n    switch (a.matchType) {\n      case MatchType.Label:\n        i1 = a.labelIndices![0];\n        i2 = b.labelIndices![0];\n        break;\n      case MatchType.Category:\n      case MatchType.Split:\n        i1 = a.categoryIndices![0];\n        i2 = b.categoryIndices![0];\n        break;\n    }\n\n    // Compare based on the match index.\n    if (i1 !== i2) {\n      return i1 - i2;\n    }\n\n    // Otherwise, compare by category.\n    let d2 = a.item.category.localeCompare(b.item.category);\n    if (d2 !== 0) {\n      return d2;\n    }\n\n    // Otherwise, compare by rank.\n    let r1 = a.item.rank;\n    let r2 = b.item.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity safe\n    }\n\n    // Finally, compare by label.\n    return a.item.label.localeCompare(b.item.label);\n  }\n\n  /**\n   * Create the results from an array of sorted scores.\n   */\n  function createResults(scores: IScore[]): SearchResult[] {\n    // Set up the search results array.\n    let results: SearchResult[] = [];\n\n    // Iterate over each score in the array.\n    for (let i = 0, n = scores.length; i < n; ++i) {\n      // Extract the current item and indices.\n      let { item, categoryIndices, labelIndices } = scores[i];\n\n      // Extract the category for the current item.\n      let category = item.category;\n\n      // Is this the same category as the preceding result?\n      if (i === 0 || category !== scores[i - 1].item.category) {\n        // Add the header result for the category.\n        results.push({ type: 'header', category, indices: categoryIndices });\n      }\n\n      // Create the item result for the score.\n      results.push({ type: 'item', item, indices: labelIndices });\n    }\n\n    // Return the final results.\n    return results;\n  }\n\n  /**\n   * A concrete implementation of `CommandPalette.IItem`.\n   */\n  class CommandItem implements CommandPalette.IItem {\n    /**\n     * Construct a new command item.\n     */\n    constructor(\n      commands: CommandRegistry,\n      options: CommandPalette.IItemOptions\n    ) {\n      this._commands = commands;\n      this.category = normalizeCategory(options.category);\n      this.command = options.command;\n      this.args = options.args || JSONExt.emptyObject;\n      this.rank = options.rank !== undefined ? options.rank : Infinity;\n    }\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    get label(): string {\n      return this._commands.label(this.command, this.args);\n    }\n\n    /**\n     * The icon renderer for the command item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      return this._commands.icon(this.command, this.args);\n    }\n\n    /**\n     * The icon class for the command item.\n     */\n    get iconClass(): string {\n      return this._commands.iconClass(this.command, this.args);\n    }\n\n    /**\n     * The icon label for the command item.\n     */\n    get iconLabel(): string {\n      return this._commands.iconLabel(this.command, this.args);\n    }\n\n    /**\n     * The display caption for the command item.\n     */\n    get caption(): string {\n      return this._commands.caption(this.command, this.args);\n    }\n\n    /**\n     * The extra class name for the command item.\n     */\n    get className(): string {\n      return this._commands.className(this.command, this.args);\n    }\n\n    /**\n     * The dataset for the command item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      return this._commands.dataset(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is enabled.\n     */\n    get isEnabled(): boolean {\n      return this._commands.isEnabled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggled.\n     */\n    get isToggled(): boolean {\n      return this._commands.isToggled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    get isToggleable(): boolean {\n      return this._commands.isToggleable(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is visible.\n     */\n    get isVisible(): boolean {\n      return this._commands.isVisible(this.command, this.args);\n    }\n\n    /**\n     * The key binding for the command item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      let { command, args } = this;\n      return (\n        ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n          return kb.command === command && JSONExt.deepEqual(kb.args, args);\n        }) || null\n      );\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ARIAAttrNames,\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n  pageXOffset: number;\n  pageYOffset: number;\n  clientWidth: number;\n  clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n  /**\n   * Construct a new menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: Menu.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-Menu');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || Menu.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the menu.\n   */\n  dispose(): void {\n    this.close();\n    this._items.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted just before the menu is closed.\n   *\n   * #### Notes\n   * This signal is emitted when the menu receives a `'close-request'`\n   * message, just before it removes itself from the DOM.\n   *\n   * This signal is not emitted if the menu is already detached from\n   * the DOM when it receives the `'close-request'` message.\n   */\n  get aboutToClose(): ISignal<this, void> {\n    return this._aboutToClose;\n  }\n\n  /**\n   * A signal emitted when a new menu is requested by the user.\n   *\n   * #### Notes\n   * This signal is emitted whenever the user presses the right or left\n   * arrow keys, and a submenu cannot be opened or closed in response.\n   *\n   * This signal is useful when implementing menu bars in order to open\n   * the next or previous menu in response to a user key press.\n   *\n   * This signal is only emitted for the root menu in a hierarchy.\n   */\n  get menuRequested(): ISignal<this, 'next' | 'previous'> {\n    return this._menuRequested;\n  }\n\n  /**\n   * The command registry used by the menu.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the menu.\n   */\n  readonly renderer: Menu.IRenderer;\n\n  /**\n   * The parent menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu is an open submenu.\n   */\n  get parentMenu(): Menu | null {\n    return this._parentMenu;\n  }\n\n  /**\n   * The child menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu has an open submenu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The root menu of the menu hierarchy.\n   */\n  get rootMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._parentMenu) {\n      menu = menu._parentMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The leaf menu of the menu hierarchy.\n   */\n  get leafMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._childMenu) {\n      menu = menu._childMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The menu content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-Menu-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu item.\n   */\n  get activeItem(): Menu.IItem | null {\n    return this._items[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the item will be set to `null`.\n   */\n  set activeItem(value: Menu.IItem | null) {\n    this.activeIndex = value ? this._items.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu item.\n   *\n   * #### Notes\n   * This will be `-1` if no menu item is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._items.length) {\n      value = -1;\n    }\n\n    // Ensure the item can be activated.\n    if (value !== -1 && !Private.canActivate(this._items[value])) {\n      value = -1;\n    }\n\n    // Bail if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Make active element in focus\n    if (\n      this._activeIndex >= 0 &&\n      this.contentNode.childNodes[this._activeIndex]\n    ) {\n      (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n    }\n\n    // schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menu items in the menu.\n   */\n  get items(): ReadonlyArray<Menu.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Activate the next selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activateNextItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this.activeIndex = ArrayExt.findFirstIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Activate the previous selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activatePreviousItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this.activeIndex = ArrayExt.findLastIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Trigger the active menu item.\n   *\n   * #### Notes\n   * If the active item is a submenu, it will be opened and the first\n   * item will be activated.\n   *\n   * If the active item is a command, the command will be executed.\n   *\n   * If the menu is not attached, this is a no-op.\n   *\n   * If there is no active item, this is a no-op.\n   */\n  triggerActiveItem(): void {\n    // Bail if the menu is not attached.\n    if (!this.isAttached) {\n      return;\n    }\n\n    // Bail if there is no active item.\n    let item = this.activeItem;\n    if (!item) {\n      return;\n    }\n\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // If the item is a submenu, open it.\n    if (item.type === 'submenu') {\n      this._openChildMenu(true);\n      return;\n    }\n\n    // Close the root menu before executing the command.\n    this.rootMenu.close();\n\n    // Execute the command for the item.\n    let { command, args } = item;\n    if (this.commands.isEnabled(command, args)) {\n      this.commands.execute(command, args);\n    } else {\n      console.log(`Command '${command}' is disabled.`);\n    }\n  }\n\n  /**\n   * Add a menu item to the end of the menu.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   */\n  addItem(options: Menu.IItemOptions): Menu.IItem {\n    return this.insertItem(this._items.length, options);\n  }\n\n  /**\n   * Insert a menu item into the menu at the specified index.\n   *\n   * @param index - The index at which to insert the item.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the items.\n   */\n  insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Clamp the insert index to the array bounds.\n    let i = Math.max(0, Math.min(index, this._items.length));\n\n    // Create the item for the options.\n    let item = Private.createItem(this, options);\n\n    // Insert the item into the array.\n    ArrayExt.insert(this._items, i, item);\n\n    // Schedule an update of the items.\n    this.update();\n\n    // Return the item added to the menu.\n    return item;\n  }\n\n  /**\n   * Remove an item from the menu.\n   *\n   * @param item - The item to remove from the menu.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the menu.\n   */\n  removeItem(item: Menu.IItem): void {\n    let index = this._items.indexOf(item);\n    if (index === -1) {\n      return;\n    }\n    this.removeItemAt(index);\n  }\n\n  /**\n   * Remove the item at a given index from the menu.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Remove all menu items from the menu.\n   */\n  clearItems(): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the items.\n    this._items.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Open the menu at the specified location.\n   *\n   * @param x - The client X coordinate of the menu location.\n   *\n   * @param y - The client Y coordinate of the menu location.\n   *\n   * @param options - The additional options for opening the menu.\n   *\n   * #### Notes\n   * The menu will be opened at the given location unless it will not\n   * fully fit on the screen. If it will not fit, it will be adjusted\n   * to fit naturally on the screen.\n   *\n   * The menu will be attached under the `host` element in the DOM\n   * (or `document.body` if `host` is `null`) and before the `ref`\n   * element (or as the last child of `host` if `ref` is `null`).\n   * The menu may be displayed outside of the `host` element\n   * following the rules of CSS absolute positioning.\n   *\n   * This is a no-op if the menu is already attached to the DOM.\n   */\n  open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n    // Bail early if the menu is already attached.\n    if (this.isAttached) {\n      return;\n    }\n\n    // Extract the menu options.\n    let forceX = options.forceX || false;\n    let forceY = options.forceY || false;\n    const host = options.host ?? null;\n    const ref = options.ref ?? null;\n    const horizontalAlignment =\n      options.horizontalAlignment ??\n      (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n    // Open the menu as a root menu.\n    Private.openRootMenu(\n      this,\n      x,\n      y,\n      forceX,\n      forceY,\n      horizontalAlignment,\n      host,\n      ref\n    );\n\n    // Activate the menu to accept keyboard input.\n    this.activate();\n  }\n\n  /**\n   * Handle the DOM events for the menu.\n   *\n   * @param event - The DOM event sent to the menu.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu's DOM nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseenter':\n        this._evtMouseEnter(event as MouseEvent);\n        break;\n      case 'mouseleave':\n        this._evtMouseLeave(event as MouseEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mouseup', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseenter', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('contextmenu', this);\n    document.addEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mouseup', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseenter', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('contextmenu', this);\n    document.removeEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this.node.focus();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let items = this._items;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let collapsedFlags = Private.computeCollapsed(items);\n    let content = new Array<VirtualElement>(items.length);\n    for (let i = 0, n = items.length; i < n; ++i) {\n      let item = items[i];\n      let active = i === activeIndex;\n      let collapsed = collapsedFlags[i];\n      content[i] = renderer.renderItem({\n        item,\n        active,\n        collapsed,\n        onfocus: () => {\n          this.activeIndex = i;\n        }\n      });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   */\n  protected onCloseRequest(msg: Message): void {\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Close any open child menu.\n    let childMenu = this._childMenu;\n    if (childMenu) {\n      this._childIndex = -1;\n      this._childMenu = null;\n      childMenu._parentMenu = null;\n      childMenu.close();\n    }\n\n    // Remove this menu from its parent and activate the parent.\n    let parentMenu = this._parentMenu;\n    if (parentMenu) {\n      this._parentMenu = null;\n      parentMenu._childIndex = -1;\n      parentMenu._childMenu = null;\n      parentMenu.activate();\n    }\n\n    // Emit the `aboutToClose` signal if the menu is attached.\n    if (this.isAttached) {\n      this._aboutToClose.emit(undefined);\n    }\n\n    // Finish closing the menu.\n    super.onCloseRequest(msg);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // A menu handles all keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Enter\n    if (kc === 13) {\n      this.triggerActiveItem();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this.close();\n      return;\n    }\n\n    // Left Arrow\n    if (kc === 37) {\n      if (this._parentMenu) {\n        this.close();\n      } else {\n        this._menuRequested.emit('previous');\n      }\n      return;\n    }\n\n    // Up Arrow\n    if (kc === 38) {\n      this.activatePreviousItem();\n      return;\n    }\n\n    // Right Arrow\n    if (kc === 39) {\n      let item = this.activeItem;\n      if (item && item.type === 'submenu') {\n        this.triggerActiveItem();\n      } else {\n        this.rootMenu._menuRequested.emit('next');\n      }\n      return;\n    }\n\n    // Down Arrow\n    if (kc === 40) {\n      this.activateNextItem();\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._items, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that item is triggered.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.triggerActiveItem();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n    }\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    if (event.button !== 0) {\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n    this.triggerActiveItem();\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Hit test the item nodes for the item under the mouse.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the mouse is already over the active index.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Update and coerce the active index.\n    this.activeIndex = index;\n    index = this.activeIndex;\n\n    // If the index is the current child index, cancel the timers.\n    if (index === this._childIndex) {\n      this._cancelOpenTimer();\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // If a child menu is currently open, start the close timer.\n    if (this._childIndex !== -1) {\n      this._startCloseTimer();\n    }\n\n    // Cancel the open timer to give a full delay for opening.\n    this._cancelOpenTimer();\n\n    // Bail if the active item is not a valid submenu item.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      return;\n    }\n\n    // Start the open timer to open the active item submenu.\n    this._startOpenTimer();\n  }\n\n  /**\n   * Handle the `'mouseenter'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseEnter(event: MouseEvent): void {\n    // Synchronize the active ancestor items.\n    for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n      menu._cancelOpenTimer();\n      menu._cancelCloseTimer();\n      menu.activeIndex = menu._childIndex;\n    }\n  }\n\n  /**\n   * Handle the `'mouseleave'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseLeave(event: MouseEvent): void {\n    // Cancel any pending submenu opening.\n    this._cancelOpenTimer();\n\n    // If there is no open child menu, just reset the active index.\n    if (!this._childMenu) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // If the mouse is over the child menu, cancel the close timer.\n    let { clientX, clientY } = event;\n    if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // Otherwise, reset the active index and start the close timer.\n    this.activeIndex = -1;\n    this._startCloseTimer();\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the document node.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the menu is not a root menu.\n    if (this._parentMenu) {\n      return;\n    }\n\n    // The mouse button which is pressed is irrelevant. If the press\n    // is not on a menu, the entire hierarchy is closed and the event\n    // is allowed to propagate. This allows other code to act on the\n    // event, such as focusing the clicked element.\n    if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n      event.preventDefault();\n      event.stopPropagation();\n    } else {\n      this.close();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if the active item is not a valid submenu.\n   */\n  private _openChildMenu(activateFirst = false): void {\n    // If the item is not a valid submenu, close the child menu.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Do nothing if the child menu will not change.\n    let submenu = item.submenu;\n    if (submenu === this._childMenu) {\n      return;\n    }\n\n    // Prior to any DOM modifications save window data\n    Menu.saveWindowData();\n\n    // Ensure the current child menu is closed.\n    this._closeChildMenu();\n\n    // Update the private child state.\n    this._childMenu = submenu;\n    this._childIndex = this._activeIndex;\n\n    // Set the parent menu reference for the child.\n    submenu._parentMenu = this;\n\n    // Ensure the menu is updated and lookup the item node.\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    let itemNode = this.contentNode.children[this._activeIndex];\n\n    // Open the submenu at the active node.\n    Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n    // Activate the first item if desired.\n    if (activateFirst) {\n      submenu.activeIndex = -1;\n      submenu.activateNextItem();\n    }\n\n    // Activate the child menu.\n    submenu.activate();\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    if (this._childMenu) {\n      this._childMenu.close();\n    }\n  }\n\n  /**\n   * Start the open timer, unless it is already pending.\n   */\n  private _startOpenTimer(): void {\n    if (this._openTimerID === 0) {\n      this._openTimerID = window.setTimeout(() => {\n        this._openTimerID = 0;\n        this._openChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Start the close timer, unless it is already pending.\n   */\n  private _startCloseTimer(): void {\n    if (this._closeTimerID === 0) {\n      this._closeTimerID = window.setTimeout(() => {\n        this._closeTimerID = 0;\n        this._closeChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Cancel the open timer, if the timer is pending.\n   */\n  private _cancelOpenTimer(): void {\n    if (this._openTimerID !== 0) {\n      clearTimeout(this._openTimerID);\n      this._openTimerID = 0;\n    }\n  }\n\n  /**\n   * Cancel the close timer, if the timer is pending.\n   */\n  private _cancelCloseTimer(): void {\n    if (this._closeTimerID !== 0) {\n      clearTimeout(this._closeTimerID);\n      this._closeTimerID = 0;\n    }\n  }\n\n  /**\n   * Save window data used for menu positioning in transient cache.\n   *\n   * In order to avoid layout trashing it is recommended to invoke this\n   * method immediately prior to opening the menu and any DOM modifications\n   * (like closing previously visible menu, or adding a class to menu widget).\n   *\n   * The transient cache will be released upon `open()` call.\n   */\n  static saveWindowData(): void {\n    Private.saveWindowData();\n  }\n\n  private _childIndex = -1;\n  private _activeIndex = -1;\n  private _openTimerID = 0;\n  private _closeTimerID = 0;\n  private _items: Menu.IItem[] = [];\n  private _childMenu: Menu | null = null;\n  private _parentMenu: Menu | null = null;\n  private _aboutToClose = new Signal<this, void>(this);\n  private _menuRequested = new Signal<this, 'next' | 'previous'>(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n  /**\n   * An options object for creating a menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the menu.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for the `open` method on a menu.\n   */\n  export interface IOpenOptions {\n    /**\n     * Whether to force the X position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * X coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceX?: boolean;\n\n    /**\n     * Whether to force the Y position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * Y coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceY?: boolean;\n\n    /**\n     * The DOM node to use as the menu's host.\n     *\n     * If not specified then uses `document.body`.\n     */\n    host?: HTMLElement;\n\n    /**\n     * The child of `host` to use as the reference element.\n     * If this is provided, the menu will be inserted before this\n     * node in the host. The default is `null`, which will cause the\n     * menu to be added as the last child of the host.\n     */\n    ref?: HTMLElement;\n\n    /**\n     * The alignment of the menu.\n     *\n     * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n     */\n    horizontalAlignment?: 'left' | 'right';\n  }\n\n  /**\n   * A type alias for a menu item type.\n   */\n  export type ItemType = 'command' | 'submenu' | 'separator';\n\n  /**\n   * An options object for creating a menu item.\n   */\n  export interface IItemOptions {\n    /**\n     * The type of the menu item.\n     *\n     * The default value is `'command'`.\n     */\n    type?: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     *\n     * The default value is an empty string.\n     */\n    command?: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     *\n     * The default value is `null`.\n     */\n    submenu?: Menu | null;\n  }\n\n  /**\n   * An object which represents a menu item.\n   *\n   * #### Notes\n   * Item objects are created automatically by a menu.\n   */\n  export interface IItem {\n    /**\n     * The type of the menu item.\n     */\n    readonly type: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    readonly label: string;\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    readonly mnemonic: number;\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the menu item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the menu item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The display caption for the menu item.\n     */\n    readonly caption: string;\n\n    /**\n     * The extra class name for the menu item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the menu item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the menu item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the menu item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * An object which holds the data to render a menu item.\n   */\n  export interface IRenderData {\n    /**\n     * The item to be rendered.\n     */\n    readonly item: IItem;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the item should be collapsed.\n     */\n    readonly collapsed: boolean;\n\n    /**\n     * Handler for when element is in focus.\n     */\n    readonly onfocus?: () => void;\n  }\n\n  /**\n   * A renderer for use with a menu.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          tabindex: '0',\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data),\n        this.renderShortcut(data),\n        this.renderSubmenu(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-Menu-itemLabel' }, content);\n    }\n\n    /**\n     * Render the shortcut element for a menu item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the item shortcut.\n     */\n    renderShortcut(data: IRenderData): VirtualElement {\n      let content = this.formatShortcut(data);\n      return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n    }\n\n    /**\n     * Render the submenu icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the submenu icon.\n     *\n     * @returns A virtual element representing the submenu icon.\n     */\n    renderSubmenu(data: IRenderData): VirtualElement {\n      return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n    }\n\n    /**\n     * Create the class name for the menu item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      // Setup the initial class name.\n      let name = 'lm-Menu-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (!data.item.isVisible) {\n        name += ' lm-mod-hidden';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n      if (data.collapsed) {\n        name += ' lm-mod-collapsed';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the menu item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the menu item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      let result: ElementDataset;\n      let { type, command, dataset } = data.item;\n      if (type === 'command') {\n        result = { ...dataset, type, command };\n      } else {\n        result = { ...dataset, type };\n      }\n      return result;\n    }\n\n    /**\n     * Create the class name for the menu item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-Menu-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the aria attributes for menu item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      let aria: { [T in ARIAAttrNames]?: string } = {};\n      switch (data.item.type) {\n        case 'separator':\n          aria.role = 'presentation';\n          break;\n        case 'submenu':\n          aria['aria-haspopup'] = 'true';\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          break;\n        default:\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          if (data.item.isToggled) {\n            aria.role = 'menuitemcheckbox';\n            aria['aria-checked'] = 'true';\n          } else {\n            aria.role = 'menuitem';\n          }\n      }\n      return aria;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.item;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n\n    /**\n     * Create the render content for the shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatShortcut(data: IRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The ms delay for opening and closing a submenu.\n   */\n  export const TIMER_DELAY = 300;\n\n  /**\n   * The horizontal pixel overlap for an open submenu.\n   */\n  export const SUBMENU_OVERLAP = 3;\n\n  let transientWindowDataCache: IWindowData | null = null;\n  let transientCacheCounter: number = 0;\n\n  function getWindowData(): IWindowData {\n    // if transient cache is in use, take one from it\n    if (transientCacheCounter > 0) {\n      transientCacheCounter--;\n      return transientWindowDataCache!;\n    }\n    return _getWindowData();\n  }\n\n  /**\n   * Store window data in transient cache.\n   *\n   * The transient cache will be released upon `getWindowData()` call.\n   * If this function is called multiple times, the cache will be\n   * retained until as many calls to `getWindowData()` were made.\n   *\n   * Note: should be called before any DOM modifications.\n   */\n  export function saveWindowData(): void {\n    transientWindowDataCache = _getWindowData();\n    transientCacheCounter++;\n  }\n\n  /**\n   * Create the DOM node for a menu.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-Menu-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menu');\n    node.tabIndex = 0;\n    return node;\n  }\n\n  /**\n   * Test whether a menu item can be activated.\n   */\n  export function canActivate(item: Menu.IItem): boolean {\n    return item.type !== 'separator' && item.isEnabled && item.isVisible;\n  }\n\n  /**\n   * Create a new menu item for an owner menu.\n   */\n  export function createItem(\n    owner: Menu,\n    options: Menu.IItemOptions\n  ): Menu.IItem {\n    return new MenuItem(owner.commands, options);\n  }\n\n  /**\n   * Hit test a menu hierarchy starting at the given root.\n   */\n  export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n    for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n      if (ElementExt.hitTest(temp.node, x, y)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Compute which extra separator items should be collapsed.\n   */\n  export function computeCollapsed(\n    items: ReadonlyArray<Menu.IItem>\n  ): boolean[] {\n    // Allocate the return array and fill it with `false`.\n    let result = new Array<boolean>(items.length);\n    ArrayExt.fill(result, false);\n\n    // Collapse the leading separators.\n    let k1 = 0;\n    let n = items.length;\n    for (; k1 < n; ++k1) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k1] = true;\n    }\n\n    // Hide the trailing separators.\n    let k2 = n - 1;\n    for (; k2 >= 0; --k2) {\n      let item = items[k2];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k2] = true;\n    }\n\n    // Hide the remaining consecutive separators.\n    let hide = false;\n    while (++k1 < k2) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        hide = false;\n      } else if (hide) {\n        result[k1] = true;\n      } else {\n        hide = true;\n      }\n    }\n\n    // Return the resulting flags.\n    return result;\n  }\n\n  function _getWindowData(): IWindowData {\n    return {\n      pageXOffset: window.pageXOffset,\n      pageYOffset: window.pageYOffset,\n      clientWidth: document.documentElement.clientWidth,\n      clientHeight: document.documentElement.clientHeight\n    };\n  }\n\n  /**\n   * Open a menu as a root menu at the target location.\n   */\n  export function openRootMenu(\n    menu: Menu,\n    x: number,\n    y: number,\n    forceX: boolean,\n    forceY: boolean,\n    horizontalAlignment: 'left' | 'right',\n    host: HTMLElement | null,\n    ref: HTMLElement | null\n  ): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData();\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before attaching and measuring.\n    MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch - (forceY ? y : 0);\n\n    // Fetch common variables.\n    let node = menu.node;\n    let style = node.style;\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(menu, host || document.body, ref);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // align the menu to the right of the target if requested or language is RTL\n    if (horizontalAlignment === 'right') {\n      x -= width;\n    }\n\n    // Adjust the X position of the menu to fit on-screen.\n    if (!forceX && x + width > px + cw) {\n      x = px + cw - width;\n    }\n\n    // Adjust the Y position of the menu to fit on-screen.\n    if (!forceY && y + height > py + ch) {\n      if (y > py + ch) {\n        y = py + ch - height;\n      } else {\n        y = y - height;\n      }\n    }\n\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * Open a menu as a submenu using an item node for positioning.\n   */\n  export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData();\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before opening.\n    MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch;\n\n    // Fetch common variables.\n    let node = submenu.node;\n    let style = node.style;\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(submenu, document.body);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // Compute the box sizing for the menu.\n    let box = ElementExt.boxSizing(submenu.node);\n\n    // Get the bounding rect for the target item node.\n    let itemRect = itemNode.getBoundingClientRect();\n\n    // Compute the target X position.\n    let x = itemRect.right - SUBMENU_OVERLAP;\n\n    // Adjust the X position to fit on the screen.\n    if (x + width > px + cw) {\n      x = itemRect.left + SUBMENU_OVERLAP - width;\n    }\n\n    // Compute the target Y position.\n    let y = itemRect.top - box.borderTop - box.paddingTop;\n\n    // Adjust the Y position to fit on the screen.\n    if (y + height > py + ch) {\n      y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n    }\n\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    items: ReadonlyArray<Menu.IItem>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Lookup the item\n      let item = items[k];\n\n      // Ignore items which cannot be activated.\n      if (!canActivate(item)) {\n        continue;\n      }\n\n      // Ignore items with an empty label.\n      let label = item.label;\n      if (label.length === 0) {\n        continue;\n      }\n\n      // Lookup the mnemonic index for the label.\n      let mn = item.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < label.length) {\n        if (label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n\n  /**\n   * A concrete implementation of `Menu.IItem`.\n   */\n  class MenuItem implements Menu.IItem {\n    /**\n     * Construct a new menu item.\n     */\n    constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n      this._commands = commands;\n      this.type = options.type || 'command';\n      this.command = options.command || '';\n      this.args = options.args || JSONExt.emptyObject;\n      this.submenu = options.submenu || null;\n    }\n\n    /**\n     * The type of the menu item.\n     */\n    readonly type: Menu.ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    get label(): string {\n      if (this.type === 'command') {\n        return this._commands.label(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.label;\n      }\n      return '';\n    }\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    get mnemonic(): number {\n      if (this.type === 'command') {\n        return this._commands.mnemonic(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.mnemonic;\n      }\n      return -1;\n    }\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      if (this.type === 'command') {\n        return this._commands.icon(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.icon;\n      }\n      return undefined;\n    }\n\n    /**\n     * The icon class for the menu item.\n     */\n    get iconClass(): string {\n      if (this.type === 'command') {\n        return this._commands.iconClass(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconClass;\n      }\n      return '';\n    }\n\n    /**\n     * The icon label for the menu item.\n     */\n    get iconLabel(): string {\n      if (this.type === 'command') {\n        return this._commands.iconLabel(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconLabel;\n      }\n      return '';\n    }\n\n    /**\n     * The display caption for the menu item.\n     */\n    get caption(): string {\n      if (this.type === 'command') {\n        return this._commands.caption(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.caption;\n      }\n      return '';\n    }\n\n    /**\n     * The extra class name for the menu item.\n     */\n    get className(): string {\n      if (this.type === 'command') {\n        return this._commands.className(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.className;\n      }\n      return '';\n    }\n\n    /**\n     * The dataset for the menu item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      if (this.type === 'command') {\n        return this._commands.dataset(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.dataset;\n      }\n      return {};\n    }\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    get isEnabled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isEnabled(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    get isToggled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isToggled(this.command, this.args);\n      }\n      return false;\n    }\n\n    /**\n     * Whether the menu item is visible.\n     */\n    get isVisible(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isVisible(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * The key binding for the menu item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      if (this.type === 'command') {\n        let { command, args } = this;\n        return (\n          ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n            return kb.command === command && JSONExt.deepEqual(kb.args, args);\n          }) || null\n        );\n      }\n      return null;\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n  /**\n   * Construct a new context menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: ContextMenu.IOptions) {\n    const { groupByTarget, sortBySelector, ...others } = options;\n    this.menu = new Menu(others);\n    this._groupByTarget = groupByTarget !== false;\n    this._sortBySelector = sortBySelector !== false;\n  }\n\n  /**\n   * The menu widget which displays the matched context items.\n   */\n  readonly menu: Menu;\n\n  /**\n   * Add an item to the context menu.\n   *\n   * @param options - The options for creating the item.\n   *\n   * @returns A disposable which will remove the item from the menu.\n   */\n  addItem(options: ContextMenu.IItemOptions): IDisposable {\n    // Create an item from the given options.\n    let item = Private.createItem(options, this._idTick++);\n\n    // Add the item to the internal array.\n    this._items.push(item);\n\n    // Return a disposable which will remove the item.\n    return new DisposableDelegate(() => {\n      ArrayExt.removeFirstOf(this._items, item);\n    });\n  }\n\n  /**\n   * Open the context menu in response to a `'contextmenu'` event.\n   *\n   * @param event - The `'contextmenu'` event of interest.\n   *\n   * @returns `true` if the menu was opened, or `false` if no items\n   *   matched the event and the menu was not opened.\n   *\n   * #### Notes\n   * This method will populate the context menu with items which match\n   * the propagation path of the event, then open the menu at the mouse\n   * position indicated by the event.\n   */\n  open(event: MouseEvent): boolean {\n    // Prior to any DOM modifications update the window data.\n    Menu.saveWindowData();\n\n    // Clear the current contents of the context menu.\n    this.menu.clearItems();\n\n    // Bail early if there are no items to match.\n    if (this._items.length === 0) {\n      return false;\n    }\n\n    // Find the matching items for the event.\n    let items = Private.matchItems(\n      this._items,\n      event,\n      this._groupByTarget,\n      this._sortBySelector\n    );\n\n    // Bail if there are no matching items.\n    if (!items || items.length === 0) {\n      return false;\n    }\n\n    // Add the filtered items to the menu.\n    for (const item of items) {\n      this.menu.addItem(item);\n    }\n\n    // Open the context menu at the current mouse position.\n    this.menu.open(event.clientX, event.clientY);\n\n    // Indicate success.\n    return true;\n  }\n\n  private _groupByTarget: boolean = true;\n  private _idTick = 0;\n  private _items: Private.IItem[] = [];\n  private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n  /**\n   * An options object for initializing a context menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry to use with the context menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the context menu.\n     */\n    renderer?: Menu.IRenderer;\n\n    /**\n     * Whether to sort by selector and rank or only rank.\n     *\n     * Default true.\n     */\n    sortBySelector?: boolean;\n\n    /**\n     * Whether to group items following the DOM hierarchy.\n     *\n     * Default true.\n     *\n     * #### Note\n     * If true, when the mouse event occurs on element `span` within `div.top`,\n     * the items matching `div.top` will be shown before the ones matching `body`.\n     */\n    groupByTarget?: boolean;\n  }\n\n  /**\n   * An options object for creating a context menu item.\n   */\n  export interface IItemOptions extends Menu.IItemOptions {\n    /**\n     * The CSS selector for the context menu item.\n     *\n     * The context menu item will only be displayed in the context menu\n     * when the selector matches a node on the propagation path of the\n     * contextmenu event. This allows the menu item to be restricted to\n     * user-defined contexts.\n     *\n     * The selector must not contain commas.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     *\n     * The rank is used as a tie-breaker when ordering context menu\n     * items for display. Items are sorted in the following order:\n     *   1. Depth in the DOM tree (deeper is better)\n     *   2. Selector specificity (higher is better)\n     *   3. Rank (lower is better)\n     *   4. Insertion order\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A normalized item for a context menu.\n   */\n  export interface IItem extends Menu.IItemOptions {\n    /**\n     * The selector for the item.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     */\n    rank: number;\n\n    /**\n     * The tie-breaking id for the item.\n     */\n    id: number;\n  }\n\n  /**\n   * Create a normalized context menu item from an options object.\n   */\n  export function createItem(\n    options: ContextMenu.IItemOptions,\n    id: number\n  ): IItem {\n    let selector = validateSelector(options.selector);\n    let rank = options.rank !== undefined ? options.rank : Infinity;\n    return { ...options, selector, rank, id };\n  }\n\n  /**\n   * Find the items which match a context menu event.\n   *\n   * The results are sorted by DOM level, specificity, and rank.\n   */\n  export function matchItems(\n    items: IItem[],\n    event: MouseEvent,\n    groupByTarget: boolean,\n    sortBySelector: boolean\n  ): IItem[] | null {\n    // Look up the target of the event.\n    let target = event.target as Element | null;\n\n    // Bail if there is no target.\n    if (!target) {\n      return null;\n    }\n\n    // Look up the current target of the event.\n    let currentTarget = event.currentTarget as Element | null;\n\n    // Bail if there is no current target.\n    if (!currentTarget) {\n      return null;\n    }\n\n    // There are some third party libraries that cause the `target` to\n    // be detached from the DOM before lumino can process the event.\n    // If that happens, search for a new target node by point. If that\n    // node is still dangling, bail.\n    if (!currentTarget.contains(target)) {\n      target = document.elementFromPoint(event.clientX, event.clientY);\n      if (!target || !currentTarget.contains(target)) {\n        return null;\n      }\n    }\n\n    // Set up the result array.\n    let result: IItem[] = [];\n\n    // Copy the items array to allow in-place modification.\n    let availableItems: Array<IItem | null> = items.slice();\n\n    // Walk up the DOM hierarchy searching for matches.\n    while (target !== null) {\n      // Set up the match array for this DOM level.\n      let matches: IItem[] = [];\n\n      // Search the remaining items for matches.\n      for (let i = 0, n = availableItems.length; i < n; ++i) {\n        // Fetch the item.\n        let item = availableItems[i];\n\n        // Skip items which are already consumed.\n        if (!item) {\n          continue;\n        }\n\n        // Skip items which do not match the element.\n        if (!Selector.matches(target, item.selector)) {\n          continue;\n        }\n\n        // Add the matched item to the result for this DOM level.\n        matches.push(item);\n\n        // Mark the item as consumed.\n        availableItems[i] = null;\n      }\n\n      // Sort the matches for this level and add them to the results.\n      if (matches.length !== 0) {\n        if (groupByTarget) {\n          matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n        }\n        result.push(...matches);\n      }\n\n      // Stop searching at the limits of the DOM range.\n      if (target === currentTarget) {\n        break;\n      }\n\n      // Step to the parent DOM level.\n      target = target.parentElement;\n    }\n\n    if (!groupByTarget) {\n      result.sort(sortBySelector ? itemCmp : itemCmpRank);\n    }\n\n    // Return the matched and sorted results.\n    return result;\n  }\n\n  /**\n   * Validate the selector for a menu item.\n   *\n   * This returns the validated selector, or throws if the selector is\n   * invalid or contains commas.\n   */\n  function validateSelector(selector: string): string {\n    if (selector.indexOf(',') !== -1) {\n      throw new Error(`Selector cannot contain commas: ${selector}`);\n    }\n    if (!Selector.isValid(selector)) {\n      throw new Error(`Invalid selector: ${selector}`);\n    }\n    return selector;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by ranks.\n   */\n  function itemCmpRank(a: IItem, b: IItem): number {\n    // Sort based on rank.\n    let r1 = a.rank;\n    let r2 = b.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity-safe\n    }\n\n    // When all else fails, sort by item id.\n    return a.id - b.id;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by selectors and ranks.\n   */\n  function itemCmp(a: IItem, b: IItem): number {\n    // Sort first based on selector specificity.\n    let s1 = Selector.calculateSpecificity(a.selector);\n    let s2 = Selector.calculateSpecificity(b.selector);\n    if (s1 !== s2) {\n      return s2 - s1;\n    }\n\n    // If specificities are equal\n    return itemCmpRank(a, b);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ElementARIAAttrs,\n  ElementBaseAttrs,\n  ElementDataset,\n  ElementInlineStyle,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n  'ArrowLeft',\n  'ArrowUp',\n  'ArrowRight',\n  'ArrowDown',\n  'Home',\n  'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar<T> extends Widget {\n  /**\n   * Construct a new tab bar.\n   *\n   * @param options - The options for initializing the tab bar.\n   */\n  constructor(options: TabBar.IOptions<T> = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-TabBar');\n    this.contentNode.setAttribute('role', 'tablist');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this._document = options.document || document;\n    this.tabsMovable = options.tabsMovable || false;\n    this.titlesEditable = options.titlesEditable || false;\n    this.allowDeselect = options.allowDeselect || false;\n    this.addButtonEnabled = options.addButtonEnabled || false;\n    this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n    this.name = options.name || '';\n    this.orientation = options.orientation || 'horizontal';\n    this.removeBehavior = options.removeBehavior || 'select-tab-after';\n    this.renderer = options.renderer || TabBar.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    this._titles.length = 0;\n    this._previousTitle = null;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabBar.ICurrentChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when a tab is moved by the user.\n   *\n   * #### Notes\n   * This signal is emitted when a tab is moved by user interaction.\n   *\n   * This signal is not emitted when a tab is moved programmatically.\n   */\n  get tabMoved(): ISignal<this, TabBar.ITabMovedArgs<T>> {\n    return this._tabMoved;\n  }\n\n  /**\n   * A signal emitted when a tab is clicked by the user.\n   *\n   * #### Notes\n   * If the clicked tab is not the current tab, the clicked tab will be\n   * made current and the `currentChanged` signal will be emitted first.\n   *\n   * This signal is emitted even if the clicked tab is the current tab.\n   */\n  get tabActivateRequested(): ISignal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  > {\n    return this._tabActivateRequested;\n  }\n\n  /**\n   * A signal emitted when the tab bar add button is clicked.\n   */\n  get addRequested(): ISignal<this, void> {\n    return this._addRequested;\n  }\n\n  /**\n   * A signal emitted when a tab close icon is clicked.\n   *\n   * #### Notes\n   * This signal is not emitted unless the tab title is `closable`.\n   */\n  get tabCloseRequested(): ISignal<this, TabBar.ITabCloseRequestedArgs<T>> {\n    return this._tabCloseRequested;\n  }\n\n  /**\n   * A signal emitted when a tab is dragged beyond the detach threshold.\n   *\n   * #### Notes\n   * This signal is emitted when the user drags a tab with the mouse,\n   * and mouse is dragged beyond the detach threshold.\n   *\n   * The consumer of the signal should call `releaseMouse` and remove\n   * the tab in order to complete the detach.\n   *\n   * This signal is only emitted once per drag cycle.\n   */\n  get tabDetachRequested(): ISignal<this, TabBar.ITabDetachRequestedArgs<T>> {\n    return this._tabDetachRequested;\n  }\n\n  /**\n   * The renderer used by the tab bar.\n   */\n  readonly renderer: TabBar.IRenderer<T>;\n\n  /**\n   * The document to use with the tab bar.\n   *\n   * The default is the global `document` instance.\n   */\n  get document(): Document | ShadowRoot {\n    return this._document;\n  }\n\n  /**\n   * Whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  tabsMovable: boolean;\n\n  /**\n   * Whether the titles can be user-edited.\n   *\n   */\n  get titlesEditable(): boolean {\n    return this._titlesEditable;\n  }\n\n  /**\n   * Set whether titles can be user edited.\n   *\n   */\n  set titlesEditable(value: boolean) {\n    this._titlesEditable = value;\n  }\n\n  /**\n   * Whether a tab can be deselected by the user.\n   *\n   * #### Notes\n   * Tabs can be always be deselected programmatically.\n   */\n  allowDeselect: boolean;\n\n  /**\n   * The selection behavior when inserting a tab.\n   */\n  insertBehavior: TabBar.InsertBehavior;\n\n  /**\n   * The selection behavior when removing a tab.\n   */\n  removeBehavior: TabBar.RemoveBehavior;\n\n  /**\n   * Get the currently selected title.\n   *\n   * #### Notes\n   * This will be `null` if no tab is selected.\n   */\n  get currentTitle(): Title<T> | null {\n    return this._titles[this._currentIndex] || null;\n  }\n\n  /**\n   * Set the currently selected title.\n   *\n   * #### Notes\n   * If the title does not exist, the title will be set to `null`.\n   */\n  set currentTitle(value: Title<T> | null) {\n    this.currentIndex = value ? this._titles.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this._currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the value is out of range, the index will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    // Adjust for an out of range index.\n    if (value < 0 || value >= this._titles.length) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._currentIndex === value) {\n      return;\n    }\n\n    // Look up the previous index and title.\n    let pi = this._currentIndex;\n    let pt = this._titles[pi] || null;\n\n    // Look up the current index and title.\n    let ci = value;\n    let ct = this._titles[ci] || null;\n\n    // Update the current index and previous title.\n    this._currentIndex = ci;\n    this._previousTitle = pt;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: ci,\n      currentTitle: ct\n    });\n  }\n\n  /**\n   * Get the name of the tab bar.\n   */\n  get name(): string {\n    return this._name;\n  }\n\n  /**\n   * Set the name of the tab bar.\n   */\n  set name(value: string) {\n    this._name = value;\n    if (value) {\n      this.contentNode.setAttribute('aria-label', value);\n    } else {\n      this.contentNode.removeAttribute('aria-label');\n    }\n  }\n\n  /**\n   * Get the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  get orientation(): TabBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  set orientation(value: TabBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Toggle the orientation values.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n    this.contentNode.setAttribute('aria-orientation', value);\n  }\n\n  /**\n   * Whether the add button is enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add button is enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    // Do nothing if the value does not change.\n    if (this._addButtonEnabled === value) {\n      return;\n    }\n\n    this._addButtonEnabled = value;\n    if (value) {\n      this.addButtonNode.classList.remove('lm-mod-hidden');\n    } else {\n      this.addButtonNode.classList.add('lm-mod-hidden');\n    }\n  }\n\n  /**\n   * A read-only array of the titles in the tab bar.\n   */\n  get titles(): ReadonlyArray<Title<T>> {\n    return this._titles;\n  }\n\n  /**\n   * The tab bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the tab nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * The tab bar add button node.\n   *\n   * #### Notes\n   * This is the node which holds the add button.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get addButtonNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-addButton'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Add a tab to the end of the tab bar.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  addTab(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return this.insertTab(this._titles.length, value);\n  }\n\n  /**\n   * Insert a tab into the tab bar at the specified index.\n   *\n   * @param index - The index at which to insert the tab.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the tabs.\n   *\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  insertTab(index: number, value: Title<T> | Title.IOptions<T>): Title<T> {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Coerce the value to a title.\n    let title = Private.asTitle(value);\n\n    // Look up the index of the title.\n    let i = this._titles.indexOf(title);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._titles.length));\n\n    // If the title is not in the array, insert it.\n    if (i === -1) {\n      // Insert the title into the array.\n      ArrayExt.insert(this._titles, j, title);\n\n      // Connect to the title changed signal.\n      title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the tabs.\n      this.update();\n\n      // Adjust the current index for the insert.\n      this._adjustCurrentForInsert(j, title);\n\n      // Return the title added to the tab bar.\n      return title;\n    }\n\n    // Otherwise, the title exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._titles.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return title;\n    }\n\n    // Move the title to the new location.\n    ArrayExt.move(this._titles, i, j);\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the move.\n    this._adjustCurrentForMove(i, j);\n\n    // Return the title added to the tab bar.\n    return title;\n  }\n\n  /**\n   * Remove a tab from the tab bar.\n   *\n   * @param title - The title for the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the title is not in the tab bar.\n   */\n  removeTab(title: Title<T>): void {\n    this.removeTabAt(this._titles.indexOf(title));\n  }\n\n  /**\n   * Remove the tab at a given index from the tab bar.\n   *\n   * @param index - The index of the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeTabAt(index: number): void {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Remove the title from the array.\n    let title = ArrayExt.removeAt(this._titles, index);\n\n    // Bail if the index is out of range.\n    if (!title) {\n      return;\n    }\n\n    // Disconnect from the title changed signal.\n    title.changed.disconnect(this._onTitleChanged, this);\n\n    // Clear the previous title if it's being removed.\n    if (title === this._previousTitle) {\n      this._previousTitle = null;\n    }\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the remove.\n    this._adjustCurrentForRemove(index, title);\n  }\n\n  /**\n   * Remove all tabs from the tab bar.\n   */\n  clearTabs(): void {\n    // Bail if there is nothing to remove.\n    if (this._titles.length === 0) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Disconnect from the title changed signals.\n    for (let title of this._titles) {\n      title.changed.disconnect(this._onTitleChanged, this);\n    }\n\n    // Get the current index and title.\n    let pi = this.currentIndex;\n    let pt = this.currentTitle;\n\n    // Reset the current index and previous title.\n    this._currentIndex = -1;\n    this._previousTitle = null;\n\n    // Clear the title array.\n    this._titles.length = 0;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // If no tab was selected, there's nothing else to do.\n    if (pi === -1) {\n      return;\n    }\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   *\n   * #### Notes\n   * This will cause the tab bar to stop handling mouse events and to\n   * restore the tabs to their non-dragged positions.\n   */\n  releaseMouse(): void {\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the DOM events for the tab bar.\n   *\n   * @param event - The DOM event sent to the tab bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tab bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'dblclick':\n        this._evtDblClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        event.eventPhase === Event.CAPTURING_PHASE\n          ? this._evtKeyDownCapturing(event as KeyboardEvent)\n          : this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n    this.node.addEventListener('dblclick', this);\n    this.node.addEventListener('keydown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this.node.removeEventListener('dblclick', this);\n    this.node.removeEventListener('keydown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let titles = this._titles;\n    let renderer = this.renderer;\n    let currentTitle = this.currentTitle;\n    let content = new Array<VirtualElement>(titles.length);\n    // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n    // If the add button handles it, no need to do anything. If no element of the tab\n    // bar handles it, set it on the current or the first tab to ensure one element\n    // handles it after update.\n    const tabHandlingTabindex =\n      this._getCurrentTabindex() ??\n      (this._currentIndex > -1 ? this._currentIndex : 0);\n\n    for (let i = 0, n = titles.length; i < n; ++i) {\n      let title = titles[i];\n      let current = title === currentTitle;\n      let zIndex = current ? n : n - i - 1;\n      let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n      content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * Get the index of the tab which handles tabindex=\"0\".\n   * If the add button handles tabindex=\"0\", -1 is returned.\n   * If none of the previous handles tabindex=\"0\", null is returned.\n   */\n  private _getCurrentTabindex(): number | null {\n    let index = null;\n    const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n    if (elemTabindex) {\n      index = [...this.contentNode.children].indexOf(elemTabindex);\n    } else if (\n      this._addButtonEnabled &&\n      this.addButtonNode.getAttribute('tabindex') === '0'\n    ) {\n      index = -1;\n    }\n    return index;\n  }\n\n  /**\n   * Handle the `'dblclick'` event for the tab bar.\n   */\n  private _evtDblClick(event: MouseEvent): void {\n    // Do nothing if titles are not editable\n    if (!this.titlesEditable) {\n      return;\n    }\n\n    let tabs = this.contentNode.children;\n\n    // Find the index of the targeted tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab.\n    if (index === -1) {\n      return;\n    }\n\n    let title = this.titles[index];\n    let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n    if (label && label.contains(event.target as HTMLElement)) {\n      let value = title.label || '';\n\n      // Clear the label element\n      let oldValue = label.innerHTML;\n      label.innerHTML = '';\n\n      let input = document.createElement('input');\n      input.classList.add('lm-TabBar-tabInput');\n      input.value = value;\n      label.appendChild(input);\n\n      let onblur = () => {\n        input.removeEventListener('blur', onblur);\n        label.innerHTML = oldValue;\n        this.node.addEventListener('keydown', this);\n      };\n\n      input.addEventListener('dblclick', (event: Event) =>\n        event.stopPropagation()\n      );\n      input.addEventListener('blur', onblur);\n      input.addEventListener('keydown', (event: KeyboardEvent) => {\n        if (event.key === 'Enter') {\n          if (input.value !== '') {\n            title.label = title.caption = input.value;\n          }\n          onblur();\n        } else if (event.key === 'Escape') {\n          onblur();\n        }\n      });\n      this.node.removeEventListener('keydown', this);\n      input.select();\n      input.focus();\n\n      if (label.children.length > 0) {\n        (label.children[0] as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at capturing phase.\n   */\n  private _evtKeyDownCapturing(event: KeyboardEvent): void {\n    if (event.eventPhase !== Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.key === 'Escape') {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at target phase.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Allow for navigation using tab key\n    if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Check if Enter or Spacebar key has been pressed and open that tab\n    if (\n      event.key === 'Enter' ||\n      event.key === 'Spacebar' ||\n      event.key === ' '\n    ) {\n      // Get focus element that is in focus by the tab key\n      const focusedElement = document.activeElement;\n\n      // Test first if the focus is on the add button node\n      if (\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(focusedElement)\n      ) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._addRequested.emit();\n      } else {\n        const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n          tab.contains(focusedElement)\n        );\n        if (index >= 0) {\n          event.preventDefault();\n          event.stopPropagation();\n          this.currentIndex = index;\n        }\n      }\n      // Handle the arrow keys to switch tabs.\n    } else if (ARROW_KEYS.includes(event.key)) {\n      // Create a list of all focusable elements in the tab bar.\n      const focusable: Element[] = [...this.contentNode.children];\n      if (this.addButtonEnabled) {\n        focusable.push(this.addButtonNode);\n      }\n      // If the tab bar contains only one element, nothing to do.\n      if (focusable.length <= 1) {\n        return;\n      }\n      event.preventDefault();\n      event.stopPropagation();\n\n      // Get the current focused element.\n      let focusedIndex = focusable.indexOf(document.activeElement as Element);\n      if (focusedIndex === -1) {\n        focusedIndex = this._currentIndex;\n      }\n\n      // Find the next element to focus on.\n      let nextFocused: Element | null | undefined;\n      if (\n        (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowDown' && this._orientation === 'vertical')\n      ) {\n        nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n      } else if (\n        (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowUp' && this._orientation === 'vertical')\n      ) {\n        nextFocused =\n          focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n      } else if (event.key === 'Home') {\n        nextFocused = focusable[0];\n      } else if (event.key === 'End') {\n        nextFocused = focusable[focusable.length - 1];\n      }\n\n      // Change the focused element and the tabindex value.\n      if (nextFocused) {\n        focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n        nextFocused?.setAttribute('tabindex', '0');\n        (nextFocused as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the tab bar.\n   */\n  private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse press.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if a drag is in progress.\n    if (this._dragData) {\n      return;\n    }\n\n    // Do nothing if a title editable input was clicked.\n    if (\n      (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n    ) {\n      return;\n    }\n\n    // Check if the add button was clicked.\n    let addButtonClicked =\n      this.addButtonEnabled &&\n      this.addButtonNode.contains(event.target as HTMLElement);\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Find the index of the pressed tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab or the add button.\n    if (index === -1 && !addButtonClicked) {\n      return;\n    }\n\n    // Pressing on a tab stops the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Initialize the non-measured parts of the drag data.\n    this._dragData = {\n      tab: tabs[index] as HTMLElement,\n      index: index,\n      pressX: event.clientX,\n      pressY: event.clientY,\n      tabPos: -1,\n      tabSize: -1,\n      tabPressPos: -1,\n      targetIndex: -1,\n      tabLayout: null,\n      contentRect: null,\n      override: null,\n      dragActive: false,\n      dragAborted: false,\n      detachRequested: false\n    };\n\n    // Add the document pointer up listener.\n    this.document.addEventListener('pointerup', this, true);\n\n    // Do nothing else if the middle button or add button is clicked.\n    if (event.button === 1 || addButtonClicked) {\n      return;\n    }\n\n    // Do nothing else if the close icon is clicked.\n    let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n    if (icon && icon.contains(event.target as HTMLElement)) {\n      return;\n    }\n\n    // Add the extra listeners if the tabs are movable.\n    if (this.tabsMovable) {\n      this.document.addEventListener('pointermove', this, true);\n      this.document.addEventListener('keydown', this, true);\n      this.document.addEventListener('contextmenu', this, true);\n    }\n\n    // Update the current index as appropriate.\n    if (this.allowDeselect && this.currentIndex === index) {\n      this.currentIndex = -1;\n    } else {\n      this.currentIndex = index;\n    }\n\n    // Do nothing else if there is no current tab.\n    if (this.currentIndex === -1) {\n      return;\n    }\n\n    // Emit the tab activate request signal.\n    this._tabActivateRequested.emit({\n      index: this.currentIndex,\n      title: this.currentTitle!\n    });\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the tab bar.\n   */\n  private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Suppress the event during a drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Bail early if the drag threshold has not been met.\n    if (!data.dragActive && !Private.dragExceeded(data, event)) {\n      return;\n    }\n\n    // Activate the drag if necessary.\n    if (!data.dragActive) {\n      // Fill in the rest of the drag data measurements.\n      let tabRect = data.tab.getBoundingClientRect();\n      if (this._orientation === 'horizontal') {\n        data.tabPos = data.tab.offsetLeft;\n        data.tabSize = tabRect.width;\n        data.tabPressPos = data.pressX - tabRect.left;\n      } else {\n        data.tabPos = data.tab.offsetTop;\n        data.tabSize = tabRect.height;\n        data.tabPressPos = data.pressY - tabRect.top;\n      }\n      data.tabPressOffset = {\n        x: data.pressX - tabRect.left,\n        y: data.pressY - tabRect.top\n      };\n      data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n      data.contentRect = this.contentNode.getBoundingClientRect();\n      data.override = Drag.overrideCursor('default');\n\n      // Add the dragging style classes.\n      data.tab.classList.add('lm-mod-dragging');\n      this.addClass('lm-mod-dragging');\n\n      // Mark the drag as active.\n      data.dragActive = true;\n    }\n\n    // Emit the detach requested signal if the threshold is exceeded.\n    if (!data.detachRequested && Private.detachExceeded(data, event)) {\n      // Only emit the signal once per drag cycle.\n      data.detachRequested = true;\n\n      // Setup the arguments for the signal.\n      let index = data.index;\n      let clientX = event.clientX;\n      let clientY = event.clientY;\n      let tab = tabs[index] as HTMLElement;\n      let title = this._titles[index];\n\n      // Emit the tab detach requested signal.\n      this._tabDetachRequested.emit({\n        index,\n        title,\n        tab,\n        clientX,\n        clientY,\n        offset: data.tabPressOffset\n      });\n\n      // Bail if the signal handler aborted the drag.\n      if (data.dragAborted) {\n        return;\n      }\n    }\n\n    // Update the positions of the tabs.\n    Private.layoutTabs(tabs, data, event, this._orientation);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the document.\n   */\n  private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse release.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if no drag is in progress.\n    const data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Remove the extra mouse event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Handle a release when the drag is not active.\n    if (!data.dragActive) {\n      // Clear the drag data.\n      this._dragData = null;\n\n      // Handle clicking the add button.\n      let addButtonClicked =\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(event.target as HTMLElement);\n      if (addButtonClicked) {\n        this._addRequested.emit(undefined);\n        return;\n      }\n\n      // Lookup the tab nodes.\n      let tabs = this.contentNode.children;\n\n      // Find the index of the released tab.\n      let index = ArrayExt.findFirstIndex(tabs, tab => {\n        return ElementExt.hitTest(tab, event.clientX, event.clientY);\n      });\n\n      // Do nothing if the release is not on the original pressed tab.\n      if (index !== data.index) {\n        return;\n      }\n\n      // Ignore the release if the title is not closable.\n      let title = this._titles[index];\n      if (!title.closable) {\n        return;\n      }\n\n      // Emit the close requested signal if the middle button is released.\n      if (event.button === 1) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Emit the close requested signal if the close icon was released.\n      let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n      if (icon && icon.contains(event.target as HTMLElement)) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Otherwise, there is nothing left to do.\n      return;\n    }\n\n    // Do nothing if the left button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Position the tab at its final resting position.\n    Private.finalizeTabPosition(data, this._orientation);\n\n    // Remove the dragging class from the tab so it can be transitioned.\n    data.tab.classList.remove('lm-mod-dragging');\n\n    // Parse the transition duration for releasing the tab.\n    let duration = Private.parseTransitionDuration(data.tab);\n\n    // Complete the release on a timer to allow the tab to transition.\n    setTimeout(() => {\n      // Do nothing if the drag has been aborted.\n      if (data.dragAborted) {\n        return;\n      }\n\n      // Clear the drag data reference.\n      this._dragData = null;\n\n      // Reset the positions of the tabs.\n      Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n      // Clear the cursor grab.\n      data.override!.dispose();\n\n      // Remove the remaining dragging style.\n      this.removeClass('lm-mod-dragging');\n\n      // If the tab was not moved, there is nothing else to do.\n      let i = data.index;\n      let j = data.targetIndex;\n      if (j === -1 || i === j) {\n        return;\n      }\n\n      // Move the title to the new locations.\n      ArrayExt.move(this._titles, i, j);\n\n      // Adjust the current index for the move.\n      this._adjustCurrentForMove(i, j);\n\n      // Emit the tab moved signal.\n      this._tabMoved.emit({\n        fromIndex: i,\n        toIndex: j,\n        title: this._titles[j]\n      });\n\n      // Update the tabs immediately to prevent flicker.\n      MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    }, duration);\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   */\n  private _releaseMouse(): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Clear the drag data reference.\n    this._dragData = null;\n\n    // Remove the extra document event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Indicate the drag has been aborted. This allows the mouse\n    // event handlers to return early when the drag is canceled.\n    data.dragAborted = true;\n\n    // If the drag is not active, there's nothing more to do.\n    if (!data.dragActive) {\n      return;\n    }\n\n    // Reset the tabs to their non-dragged positions.\n    Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n    // Clear the cursor override.\n    data.override!.dispose();\n\n    // Clear the dragging style classes.\n    data.tab.classList.remove('lm-mod-dragging');\n    this.removeClass('lm-mod-dragging');\n  }\n\n  /**\n   * Adjust the current index for a tab insert operation.\n   *\n   * This method accounts for the tab bar's insertion behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForInsert(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ct = this.currentTitle;\n    let ci = this._currentIndex;\n    let bh = this.insertBehavior;\n\n    // TODO: do we need to do an update to update the aria-selected attribute?\n\n    // Handle the behavior where the new tab is always selected,\n    // or the behavior where the new tab is selected if needed.\n    if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n      this._currentIndex = i;\n      this._previousTitle = ct;\n      this._currentChanged.emit({\n        previousIndex: ci,\n        previousTitle: ct,\n        currentIndex: i,\n        currentTitle: title\n      });\n      return;\n    }\n\n    // Otherwise, silently adjust the current index if needed.\n    if (ci >= i) {\n      this._currentIndex++;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab move operation.\n   *\n   * This method will not cause the actual current tab to change.\n   * It silently adjusts the index to account for the given move.\n   */\n  private _adjustCurrentForMove(i: number, j: number): void {\n    if (this._currentIndex === i) {\n      this._currentIndex = j;\n    } else if (this._currentIndex < i && this._currentIndex >= j) {\n      this._currentIndex++;\n    } else if (this._currentIndex > i && this._currentIndex <= j) {\n      this._currentIndex--;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab remove operation.\n   *\n   * This method accounts for the tab bar's remove behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForRemove(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ci = this._currentIndex;\n    let bh = this.removeBehavior;\n\n    // Silently adjust the index if the current tab is not removed.\n    if (ci !== i) {\n      if (ci > i) {\n        this._currentIndex--;\n      }\n      return;\n    }\n\n    // TODO: do we need to do an update to adjust the aria-selected value?\n\n    // No tab gets selected if the tab bar is empty.\n    if (this._titles.length === 0) {\n      this._currentIndex = -1;\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: -1,\n        currentTitle: null\n      });\n      return;\n    }\n\n    // Handle behavior where the next sibling tab is selected.\n    if (bh === 'select-tab-after') {\n      this._currentIndex = Math.min(i, this._titles.length - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous sibling tab is selected.\n    if (bh === 'select-tab-before') {\n      this._currentIndex = Math.max(0, i - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous history tab is selected.\n    if (bh === 'select-previous-tab') {\n      if (this._previousTitle) {\n        this._currentIndex = this._titles.indexOf(this._previousTitle);\n        this._previousTitle = null;\n      } else {\n        this._currentIndex = Math.min(i, this._titles.length - 1);\n      }\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Otherwise, no tab gets selected.\n    this._currentIndex = -1;\n    this._currentChanged.emit({\n      previousIndex: i,\n      previousTitle: title,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<T>): void {\n    this.update();\n  }\n\n  private _name: string;\n  private _currentIndex = -1;\n  private _titles: Title<T>[] = [];\n  private _orientation: TabBar.Orientation;\n  private _document: Document | ShadowRoot;\n  private _titlesEditable: boolean = false;\n  private _previousTitle: Title<T> | null = null;\n  private _dragData: Private.IDragData | null = null;\n  private _addButtonEnabled: boolean = false;\n  private _tabMoved = new Signal<this, TabBar.ITabMovedArgs<T>>(this);\n  private _currentChanged = new Signal<this, TabBar.ICurrentChangedArgs<T>>(\n    this\n  );\n  private _addRequested = new Signal<this, void>(this);\n  private _tabCloseRequested = new Signal<\n    this,\n    TabBar.ITabCloseRequestedArgs<T>\n  >(this);\n  private _tabDetachRequested = new Signal<\n    this,\n    TabBar.ITabDetachRequestedArgs<T>\n  >(this);\n  private _tabActivateRequested = new Signal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n  /**\n   * A type alias for a tab bar orientation.\n   */\n  export type Orientation =\n    | /**\n     * The tabs are arranged in a single row, left-to-right.\n     *\n     * The tab text orientation is horizontal.\n     */\n    'horizontal'\n\n    /**\n     * The tabs are arranged in a single column, top-to-bottom.\n     *\n     * The tab text orientation is horizontal.\n     */\n    | 'vertical';\n\n  /**\n   * A type alias for the selection behavior on tab insert.\n   */\n  export type InsertBehavior =\n    | /**\n     * The selected tab will not be changed.\n     */\n    'none'\n\n    /**\n     * The inserted tab will be selected.\n     */\n    | 'select-tab'\n\n    /**\n     * The inserted tab will be selected if the current tab is null.\n     */\n    | 'select-tab-if-needed';\n\n  /**\n   * A type alias for the selection behavior on tab remove.\n   */\n  export type RemoveBehavior =\n    | /**\n     * No tab will be selected.\n     */\n    'none'\n\n    /**\n     * The tab after the removed tab will be selected if possible.\n     */\n    | 'select-tab-after'\n\n    /**\n     * The tab before the removed tab will be selected if possible.\n     */\n    | 'select-tab-before'\n\n    /**\n     * The previously selected tab will be selected if possible.\n     */\n    | 'select-previous-tab';\n\n  /**\n   * An options object for creating a tab bar.\n   */\n  export interface IOptions<T> {\n    /**\n     * The document to use with the tab bar.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n\n    /**\n     * Name of the tab bar.\n     *\n     * This is used for accessibility reasons. The default is the empty string.\n     */\n    name?: string;\n\n    /**\n     * The layout orientation of the tab bar.\n     *\n     * The default is `horizontal`.\n     */\n    orientation?: TabBar.Orientation;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether a tab can be deselected by the user.\n     *\n     * The default is `false`.\n     */\n    allowDeselect?: boolean;\n\n    /**\n     * Whether the titles can be directly edited by the user.\n     *\n     * The default is `false`.\n     */\n    titlesEditable?: boolean;\n\n    /**\n     * Whether the add button is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The selection behavior when inserting a tab.\n     *\n     * The default is `'select-tab-if-needed'`.\n     */\n    insertBehavior?: TabBar.InsertBehavior;\n\n    /**\n     * The selection behavior when removing a tab.\n     *\n     * The default is `'select-tab-after'`.\n     */\n    removeBehavior?: TabBar.RemoveBehavior;\n\n    /**\n     * A renderer to use with the tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer<T>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs<T> {\n    /**\n     * The previously selected index.\n     */\n    readonly previousIndex: number;\n\n    /**\n     * The previously selected title.\n     */\n    readonly previousTitle: Title<T> | null;\n\n    /**\n     * The currently selected index.\n     */\n    readonly currentIndex: number;\n\n    /**\n     * The currently selected title.\n     */\n    readonly currentTitle: Title<T> | null;\n  }\n\n  /**\n   * The arguments object for the `tabMoved` signal.\n   */\n  export interface ITabMovedArgs<T> {\n    /**\n     * The previous index of the tab.\n     */\n    readonly fromIndex: number;\n\n    /**\n     * The current index of the tab.\n     */\n    readonly toIndex: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabActivateRequested` signal.\n   */\n  export interface ITabActivateRequestedArgs<T> {\n    /**\n     * The index of the tab to activate.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabCloseRequested` signal.\n   */\n  export interface ITabCloseRequestedArgs<T> {\n    /**\n     * The index of the tab to close.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabDetachRequested` signal.\n   */\n  export interface ITabDetachRequestedArgs<T> {\n    /**\n     * The index of the tab to detach.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * The node representing the tab.\n     */\n    readonly tab: HTMLElement;\n\n    /**\n     * The current client X position of the mouse.\n     */\n    readonly clientX: number;\n\n    /**\n     * The current client Y position of the mouse.\n     */\n    readonly clientY: number;\n\n    /**\n     * The mouse position in the tab coordinate.\n     */\n    readonly offset?: { x: number; y: number };\n  }\n\n  /**\n   * An object which holds the data to render a tab.\n   */\n  export interface IRenderData<T> {\n    /**\n     * The title associated with the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * Whether the tab is the current tab.\n     */\n    readonly current: boolean;\n\n    /**\n     * The z-index for the tab.\n     */\n    readonly zIndex: number;\n\n    /**\n     * The tabindex value for the tab.\n     */\n    readonly tabIndex?: number;\n  }\n\n  /**\n   * A renderer for use with a tab bar.\n   */\n  export interface IRenderer<T> {\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector: string;\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<T>): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer<any> {\n    constructor() {\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<any>): VirtualElement {\n      let title = data.title.caption;\n      let key = this.createTabKey(data);\n      let id = key;\n      let style = this.createTabStyle(data);\n      let className = this.createTabClass(data);\n      let dataset = this.createTabDataset(data);\n      let aria = this.createTabARIA(data);\n      if (data.title.closable) {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data),\n          this.renderCloseIcon(data)\n        );\n      } else {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data)\n        );\n      }\n    }\n\n    /**\n     * Render the icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab icon.\n     */\n    renderIcon(data: IRenderData<any>): VirtualElement {\n      const { title } = data;\n      let className = this.createIconClass(data);\n\n      // If title.icon is undefined, it will be ignored.\n      return h.div({ className }, title.icon!, title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab label.\n     */\n    renderLabel(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n    }\n\n    /**\n     * Render the close icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab close icon.\n     */\n    renderCloseIcon(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n    }\n\n    /**\n     * Create a unique render key for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The unique render key for the tab.\n     *\n     * #### Notes\n     * This method caches the key against the tab title the first time\n     * the key is generated. This enables efficient rendering of moved\n     * tabs and avoids subtle hover style artifacts.\n     */\n    createTabKey(data: IRenderData<any>): string {\n      let key = this._tabKeys.get(data.title);\n      if (key === undefined) {\n        key = `tab-key-${this._uuid}-${this._tabID++}`;\n        this._tabKeys.set(data.title, key);\n      }\n      return key;\n    }\n\n    /**\n     * Create the inline style object for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The inline style data for the tab.\n     */\n    createTabStyle(data: IRenderData<any>): ElementInlineStyle {\n      return { zIndex: `${data.zIndex}` };\n    }\n\n    /**\n     * Create the class name for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab.\n     */\n    createTabClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tab';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.title.closable) {\n        name += ' lm-mod-closable';\n      }\n      if (data.current) {\n        name += ' lm-mod-current';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The dataset for the tab.\n     */\n    createTabDataset(data: IRenderData<any>): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the ARIA attributes for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The ARIA attributes for the tab.\n     */\n    createTabARIA(data: IRenderData<any>): ElementARIAAttrs | ElementBaseAttrs {\n      return {\n        role: 'tab',\n        'aria-selected': data.current.toString(),\n        tabindex: `${data.tabIndex ?? '-1'}`\n      };\n    }\n\n    /**\n     * Create the class name for the tab icon.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab icon.\n     */\n    createIconClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tabIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _tabID = 0;\n    private _tabKeys = new WeakMap<Title<any>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * A selector which matches the add button node in the tab bar.\n   */\n  export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The start drag distance threshold.\n   */\n  export const DRAG_THRESHOLD = 5;\n\n  /**\n   * The detach distance threshold.\n   */\n  export const DETACH_THRESHOLD = 20;\n\n  /**\n   * A struct which holds the drag data for a tab bar.\n   */\n  export interface IDragData {\n    /**\n     * The tab node being dragged.\n     */\n    tab: HTMLElement;\n\n    /**\n     * The index of the tab being dragged.\n     */\n    index: number;\n\n    /**\n     * The mouse press client X position.\n     */\n    pressX: number;\n\n    /**\n     * The mouse press client Y position.\n     */\n    pressY: number;\n\n    /**\n     * The offset left/top of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPos: number;\n\n    /**\n     * The offset width/height of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabSize: number;\n\n    /**\n     * The original mouse X/Y position in tab coordinates.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPressPos: number;\n\n    /**\n     * The original mouse position in tab coordinates.\n     *\n     * This is undefined if the drag is not active.\n     */\n    tabPressOffset?: { x: number; y: number };\n\n    /**\n     * The tab target index upon mouse release.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    targetIndex: number;\n\n    /**\n     * The array of tab layout objects snapped at drag start.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    tabLayout: ITabLayout[] | null;\n\n    /**\n     * The bounding client rect of the tab bar content node.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    contentRect: DOMRect | null;\n\n    /**\n     * The disposable to clean up the cursor override.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    override: IDisposable | null;\n\n    /**\n     * Whether the drag is currently active.\n     */\n    dragActive: boolean;\n\n    /**\n     * Whether the drag has been aborted.\n     */\n    dragAborted: boolean;\n\n    /**\n     * Whether a detach request as been made.\n     */\n    detachRequested: boolean;\n  }\n\n  /**\n   * An object which holds layout data for a tab.\n   */\n  export interface ITabLayout {\n    /**\n     * The left/top margin value for the tab.\n     */\n    margin: number;\n\n    /**\n     * The offset left/top position of the tab.\n     */\n    pos: number;\n\n    /**\n     * The offset width/height of the tab.\n     */\n    size: number;\n  }\n\n  /**\n   * Create the DOM node for a tab bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.setAttribute('role', 'tablist');\n    content.className = 'lm-TabBar-content';\n    node.appendChild(content);\n\n    let add = document.createElement('div');\n    add.className = 'lm-TabBar-addButton lm-mod-hidden';\n    add.setAttribute('tabindex', '-1');\n    add.setAttribute('role', 'button');\n    node.appendChild(add);\n    return node;\n  }\n\n  /**\n   * Coerce a title or options into a real title.\n   */\n  export function asTitle<T>(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return value instanceof Title ? value : new Title<T>(value);\n  }\n\n  /**\n   * Parse the transition duration for a tab node.\n   */\n  export function parseTransitionDuration(tab: HTMLElement): number {\n    let style = window.getComputedStyle(tab);\n    return 1000 * (parseFloat(style.transitionDuration!) || 0);\n  }\n\n  /**\n   * Get a snapshot of the current tab layout values.\n   */\n  export function snapTabLayout(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): ITabLayout[] {\n    let layout = new Array<ITabLayout>(tabs.length);\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let node = tabs[i] as HTMLElement;\n      let style = window.getComputedStyle(node);\n      if (orientation === 'horizontal') {\n        layout[i] = {\n          pos: node.offsetLeft,\n          size: node.offsetWidth,\n          margin: parseFloat(style.marginLeft!) || 0\n        };\n      } else {\n        layout[i] = {\n          pos: node.offsetTop,\n          size: node.offsetHeight,\n          margin: parseFloat(style.marginTop!) || 0\n        };\n      }\n    }\n    return layout;\n  }\n\n  /**\n   * Test if the event exceeds the drag threshold.\n   */\n  export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n    let dx = Math.abs(event.clientX - data.pressX);\n    let dy = Math.abs(event.clientY - data.pressY);\n    return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n  }\n\n  /**\n   * Test if the event exceeds the drag detach threshold.\n   */\n  export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n    let rect = data.contentRect!;\n    return (\n      event.clientX < rect.left - DETACH_THRESHOLD ||\n      event.clientX >= rect.right + DETACH_THRESHOLD ||\n      event.clientY < rect.top - DETACH_THRESHOLD ||\n      event.clientY >= rect.bottom + DETACH_THRESHOLD\n    );\n  }\n\n  /**\n   * Update the relative tab positions and computed target index.\n   */\n  export function layoutTabs(\n    tabs: HTMLCollection,\n    data: IDragData,\n    event: MouseEvent,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive values.\n    let pressPos: number;\n    let localPos: number;\n    let clientPos: number;\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      pressPos = data.pressX;\n      localPos = event.clientX - data.contentRect!.left;\n      clientPos = event.clientX;\n      clientSize = data.contentRect!.width;\n    } else {\n      pressPos = data.pressY;\n      localPos = event.clientY - data.contentRect!.top;\n      clientPos = event.clientY;\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the target data.\n    let targetIndex = data.index;\n    let targetPos = localPos - data.tabPressPos;\n    let targetEnd = targetPos + data.tabSize;\n\n    // Update the relative tab positions.\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let pxPos: string;\n      let layout = data.tabLayout![i];\n      let threshold = layout.pos + (layout.size >> 1);\n      if (i < data.index && targetPos < threshold) {\n        pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n        targetIndex = Math.min(targetIndex, i);\n      } else if (i > data.index && targetEnd > threshold) {\n        pxPos = `${-data.tabSize - layout.margin}px`;\n        targetIndex = Math.max(targetIndex, i);\n      } else if (i === data.index) {\n        let ideal = clientPos - pressPos;\n        let limit = clientSize - (data.tabPos + data.tabSize);\n        pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n      } else {\n        pxPos = '';\n      }\n      if (orientation === 'horizontal') {\n        (tabs[i] as HTMLElement).style.left = pxPos;\n      } else {\n        (tabs[i] as HTMLElement).style.top = pxPos;\n      }\n    }\n\n    // Update the computed target index.\n    data.targetIndex = targetIndex;\n  }\n\n  /**\n   * Position the drag tab at its final resting relative position.\n   */\n  export function finalizeTabPosition(\n    data: IDragData,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive client size.\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      clientSize = data.contentRect!.width;\n    } else {\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the ideal final tab position.\n    let ideal: number;\n    if (data.targetIndex === data.index) {\n      ideal = 0;\n    } else if (data.targetIndex > data.index) {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n    } else {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos - data.tabPos;\n    }\n\n    // Compute the tab position limit.\n    let limit = clientSize - (data.tabPos + data.tabSize);\n    let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n    // Set the final orientation-sensitive position.\n    if (orientation === 'horizontal') {\n      data.tab.style.left = `${final}px`;\n    } else {\n      data.tab.style.top = `${final}px`;\n    }\n  }\n\n  /**\n   * Reset the relative positions of the given tabs.\n   */\n  export function resetTabPositions(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): void {\n    for (const tab of tabs) {\n      if (orientation === 'horizontal') {\n        (tab as HTMLElement).style.left = '';\n      } else {\n        (tab as HTMLElement).style.top = '';\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n  /**\n   * Construct a new dock layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: DockLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n    this._document = options.document || document;\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   */\n  dispose(): void {\n    // Get an iterator over the widgets in the layout.\n    let widgets = this[Symbol.iterator]();\n\n    // Dispose of the layout items.\n    this._items.forEach(item => {\n      item.dispose();\n    });\n\n    // Clear the layout state before disposing the widgets.\n    this._box = null;\n    this._root = null;\n    this._items.clear();\n\n    // Dispose of the widgets contained in the old layout root.\n    for (const widget of widgets) {\n      widget.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the dock layout.\n   */\n  readonly renderer: DockLayout.IRenderer;\n\n  /**\n   * The method for hiding child widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    for (const bar of this.tabBars()) {\n      if (bar.titles.length > 1) {\n        for (const title of bar.titles) {\n          title.owner.hiddenMode = this._hiddenMode;\n        }\n      }\n    }\n  }\n\n  /**\n   * Get the inter-element spacing for the dock layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the dock layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Whether the dock layout is empty.\n   */\n  get isEmpty(): boolean {\n    return this._root === null;\n  }\n\n  /**\n   * Create an iterator over all widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This iterator includes the generated tab bars.\n   */\n  [Symbol.iterator](): IterableIterator<Widget> {\n    return this._root ? this._root.iterAllWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the user widgets in the layout.\n   *\n   * @returns A new iterator over the user widgets in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  widgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterUserWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the layout.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the layout.\n   */\n  selectedWidgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterSelectedWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the layout.\n   *\n   * @returns A new iterator over the tab bars in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  tabBars(): IterableIterator<TabBar<Widget>> {\n    return this._root ? this._root.iterTabBars() : empty();\n  }\n\n  /**\n   * Create an iterator over the handles in the layout.\n   *\n   * @returns A new iterator over the handles in the layout.\n   */\n  handles(): IterableIterator<HTMLDivElement> {\n    return this._root ? this._root.iterHandles() : empty();\n  }\n\n  /**\n   * Move a handle to the given offset position.\n   *\n   * @param handle - The handle to move.\n   *\n   * @param offsetX - The desired offset X position of the handle.\n   *\n   * @param offsetY - The desired offset Y position of the handle.\n   *\n   * #### Notes\n   * If the given handle is not contained in the layout, this is no-op.\n   *\n   * The handle will be moved as close as possible to the desired\n   * position without violating any of the layout constraints.\n   *\n   * Only one of the coordinates is used depending on the orientation\n   * of the handle. This method accepts both coordinates to make it\n   * easy to invoke from a mouse move event without needing to know\n   * the handle orientation.\n   */\n  moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n    // Bail early if there is no root or if the handle is hidden.\n    let hidden = handle.classList.contains('lm-mod-hidden');\n    if (!this._root || hidden) {\n      return;\n    }\n\n    // Lookup the split node for the handle.\n    let data = this._root.findSplitNode(handle);\n    if (!data) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (data.node.orientation === 'horizontal') {\n      delta = offsetX - handle.offsetLeft;\n    } else {\n      delta = offsetY - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent sibling resizing unless needed.\n    data.node.holdSizes();\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Save the current configuration of the dock layout.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockLayout.ILayoutConfig {\n    // Bail early if there is no root.\n    if (!this._root) {\n      return { main: null };\n    }\n\n    // Hold the current sizes in the layout tree.\n    this._root.holdAllSizes();\n\n    // Return the layout config.\n    return { main: this._root.createConfig() };\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   */\n  restoreLayout(config: DockLayout.ILayoutConfig): void {\n    // Create the widget set for validating the config.\n    let widgetSet = new Set<Widget>();\n\n    // Normalize the main area config and collect the widgets.\n    let mainConfig: DockLayout.AreaConfig | null;\n    if (config.main) {\n      mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n    } else {\n      mainConfig = null;\n    }\n\n    // Create iterators over the old content.\n    let oldWidgets = this.widgets();\n    let oldTabBars = this.tabBars();\n    let oldHandles = this.handles();\n\n    // Clear the root before removing the old content.\n    this._root = null;\n\n    // Unparent the old widgets which are not in the new config.\n    for (const widget of oldWidgets) {\n      if (!widgetSet.has(widget)) {\n        widget.parent = null;\n      }\n    }\n\n    // Dispose of the old tab bars.\n    for (const tabBar of oldTabBars) {\n      tabBar.dispose();\n    }\n\n    // Remove the old handles.\n    for (const handle of oldHandles) {\n      if (handle.parentNode) {\n        handle.parentNode.removeChild(handle);\n      }\n    }\n\n    // Reparent the new widgets to the current parent.\n    for (const widget of widgetSet) {\n      widget.parent = this.parent;\n    }\n\n    // Create the root node for the new config.\n    if (mainConfig) {\n      this._root = Private.realizeAreaConfig(\n        mainConfig,\n        {\n          // Ignoring optional `document` argument as we must reuse `this._document`\n          createTabBar: (document?: Document | ShadowRoot) =>\n            this._createTabBar(),\n          createHandle: () => this._createHandle()\n        },\n        this._document\n      );\n    } else {\n      this._root = null;\n    }\n\n    // If there is no parent, there is nothing more to do.\n    if (!this.parent) {\n      return;\n    }\n\n    // Attach the new widgets to the parent.\n    widgetSet.forEach(widget => {\n      this.attachWidget(widget);\n    });\n\n    // Post a fit request to the parent.\n    this.parent.fit();\n  }\n\n  /**\n   * Add a widget to the dock layout.\n   *\n   * @param widget - The widget to add to the dock layout.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * The widget will be moved if it is already contained in the layout.\n   *\n   * An error will be thrown if the reference widget is invalid.\n   */\n  addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n    // Parse the options.\n    let ref = options.ref || null;\n    let mode = options.mode || 'tab-after';\n\n    // Find the tab node which holds the reference widget.\n    let refNode: Private.TabLayoutNode | null = null;\n    if (this._root && ref) {\n      refNode = this._root.findTabNode(ref);\n    }\n\n    // Throw an error if the reference widget is invalid.\n    if (ref && !refNode) {\n      throw new Error('Reference widget is not in the layout.');\n    }\n\n    // Reparent the widget to the current layout parent.\n    widget.parent = this.parent;\n\n    // Insert the widget according to the insert mode.\n    switch (mode) {\n      case 'tab-after':\n        this._insertTab(widget, ref, refNode, true);\n        break;\n      case 'tab-before':\n        this._insertTab(widget, ref, refNode, false);\n        break;\n      case 'split-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false);\n        break;\n      case 'split-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false);\n        break;\n      case 'split-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true);\n        break;\n      case 'split-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true);\n        break;\n      case 'merge-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n        break;\n      case 'merge-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n        break;\n      case 'merge-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n        break;\n      case 'merge-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n        break;\n    }\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Ensure the widget is attached to the parent widget.\n    this.attachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Remove the widget from its current layout location.\n    this._removeWidget(widget);\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Detach the widget from the parent widget.\n    this.detachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Find the tab area which contains the given client position.\n   *\n   * @param clientX - The client X position of interest.\n   *\n   * @param clientY - The client Y position of interest.\n   *\n   * @returns The geometry of the tab area at the given position, or\n   *   `null` if there is no tab area at the given position.\n   */\n  hitTestTabAreas(\n    clientX: number,\n    clientY: number\n  ): DockLayout.ITabAreaGeometry | null {\n    // Bail early if hit testing cannot produce valid results.\n    if (!this._root || !this.parent || !this.parent.isVisible) {\n      return null;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent.node);\n    }\n\n    // Convert from client to local coordinates.\n    let rect = this.parent.node.getBoundingClientRect();\n    let x = clientX - rect.left - this._box.borderLeft;\n    let y = clientY - rect.top - this._box.borderTop;\n\n    // Find the tab layout node at the local position.\n    let tabNode = this._root.hitTestTabNodes(x, y);\n\n    // Bail if a tab layout node was not found.\n    if (!tabNode) {\n      return null;\n    }\n\n    // Extract the data from the tab node.\n    let { tabBar, top, left, width, height } = tabNode;\n\n    // Compute the right and bottom edges of the tab area.\n    let borderWidth = this._box.borderLeft + this._box.borderRight;\n    let borderHeight = this._box.borderTop + this._box.borderBottom;\n    let right = rect.width - borderWidth - (left + width);\n    let bottom = rect.height - borderHeight - (top + height);\n\n    // Return the hit test results.\n    return { tabBar, x, y, top, left, right, bottom, width, height };\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    // Perform superclass initialization.\n    super.init();\n\n    // Attach each widget to the parent.\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n\n    // Attach each handle to the parent.\n    for (const handle of this.handles()) {\n      this.parent!.node.appendChild(handle);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Attach the widget to the layout parent widget.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is already attached.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Do nothing if the widget is already attached.\n    if (this.parent!.node === widget.node.parentNode) {\n      return;\n    }\n\n    // Create the layout item for the widget.\n    this._items.set(widget, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach the widget from the layout parent widget.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not attached.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Do nothing if the widget is not attached.\n    if (this.parent!.node !== widget.node.parentNode) {\n      return;\n    }\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Delete the layout item for the widget.\n    let item = this._items.get(widget);\n    if (item) {\n      this._items.delete(widget);\n      item.dispose();\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Remove the specified widget from the layout structure.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not in the layout tree.\n   *\n   * This does not detach the widget from the parent node.\n   */\n  private _removeWidget(widget: Widget): void {\n    // Bail early if there is no layout root.\n    if (!this._root) {\n      return;\n    }\n\n    // Find the tab node which contains the given widget.\n    let tabNode = this._root.findTabNode(widget);\n\n    // Bail early if the tab node is not found.\n    if (!tabNode) {\n      return;\n    }\n\n    Private.removeAria(widget);\n\n    // If there are multiple tabs, just remove the widget's tab.\n    if (tabNode.tabBar.titles.length > 1) {\n      tabNode.tabBar.removeTab(widget.title);\n      if (\n        this._hiddenMode === Widget.HiddenMode.Scale &&\n        tabNode.tabBar.titles.length == 1\n      ) {\n        const existingWidget = tabNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Display;\n      }\n      return;\n    }\n\n    // Otherwise, the tab node needs to be removed...\n\n    // Dispose the tab bar.\n    tabNode.tabBar.dispose();\n\n    // Handle the case where the tab node is the root.\n    if (this._root === tabNode) {\n      this._root = null;\n      return;\n    }\n\n    // Otherwise, remove the tab node from its parent...\n\n    // Prevent widget resizing unless needed.\n    this._root.holdAllSizes();\n\n    // Clear the parent reference on the tab node.\n    let splitNode = tabNode.parent!;\n    tabNode.parent = null;\n\n    // Remove the tab node from its parent split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n    let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n    ArrayExt.removeAt(splitNode.sizers, i);\n\n    // Remove the handle from its parent DOM node.\n    if (handle.parentNode) {\n      handle.parentNode.removeChild(handle);\n    }\n\n    // If there are multiple children, just update the handles.\n    if (splitNode.children.length > 1) {\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Otherwise, the split node also needs to be removed...\n\n    // Clear the parent reference on the split node.\n    let maybeParent = splitNode.parent;\n    splitNode.parent = null;\n\n    // Lookup the remaining child node and handle.\n    let childNode = splitNode.children[0];\n    let childHandle = splitNode.handles[0];\n\n    // Clear the split node data.\n    splitNode.children.length = 0;\n    splitNode.handles.length = 0;\n    splitNode.sizers.length = 0;\n\n    // Remove the child handle from its parent node.\n    if (childHandle.parentNode) {\n      childHandle.parentNode.removeChild(childHandle);\n    }\n\n    // Handle the case where the split node is the root.\n    if (this._root === splitNode) {\n      childNode.parent = null;\n      this._root = childNode;\n      return;\n    }\n\n    // Otherwise, move the child node to the parent node...\n    let parentNode = maybeParent!;\n\n    // Lookup the index of the split node.\n    let j = parentNode.children.indexOf(splitNode);\n\n    // Handle the case where the child node is a tab node.\n    if (childNode instanceof Private.TabLayoutNode) {\n      childNode.parent = parentNode;\n      parentNode.children[j] = childNode;\n      return;\n    }\n\n    // Remove the split data from the parent.\n    let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n    ArrayExt.removeAt(parentNode.children, j);\n    ArrayExt.removeAt(parentNode.sizers, j);\n\n    // Remove the handle from its parent node.\n    if (splitHandle.parentNode) {\n      splitHandle.parentNode.removeChild(splitHandle);\n    }\n\n    // The child node and the split parent node will have the same\n    // orientation. Merge the grand-children with the parent node.\n    for (let i = 0, n = childNode.children.length; i < n; ++i) {\n      let gChild = childNode.children[i];\n      let gHandle = childNode.handles[i];\n      let gSizer = childNode.sizers[i];\n      ArrayExt.insert(parentNode.children, j + i, gChild);\n      ArrayExt.insert(parentNode.handles, j + i, gHandle);\n      ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n      gChild.parent = parentNode;\n    }\n\n    // Clear the child node.\n    childNode.children.length = 0;\n    childNode.handles.length = 0;\n    childNode.sizers.length = 0;\n    childNode.parent = null;\n\n    // Sync the handles on the parent node.\n    parentNode.syncHandles();\n  }\n\n  /**\n   * Create the tab layout node to hold the widget.\n   */\n  private _createTabNode(widget: Widget): Private.TabLayoutNode {\n    let tabNode = new Private.TabLayoutNode(this._createTabBar());\n    tabNode.tabBar.addTab(widget.title);\n    Private.addAria(widget, tabNode.tabBar);\n    return tabNode;\n  }\n\n  /**\n   * Insert a widget next to an existing tab.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertTab(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    after: boolean\n  ): void {\n    // Do nothing if the tab is inserted next to itself.\n    if (widget === ref) {\n      return;\n    }\n\n    // Create the root if it does not exist.\n    if (!this._root) {\n      let tabNode = new Private.TabLayoutNode(this._createTabBar());\n      tabNode.tabBar.addTab(widget.title);\n      this._root = tabNode;\n      Private.addAria(widget, tabNode.tabBar);\n      return;\n    }\n\n    // Use the first tab node as the ref node if needed.\n    if (!refNode) {\n      refNode = this._root.findFirstTabNode()!;\n    }\n\n    // If the widget is not contained in the ref node, ensure it is\n    // removed from the layout and hidden before being added again.\n    if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n      this._removeWidget(widget);\n      widget.hide();\n    }\n\n    // Lookup the target index for inserting the tab.\n    let index: number;\n    if (ref) {\n      index = refNode.tabBar.titles.indexOf(ref.title);\n    } else {\n      index = refNode.tabBar.currentIndex;\n    }\n\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      if (refNode.tabBar.titles.length === 0) {\n        // Singular tab should use display mode to limit number of layers.\n        widget.hiddenMode = Widget.HiddenMode.Display;\n      } else if (refNode.tabBar.titles.length == 1) {\n        // If we are adding a second tab, switch the existing tab back to scale.\n        const existingWidget = refNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n      } else {\n        // For the third and subsequent tabs no special action is needed.\n        widget.hiddenMode = Widget.HiddenMode.Scale;\n      }\n    } else {\n      // For all other modes just propagate the current mode.\n      widget.hiddenMode = this._hiddenMode;\n    }\n\n    // Insert the widget's tab relative to the target index.\n    refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n    Private.addAria(widget, refNode.tabBar);\n  }\n\n  /**\n   * Insert a widget as a new split area.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertSplit(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    orientation: Private.Orientation,\n    after: boolean,\n    merge: boolean = false\n  ): void {\n    // Do nothing if there is no effective split.\n    if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n      return;\n    }\n\n    // Ensure the widget is removed from the current layout.\n    this._removeWidget(widget);\n\n    // Set the root if it does not exist.\n    if (!this._root) {\n      this._root = this._createTabNode(widget);\n      return;\n    }\n\n    // If the ref node parent is null, split the root.\n    if (!refNode || !refNode.parent) {\n      // Ensure the root is split with the correct orientation.\n      let root = this._splitRoot(orientation);\n\n      // Determine the insert index for the new tab node.\n      let i = after ? root.children.length : 0;\n\n      // Normalize the split node.\n      root.normalizeSizes();\n\n      // Create the sizer for new tab node.\n      let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n      // Insert the tab node sized to the golden ratio.\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(root.children, i, tabNode);\n      ArrayExt.insert(root.sizers, i, sizer);\n      ArrayExt.insert(root.handles, i, this._createHandle());\n      tabNode.parent = root;\n\n      // Re-normalize the split node to maintain the ratios.\n      root.normalizeSizes();\n\n      // Finally, synchronize the visibility of the handles.\n      root.syncHandles();\n      return;\n    }\n\n    // Lookup the split node for the ref widget.\n    let splitNode = refNode.parent;\n\n    // If the split node already had the correct orientation,\n    // the widget can be inserted into the split node directly.\n    if (splitNode.orientation === orientation) {\n      // Find the index of the ref node.\n      let i = splitNode.children.indexOf(refNode);\n\n      // Conditionally reuse a tab layout found in the wanted position.\n      if (merge) {\n        let j = i + (after ? 1 : -1);\n        let sibling = splitNode.children[j];\n        if (sibling instanceof Private.TabLayoutNode) {\n          this._insertTab(widget, null, sibling, true);\n          ++sibling.tabBar.currentIndex;\n          return;\n        }\n      }\n\n      // Normalize the split node.\n      splitNode.normalizeSizes();\n\n      // Consume half the space for the insert location.\n      let s = (splitNode.sizers[i].sizeHint /= 2);\n\n      // Insert the tab node sized to the other half.\n      let j = i + (after ? 1 : 0);\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(splitNode.children, j, tabNode);\n      ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n      ArrayExt.insert(splitNode.handles, j, this._createHandle());\n      tabNode.parent = splitNode;\n\n      // Finally, synchronize the visibility of the handles.\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Remove the ref node from the split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n    // Create a new normalized split node for the children.\n    let childNode = new Private.SplitLayoutNode(orientation);\n    childNode.normalized = true;\n\n    // Add the ref node sized to half the space.\n    childNode.children.push(refNode);\n    childNode.sizers.push(Private.createSizer(0.5));\n    childNode.handles.push(this._createHandle());\n    refNode.parent = childNode;\n\n    // Add the tab node sized to the other half.\n    let j = after ? 1 : 0;\n    let tabNode = this._createTabNode(widget);\n    ArrayExt.insert(childNode.children, j, tabNode);\n    ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n    ArrayExt.insert(childNode.handles, j, this._createHandle());\n    tabNode.parent = childNode;\n\n    // Synchronize the visibility of the handles.\n    childNode.syncHandles();\n\n    // Finally, add the new child node to the original split node.\n    ArrayExt.insert(splitNode.children, i, childNode);\n    childNode.parent = splitNode;\n  }\n\n  /**\n   * Ensure the root is a split node with the given orientation.\n   */\n  private _splitRoot(\n    orientation: Private.Orientation\n  ): Private.SplitLayoutNode {\n    // Bail early if the root already meets the requirements.\n    let oldRoot = this._root;\n    if (oldRoot instanceof Private.SplitLayoutNode) {\n      if (oldRoot.orientation === orientation) {\n        return oldRoot;\n      }\n    }\n\n    // Create a new root node with the specified orientation.\n    let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n    // Add the old root to the new root.\n    if (oldRoot) {\n      newRoot.children.push(oldRoot);\n      newRoot.sizers.push(Private.createSizer(0));\n      newRoot.handles.push(this._createHandle());\n      oldRoot.parent = newRoot;\n    }\n\n    // Return the new root as a convenience.\n    return newRoot;\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the size limits for the layout tree.\n    if (this._root) {\n      let limits = this._root.fit(this._spacing, this._items);\n      minW = limits.minWidth;\n      minH = limits.minHeight;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Bail early if there is no root layout node.\n    if (!this._root) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let x = this._box.paddingTop;\n    let y = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the geometry of the layout tree.\n    this._root.update(x, y, width, height, this._spacing, this._items);\n  }\n\n  /**\n   * Create a new tab bar for use by the dock layout.\n   *\n   * #### Notes\n   * The tab bar will be attached to the parent if it exists.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar using the renderer.\n    let tabBar = this.renderer.createTabBar(this._document);\n\n    // Enforce necessary tab bar behavior.\n    tabBar.orientation = 'horizontal';\n\n    // Attach the tab bar to the parent if possible.\n    if (this.parent) {\n      this.attachWidget(tabBar);\n    }\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for the dock layout.\n   *\n   * #### Notes\n   * The handle will be attached to the parent if it exists.\n   */\n  private _createHandle(): HTMLDivElement {\n    // Create the handle using the renderer.\n    let handle = this.renderer.createHandle();\n\n    // Initialize the handle layout behavior.\n    let style = handle.style;\n    style.position = 'absolute';\n    style.contain = 'strict';\n    style.top = '0';\n    style.left = '0';\n    style.width = '0';\n    style.height = '0';\n\n    // Attach the handle to the parent if it exists.\n    if (this.parent) {\n      this.parent.node.appendChild(handle);\n    }\n\n    // Return the initialized handle.\n    return handle;\n  }\n\n  private _spacing = 4;\n  private _dirty = false;\n  private _root: Private.LayoutNode | null = null;\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _document: Document | ShadowRoot;\n  private _hiddenMode: Widget.HiddenMode;\n  private _items: Private.ItemMap = new Map<Widget, LayoutItem>();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n  /**\n   * An options object for creating a dock layout.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * The renderer to use for the dock layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a dock layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new tab bar for use with a dock layout.\n     *\n     * @returns A new tab bar for a dock layout.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget>;\n\n    /**\n     * Create a new handle node for use with a dock layout.\n     *\n     * @returns A new handle node for a dock layout.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * A type alias for the supported insertion modes.\n   *\n   * An insert mode is used to specify how a widget should be added\n   * to the dock layout relative to a reference widget.\n   */\n  export type InsertMode =\n    | /**\n     * The area to the top of the reference widget.\n     *\n     * The widget will be inserted just above the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the top edge of the dock layout.\n     */\n    'split-top'\n\n    /**\n     * The area to the left of the reference widget.\n     *\n     * The widget will be inserted just left of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the left edge of the dock layout.\n     */\n    | 'split-left'\n\n    /**\n     * The area to the right of the reference widget.\n     *\n     * The widget will be inserted just right of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted  at the right edge of the dock layout.\n     */\n    | 'split-right'\n\n    /**\n     * The area to the bottom of the reference widget.\n     *\n     * The widget will be inserted just below the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the bottom edge of the dock layout.\n     */\n    | 'split-bottom'\n\n    /**\n     * Like `split-top` but if a tab layout exists above the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-top'\n\n    /**\n     * Like `split-left` but if a tab layout exists left of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-left'\n\n    /**\n     * Like `split-right` but if a tab layout exists right of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-right'\n\n    /**\n     * Like `split-bottom` but if a tab layout exists below the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-bottom'\n\n    /**\n     * The tab position before the reference widget.\n     *\n     * The widget will be added as a tab before the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-before'\n\n    /**\n     * The tab position after the reference widget.\n     *\n     * The widget will be added as a tab after the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-after';\n\n  /**\n   * An options object for adding a widget to the dock layout.\n   */\n  export interface IAddOptions {\n    /**\n     * The insertion mode for adding the widget.\n     *\n     * The default is `'tab-after'`.\n     */\n    mode?: InsertMode;\n\n    /**\n     * The reference widget for the insert location.\n     *\n     * The default is `null`.\n     */\n    ref?: Widget | null;\n  }\n\n  /**\n   * A layout config object for a tab area.\n   */\n  export interface ITabAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'tab-area';\n\n    /**\n     * The widgets contained in the tab area.\n     */\n    widgets: Widget[];\n\n    /**\n     * The index of the selected tab.\n     */\n    currentIndex: number;\n  }\n\n  /**\n   * A layout config object for a split area.\n   */\n  export interface ISplitAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'split-area';\n\n    /**\n     * The orientation of the split area.\n     */\n    orientation: 'horizontal' | 'vertical';\n\n    /**\n     * The children in the split area.\n     */\n    children: AreaConfig[];\n\n    /**\n     * The relative sizes of the children.\n     */\n    sizes: number[];\n  }\n\n  /**\n   * A type alias for a general area config.\n   */\n  export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n  /**\n   * A dock layout configuration object.\n   */\n  export interface ILayoutConfig {\n    /**\n     * The layout config for the main dock area.\n     */\n    main: AreaConfig | null;\n  }\n\n  /**\n   * An object which represents the geometry of a tab area.\n   */\n  export interface ITabAreaGeometry {\n    /**\n     * The tab bar for the tab area.\n     */\n    tabBar: TabBar<Widget>;\n\n    /**\n     * The local X position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the local X coordinate of the hit test query.\n     */\n    x: number;\n\n    /**\n     * The local Y position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the local Y coordinate of the hit test query.\n     */\n    y: number;\n\n    /**\n     * The local coordinate of the top edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the top edge of the tab area.\n     */\n    top: number;\n\n    /**\n     * The local coordinate of the left edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the left edge of the tab area.\n     */\n    left: number;\n\n    /**\n     * The local coordinate of the right edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the right edge of the layout parent\n     * widget, to the right edge of the tab area.\n     */\n    right: number;\n\n    /**\n     * The local coordinate of the bottom edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the bottom edge of the layout parent\n     * widget, to the bottom edge of the tab area.\n     */\n    bottom: number;\n\n    /**\n     * The width of the tab area.\n     *\n     * #### Notes\n     * This is total width allocated for the tab area.\n     */\n    width: number;\n\n    /**\n     * The height of the tab area.\n     *\n     * #### Notes\n     * This is total height allocated for the tab area.\n     */\n    height: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * A type alias for a dock layout node.\n   */\n  export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n  /**\n   * A type alias for the orientation of a split layout node.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a layout item map.\n   */\n  export type ItemMap = Map<Widget, LayoutItem>;\n\n  /**\n   * Create a box sizer with an initial size hint.\n   */\n  export function createSizer(hint: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = hint;\n    sizer.size = hint;\n    return sizer;\n  }\n\n  /**\n   * Normalize an area config object and collect the visited widgets.\n   */\n  export function normalizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    let result: DockLayout.AreaConfig | null;\n    if (config.type === 'tab-area') {\n      result = normalizeTabAreaConfig(config, widgetSet);\n    } else {\n      result = normalizeSplitAreaConfig(config, widgetSet);\n    }\n    return result;\n  }\n\n  /**\n   * Convert a normalized area config into a layout tree.\n   */\n  export function realizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): LayoutNode {\n    let node: LayoutNode;\n    if (config.type === 'tab-area') {\n      node = realizeTabAreaConfig(config, renderer, document);\n    } else {\n      node = realizeSplitAreaConfig(config, renderer, document);\n    }\n    return node;\n  }\n\n  /**\n   * A layout node which holds the data for a tabbed area.\n   */\n  export class TabLayoutNode {\n    /**\n     * Construct a new tab layout node.\n     *\n     * @param tabBar - The tab bar to use for the layout node.\n     */\n    constructor(tabBar: TabBar<Widget>) {\n      let tabSizer = new BoxSizer();\n      let widgetSizer = new BoxSizer();\n      tabSizer.stretch = 0;\n      widgetSizer.stretch = 1;\n      this.tabBar = tabBar;\n      this.sizers = [tabSizer, widgetSizer];\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * The tab bar for the layout node.\n     */\n    readonly tabBar: TabBar<Widget>;\n\n    /**\n     * The sizers for the layout node.\n     */\n    readonly sizers: [BoxSizer, BoxSizer];\n\n    /**\n     * The most recent value for the `top` edge of the layout box.\n     */\n    get top(): number {\n      return this._top;\n    }\n\n    /**\n     * The most recent value for the `left` edge of the layout box.\n     */\n    get left(): number {\n      return this._left;\n    }\n\n    /**\n     * The most recent value for the `width` of the layout box.\n     */\n    get width(): number {\n      return this._width;\n    }\n\n    /**\n     * The most recent value for the `height` of the layout box.\n     */\n    get height(): number {\n      return this._height;\n    }\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      yield this.tabBar;\n      yield* this.iterUserWidgets();\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const title of this.tabBar.titles) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      let title = this.tabBar.currentTitle;\n      if (title) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      yield this.tabBar;\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    // eslint-disable-next-line require-yield\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      return;\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      return this;\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      if (x < this._left || x >= this._left + this._width) {\n        return null;\n      }\n      if (y < this._top || y >= this._top + this._height) {\n        return null;\n      }\n      return this;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ITabAreaConfig {\n      let widgets = this.tabBar.titles.map(title => title.owner);\n      let currentIndex = this.tabBar.currentIndex;\n      return { type: 'tab-area', widgets, currentIndex };\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      return;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Set up the limit variables.\n      let minWidth = 0;\n      let minHeight = 0;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Lookup the tab bar and widget sizers.\n      let [tabBarSizer, widgetSizer] = this.sizers;\n\n      // Update the tab bar limits.\n      if (tabBarItem) {\n        tabBarItem.fit();\n      }\n\n      // Update the widget limits.\n      if (widgetItem) {\n        widgetItem.fit();\n      }\n\n      // Update the results and sizer for the tab bar.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        minWidth = Math.max(minWidth, tabBarItem.minWidth);\n        minHeight += tabBarItem.minHeight;\n        tabBarSizer.minSize = tabBarItem.minHeight;\n        tabBarSizer.maxSize = tabBarItem.maxHeight;\n      } else {\n        tabBarSizer.minSize = 0;\n        tabBarSizer.maxSize = 0;\n      }\n\n      // Update the results and sizer for the current widget.\n      if (widgetItem && !widgetItem.isHidden) {\n        minWidth = Math.max(minWidth, widgetItem.minWidth);\n        minHeight += widgetItem.minHeight;\n        widgetSizer.minSize = widgetItem.minHeight;\n        widgetSizer.maxSize = Infinity;\n      } else {\n        widgetSizer.minSize = 0;\n        widgetSizer.maxSize = Infinity;\n      }\n\n      // Return the computed size limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Update the layout box values.\n      this._top = top;\n      this._left = left;\n      this._width = width;\n      this._height = height;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, height);\n\n      // Update the tab bar item using the computed size.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        let size = this.sizers[0].size;\n        tabBarItem.update(left, top, width, size);\n        top += size;\n      }\n\n      // Layout the widget using the computed size.\n      if (widgetItem && !widgetItem.isHidden) {\n        let size = this.sizers[1].size;\n        widgetItem.update(left, top, width, size);\n      }\n    }\n\n    private _top = 0;\n    private _left = 0;\n    private _width = 0;\n    private _height = 0;\n  }\n\n  /**\n   * A layout node which holds the data for a split area.\n   */\n  export class SplitLayoutNode {\n    /**\n     * Construct a new split layout node.\n     *\n     * @param orientation - The orientation of the node.\n     */\n    constructor(orientation: Orientation) {\n      this.orientation = orientation;\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * Whether the sizers have been normalized.\n     */\n    normalized = false;\n\n    /**\n     * The orientation of the node.\n     */\n    readonly orientation: Orientation;\n\n    /**\n     * The child nodes for the split node.\n     */\n    readonly children: LayoutNode[] = [];\n\n    /**\n     * The box sizers for the layout children.\n     */\n    readonly sizers: BoxSizer[] = [];\n\n    /**\n     * The handles for the layout children.\n     */\n    readonly handles: HTMLDivElement[] = [];\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterAllWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterUserWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterSelectedWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      for (const child of this.children) {\n        yield* child.iterTabBars();\n      }\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      yield* this.handles;\n      for (const child of this.children) {\n        yield* child.iterHandles();\n      }\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findTabNode(widget);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      let index = this.handles.indexOf(handle);\n      if (index !== -1) {\n        return { index, node: this };\n      }\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findSplitNode(handle);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      if (this.children.length === 0) {\n        return null;\n      }\n      return this.children[0].findFirstTabNode();\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].hitTestTabNodes(x, y);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ISplitAreaConfig {\n      let orientation = this.orientation;\n      let sizes = this.createNormalizedSizes();\n      let children = this.children.map(child => child.createConfig());\n      return { type: 'split-area', orientation, children, sizes };\n    }\n\n    /**\n     * Sync the visibility and orientation of the handles.\n     */\n    syncHandles(): void {\n      this.handles.forEach((handle, i) => {\n        handle.setAttribute('data-orientation', this.orientation);\n        if (i === this.handles.length - 1) {\n          handle.classList.add('lm-mod-hidden');\n        } else {\n          handle.classList.remove('lm-mod-hidden');\n        }\n      });\n    }\n\n    /**\n     * Hold the current sizes of the box sizers.\n     *\n     * This sets the size hint of each sizer to its current size.\n     */\n    holdSizes(): void {\n      for (const sizer of this.sizers) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      for (const child of this.children) {\n        child.holdAllSizes();\n      }\n      this.holdSizes();\n    }\n\n    /**\n     * Normalize the sizes of the split layout node.\n     */\n    normalizeSizes(): void {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return;\n      }\n\n      // Hold the current sizes of the sizers.\n      this.holdSizes();\n\n      // Compute the sum of the sizes.\n      let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint = 1 / n;\n        }\n      } else {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint /= sum;\n        }\n      }\n\n      // Mark the sizes as normalized.\n      this.normalized = true;\n    }\n\n    /**\n     * Snap the normalized sizes of the split layout node.\n     */\n    createNormalizedSizes(): number[] {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return [];\n      }\n\n      // Grab the current sizes of the sizers.\n      let sizes = this.sizers.map(sizer => sizer.size);\n\n      // Compute the sum of the sizes.\n      let sum = sizes.reduce((v, size) => v + size, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] = 1 / n;\n        }\n      } else {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] /= sum;\n        }\n      }\n\n      // Return the normalized sizes.\n      return sizes;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Compute the required fixed space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n      // Set up the limit variables.\n      let minWidth = horizontal ? fixed : 0;\n      let minHeight = horizontal ? 0 : fixed;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Fit the children and update the limits.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let limits = this.children[i].fit(spacing, items);\n        if (horizontal) {\n          minHeight = Math.max(minHeight, limits.minHeight);\n          minWidth += limits.minWidth;\n          this.sizers[i].minSize = limits.minWidth;\n        } else {\n          minWidth = Math.max(minWidth, limits.minWidth);\n          minHeight += limits.minHeight;\n          this.sizers[i].minSize = limits.minHeight;\n        }\n      }\n\n      // Return the computed limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Compute the available layout space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n      let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n      // De-normalize the sizes if needed.\n      if (this.normalized) {\n        for (const sizer of this.sizers) {\n          sizer.sizeHint *= space;\n        }\n        this.normalized = false;\n      }\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, space);\n\n      // Update the geometry of the child nodes and handles.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let child = this.children[i];\n        let size = this.sizers[i].size;\n        let handleStyle = this.handles[i].style;\n        if (horizontal) {\n          child.update(left, top, size, height, spacing, items);\n          left += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${spacing}px`;\n          handleStyle.height = `${height}px`;\n          left += spacing;\n        } else {\n          child.update(left, top, width, size, spacing, items);\n          top += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${width}px`;\n          handleStyle.height = `${spacing}px`;\n          top += spacing;\n        }\n      }\n    }\n  }\n\n  export function addAria(widget: Widget, tabBar: TabBar<Widget>): void {\n    widget.node.setAttribute('role', 'tabpanel');\n    let renderer = tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  export function removeAria(widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n  }\n\n  /**\n   * Normalize a tab area config and collect the visited widgets.\n   */\n  function normalizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.ITabAreaConfig | null {\n    // Bail early if there is no content.\n    if (config.widgets.length === 0) {\n      return null;\n    }\n\n    // Setup the filtered widgets array.\n    let widgets: Widget[] = [];\n\n    // Filter the config for unique widgets.\n    for (const widget of config.widgets) {\n      if (!widgetSet.has(widget)) {\n        widgetSet.add(widget);\n        widgets.push(widget);\n      }\n    }\n\n    // Bail if there are no effective widgets.\n    if (widgets.length === 0) {\n      return null;\n    }\n\n    // Normalize the current index.\n    let index = config.currentIndex;\n    if (index !== -1 && (index < 0 || index >= widgets.length)) {\n      index = 0;\n    }\n\n    // Return a normalized config object.\n    return { type: 'tab-area', widgets, currentIndex: index };\n  }\n\n  /**\n   * Normalize a split area config and collect the visited widgets.\n   */\n  function normalizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    // Set up the result variables.\n    let orientation = config.orientation;\n    let children: DockLayout.AreaConfig[] = [];\n    let sizes: number[] = [];\n\n    // Normalize the config children.\n    for (let i = 0, n = config.children.length; i < n; ++i) {\n      // Normalize the child config.\n      let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n      // Ignore an empty child.\n      if (!child) {\n        continue;\n      }\n\n      // Add the child or hoist its content as appropriate.\n      if (child.type === 'tab-area' || child.orientation !== orientation) {\n        children.push(child);\n        sizes.push(Math.abs(config.sizes[i] || 0));\n      } else {\n        children.push(...child.children);\n        sizes.push(...child.sizes);\n      }\n    }\n\n    // Bail if there are no effective children.\n    if (children.length === 0) {\n      return null;\n    }\n\n    // If there is only one effective child, return that child.\n    if (children.length === 1) {\n      return children[0];\n    }\n\n    // Return a normalized config object.\n    return { type: 'split-area', orientation, children, sizes };\n  }\n\n  /**\n   * Convert a normalized tab area config into a layout tree.\n   */\n  function realizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): TabLayoutNode {\n    // Create the tab bar for the layout node.\n    let tabBar = renderer.createTabBar(document);\n\n    // Hide each widget and add it to the tab bar.\n    for (const widget of config.widgets) {\n      widget.hide();\n      tabBar.addTab(widget.title);\n      Private.addAria(widget, tabBar);\n    }\n\n    // Set the current index of the tab bar.\n    tabBar.currentIndex = config.currentIndex;\n\n    // Return the new tab layout node.\n    return new TabLayoutNode(tabBar);\n  }\n\n  /**\n   * Convert a normalized split area config into a layout tree.\n   */\n  function realizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): SplitLayoutNode {\n    // Create the split layout node.\n    let node = new SplitLayoutNode(config.orientation);\n\n    // Add each child to the layout node.\n    config.children.forEach((child, i) => {\n      // Create the child data for the layout node.\n      let childNode = realizeAreaConfig(child, renderer, document);\n      let sizer = createSizer(config.sizes[i]);\n      let handle = renderer.createHandle();\n\n      // Add the child data to the layout node.\n      node.children.push(childNode);\n      node.handles.push(handle);\n      node.sizers.push(sizer);\n\n      // Update the parent for the child node.\n      childNode.parent = node;\n    });\n\n    // Synchronize the handle state for the layout node.\n    node.syncHandles();\n\n    // Normalize the sizes for the layout node.\n    node.normalizeSizes();\n\n    // Return the new layout node.\n    return node;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n  /**\n   * Construct a new dock panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: DockPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-DockPanel');\n    this._document = options.document || document;\n    this._mode = options.mode || 'multiple-document';\n    this._renderer = options.renderer || DockPanel.defaultRenderer;\n    this._edges = options.edges || Private.DEFAULT_EDGES;\n    if (options.tabsMovable !== undefined) {\n      this._tabsMovable = options.tabsMovable;\n    }\n    if (options.tabsConstrained !== undefined) {\n      this._tabsConstrained = options.tabsConstrained;\n    }\n    if (options.addButtonEnabled !== undefined) {\n      this._addButtonEnabled = options.addButtonEnabled;\n    }\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = this._mode;\n\n    // Create the delegate renderer for the layout.\n    let renderer: DockPanel.IRenderer = {\n      createTabBar: () => this._createTabBar(),\n      createHandle: () => this._createHandle()\n    };\n\n    // Set up the dock layout for the panel.\n    this.layout = new DockLayout({\n      document: this._document,\n      renderer,\n      spacing: options.spacing,\n      hiddenMode: options.hiddenMode\n    });\n\n    // Set up the overlay drop indicator.\n    this.overlay = options.overlay || new DockPanel.Overlay();\n    this.node.appendChild(this.overlay.node);\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    // Ensure the mouse is released.\n    this._releaseMouse();\n\n    // Hide the overlay.\n    this.overlay.hide(0);\n\n    // Cancel a drag if one is in progress.\n    if (this._drag) {\n      this._drag.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The method for hiding widgets.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as DockLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as DockLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when the layout configuration is modified.\n   *\n   * #### Notes\n   * This signal is emitted whenever the current layout configuration\n   * may have changed.\n   *\n   * This signal is emitted asynchronously in a collapsed fashion, so\n   * that multiple synchronous modifications results in only a single\n   * emit of the signal.\n   */\n  get layoutModified(): ISignal<this, void> {\n    return this._layoutModified;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The overlay used by the dock panel.\n   */\n  readonly overlay: DockPanel.IOverlay;\n\n  /**\n   * The renderer used by the dock panel.\n   */\n  get renderer(): DockPanel.IRenderer {\n    return (this.layout as DockLayout).renderer;\n  }\n\n  /**\n   * Get the spacing between the widgets.\n   */\n  get spacing(): number {\n    return (this.layout as DockLayout).spacing;\n  }\n\n  /**\n   * Set the spacing between the widgets.\n   */\n  set spacing(value: number) {\n    (this.layout as DockLayout).spacing = value;\n  }\n\n  /**\n   * Get the mode for the dock panel.\n   */\n  get mode(): DockPanel.Mode {\n    return this._mode;\n  }\n\n  /**\n   * Set the mode for the dock panel.\n   *\n   * #### Notes\n   * Changing the mode is a destructive operation with respect to the\n   * panel's layout configuration. If layout state must be preserved,\n   * save the current layout config before changing the mode.\n   */\n  set mode(value: DockPanel.Mode) {\n    // Bail early if the mode does not change.\n    if (this._mode === value) {\n      return;\n    }\n\n    // Update the internal mode.\n    this._mode = value;\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = value;\n\n    // Get the layout for the panel.\n    let layout = this.layout as DockLayout;\n\n    // Configure the layout for the specified mode.\n    switch (value) {\n      case 'multiple-document':\n        for (const tabBar of layout.tabBars()) {\n          tabBar.show();\n        }\n        break;\n      case 'single-document':\n        layout.restoreLayout(Private.createSingleDocumentConfig(this));\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Whether the tabs can be dragged / moved at runtime.\n   */\n  get tabsMovable(): boolean {\n    return this._tabsMovable;\n  }\n\n  /**\n   * Enable / Disable draggable / movable tabs.\n   */\n  set tabsMovable(value: boolean) {\n    this._tabsMovable = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.tabsMovable = value;\n    }\n  }\n\n  /**\n   * Whether the tabs are constrained to their source dock panel\n   */\n  get tabsConstrained(): boolean {\n    return this._tabsConstrained;\n  }\n\n  /**\n   * Constrain/Allow tabs to be dragged outside of this dock panel\n   */\n  set tabsConstrained(value: boolean) {\n    this._tabsConstrained = value;\n  }\n\n  /**\n   * Whether the add buttons for each tab bar are enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add buttons for each tab bar are enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    this._addButtonEnabled = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.addButtonEnabled = value;\n    }\n  }\n\n  /**\n   * Whether the dock panel is empty.\n   */\n  get isEmpty(): boolean {\n    return (this.layout as DockLayout).isEmpty;\n  }\n\n  /**\n   * Create an iterator over the user widgets in the panel.\n   *\n   * @returns A new iterator over the user widgets in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  *widgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).widgets();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the panel.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the panel.\n   */\n  *selectedWidgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).selectedWidgets();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the panel.\n   *\n   * @returns A new iterator over the tab bars in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  *tabBars(): IterableIterator<TabBar<Widget>> {\n    yield* (this.layout as DockLayout).tabBars();\n  }\n\n  /**\n   * Create an iterator over the handles in the panel.\n   *\n   * @returns A new iterator over the handles in the panel.\n   */\n  *handles(): IterableIterator<HTMLDivElement> {\n    yield* (this.layout as DockLayout).handles();\n  }\n\n  /**\n   * Select a specific widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will make the widget the current widget in its tab area.\n   */\n  selectWidget(widget: Widget): void {\n    // Find the tab bar which contains the widget.\n    let tabBar = find(this.tabBars(), bar => {\n      return bar.titles.indexOf(widget.title) !== -1;\n    });\n\n    // Throw an error if no tab bar is found.\n    if (!tabBar) {\n      throw new Error('Widget is not contained in the dock panel.');\n    }\n\n    // Ensure the widget is the current widget.\n    tabBar.currentTitle = widget.title;\n  }\n\n  /**\n   * Activate a specified widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will select and activate the given widget.\n   */\n  activateWidget(widget: Widget): void {\n    this.selectWidget(widget);\n    widget.activate();\n  }\n\n  /**\n   * Save the current layout configuration of the dock panel.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockPanel.ILayoutConfig {\n    return (this.layout as DockLayout).saveLayout();\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   *\n   * The dock panel automatically reverts to `'multiple-document'`\n   * mode when a layout config is restored.\n   */\n  restoreLayout(config: DockPanel.ILayoutConfig): void {\n    // Reset the mode.\n    this._mode = 'multiple-document';\n\n    // Restore the layout.\n    (this.layout as DockLayout).restoreLayout(config);\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Add a widget to the dock panel.\n   *\n   * @param widget - The widget to add to the dock panel.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * If the panel is in single document mode, the options are ignored\n   * and the widget is always added as tab in the hidden tab bar.\n   */\n  addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n    // Add the widget to the layout.\n    if (this._mode === 'single-document') {\n      (this.layout as DockLayout).addWidget(widget);\n    } else {\n      (this.layout as DockLayout).addWidget(widget, options);\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   */\n  processMessage(msg: Message): void {\n    if (msg.type === 'layout-modified') {\n      this._layoutModified.emit(undefined);\n    } else {\n      super.processMessage(msg);\n    }\n  }\n\n  /**\n   * Handle the DOM events for the dock panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'lm-dragenter':\n        this._evtDragEnter(event as Drag.Event);\n        break;\n      case 'lm-dragleave':\n        this._evtDragLeave(event as Drag.Event);\n        break;\n      case 'lm-dragover':\n        this._evtDragOver(event as Drag.Event);\n        break;\n      case 'lm-drop':\n        this._evtDrop(event as Drag.Event);\n        break;\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('lm-dragenter', this);\n    this.node.addEventListener('lm-dragleave', this);\n    this.node.addEventListener('lm-dragover', this);\n    this.node.addEventListener('lm-drop', this);\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('lm-dragenter', this);\n    this.node.removeEventListener('lm-dragleave', this);\n    this.node.removeEventListener('lm-dragover', this);\n    this.node.removeEventListener('lm-drop', this);\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Add the widget class to the child.\n    msg.child.addClass('lm-DockPanel-widget');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Remove the widget class from the child.\n    msg.child.removeClass('lm-DockPanel-widget');\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `'lm-dragenter'` event for the dock panel.\n   */\n  private _evtDragEnter(event: Drag.Event): void {\n    // If the factory mime type is present, mark the event as\n    // handled in order to get the rest of the drag events.\n    if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n  }\n\n  /**\n   * Handle the `'lm-dragleave'` event for the dock panel.\n   */\n  private _evtDragLeave(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    if (this._tabsConstrained && event.source !== this) return;\n\n    event.stopPropagation();\n\n    // The new target might be a descendant, so we might still handle the drop.\n    // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n    // hide is cancelled by the lm-dragover handler's show overlay logic.\n    this.overlay.hide(1);\n  }\n\n  /**\n   * Handle the `'lm-dragover'` event for the dock panel.\n   */\n  private _evtDragOver(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Show the drop indicator overlay and update the drop\n    // action based on the drop target zone under the mouse.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      this._showOverlay(event.clientX, event.clientY) === 'invalid'\n    ) {\n      event.dropAction = 'none';\n    } else {\n      event.stopPropagation();\n      event.dropAction = event.proposedAction;\n    }\n  }\n\n  /**\n   * Handle the `'lm-drop'` event for the dock panel.\n   */\n  private _evtDrop(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Hide the drop indicator overlay.\n    this.overlay.hide(0);\n\n    // Bail if the proposed action is to do nothing.\n    if (event.proposedAction === 'none') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the drop target under the mouse.\n    let { clientX, clientY } = event;\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // Bail if the drop zone is invalid.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      zone === 'invalid'\n    ) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory mime type has invalid data.\n    let mimeData = event.mimeData;\n    let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n    if (typeof factory !== 'function') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory does not produce a widget.\n    let widget = factory();\n    if (!(widget instanceof Widget)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the widget is an ancestor of the dock panel.\n    if (widget.contains(this)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the reference widget for the drop target.\n    let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n    // Add the widget according to the indicated drop zone.\n    switch (zone) {\n      case 'root-all':\n        this.addWidget(widget);\n        break;\n      case 'root-top':\n        this.addWidget(widget, { mode: 'split-top' });\n        break;\n      case 'root-left':\n        this.addWidget(widget, { mode: 'split-left' });\n        break;\n      case 'root-right':\n        this.addWidget(widget, { mode: 'split-right' });\n        break;\n      case 'root-bottom':\n        this.addWidget(widget, { mode: 'split-bottom' });\n        break;\n      case 'widget-all':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      case 'widget-top':\n        this.addWidget(widget, { mode: 'split-top', ref });\n        break;\n      case 'widget-left':\n        this.addWidget(widget, { mode: 'split-left', ref });\n        break;\n      case 'widget-right':\n        this.addWidget(widget, { mode: 'split-right', ref });\n        break;\n      case 'widget-bottom':\n        this.addWidget(widget, { mode: 'split-bottom', ref });\n        break;\n      case 'widget-tab':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Accept the proposed drop action.\n    event.dropAction = event.proposedAction;\n\n    // Stop propagation if we have not bailed so far.\n    event.stopPropagation();\n\n    // Activate the dropped widget.\n    this.activateWidget(widget);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the dock panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      // Finalize the mouse release.\n      this._releaseMouse();\n\n      // Schedule an emit of the layout modified signal.\n      MessageLoop.postMessage(this, Private.LayoutModified);\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the dock panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the mouse target, if any.\n    let layout = this.layout as DockLayout;\n    let target = event.target as HTMLElement;\n    let handle = find(layout.handles(), handle => handle.contains(target));\n    if (!handle) {\n      return;\n    }\n\n    // Stop the event when a handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    this._document.addEventListener('keydown', this, true);\n    this._document.addEventListener('pointerup', this, true);\n    this._document.addEventListener('pointermove', this, true);\n    this._document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset deltas for the handle press.\n    let rect = handle.getBoundingClientRect();\n    let deltaX = event.clientX - rect.left;\n    let deltaY = event.clientY - rect.top;\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!, this._document);\n    this._pressData = { handle, deltaX, deltaY, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the dock panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event when dragging a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let rect = this.node.getBoundingClientRect();\n    let xPos = event.clientX - rect.left - this._pressData.deltaX;\n    let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n    // Set the handle as close to the desired position as possible.\n    let layout = this.layout as DockLayout;\n    layout.moveHandle(this._pressData.handle, xPos, yPos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the dock panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Release the mouse grab for the dock panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra document listeners.\n    this._document.removeEventListener('keydown', this, true);\n    this._document.removeEventListener('pointerup', this, true);\n    this._document.removeEventListener('pointermove', this, true);\n    this._document.removeEventListener('contextmenu', this, true);\n  }\n\n  /**\n   * Show the overlay indicator at the given client position.\n   *\n   * Returns the drop zone at the specified client position.\n   *\n   * #### Notes\n   * If the position is not over a valid zone, the overlay is hidden.\n   */\n  private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n    // Find the dock target for the given client position.\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // If the drop zone is invalid, hide the overlay and bail.\n    if (zone === 'invalid') {\n      this.overlay.hide(100);\n      return zone;\n    }\n\n    // Setup the variables needed to compute the overlay geometry.\n    let top: number;\n    let left: number;\n    let right: number;\n    let bottom: number;\n    let box = ElementExt.boxSizing(this.node); // TODO cache this?\n    let rect = this.node.getBoundingClientRect();\n\n    // Compute the overlay geometry based on the dock zone.\n    switch (zone) {\n      case 'root-all':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-top':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = rect.height * Private.GOLDEN_RATIO;\n        break;\n      case 'root-left':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = rect.width * Private.GOLDEN_RATIO;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-right':\n        top = box.paddingTop;\n        left = rect.width * Private.GOLDEN_RATIO;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-bottom':\n        top = rect.height * Private.GOLDEN_RATIO;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'widget-all':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-top':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height / 2;\n        break;\n      case 'widget-left':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right + target!.width / 2;\n        bottom = target!.bottom;\n        break;\n      case 'widget-right':\n        top = target!.top;\n        left = target!.left + target!.width / 2;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-bottom':\n        top = target!.top + target!.height / 2;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-tab': {\n        const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height - tabHeight;\n        break;\n      }\n      default:\n        throw 'unreachable';\n    }\n\n    // Show the overlay with the computed geometry.\n    this.overlay.show({ top, left, right, bottom });\n\n    // Finally, return the computed drop zone.\n    return zone;\n  }\n\n  /**\n   * Create a new tab bar for use by the panel.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar.\n    let tabBar = this._renderer.createTabBar(this._document);\n\n    // Set the generated tab bar property for the tab bar.\n    Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n    // Hide the tab bar when in single document mode.\n    if (this._mode === 'single-document') {\n      tabBar.hide();\n    }\n\n    // Enforce necessary tab bar behavior.\n    // TODO do we really want to enforce *all* of these?\n    tabBar.tabsMovable = this._tabsMovable;\n    tabBar.allowDeselect = false;\n    tabBar.addButtonEnabled = this._addButtonEnabled;\n    tabBar.removeBehavior = 'select-previous-tab';\n    tabBar.insertBehavior = 'select-tab-if-needed';\n\n    // Connect the signal handlers for the tab bar.\n    tabBar.tabMoved.connect(this._onTabMoved, this);\n    tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n    tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n    tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for use by the panel.\n   */\n  private _createHandle(): HTMLDivElement {\n    return this._renderer.createHandle();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from a tab bar.\n   */\n  private _onTabMoved(): void {\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `currentChanged` signal from a tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousTitle, currentTitle } = args;\n\n    // Hide the previous widget.\n    if (previousTitle) {\n      previousTitle.owner.hide();\n    }\n\n    // Show the current widget.\n    if (currentTitle) {\n      currentTitle.owner.show();\n    }\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `addRequested` signal from a tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from a tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from a tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabDetachRequested` signal from a tab bar.\n   */\n  private _onTabDetachRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabDetachRequestedArgs<Widget>\n  ): void {\n    // Do nothing if a drag is already in progress.\n    if (this._drag) {\n      return;\n    }\n\n    // Release the tab bar's hold on the mouse.\n    sender.releaseMouse();\n\n    // Extract the data from the args.\n    let { title, tab, clientX, clientY, offset } = args;\n\n    // Setup the mime data for the drag operation.\n    let mimeData = new MimeData();\n    let factory = () => title.owner;\n    mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n    // Create the drag image for the drag operation.\n    let dragImage = tab.cloneNode(true) as HTMLElement;\n    if (offset) {\n      dragImage.style.top = `-${offset.y}px`;\n      dragImage.style.left = `-${offset.x}px`;\n    }\n\n    // Create the drag object to manage the drag-drop operation.\n    this._drag = new Drag({\n      document: this._document,\n      mimeData,\n      dragImage,\n      proposedAction: 'move',\n      supportedActions: 'move',\n      source: this\n    });\n\n    // Hide the tab node in the original tab.\n    tab.classList.add('lm-mod-hidden');\n    let cleanup = () => {\n      this._drag = null;\n      tab.classList.remove('lm-mod-hidden');\n    };\n\n    // Start the drag operation and cleanup when done.\n    this._drag.start(clientX, clientY).then(cleanup);\n  }\n\n  private _edges: DockPanel.IEdges;\n  private _document: Document | ShadowRoot;\n  private _mode: DockPanel.Mode;\n  private _drag: Drag | null = null;\n  private _renderer: DockPanel.IRenderer;\n  private _tabsMovable: boolean = true;\n  private _tabsConstrained: boolean = false;\n  private _addButtonEnabled: boolean = false;\n  private _pressData: Private.IPressData | null = null;\n  private _layoutModified = new Signal<this, void>(this);\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n  /**\n   * An options object for creating a dock panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n    /**\n     * The overlay to use with the dock panel.\n     *\n     * The default is a new `Overlay` instance.\n     */\n    overlay?: IOverlay;\n\n    /**\n     * The renderer to use for the dock panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The spacing between the items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The mode for the dock panel.\n     *\n     * The default is `'multiple-document'`.\n     */\n    mode?: DockPanel.Mode;\n\n    /**\n     * The sizes of the edge drop zones, in pixels.\n     * If not given, default values will be used.\n     */\n    edges?: IEdges;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * Allow tabs to be draggable / movable by user.\n     *\n     * The default is `'true'`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Constrain tabs to this dock panel\n     *\n     * The default is `'false'`.\n     */\n    tabsConstrained?: boolean;\n\n    /**\n     * Enable add buttons in each of the dock panel's tab bars.\n     *\n     * The default is `'false'`.\n     */\n    addButtonEnabled?: boolean;\n  }\n\n  /**\n   * The sizes of the edge drop zones, in pixels.\n   */\n  export interface IEdges {\n    /**\n     * The size of the top edge drop zone.\n     */\n    top: number;\n\n    /**\n     * The size of the right edge drop zone.\n     */\n    right: number;\n\n    /**\n     * The size of the bottom edge drop zone.\n     */\n    bottom: number;\n\n    /**\n     * The size of the left edge drop zone.\n     */\n    left: number;\n  }\n\n  /**\n   * A type alias for the supported dock panel modes.\n   */\n  export type Mode =\n    | /**\n     * The single document mode.\n     *\n     * In this mode, only a single widget is visible at a time, and that\n     * widget fills the available layout space. No tab bars are visible.\n     */\n    'single-document'\n\n    /**\n     * The multiple document mode.\n     *\n     * In this mode, multiple documents are displayed in separate tab\n     * areas, and those areas can be individually resized by the user.\n     */\n    | 'multiple-document';\n\n  /**\n   * A type alias for a layout configuration object.\n   */\n  export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n  /**\n   * A type alias for the supported insertion modes.\n   */\n  export type InsertMode = DockLayout.InsertMode;\n\n  /**\n   * A type alias for the add widget options.\n   */\n  export type IAddOptions = DockLayout.IAddOptions;\n\n  /**\n   * An object which holds the geometry for overlay positioning.\n   */\n  export interface IOverlayGeometry {\n    /**\n     * The distance between the overlay and parent top edges.\n     */\n    top: number;\n\n    /**\n     * The distance between the overlay and parent left edges.\n     */\n    left: number;\n\n    /**\n     * The distance between the overlay and parent right edges.\n     */\n    right: number;\n\n    /**\n     * The distance between the overlay and parent bottom edges.\n     */\n    bottom: number;\n  }\n\n  /**\n   * An object which manages the overlay node for a dock panel.\n   */\n  export interface IOverlay {\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     *\n     * #### Notes\n     * The given geometry values assume the node will use absolute\n     * positioning.\n     *\n     * This is called on every mouse move event during a drag in order\n     * to update the position of the overlay. It should be efficient.\n     */\n    show(geo: IOverlayGeometry): void;\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 should hide the overlay immediately.\n     *\n     * #### Notes\n     * This is called whenever the overlay node should been hidden.\n     */\n    hide(delay: number): void;\n  }\n\n  /**\n   * A concrete implementation of `IOverlay`.\n   *\n   * This is the default overlay implementation for a dock panel.\n   */\n  export class Overlay implements IOverlay {\n    /**\n     * Construct a new overlay.\n     */\n    constructor() {\n      this.node = document.createElement('div');\n      this.node.classList.add('lm-DockPanel-overlay');\n      this.node.classList.add('lm-mod-hidden');\n      this.node.style.position = 'absolute';\n      this.node.style.contain = 'strict';\n    }\n\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     */\n    show(geo: IOverlayGeometry): void {\n      // Update the position of the overlay.\n      let style = this.node.style;\n      style.top = `${geo.top}px`;\n      style.left = `${geo.left}px`;\n      style.right = `${geo.right}px`;\n      style.bottom = `${geo.bottom}px`;\n\n      // Clear any pending hide timer.\n      clearTimeout(this._timer);\n      this._timer = -1;\n\n      // If the overlay is already visible, we're done.\n      if (!this._hidden) {\n        return;\n      }\n\n      // Clear the hidden flag.\n      this._hidden = false;\n\n      // Finally, show the overlay.\n      this.node.classList.remove('lm-mod-hidden');\n    }\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 will hide the overlay immediately.\n     */\n    hide(delay: number): void {\n      // Do nothing if the overlay is already hidden.\n      if (this._hidden) {\n        return;\n      }\n\n      // Hide immediately if the delay is <= 0.\n      if (delay <= 0) {\n        clearTimeout(this._timer);\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n        return;\n      }\n\n      // Do nothing if a hide is already pending.\n      if (this._timer !== -1) {\n        return;\n      }\n\n      // Otherwise setup the hide timer.\n      this._timer = window.setTimeout(() => {\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n      }, delay);\n    }\n\n    private _timer = -1;\n    private _hidden = true;\n  }\n\n  /**\n   * A type alias for a dock panel renderer;\n   */\n  export type IRenderer = DockLayout.IRenderer;\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new tab bar for use with a dock panel.\n     *\n     * @returns A new tab bar for a dock panel.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget> {\n      let bar = new TabBar<Widget>({ document });\n      bar.addClass('lm-DockPanel-tabBar');\n      return bar;\n    }\n\n    /**\n     * Create a new handle node for use with a dock panel.\n     *\n     * @returns A new handle node for a dock panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-DockPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * The default sizes for the edge drop zones, in pixels.\n   */\n  export const DEFAULT_EDGES = {\n    /**\n     * The size of the top edge dock zone for the root panel, in pixels.\n     * This is different from the others to distinguish between the top\n     * tab bar and the top root zone.\n     */\n    top: 12,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    right: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    bottom: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    left: 40\n  };\n\n  /**\n   * A singleton `'layout-modified'` conflatable message.\n   */\n  export const LayoutModified = new ConflatableMessage('layout-modified');\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The handle which was pressed.\n     */\n    handle: HTMLDivElement;\n\n    /**\n     * The X offset of the press in handle coordinates.\n     */\n    deltaX: number;\n\n    /**\n     * The Y offset of the press in handle coordinates.\n     */\n    deltaY: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * A type alias for a drop zone.\n   */\n  export type DropZone =\n    | /**\n     * An invalid drop zone.\n     */\n    'invalid'\n\n    /**\n     * The entirety of the root dock area.\n     */\n    | 'root-all'\n\n    /**\n     * The top portion of the root dock area.\n     */\n    | 'root-top'\n\n    /**\n     * The left portion of the root dock area.\n     */\n    | 'root-left'\n\n    /**\n     * The right portion of the root dock area.\n     */\n    | 'root-right'\n\n    /**\n     * The bottom portion of the root dock area.\n     */\n    | 'root-bottom'\n\n    /**\n     * The entirety of a tabbed widget area.\n     */\n    | 'widget-all'\n\n    /**\n     * The top portion of tabbed widget area.\n     */\n    | 'widget-top'\n\n    /**\n     * The left portion of tabbed widget area.\n     */\n    | 'widget-left'\n\n    /**\n     * The right portion of tabbed widget area.\n     */\n    | 'widget-right'\n\n    /**\n     * The bottom portion of tabbed widget area.\n     */\n    | 'widget-bottom'\n\n    /**\n     * The the bar of a tabbed widget area.\n     */\n    | 'widget-tab';\n\n  /**\n   * An object which holds the drop target zone and widget.\n   */\n  export interface IDropTarget {\n    /**\n     * The semantic zone for the mouse position.\n     */\n    zone: DropZone;\n\n    /**\n     * The tab area geometry for the drop zone, or `null`.\n     */\n    target: DockLayout.ITabAreaGeometry | null;\n  }\n\n  /**\n   * An attached property used to track generated tab bars.\n   */\n  export const isGeneratedTabBarProperty = new AttachedProperty<\n    Widget,\n    boolean\n  >({\n    name: 'isGeneratedTabBar',\n    create: () => false\n  });\n\n  /**\n   * Create a single document config for the widgets in a dock panel.\n   */\n  export function createSingleDocumentConfig(\n    panel: DockPanel\n  ): DockPanel.ILayoutConfig {\n    // Return an empty config if the panel is empty.\n    if (panel.isEmpty) {\n      return { main: null };\n    }\n\n    // Get a flat array of the widgets in the panel.\n    let widgets = Array.from(panel.widgets());\n\n    // Get the first selected widget in the panel.\n    let selected = panel.selectedWidgets().next().value;\n\n    // Compute the current index for the new config.\n    let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n    // Return the single document config.\n    return { main: { type: 'tab-area', widgets, currentIndex } };\n  }\n\n  /**\n   * Find the drop target at the given client position.\n   */\n  export function findDropTarget(\n    panel: DockPanel,\n    clientX: number,\n    clientY: number,\n    edges: DockPanel.IEdges\n  ): IDropTarget {\n    // Bail if the mouse is not over the dock panel.\n    if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Look up the layout for the panel.\n    let layout = panel.layout as DockLayout;\n\n    // If the layout is empty, indicate the entire root drop zone.\n    if (layout.isEmpty) {\n      return { zone: 'root-all', target: null };\n    }\n\n    // Test the edge zones when in multiple document mode.\n    if (panel.mode === 'multiple-document') {\n      // Get the client rect for the dock panel.\n      let panelRect = panel.node.getBoundingClientRect();\n\n      // Compute the distance to each edge of the panel.\n      let pl = clientX - panelRect.left + 1;\n      let pt = clientY - panelRect.top + 1;\n      let pr = panelRect.right - clientX;\n      let pb = panelRect.bottom - clientY;\n\n      // Find the minimum distance to an edge.\n      let pd = Math.min(pt, pr, pb, pl);\n\n      // Return a root zone if the mouse is within an edge.\n      switch (pd) {\n        case pt:\n          if (pt < edges.top) {\n            return { zone: 'root-top', target: null };\n          }\n          break;\n        case pr:\n          if (pr < edges.right) {\n            return { zone: 'root-right', target: null };\n          }\n          break;\n        case pb:\n          if (pb < edges.bottom) {\n            return { zone: 'root-bottom', target: null };\n          }\n          break;\n        case pl:\n          if (pl < edges.left) {\n            return { zone: 'root-left', target: null };\n          }\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Hit test the dock layout at the given client position.\n    let target = layout.hitTestTabAreas(clientX, clientY);\n\n    // Bail if no target area was found.\n    if (!target) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Return the whole tab area when in single document mode.\n    if (panel.mode === 'single-document') {\n      return { zone: 'widget-all', target };\n    }\n\n    // Compute the distance to each edge of the tab area.\n    let al = target.x - target.left + 1;\n    let at = target.y - target.top + 1;\n    let ar = target.left + target.width - target.x;\n    let ab = target.top + target.height - target.y;\n\n    const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n    if (at < tabHeight) {\n      return { zone: 'widget-tab', target };\n    }\n\n    // Get the X and Y edge sizes for the area.\n    let rx = Math.round(target.width / 3);\n    let ry = Math.round(target.height / 3);\n\n    // If the mouse is not within an edge, indicate the entire area.\n    if (al > rx && ar > rx && at > ry && ab > ry) {\n      return { zone: 'widget-all', target };\n    }\n\n    // Scale the distances by the slenderness ratio.\n    al /= rx;\n    at /= ry;\n    ar /= rx;\n    ab /= ry;\n\n    // Find the minimum distance to the area edge.\n    let ad = Math.min(al, at, ar, ab);\n\n    // Find the widget zone for the area edge.\n    let zone: DropZone;\n    switch (ad) {\n      case al:\n        zone = 'widget-left';\n        break;\n      case at:\n        zone = 'widget-top';\n        break;\n      case ar:\n        zone = 'widget-right';\n        break;\n      case ab:\n        zone = 'widget-bottom';\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Return the final drop target.\n    return { zone, target };\n  }\n\n  /**\n   * Get the drop reference widget for a tab bar.\n   */\n  export function getDropRef(tabBar: TabBar<Widget>): Widget | null {\n    if (tabBar.titles.length === 0) {\n      return null;\n    }\n    if (tabBar.currentTitle) {\n      return tabBar.currentTitle.owner;\n    }\n    return tabBar.titles[tabBar.titles.length - 1].owner;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker<T extends Widget> implements IDisposable {\n  /**\n   * Dispose of the resources held by the tracker.\n   */\n  dispose(): void {\n    // Do nothing if the tracker is already disposed.\n    if (this._counter < 0) {\n      return;\n    }\n\n    // Mark the tracker as disposed.\n    this._counter = -1;\n\n    // Clear the connections for the tracker.\n    Signal.clearData(this);\n\n    // Remove all event listeners.\n    for (const widget of this._widgets) {\n      widget.node.removeEventListener('focus', this, true);\n      widget.node.removeEventListener('blur', this, true);\n    }\n\n    // Clear the internal data structures.\n    this._activeWidget = null;\n    this._currentWidget = null;\n    this._nodes.clear();\n    this._numbers.clear();\n    this._widgets.length = 0;\n  }\n\n  /**\n   * A signal emitted when the current widget has changed.\n   */\n  get currentChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when the active widget has changed.\n   */\n  get activeChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._activeChanged;\n  }\n\n  /**\n   * A flag indicating whether the tracker is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._counter < 0;\n  }\n\n  /**\n   * The current widget in the tracker.\n   *\n   * #### Notes\n   * The current widget is the widget among the tracked widgets which\n   * has the *descendant node* which has most recently been focused.\n   *\n   * The current widget will not be updated if the node loses focus. It\n   * will only be updated when a different tracked widget gains focus.\n   *\n   * If the current widget is removed from the tracker, the previous\n   * current widget will be restored.\n   *\n   * This behavior is intended to follow a user's conceptual model of\n   * a semantically \"current\" widget, where the \"last thing of type X\"\n   * to be interacted with is the \"current instance of X\", regardless\n   * of whether that instance still has focus.\n   */\n  get currentWidget(): T | null {\n    return this._currentWidget;\n  }\n\n  /**\n   * The active widget in the tracker.\n   *\n   * #### Notes\n   * The active widget is the widget among the tracked widgets which\n   * has the *descendant node* which is currently focused.\n   */\n  get activeWidget(): T | null {\n    return this._activeWidget;\n  }\n\n  /**\n   * A read only array of the widgets being tracked.\n   */\n  get widgets(): ReadonlyArray<T> {\n    return this._widgets;\n  }\n\n  /**\n   * Get the focus number for a particular widget in the tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The focus number for the given widget, or `-1` if the\n   *   widget has not had focus since being added to the tracker, or\n   *   is not contained by the tracker.\n   *\n   * #### Notes\n   * The focus number indicates the relative order in which the widgets\n   * have gained focus. A widget with a larger number has gained focus\n   * more recently than a widget with a smaller number.\n   *\n   * The `currentWidget` will always have the largest focus number.\n   *\n   * All widgets start with a focus number of `-1`, which indicates that\n   * the widget has not been focused since being added to the tracker.\n   */\n  focusNumber(widget: T): number {\n    let n = this._numbers.get(widget);\n    return n === undefined ? -1 : n;\n  }\n\n  /**\n   * Test whether the focus tracker contains a given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns `true` if the widget is tracked, `false` otherwise.\n   */\n  has(widget: T): boolean {\n    return this._numbers.has(widget);\n  }\n\n  /**\n   * Add a widget to the focus tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is already tracked, this is a no-op.\n   */\n  add(widget: T): void {\n    // Do nothing if the widget is already tracked.\n    if (this._numbers.has(widget)) {\n      return;\n    }\n\n    // Test whether the widget has focus.\n    let focused = widget.node.contains(document.activeElement);\n\n    // Set up the initial focus number.\n    let n = focused ? this._counter++ : -1;\n\n    // Add the widget to the internal data structures.\n    this._widgets.push(widget);\n    this._numbers.set(widget, n);\n    this._nodes.set(widget.node, widget);\n\n    // Set up the event listeners. The capturing phase must be used\n    // since the 'focus' and 'blur' events don't bubble and Firefox\n    // doesn't support the 'focusin' or 'focusout' events.\n    widget.node.addEventListener('focus', this, true);\n    widget.node.addEventListener('blur', this, true);\n\n    // Connect the disposed signal handler.\n    widget.disposed.connect(this._onWidgetDisposed, this);\n\n    // Set the current and active widgets if needed.\n    if (focused) {\n      this._setWidgets(widget, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the focus tracker.\n   *\n   * #### Notes\n   * If the widget is the `currentWidget`, the previous current widget\n   * will become the new `currentWidget`.\n   *\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is not tracked, this is a no-op.\n   */\n  remove(widget: T): void {\n    // Bail early if the widget is not tracked.\n    if (!this._numbers.has(widget)) {\n      return;\n    }\n\n    // Disconnect the disposed signal handler.\n    widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n    // Remove the event listeners.\n    widget.node.removeEventListener('focus', this, true);\n    widget.node.removeEventListener('blur', this, true);\n\n    // Remove the widget from the internal data structures.\n    ArrayExt.removeFirstOf(this._widgets, widget);\n    this._nodes.delete(widget.node);\n    this._numbers.delete(widget);\n\n    // Bail early if the widget is not the current widget.\n    if (this._currentWidget !== widget) {\n      return;\n    }\n\n    // Filter the widgets for those which have had focus.\n    let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n    // Get the valid widget with the max focus number.\n    let previous =\n      max(valid, (first, second) => {\n        let a = this._numbers.get(first)!;\n        let b = this._numbers.get(second)!;\n        return a - b;\n      }) || null;\n\n    // Set the current and active widgets.\n    this._setWidgets(previous, null);\n  }\n\n  /**\n   * Handle the DOM events for the focus tracker.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tracked nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'focus':\n        this._evtFocus(event as FocusEvent);\n        break;\n      case 'blur':\n        this._evtBlur(event as FocusEvent);\n        break;\n    }\n  }\n\n  /**\n   * Set the current and active widgets for the tracker.\n   */\n  private _setWidgets(current: T | null, active: T | null): void {\n    // Swap the current widget.\n    let oldCurrent = this._currentWidget;\n    this._currentWidget = current;\n\n    // Swap the active widget.\n    let oldActive = this._activeWidget;\n    this._activeWidget = active;\n\n    // Emit the `currentChanged` signal if needed.\n    if (oldCurrent !== current) {\n      this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n    }\n\n    // Emit the `activeChanged` signal if needed.\n    if (oldActive !== active) {\n      this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n    }\n  }\n\n  /**\n   * Handle the `'focus'` event for a tracked widget.\n   */\n  private _evtFocus(event: FocusEvent): void {\n    // Find the widget which gained focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Update the focus number if necessary.\n    if (widget !== this._currentWidget) {\n      this._numbers.set(widget, this._counter++);\n    }\n\n    // Set the current and active widgets.\n    this._setWidgets(widget, widget);\n  }\n\n  /**\n   * Handle the `'blur'` event for a tracked widget.\n   */\n  private _evtBlur(event: FocusEvent): void {\n    // Find the widget which lost focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Get the node which being focused after this blur.\n    let focusTarget = event.relatedTarget as HTMLElement;\n\n    // If no other node is being focused, clear the active widget.\n    if (!focusTarget) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n\n    // Bail if the focus widget is not changing.\n    if (widget.node.contains(focusTarget)) {\n      return;\n    }\n\n    // If no tracked widget is being focused, clear the active widget.\n    if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n  }\n\n  /**\n   * Handle the `disposed` signal for a tracked widget.\n   */\n  private _onWidgetDisposed(sender: T): void {\n    this.remove(sender);\n  }\n\n  private _counter = 0;\n  private _widgets: T[] = [];\n  private _activeWidget: T | null = null;\n  private _currentWidget: T | null = null;\n  private _numbers = new Map<T, number>();\n  private _nodes = new Map<HTMLElement, T>();\n  private _activeChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(this);\n  private _currentChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(\n    this\n  );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n  /**\n   * An arguments object for the changed signals.\n   */\n  export interface IChangedArgs<T extends Widget> {\n    /**\n     * The old value for the widget.\n     */\n    oldValue: T | null;\n\n    /**\n     * The new value for the widget.\n     */\n    newValue: T | null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n  /**\n   * Construct a new grid layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: GridLayout.IOptions = {}) {\n    super(options);\n    if (options.rowCount !== undefined) {\n      Private.reallocSizers(this._rowSizers, options.rowCount);\n    }\n    if (options.columnCount !== undefined) {\n      Private.reallocSizers(this._columnSizers, options.columnCount);\n    }\n    if (options.rowSpacing !== undefined) {\n      this._rowSpacing = Private.clampValue(options.rowSpacing);\n    }\n    if (options.columnSpacing !== undefined) {\n      this._columnSpacing = Private.clampValue(options.columnSpacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the widgets and layout items.\n    for (const item of this._items) {\n      let widget = item.widget;\n      item.dispose();\n      widget.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._rowStarts.length = 0;\n    this._rowSizers.length = 0;\n    this._columnStarts.length = 0;\n    this._columnSizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the number of rows in the layout.\n   */\n  get rowCount(): number {\n    return this._rowSizers.length;\n  }\n\n  /**\n   * Set the number of rows in the layout.\n   *\n   * #### Notes\n   * The minimum row count is `1`.\n   */\n  set rowCount(value: number) {\n    // Do nothing if the row count does not change.\n    if (value === this.rowCount) {\n      return;\n    }\n\n    // Reallocate the row sizers.\n    Private.reallocSizers(this._rowSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the number of columns in the layout.\n   */\n  get columnCount(): number {\n    return this._columnSizers.length;\n  }\n\n  /**\n   * Set the number of columns in the layout.\n   *\n   * #### Notes\n   * The minimum column count is `1`.\n   */\n  set columnCount(value: number) {\n    // Do nothing if the column count does not change.\n    if (value === this.columnCount) {\n      return;\n    }\n\n    // Reallocate the column sizers.\n    Private.reallocSizers(this._columnSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the row spacing for the layout.\n   */\n  get rowSpacing(): number {\n    return this._rowSpacing;\n  }\n\n  /**\n   * Set the row spacing for the layout.\n   */\n  set rowSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._rowSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._rowSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the column spacing for the layout.\n   */\n  get columnSpacing(): number {\n    return this._columnSpacing;\n  }\n\n  /**\n   * Set the col spacing for the layout.\n   */\n  set columnSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._columnSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._columnSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @returns The stretch factor for the row.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  rowStretch(index: number): number {\n    let sizer = this._rowSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @param value - The stretch factor for the row.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setRowStretch(index: number, value: number): void {\n    // Look up the row sizer.\n    let sizer = this._rowSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @returns The stretch factor for the column.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  columnStretch(index: number): number {\n    let sizer = this._columnSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @param value - The stretch factor for the column.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setColumnStretch(index: number, value: number): void {\n    // Look up the column sizer.\n    let sizer = this._columnSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    for (const item of this._items) {\n      yield item.widget;\n    }\n  }\n\n  /**\n   * Add a widget to the grid layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, this is no-op.\n   */\n  addWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is already in the layout.\n    if (i !== -1) {\n      return;\n    }\n\n    // Add the widget to the layout.\n    this._items.push(new LayoutItem(widget));\n\n    // Attach the widget to the parent.\n    if (this.parent) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the grid layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is not in the layout.\n    if (i === -1) {\n      return;\n    }\n\n    // Remove the widget from the layout.\n    let item = ArrayExt.removeAt(this._items, i)!;\n\n    // Detach the widget from the parent.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n\n    // Dispose the layout item.\n    item.dispose();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Reset the min sizes of the sizers.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      this._rowSizers[i].minSize = 0;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      this._columnSizers[i].minSize = 0;\n    }\n\n    // Filter for the visible layout items.\n    let items = this._items.filter(it => !it.isHidden);\n\n    // Fit the layout items.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      items[i].fit();\n    }\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Sort the items by row span.\n    items.sort(Private.rowSpanCmp);\n\n    // Update the min sizes of the row sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the row bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n      // Distribute the minimum height to the sizers as needed.\n      Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n    }\n\n    // Sort the items by column span.\n    items.sort(Private.columnSpanCmp);\n\n    // Update the min sizes of the column sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the column bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let c1 = Math.min(config.column, maxCol);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Distribute the minimum width to the sizers as needed.\n      Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n    }\n\n    // If no size constraint is needed, just update the parent.\n    if (this.fitPolicy === 'set-no-constraint') {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n      return;\n    }\n\n    // Set up the computed min size.\n    let minH = maxRow * this._rowSpacing;\n    let minW = maxCol * this._columnSpacing;\n\n    // Add the sizer minimums to the computed min size.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      minH += this._rowSizers[i].minSize;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      minW += this._columnSizers[i].minSize;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Compute the total fixed row and column space.\n    let fixedRowSpace = maxRow * this._rowSpacing;\n    let fixedColSpace = maxCol * this._columnSpacing;\n\n    // Distribute the available space to the box sizers.\n    BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n    BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n    // Update the row start positions.\n    for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n      this._rowStarts[i] = pos;\n      pos += this._rowSizers[i].size + this._rowSpacing;\n    }\n\n    // Update the column start positions.\n    for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n      this._columnStarts[i] = pos;\n      pos += this._columnSizers[i].size + this._columnSpacing;\n    }\n\n    // Update the geometry of the layout items.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the cell bounds for the widget.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let c1 = Math.min(config.column, maxCol);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Compute the cell geometry.\n      let x = this._columnStarts[c1];\n      let y = this._rowStarts[r1];\n      let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n      let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n      // Update the geometry of the layout item.\n      item.update(x, y, w, h);\n    }\n  }\n\n  private _dirty = false;\n  private _rowSpacing = 4;\n  private _columnSpacing = 4;\n  private _items: LayoutItem[] = [];\n  private _rowStarts: number[] = [];\n  private _columnStarts: number[] = [];\n  private _rowSizers: BoxSizer[] = [new BoxSizer()];\n  private _columnSizers: BoxSizer[] = [new BoxSizer()];\n  private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n  /**\n   * An options object for initializing a grid layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The initial row count for the layout.\n     *\n     * The default is `1`.\n     */\n    rowCount?: number;\n\n    /**\n     * The initial column count for the layout.\n     *\n     * The default is `1`.\n     */\n    columnCount?: number;\n\n    /**\n     * The spacing between rows in the layout.\n     *\n     * The default is `4`.\n     */\n    rowSpacing?: number;\n\n    /**\n     * The spacing between columns in the layout.\n     *\n     * The default is `4`.\n     */\n    columnSpacing?: number;\n  }\n\n  /**\n   * An object which holds the cell configuration for a widget.\n   */\n  export interface ICellConfig {\n    /**\n     * The row index for the widget.\n     */\n    readonly row: number;\n\n    /**\n     * The column index for the widget.\n     */\n    readonly column: number;\n\n    /**\n     * The row span for the widget.\n     */\n    readonly rowSpan: number;\n\n    /**\n     * The column span for the widget.\n     */\n    readonly columnSpan: number;\n  }\n\n  /**\n   * Get the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The cell config for the widget.\n   */\n  export function getCellConfig(widget: Widget): ICellConfig {\n    return Private.cellConfigProperty.get(widget);\n  }\n\n  /**\n   * Set the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the cell config.\n   */\n  export function setCellConfig(\n    widget: Widget,\n    value: Partial<ICellConfig>\n  ): void {\n    Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for the widget cell config.\n   */\n  export const cellConfigProperty = new AttachedProperty<\n    Widget,\n    GridLayout.ICellConfig\n  >({\n    name: 'cellConfig',\n    create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n    changed: onChildCellConfigChanged\n  });\n\n  /**\n   * Normalize a partial cell config object.\n   */\n  export function normalizeConfig(\n    config: Partial<GridLayout.ICellConfig>\n  ): GridLayout.ICellConfig {\n    let row = Math.max(0, Math.floor(config.row || 0));\n    let column = Math.max(0, Math.floor(config.column || 0));\n    let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n    let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n    return { row, column, rowSpan, columnSpan };\n  }\n\n  /**\n   * Clamp a value to an integer >= 0.\n   */\n  export function clampValue(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * A sort comparison function for row spans.\n   */\n  export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.rowSpan - c2.rowSpan;\n  }\n\n  /**\n   * A sort comparison function for column spans.\n   */\n  export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.columnSpan - c2.columnSpan;\n  }\n\n  /**\n   * Reallocate the box sizers for the given grid dimensions.\n   */\n  export function reallocSizers(sizers: BoxSizer[], count: number): void {\n    // Coerce the count to the valid range.\n    count = Math.max(1, Math.floor(count));\n\n    // Add the missing sizers.\n    while (sizers.length < count) {\n      sizers.push(new BoxSizer());\n    }\n\n    // Remove the extra sizers.\n    if (sizers.length > count) {\n      sizers.length = count;\n    }\n  }\n\n  /**\n   * Distribute a min size constraint across a range of sizers.\n   */\n  export function distributeMin(\n    sizers: BoxSizer[],\n    i1: number,\n    i2: number,\n    minSize: number\n  ): void {\n    // Sanity check the indices.\n    if (i2 < i1) {\n      return;\n    }\n\n    // Handle the simple case of no cell span.\n    if (i1 === i2) {\n      let sizer = sizers[i1];\n      sizer.minSize = Math.max(sizer.minSize, minSize);\n      return;\n    }\n\n    // Compute the total current min size of the span.\n    let totalMin = 0;\n    for (let i = i1; i <= i2; ++i) {\n      totalMin += sizers[i].minSize;\n    }\n\n    // Do nothing if the total is greater than the required.\n    if (totalMin >= minSize) {\n      return;\n    }\n\n    // Compute the portion of the space to allocate to each sizer.\n    let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n    // Add the portion to each sizer.\n    for (let i = i1; i <= i2; ++i) {\n      sizers[i].minSize += portion;\n    }\n  }\n\n  /**\n   * The change handler for the child cell config property.\n   */\n  function onChildCellConfigChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof GridLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n  /**\n   * Construct a new menu bar.\n   *\n   * @param options - The options for initializing the menu bar.\n   */\n  constructor(options: MenuBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-MenuBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.renderer = options.renderer || MenuBar.defaultRenderer;\n    this._forceItemsPosition = options.forceItemsPosition || {\n      forceX: true,\n      forceY: true\n    };\n    this._overflowMenuOptions = options.overflowMenuOptions || {\n      isVisible: true\n    };\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._closeChildMenu();\n    this._menus.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the menu bar.\n   */\n  readonly renderer: MenuBar.IRenderer;\n\n  /**\n   * The child menu of the menu bar.\n   *\n   * #### Notes\n   * This will be `null` if the menu bar does not have an open menu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The overflow index of the menu bar.\n   */\n  get overflowIndex(): number {\n    return this._overflowIndex;\n  }\n\n  /**\n   * The overflow menu of the menu bar.\n   */\n  get overflowMenu(): Menu | null {\n    return this._overflowMenu;\n  }\n\n  /**\n   * Get the menu bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu title nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-MenuBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu.\n   */\n  get activeMenu(): Menu | null {\n    return this._menus[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu.\n   *\n   * #### Notes\n   * If the menu does not exist, the menu will be set to `null`.\n   */\n  set activeMenu(value: Menu | null) {\n    this.activeIndex = value ? this._menus.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu.\n   *\n   * #### Notes\n   * This will be `-1` if no menu is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu.\n   *\n   * #### Notes\n   * If the menu cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._menus.length) {\n      value = -1;\n    }\n\n    // An empty menu cannot be active\n    if (value > -1 && this._menus[value].items.length === 0) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menus in the menu bar.\n   */\n  get menus(): ReadonlyArray<Menu> {\n    return this._menus;\n  }\n\n  /**\n   * Open the active menu and activate its first menu item.\n   *\n   * #### Notes\n   * If there is no active menu, this is a no-op.\n   */\n  openActiveMenu(): void {\n    // Bail early if there is no active item.\n    if (this._activeIndex === -1) {\n      return;\n    }\n\n    // Open the child menu.\n    this._openChildMenu();\n\n    // Activate the first item in the child menu.\n    if (this._childMenu) {\n      this._childMenu.activeIndex = -1;\n      this._childMenu.activateNextItem();\n    }\n  }\n\n  /**\n   * Add a menu to the end of the menu bar.\n   *\n   * @param menu - The menu to add to the menu bar.\n   *\n   * #### Notes\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  addMenu(menu: Menu, update: boolean = true): void {\n    this.insertMenu(this._menus.length, menu, update);\n  }\n\n  /**\n   * Insert a menu into the menu bar at the specified index.\n   *\n   * @param index - The index at which to insert the menu.\n   *\n   * @param menu - The menu to insert into the menu bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the menus.\n   *\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  insertMenu(index: number, menu: Menu, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Look up the index of the menu.\n    let i = this._menus.indexOf(menu);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._menus.length));\n\n    // If the menu is not in the array, insert it.\n    if (i === -1) {\n      // Insert the menu into the array.\n      ArrayExt.insert(this._menus, j, menu);\n\n      // Add the styling class to the menu.\n      menu.addClass('lm-MenuBar-menu');\n\n      // Connect to the menu signals.\n      menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n      menu.menuRequested.connect(this._onMenuMenuRequested, this);\n      menu.title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the items.\n      if (update) {\n        this.update();\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the menu exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._menus.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the menu to the new locations.\n    ArrayExt.move(this._menus, i, j);\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove a menu from the menu bar.\n   *\n   * @param menu - The menu to remove from the menu bar.\n   *\n   * #### Notes\n   * This is a no-op if the menu is not in the menu bar.\n   */\n  removeMenu(menu: Menu, update: boolean = true): void {\n    this.removeMenuAt(this._menus.indexOf(menu), update);\n  }\n\n  /**\n   * Remove the menu at a given index from the menu bar.\n   *\n   * @param index - The index of the menu to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeMenuAt(index: number, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Remove the menu from the array.\n    let menu = ArrayExt.removeAt(this._menus, index);\n\n    // Bail if the index is out of range.\n    if (!menu) {\n      return;\n    }\n\n    // Disconnect from the menu signals.\n    menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n    menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n    menu.title.changed.disconnect(this._onTitleChanged, this);\n\n    // Remove the styling class from the menu.\n    menu.removeClass('lm-MenuBar-menu');\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove all menus from the menu bar.\n   */\n  clearMenus(): void {\n    // Bail if there is nothing to remove.\n    if (this._menus.length === 0) {\n      return;\n    }\n\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Disconnect from the menu signals and remove the styling class.\n    for (let menu of this._menus) {\n      menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n      menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n      menu.title.changed.disconnect(this._onTitleChanged, this);\n      menu.removeClass('lm-MenuBar-menu');\n    }\n\n    // Clear the menus array.\n    this._menus.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the menu bar.\n   *\n   * @param event - The DOM event sent to the menu bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu bar's DOM nodes. It\n   * should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n      case 'mouseleave':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'focusout':\n        this._evtFocusOut(event as FocusEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mousedown', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('focusout', this);\n    this.node.addEventListener('contextmenu', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mousedown', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('focusout', this);\n    this.node.removeEventListener('contextmenu', this);\n    this._closeChildMenu();\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this._focusItemAt(0);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    this.update();\n    super.onResize(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let menus = this._menus;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let tabFocusIndex =\n      this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n        ? this._tabFocusIndex\n        : 0;\n    let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n    let totalMenuSize = 0;\n    let isVisible = false;\n\n    // Check that the overflow menu doesn't count\n    length = this._overflowMenu !== null ? length - 1 : length;\n    let content = new Array<VirtualElement>(length);\n\n    // Render visible menus\n    for (let i = 0; i < length; ++i) {\n      content[i] = renderer.renderItem({\n        title: menus[i].title,\n        active: i === activeIndex,\n        tabbable: i === tabFocusIndex,\n        disabled: menus[i].items.length === 0,\n        onfocus: () => {\n          this._tabFocusIndex = i;\n          this.activeIndex = i;\n        }\n      });\n      // Calculate size of current menu\n      totalMenuSize += this._menuItemSizes[i];\n      // Check if overflow menu is already rendered\n      if (menus[i].title.label === this._overflowMenuOptions.title) {\n        isVisible = true;\n        length--;\n      }\n    }\n    // Render overflow menu if needed and active\n    if (this._overflowMenuOptions.isVisible) {\n      if (this._overflowIndex > -1 && !isVisible) {\n        // Create overflow menu\n        if (this._overflowMenu === null) {\n          const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n          this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n          this._overflowMenu.title.label = overflowMenuTitle;\n          this._overflowMenu.title.mnemonic = 0;\n          this.addMenu(this._overflowMenu, false);\n        }\n        // Move menus to overflow menu\n        for (let i = menus.length - 2; i >= length; i--) {\n          const submenu = this.menus[i];\n          submenu.title.mnemonic = 0;\n          this._overflowMenu.insertItem(0, {\n            type: 'submenu',\n            submenu: submenu\n          });\n          this.removeMenu(submenu, false);\n        }\n        content[length] = renderer.renderItem({\n          title: this._overflowMenu.title,\n          active: length === activeIndex && menus[length].items.length !== 0,\n          tabbable: length === tabFocusIndex,\n          disabled: menus[length].items.length === 0,\n          onfocus: () => {\n            this._tabFocusIndex = length;\n            this.activeIndex = length;\n          }\n        });\n        length++;\n      } else if (this._overflowMenu !== null) {\n        // Remove submenus from overflow menu\n        let overflowMenuItems = this._overflowMenu.items;\n        let screenSize = this.node.offsetWidth;\n        let n = this._overflowMenu.items.length;\n        for (let i = 0; i < n; ++i) {\n          let index = menus.length - 1 - i;\n          if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n            let menu = overflowMenuItems[0].submenu as Menu;\n            this._overflowMenu.removeItemAt(0);\n            this.insertMenu(length, menu, false);\n            content[length] = renderer.renderItem({\n              title: menu.title,\n              active: false,\n              tabbable: length === tabFocusIndex,\n              disabled: menus[length].items.length === 0,\n              onfocus: () => {\n                this._tabFocusIndex = length;\n                this.activeIndex = length;\n              }\n            });\n            length++;\n          }\n        }\n        if (this._overflowMenu.items.length === 0) {\n          this.removeMenu(this._overflowMenu, false);\n          content.pop();\n          this._overflowMenu = null;\n          this._overflowIndex = -1;\n        }\n      }\n    }\n    VirtualDOM.render(content, this.contentNode);\n    this._updateOverflowIndex();\n  }\n\n  /**\n   * Calculate and update the current overflow index.\n   */\n  private _updateOverflowIndex(): void {\n    if (!this._overflowMenuOptions.isVisible) {\n      return;\n    }\n\n    // Get elements visible in the main menu bar\n    const itemMenus = this.contentNode.childNodes;\n    let screenSize = this.node.offsetWidth;\n    let totalMenuSize = 0;\n    let index = -1;\n    let n = itemMenus.length;\n\n    if (this._menuItemSizes.length == 0) {\n      // Check if it is the first resize and get info about menu items sizes\n      for (let i = 0; i < n; i++) {\n        let item = itemMenus[i] as HTMLLIElement;\n        // Add sizes to array\n        totalMenuSize += item.offsetWidth;\n        this._menuItemSizes.push(item.offsetWidth);\n        if (totalMenuSize > screenSize && index === -1) {\n          index = i;\n        }\n      }\n    } else {\n      // Calculate current menu size\n      for (let i = 0; i < this._menuItemSizes.length; i++) {\n        totalMenuSize += this._menuItemSizes[i];\n        if (totalMenuSize > screenSize) {\n          index = i;\n          break;\n        }\n      }\n    }\n    this._overflowIndex = index;\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu bar.\n   *\n   * #### Notes\n   * All keys are trapped except the tab key that is ignored.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Reset the active index on tab, but do not trap the tab key.\n    if (kc === 9) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // A menu bar handles all other keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Enter, Space, Up Arrow, Down Arrow\n    if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n      // The active index may have changed (for example, user hovers over an\n      // item with the mouse), so be sure to use the focus index.\n      this.activeIndex = this._tabFocusIndex;\n      if (this.activeIndex !== this._tabFocusIndex) {\n        // Bail if the setter refused to set activeIndex to tabFocusIndex\n        // because it means that the item at tabFocusIndex cannot be opened (for\n        // example, it has an empty menu)\n        return;\n      }\n      this.openActiveMenu();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this._closeChildMenu();\n      this._focusItemAt(this.activeIndex);\n      return;\n    }\n\n    // Left or Right Arrow\n    if (kc === 37 || kc === 39) {\n      let direction = kc === 37 ? -1 : 1;\n      let start = this._tabFocusIndex + direction;\n      let n = this._menus.length;\n      for (let i = 0; i < n; i++) {\n        let index = (n + start + direction * i) % n;\n        if (this._menus[index].items.length) {\n          this._focusItemAt(index);\n          return;\n        }\n      }\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._menus, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that menu is opened.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.openActiveMenu();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n      this._focusItemAt(this.activeIndex);\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n      this._focusItemAt(this.activeIndex);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the mouse press was not on the menu bar. This can occur\n    // when the document listener is installed for an active menu bar.\n    if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n      return;\n    }\n\n    // Stop the propagation of the event. Immediate propagation is\n    // also stopped so that an open menu does not handle the event.\n    event.stopPropagation();\n    event.stopImmediatePropagation();\n\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // If the press was not on an item, close the child menu.\n    if (index === -1) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // If the press was not the left mouse button, do nothing further.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Otherwise, toggle the open state of the child menu.\n    if (this._childMenu) {\n      this._closeChildMenu();\n      this.activeIndex = index;\n    } else {\n      // If we don't call preventDefault() here, then the item in the menu\n      // bar will take focus over the menu that is being opened.\n      event.preventDefault();\n      const position = this._positionForMenu(index);\n      Menu.saveWindowData();\n      // Begin DOM modifications.\n      this.activeIndex = index;\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the active index will not change.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Bail early if a child menu is open and the mouse is not over\n    // an item. This allows the child menu to be kept open when the\n    // mouse is over the empty part of the menu bar.\n    if (index === -1 && this._childMenu) {\n      return;\n    }\n\n    // Get position for the new menu >before< updating active index.\n    const position =\n      index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n    // Before any modification, update window data.\n    Menu.saveWindowData();\n\n    // Begin DOM modifications.\n\n    // Update the active index to the hovered item.\n    this.activeIndex = index;\n\n    // Open the new menu if a menu is already open.\n    if (position) {\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Find initial position for the menu based on menubar item position.\n   *\n   * NOTE: this should be called before updating active index to avoid\n   * an additional layout and style invalidation as changing active\n   * index modifies DOM.\n   */\n  private _positionForMenu(index: number): Private.IPosition {\n    let itemNode = this.contentNode.children[index];\n    let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n    return {\n      top: bottom,\n      left\n    };\n  }\n\n  /**\n   * Handle the `'focusout'` event for the menu bar.\n   */\n  private _evtFocusOut(event: FocusEvent): void {\n    // Reset the active index if there is no open menu and the menubar is losing focus.\n    if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n      this.activeIndex = -1;\n    }\n  }\n\n  /**\n   * Focus an item in the menu bar.\n   *\n   * #### Notes\n   * Does not open the associated menu.\n   */\n  private _focusItemAt(index: number): void {\n    const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n    if (itemNode) {\n      itemNode.focus();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if there is no active menu.\n   */\n  private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n    // If there is no active menu, close the current menu.\n    let newMenu = this.activeMenu;\n    if (!newMenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Bail if there is no effective menu change.\n    let oldMenu = this._childMenu;\n    if (oldMenu === newMenu) {\n      return;\n    }\n\n    // Swap the internal menu reference.\n    this._childMenu = newMenu;\n\n    // Close the current menu, or setup for the new menu.\n    if (oldMenu) {\n      oldMenu.close();\n    } else {\n      document.addEventListener('mousedown', this, true);\n    }\n\n    // Update the tab focus index and ensure the menu bar is updated.\n    this._tabFocusIndex = this.activeIndex;\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n    // Get the positioning data for the new menu.\n    let { left, top } = options;\n    if (typeof left === 'undefined' || typeof top === 'undefined') {\n      ({ left, top } = this._positionForMenu(this._activeIndex));\n    }\n    // Begin DOM modifications\n\n    if (!oldMenu) {\n      // Continue setup for new menu\n      this.addClass('lm-mod-active');\n    }\n\n    // Open the new menu at the computed location.\n    if (newMenu.items.length > 0) {\n      newMenu.open(left, top, this._forceItemsPosition);\n    }\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    // Bail if no child menu is open.\n    if (!this._childMenu) {\n      return;\n    }\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    let menu = this._childMenu;\n    this._childMenu = null;\n\n    // Close the menu.\n    menu.close();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `aboutToClose` signal of a menu.\n   */\n  private _onMenuAboutToClose(sender: Menu): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    this._childMenu = null;\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `menuRequested` signal of a child menu.\n   */\n  private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Look up the active index and menu count.\n    let i = this._activeIndex;\n    let n = this._menus.length;\n\n    // Active the next requested index.\n    switch (args) {\n      case 'next':\n        this.activeIndex = i === n - 1 ? 0 : i + 1;\n        break;\n      case 'previous':\n        this.activeIndex = i === 0 ? n - 1 : i - 1;\n        break;\n    }\n\n    // Open the active menu.\n    this.openActiveMenu();\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(): void {\n    this.update();\n  }\n\n  // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n  private _activeIndex = -1;\n  // Track which item can be focused using the TAB key. Unlike _activeIndex will\n  // always point to a menuitem. Whenever you update this value, it's important\n  // to follow it with an \"update-request\" message so that the `tabindex`\n  // attribute on each menubar item gets properly updated.\n  private _tabFocusIndex = 0;\n  private _forceItemsPosition: Menu.IOpenOptions;\n  private _overflowMenuOptions: IOverflowMenuOptions;\n  private _menus: Menu[] = [];\n  private _childMenu: Menu | null = null;\n  private _overflowMenu: Menu | null = null;\n  private _menuItemSizes: number[] = [];\n  private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n  /**\n   * An options object for creating a menu bar.\n   */\n  export interface IOptions {\n    /**\n     * A custom renderer for creating menu bar content.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n    /**\n     * Whether to force the position of the menu. The MenuBar forces the\n     * coordinates of its menus by default. With this option you can disable it.\n     *\n     * Setting to `false` will enable the logic which repositions the\n     * coordinates of the menu if it will not fit entirely on screen.\n     *\n     * The default is `true`.\n     */\n    forceItemsPosition?: Menu.IOpenOptions;\n    /**\n     * Whether to add a overflow menu if there's overflow.\n     *\n     * Setting to `true` will enable the logic that creates an overflow menu\n     * to show the menu items that don't fit entirely on the screen.\n     *\n     * The default is `true`.\n     */\n    overflowMenuOptions?: IOverflowMenuOptions;\n  }\n\n  /**\n   * An object which holds the data to render a menu bar item.\n   */\n  export interface IRenderData {\n    /**\n     * The title to be rendered.\n     */\n    readonly title: Title<Widget>;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the user can tab to the item.\n     */\n    readonly tabbable: boolean;\n\n    /**\n     * Whether the item is disabled.\n     *\n     * #### Notes\n     * A disabled item cannot be active.\n     * A disabled item cannot be focussed.\n     */\n    readonly disabled?: boolean;\n\n    readonly onfocus?: (event: FocusEvent) => void;\n  }\n\n  /**\n   * A renderer for use with a menu bar.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.title.icon is undefined, it will be ignored.\n      return h.div({ className }, data.title.icon!, data.title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n    }\n\n    /**\n     * Create the class name for the menu bar item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-item';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.active && !data.disabled) {\n        name += ' lm-mod-active';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a menu bar item.\n     *\n     * @param data - The data to use for the item.\n     *\n     * @returns The dataset for the menu bar item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the aria attributes for menu bar item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      return {\n        role: 'menuitem',\n        'aria-haspopup': 'true',\n        'aria-disabled': data.disabled ? 'true' : 'false'\n      };\n    }\n\n    /**\n     * Create the class name for the menu bar item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-itemIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.title;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n  /**\n   * Determines if a overflow menu appears when the menu items overflow.\n   *\n   * Defaults to `true`.\n   */\n  isVisible: boolean;\n  /**\n   * Determines the title of the overflow menu.\n   *\n   * Default: `...`.\n   */\n  title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a menu bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-MenuBar-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menubar');\n    return node;\n  }\n\n  /**\n   * Position for the menu relative to top-left screen corner.\n   */\n  export interface IPosition {\n    /**\n     * Pixels right from screen origin.\n     */\n    left: number;\n    /**\n     * Pixels down from screen origin.\n     */\n    top: number;\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    menus: ReadonlyArray<Menu>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = menus.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Look up the menu title.\n      let title = menus[k].title;\n\n      // Ignore titles with an empty label.\n      if (title.label.length === 0) {\n        continue;\n      }\n\n      // Look up the mnemonic index for the label.\n      let mn = title.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < title.label.length) {\n        if (title.label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n  /**\n   * Construct a new scroll bar.\n   *\n   * @param options - The options for initializing the scroll bar.\n   */\n  constructor(options: ScrollBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-ScrollBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n\n    // Set the orientation.\n    this._orientation = options.orientation || 'vertical';\n    this.dataset['orientation'] = this._orientation;\n\n    // Parse the rest of the options.\n    if (options.maximum !== undefined) {\n      this._maximum = Math.max(0, options.maximum);\n    }\n    if (options.page !== undefined) {\n      this._page = Math.max(0, options.page);\n    }\n    if (options.value !== undefined) {\n      this._value = Math.max(0, Math.min(options.value, this._maximum));\n    }\n  }\n\n  /**\n   * A signal emitted when the user moves the scroll thumb.\n   *\n   * #### Notes\n   * The payload is the current value of the scroll bar.\n   */\n  get thumbMoved(): ISignal<this, number> {\n    return this._thumbMoved;\n  }\n\n  /**\n   * A signal emitted when the user clicks a step button.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get stepRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._stepRequested;\n  }\n\n  /**\n   * A signal emitted when the user clicks the scroll track.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get pageRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._pageRequested;\n  }\n\n  /**\n   * Get the orientation of the scroll bar.\n   */\n  get orientation(): ScrollBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the scroll bar.\n   */\n  set orientation(value: ScrollBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making changes.\n    this._releaseMouse();\n\n    // Update the internal orientation.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the current value of the scroll bar.\n   */\n  get value(): number {\n    return this._value;\n  }\n\n  /**\n   * Set the current value of the scroll bar.\n   *\n   * #### Notes\n   * The value will be clamped to the range `[0, maximum]`.\n   */\n  set value(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Do nothing if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size is the amount of visible content in the scrolled\n   * region, expressed in data units. It determines the size of the\n   * scroll bar thumb.\n   */\n  get page(): number {\n    return this._page;\n  }\n\n  /**\n   * Set the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size will be clamped to the range `[0, Infinity]`.\n   */\n  set page(value: number) {\n    // Clamp the page size to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._page === value) {\n      return;\n    }\n\n    // Update the internal page size.\n    this._page = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the maximum value of the scroll bar.\n   */\n  get maximum(): number {\n    return this._maximum;\n  }\n\n  /**\n   * Set the maximum value of the scroll bar.\n   *\n   * #### Notes\n   * The max size will be clamped to the range `[0, Infinity]`.\n   */\n  set maximum(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._maximum === value) {\n      return;\n    }\n\n    // Update the internal values.\n    this._maximum = value;\n\n    // Clamp the current value to the new range.\n    this._value = Math.min(this._value, value);\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * The scroll bar decrement button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get decrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar increment button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get incrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[1] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar track node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get trackNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-track'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar thumb node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get thumbNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-thumb'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Handle the DOM events for the scroll bar.\n   *\n   * @param event - The DOM event sent to the scroll bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the scroll bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A method invoked on a 'before-attach' message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('mousedown', this);\n    this.update();\n  }\n\n  /**\n   * A method invoked on an 'after-detach' message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('mousedown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A method invoked on an 'update-request' message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    // Convert the value and page into percentages.\n    let value = (this._value * 100) / this._maximum;\n    let page = (this._page * 100) / (this._page + this._maximum);\n\n    // Clamp the value and page to the relevant range.\n    value = Math.max(0, Math.min(value, 100));\n    page = Math.max(0, Math.min(page, 100));\n\n    // Fetch the thumb style.\n    let thumbStyle = this.thumbNode.style;\n\n    // Update the thumb style for the current orientation.\n    if (this._orientation === 'horizontal') {\n      thumbStyle.top = '';\n      thumbStyle.height = '';\n      thumbStyle.left = `${value}%`;\n      thumbStyle.width = `${page}%`;\n      thumbStyle.transform = `translate(${-value}%, 0%)`;\n    } else {\n      thumbStyle.left = '';\n      thumbStyle.width = '';\n      thumbStyle.top = `${value}%`;\n      thumbStyle.height = `${page}%`;\n      thumbStyle.transform = `translate(0%, ${-value}%)`;\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the scroll bar.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Ignore anything except the `Escape` key.\n    if (event.keyCode !== 27) {\n      return;\n    }\n\n    // Fetch the previous scroll value.\n    let value = this._pressData ? this._pressData.value : -1;\n\n    // Release the mouse.\n    this._releaseMouse();\n\n    // Restore the old scroll value if possible.\n    if (value !== -1) {\n      this._moveThumb(value);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the scroll bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse press.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Send an activate request to the scroll bar. This can be\n    // used by message hooks to activate something relevant.\n    this.activate();\n\n    // Do nothing if the mouse is already captured.\n    if (this._pressData) {\n      return;\n    }\n\n    // Find the pressed scroll bar part.\n    let part = Private.findPart(this, event.target as HTMLElement);\n\n    // Do nothing if the part is not of interest.\n    if (!part) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Override the mouse cursor.\n    let override = Drag.overrideCursor('default');\n\n    // Set up the press data.\n    this._pressData = {\n      part,\n      override,\n      delta: -1,\n      value: -1,\n      mouseX: event.clientX,\n      mouseY: event.clientY\n    };\n\n    // Add the extra event listeners.\n    document.addEventListener('mousemove', this, true);\n    document.addEventListener('mouseup', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Handle a thumb press.\n    if (part === 'thumb') {\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Update the press data delta for the current orientation.\n      if (this._orientation === 'horizontal') {\n        this._pressData.delta = event.clientX - thumbRect.left;\n      } else {\n        this._pressData.delta = event.clientY - thumbRect.top;\n      }\n\n      // Add the active class to the thumb node.\n      thumbNode.classList.add('lm-mod-active');\n\n      // Store the current value in the press data.\n      this._pressData.value = this._value;\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track press.\n    if (part === 'track') {\n      // Fetch the client rect for the thumb.\n      let thumbRect = this.thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n\n    // Handle a decrement button press.\n    if (part === 'decrement') {\n      // Add the active class to the decrement node.\n      this.decrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button press.\n    if (part === 'increment') {\n      // Add the active class to the increment node.\n      this.incrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the scroll bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Update the mouse position.\n    this._pressData.mouseX = event.clientX;\n    this._pressData.mouseY = event.clientY;\n\n    // Bail if the thumb is not being dragged.\n    if (this._pressData.part !== 'thumb') {\n      return;\n    }\n\n    // Get the client rect for the thumb and track.\n    let thumbRect = this.thumbNode.getBoundingClientRect();\n    let trackRect = this.trackNode.getBoundingClientRect();\n\n    // Fetch the scroll geometry based on the orientation.\n    let trackPos: number;\n    let trackSpan: number;\n    if (this._orientation === 'horizontal') {\n      trackPos = event.clientX - trackRect.left - this._pressData.delta;\n      trackSpan = trackRect.width - thumbRect.width;\n    } else {\n      trackPos = event.clientY - trackRect.top - this._pressData.delta;\n      trackSpan = trackRect.height - thumbRect.height;\n    }\n\n    // Compute the desired value from the scroll geometry.\n    let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n    // Move the thumb to the computed value.\n    this._moveThumb(value);\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the scroll bar.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse release.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse and restore the node states.\n   */\n  private _releaseMouse(): void {\n    // Bail if there is no press data.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the repeat timer.\n    clearTimeout(this._repeatTimer);\n    this._repeatTimer = -1;\n\n    // Clear the press data.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra event listeners.\n    document.removeEventListener('mousemove', this, true);\n    document.removeEventListener('mouseup', this, true);\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('contextmenu', this, true);\n\n    // Remove the active classes from the nodes.\n    this.thumbNode.classList.remove('lm-mod-active');\n    this.decrementNode.classList.remove('lm-mod-active');\n    this.incrementNode.classList.remove('lm-mod-active');\n  }\n\n  /**\n   * Move the thumb to the specified position.\n   */\n  private _moveThumb(value: number): void {\n    // Clamp the value to the allowed range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Bail if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update of the scroll bar.\n    this.update();\n\n    // Emit the thumb moved signal.\n    this._thumbMoved.emit(value);\n  }\n\n  /**\n   * A timeout callback for repeating the mouse press.\n   */\n  private _onRepeat = () => {\n    // Clear the repeat timer id.\n    this._repeatTimer = -1;\n\n    // Bail if the mouse has been released.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Look up the part that was pressed.\n    let part = this._pressData.part;\n\n    // Bail if the thumb was pressed.\n    if (part === 'thumb') {\n      return;\n    }\n\n    // Schedule the timer for another repeat.\n    this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n    // Get the current mouse position.\n    let mouseX = this._pressData.mouseX;\n    let mouseY = this._pressData.mouseY;\n\n    // Handle a decrement button repeat.\n    if (part === 'decrement') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button repeat.\n    if (part === 'increment') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track repeat.\n    if (part === 'track') {\n      // Bail if the mouse is not over the track.\n      if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Bail if the mouse is over the thumb.\n      if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n  };\n\n  private _value = 0;\n  private _page = 10;\n  private _maximum = 100;\n  private _repeatTimer = -1;\n  private _orientation: ScrollBar.Orientation;\n  private _pressData: Private.IPressData | null = null;\n  private _thumbMoved = new Signal<this, number>(this);\n  private _stepRequested = new Signal<this, 'decrement' | 'increment'>(this);\n  private _pageRequested = new Signal<this, 'decrement' | 'increment'>(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n  /**\n   * A type alias for a scroll bar orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * An options object for creating a scroll bar.\n   */\n  export interface IOptions {\n    /**\n     * The orientation of the scroll bar.\n     *\n     * The default is `'vertical'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The value for the scroll bar.\n     *\n     * The default is `0`.\n     */\n    value?: number;\n\n    /**\n     * The page size for the scroll bar.\n     *\n     * The default is `10`.\n     */\n    page?: number;\n\n    /**\n     * The maximum value for the scroll bar.\n     *\n     * The default is `100`.\n     */\n    maximum?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A type alias for the parts of a scroll bar.\n   */\n  export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The scroll bar part which was pressed.\n     */\n    part: ScrollBarPart;\n\n    /**\n     * The offset of the press in thumb coordinates, or -1.\n     */\n    delta: number;\n\n    /**\n     * The scroll value at the time the thumb was pressed, or -1.\n     */\n    value: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n\n    /**\n     * The current X position of the mouse.\n     */\n    mouseX: number;\n\n    /**\n     * The current Y position of the mouse.\n     */\n    mouseY: number;\n  }\n\n  /**\n   * Create the DOM node for a scroll bar.\n   */\n  export function createNode(): HTMLElement {\n    let node = document.createElement('div');\n    let decrement = document.createElement('div');\n    let increment = document.createElement('div');\n    let track = document.createElement('div');\n    let thumb = document.createElement('div');\n    decrement.className = 'lm-ScrollBar-button';\n    increment.className = 'lm-ScrollBar-button';\n    decrement.dataset['action'] = 'decrement';\n    increment.dataset['action'] = 'increment';\n    track.className = 'lm-ScrollBar-track';\n    thumb.className = 'lm-ScrollBar-thumb';\n    track.appendChild(thumb);\n    node.appendChild(decrement);\n    node.appendChild(track);\n    node.appendChild(increment);\n    return node;\n  }\n\n  /**\n   * Find the scroll bar part which contains the given target.\n   */\n  export function findPart(\n    scrollBar: ScrollBar,\n    target: HTMLElement\n  ): ScrollBarPart | null {\n    // Test the thumb.\n    if (scrollBar.thumbNode.contains(target)) {\n      return 'thumb';\n    }\n\n    // Test the track.\n    if (scrollBar.trackNode.contains(target)) {\n      return 'track';\n    }\n\n    // Test the decrement button.\n    if (scrollBar.decrementNode.contains(target)) {\n      return 'decrement';\n    }\n\n    // Test the increment button.\n    if (scrollBar.incrementNode.contains(target)) {\n      return 'increment';\n    }\n\n    // Indicate no match.\n    return null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this._widget) {\n      let widget = this._widget;\n      this._widget = null;\n      widget.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * Get the child widget for the layout.\n   */\n  get widget(): Widget | null {\n    return this._widget;\n  }\n\n  /**\n   * Set the child widget for the layout.\n   *\n   * #### Notes\n   * Setting the child widget will cause the old child widget to be\n   * automatically disposed. If that is not desired, set the parent\n   * of the old child to `null` before assigning a new child.\n   */\n  set widget(widget: Widget | null) {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    if (widget) {\n      widget.parent = this.parent;\n    }\n\n    // Bail early if the widget does not change.\n    if (this._widget === widget) {\n      return;\n    }\n\n    // Dispose of the old child widget.\n    if (this._widget) {\n      this._widget.dispose();\n    }\n\n    // Update the internal widget.\n    this._widget = widget;\n\n    // Attach the new child widget if needed.\n    if (this.parent && widget) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    if (this._widget) {\n      yield this._widget;\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Bail early if the widget does not exist in the layout.\n    if (this._widget !== widget) {\n      return;\n    }\n\n    // Clear the internal widget.\n    this._widget = null;\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n  constructor(options: StackedLayout.IOptions = {}) {\n    super(options);\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    if (this.widgets.length > 1) {\n      this.widgets.forEach(w => {\n        w.hiddenMode = this._hiddenMode;\n      });\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (\n      this._hiddenMode === Widget.HiddenMode.Scale &&\n      this._items.length > 0\n    ) {\n      if (this._items.length === 1) {\n        this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n      }\n      widget.hiddenMode = Widget.HiddenMode.Scale;\n    } else {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n    }\n\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Reset the z-index for the widget.\n    item!.widget.node.style.zIndex = '';\n\n    // Reset the hidden mode for the widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n\n      // Reset the hidden mode for the first widget if necessary.\n      if (this._items.length === 1) {\n        this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n      }\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the computed minimum size.\n      minW = Math.max(minW, item.minWidth);\n      minH = Math.max(minH, item.minHeight);\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the widget stacking order and layout geometry.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Set the z-index for the widget.\n      item.widget.node.style.zIndex = `${i}`;\n\n      // Update the item geometry.\n      item.update(left, top, width, height);\n    }\n  }\n\n  private _dirty = false;\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n  /**\n   * An options object for initializing a stacked layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n  /**\n   * Construct a new stacked panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: StackedPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-StackedPanel');\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as StackedLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as StackedLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when a widget is removed from a stacked panel.\n   */\n  get widgetRemoved(): ISignal<this, Widget> {\n    return this._widgetRemoved;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-StackedPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-StackedPanel-child');\n    this._widgetRemoved.emit(msg.child);\n  }\n\n  private _widgetRemoved = new Signal<this, Widget>(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n  /**\n   * An options object for creating a stacked panel.\n   */\n  export interface IOptions {\n    /**\n     * The stacked layout to use for the stacked panel.\n     *\n     * The default is a new `StackedLayout`.\n     */\n    layout?: StackedLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a stacked layout for the given panel options.\n   */\n  export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n    return options.layout || new StackedLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n  /**\n   * Construct a new tab panel.\n   *\n   * @param options - The options for initializing the tab panel.\n   */\n  constructor(options: TabPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-TabPanel');\n\n    // Create the tab bar and stacked panel.\n    this.tabBar = new TabBar<Widget>(options);\n    this.tabBar.addClass('lm-TabPanel-tabBar');\n    this.stackedPanel = new StackedPanel();\n    this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n    // Connect the tab bar signal handlers.\n    this.tabBar.tabMoved.connect(this._onTabMoved, this);\n    this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    this.tabBar.tabActivateRequested.connect(\n      this._onTabActivateRequested,\n      this\n    );\n    this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Connect the stacked panel signal handlers.\n    this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n    // Get the data related to the placement.\n    this._tabPlacement = options.tabPlacement || 'top';\n    let direction = Private.directionFromPlacement(this._tabPlacement);\n    let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = this._tabPlacement;\n\n    // Create the box layout.\n    let layout = new BoxLayout({ direction, spacing: 0 });\n\n    // Set the stretch factors for the child widgets.\n    BoxLayout.setStretch(this.tabBar, 0);\n    BoxLayout.setStretch(this.stackedPanel, 1);\n\n    // Add the child widgets to the layout.\n    layout.addWidget(this.tabBar);\n    layout.addWidget(this.stackedPanel);\n\n    // Install the layout on the tab panel.\n    this.layout = layout;\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabPanel.ICurrentChangedArgs> {\n    return this._currentChanged;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this.tabBar.currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the index is out of range, it will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    this.tabBar.currentIndex = value;\n  }\n\n  /**\n   * Get the currently selected widget.\n   *\n   * #### Notes\n   * This will be `null` if there is no selected tab.\n   */\n  get currentWidget(): Widget | null {\n    let title = this.tabBar.currentTitle;\n    return title ? title.owner : null;\n  }\n\n  /**\n   * Set the currently selected widget.\n   *\n   * #### Notes\n   * If the widget is not in the panel, it will be set to `null`.\n   */\n  set currentWidget(value: Widget | null) {\n    this.tabBar.currentTitle = value ? value.title : null;\n  }\n\n  /**\n   * Get the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  get tabsMovable(): boolean {\n    return this.tabBar.tabsMovable;\n  }\n\n  /**\n   * Set the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  set tabsMovable(value: boolean) {\n    this.tabBar.tabsMovable = value;\n  }\n\n  /**\n   * Get the whether the add button is enabled.\n   *\n   */\n  get addButtonEnabled(): boolean {\n    return this.tabBar.addButtonEnabled;\n  }\n\n  /**\n   * Set the whether the add button is enabled.\n   *\n   */\n  set addButtonEnabled(value: boolean) {\n    this.tabBar.addButtonEnabled = value;\n  }\n\n  /**\n   * Get the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  get tabPlacement(): TabPanel.TabPlacement {\n    return this._tabPlacement;\n  }\n\n  /**\n   * Set the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  set tabPlacement(value: TabPanel.TabPlacement) {\n    // Bail if the placement does not change.\n    if (this._tabPlacement === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._tabPlacement = value;\n\n    // Get the values related to the placement.\n    let direction = Private.directionFromPlacement(value);\n    let orientation = Private.orientationFromPlacement(value);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = value;\n\n    // Update the layout direction.\n    (this.layout as BoxLayout).direction = direction;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The tab bar used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the tab bar directly can lead to undefined behavior.\n   */\n  readonly tabBar: TabBar<Widget>;\n\n  /**\n   * The stacked panel used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the panel directly can lead to undefined behavior.\n   */\n  readonly stackedPanel: StackedPanel;\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this.stackedPanel.widgets;\n  }\n\n  /**\n   * Add a widget to the end of the tab panel.\n   *\n   * @param widget - The widget to add to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this.widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the tab panel at a specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (widget !== this.currentWidget) {\n      widget.hide();\n    }\n    this.stackedPanel.insertWidget(index, widget);\n    this.tabBar.insertTab(index, widget.title);\n\n    widget.node.setAttribute('role', 'tabpanel');\n\n    let renderer = this.tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  /**\n   * Handle the `currentChanged` signal from the tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n    // Extract the widgets from the titles.\n    let previousWidget = previousTitle ? previousTitle.owner : null;\n    let currentWidget = currentTitle ? currentTitle.owner : null;\n\n    // Hide the previous widget.\n    if (previousWidget) {\n      previousWidget.hide();\n    }\n\n    // Show the current widget.\n    if (currentWidget) {\n      currentWidget.show();\n    }\n\n    // Emit the `currentChanged` signal for the tab panel.\n    this._currentChanged.emit({\n      previousIndex,\n      previousWidget,\n      currentIndex,\n      currentWidget\n    });\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n  }\n\n  /**\n   * Handle the `tabAddRequested` signal from the tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>, args: void): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from the tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from the tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from the tab bar.\n   */\n  private _onTabMoved(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabMovedArgs<Widget>\n  ): void {\n    this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n  }\n\n  /**\n   * Handle the `widgetRemoved` signal from the stacked panel.\n   */\n  private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n    this.tabBar.removeTab(widget.title);\n  }\n\n  private _tabPlacement: TabPanel.TabPlacement;\n  private _currentChanged = new Signal<this, TabPanel.ICurrentChangedArgs>(\n    this\n  );\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n  /**\n   * A type alias for tab placement in a tab bar.\n   */\n  export type TabPlacement =\n    | /**\n     * The tabs are placed as a row above the content.\n     */\n    'top'\n\n    /**\n     * The tabs are placed as a column to the left of the content.\n     */\n    | 'left'\n\n    /**\n     * The tabs are placed as a column to the right of the content.\n     */\n    | 'right'\n\n    /**\n     * The tabs are placed as a row below the content.\n     */\n    | 'bottom';\n\n  /**\n   * An options object for initializing a tab panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the tab panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether the button to add new tabs is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The placement of the tab bar relative to the content.\n     *\n     * The default is `'top'`.\n     */\n    tabPlacement?: TabPlacement;\n\n    /**\n     * The renderer for the panel's tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: TabBar.IRenderer<Widget>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs {\n    /**\n     * The previously selected index.\n     */\n    previousIndex: number;\n\n    /**\n     * The previously selected widget.\n     */\n    previousWidget: Widget | null;\n\n    /**\n     * The currently selected index.\n     */\n    currentIndex: number;\n\n    /**\n     * The currently selected widget.\n     */\n    currentWidget: Widget | null;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Convert a tab placement to tab bar orientation.\n   */\n  export function orientationFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): TabBar.Orientation {\n    return placementToOrientationMap[plc];\n  }\n\n  /**\n   * Convert a tab placement to a box layout direction.\n   */\n  export function directionFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): BoxLayout.Direction {\n    return placementToDirectionMap[plc];\n  }\n\n  /**\n   * A mapping of tab placement to tab bar orientation.\n   */\n  const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n    top: 'horizontal',\n    left: 'vertical',\n    right: 'vertical',\n    bottom: 'horizontal'\n  };\n\n  /**\n   * A mapping of tab placement to box layout direction.\n   */\n  const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n    top: 'top-to-bottom',\n    left: 'left-to-right',\n    right: 'right-to-left',\n    bottom: 'bottom-to-top'\n  };\n}\n"],"names":["BoxEngine","Signal","Private","MessageLoop","AttachedProperty","Message","ConflatableMessage","ElementExt","ArrayExt","Utils","UUID","Drag","VirtualDOM","h","StringExt","CommandRegistry","JSONExt","getKeyboardLayout","DisposableDelegate","Selector","empty","find","Platform","MimeData","max"],"mappings":";;;;;;IAAA;IACA;IACA;;;;;;IAM+E;IAE/E;;;;;;;;;IASG;UACU,QAAQ,CAAA;IAArB,IAAA,WAAA,GAAA;IACE;;;;;;;;;;;;IAYG;YACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;IAEb;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;IAEnB;;;;;;;;;;;;;;;IAeG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;IAWG;YACH,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;IAET;;;;;;;IAOG;YACH,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;SACd;IAAA,CAAA;IAED;;IAEG;AACcA,+BA0XhB;IA1XD,CAAA,UAAiB,SAAS,EAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DG;IACH,IAAA,SAAgB,IAAI,CAAC,MAA2B,EAAE,KAAa,EAAA;;IAE7D,QAAA,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;YAC1B,IAAI,KAAK,KAAK,CAAC,EAAE;IACf,YAAA,OAAO,KAAK,CAAC;IACd,SAAA;;YAGD,IAAI,QAAQ,GAAG,CAAC,C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AAC;SAChE;IAED;;IAEG;QACK,gBAAgB,CAAC,MAAoB,EAAE,MAAc,EAAA;IAC3D,QAAA,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IACpC,QAAA,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACrC;IAQF,CAAA;IAgGD;;IAEG;IACH,IAAU,OAAO,CAsChB;IAtCD,CAAA,UAAU,OAAO,EAAA;IACf;;IAEG;QACH,SAAgB,wBAAwB,CACtC,GAA0B,EAAA;IAE1B,QAAA,OAAO,yBAAyB,CAAC,GAAG,CAAC,CAAC;SACvC;IAJe,IAAA,OAAA,CAAA,wBAAwB,2BAIvC,CAAA;IAED;;IAEG;QACH,SAAgB,sBAAsB,CACpC,GAA0B,EAAA;IAE1B,QAAA,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;SACrC;IAJe,IAAA,OAAA,CAAA,sBAAsB,yBAIrC,CAAA;IAED;;IAEG;IACH,IAAA,MAAM,yBAAyB,GAA0C;IACvE,QAAA,GAAG,EAAE,YAAY;IACjB,QAAA,IAAI,EAAE,UAAU;IAChB,QAAA,KAAK,EAAE,UAAU;IACjB,QAAA,MAAM,EAAE,YAAY;SACrB,CAAC;IAEF;;IAEG;IACH,IAAA,MAAM,uBAAuB,GAA2C;IACtE,QAAA,GAAG,EAAE,eAAe;IACpB,QAAA,IAAI,EAAE,eAAe;IACrB,QAAA,KAAK,EAAE,eAAe;IACtB,QAAA,MAAM,EAAE,eAAe;SACxB,CAAC;IACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"index.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n  /**\n   * The preferred size for the sizer.\n   *\n   * #### Notes\n   * The sizer will be given this initial size subject to its size\n   * bounds. The sizer will not deviate from this size unless such\n   * deviation is required to fit into the available layout space.\n   *\n   * There is no limit to this value, but it will be clamped to the\n   * bounds defined by {@link minSize} and {@link maxSize}.\n   *\n   * The default value is `0`.\n   */\n  sizeHint = 0;\n\n  /**\n   * The minimum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized less than this value, even if\n   * it means the sizer will overflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity)`\n   * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `0`.\n   */\n  minSize = 0;\n\n  /**\n   * The maximum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized greater than this value, even if\n   * it means the sizer will underflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity]`\n   * and that it is `>=` to {@link minSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `Infinity`.\n   */\n  maxSize = Infinity;\n\n  /**\n   * The stretch factor for the sizer.\n   *\n   * #### Notes\n   * This controls how much the sizer stretches relative to its sibling\n   * sizers when layout space is distributed. A stretch factor of zero\n   * is special and will cause the sizer to only be resized after all\n   * other sizers with a stretch factor greater than zero have been\n   * resized to their limits.\n   *\n   * It is assumed that this value is an integer that lies in the range\n   * `[0, Infinity)`. Failure to adhere to this constraint will yield\n   * undefined results.\n   *\n   * The default value is `1`.\n   */\n  stretch = 1;\n\n  /**\n   * The computed size of the sizer.\n   *\n   * #### Notes\n   * This value is the output of a call to {@link BoxEngine.calc}. It represents\n   * the computed size for the object along the layout orientation,\n   * and will always lie in the range `[minSize, maxSize]`.\n   *\n   * This value is output only.\n   *\n   * Changing this value will have no effect.\n   */\n  size = 0;\n\n  /**\n   * An internal storage property for the layout algorithm.\n   *\n   * #### Notes\n   * This value is used as temporary storage by the layout algorithm.\n   *\n   * Changing this value will have no effect.\n   */\n  done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n  /**\n   * Calculate the optimal layout sizes for a sequence of box sizers.\n   *\n   * This distributes the available layout space among the box sizers\n   * according to the following algorithm:\n   *\n   * 1. Initialize the sizers's size to its size hint and compute the\n   *    sums for each of size hint, min size, and max size.\n   *\n   * 2. If the total size hint equals the available space, return.\n   *\n   * 3. If the available space is less than the total min size, set all\n   *    sizers to their min size and return.\n   *\n   * 4. If the available space is greater than the total max size, set\n   *    all sizers to their max size and return.\n   *\n   * 5. If the layout space is less than the total size hint, distribute\n   *    the negative delta as follows:\n   *\n   *    a. Shrink each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the negative space and the sum of\n   *       stretch factors. If the sizer reaches its min size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains negative\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its min size,\n   *       remove it from the computation.\n   *\n   * 6. If the layout space is greater than the total size hint,\n   *    distribute the positive delta as follows:\n   *\n   *    a. Expand each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the postive space and the sum of\n   *       stretch factors. If the sizer reaches its max size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains positive\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its max size,\n   *       remove it from the computation.\n   *\n   * 7. return\n   *\n   * @param sizers - The sizers for a particular layout line.\n   *\n   * @param space - The available layout space for the sizers.\n   *\n   * @returns The delta between the provided available space and the\n   *   actual consumed space. This value will be zero if the sizers\n   *   can be adjusted to fit, negative if the available space is too\n   *   small, and positive if the available space is too large.\n   *\n   * #### Notes\n   * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n   *\n   * This function can be called at any time to recompute the layout for\n   * an existing sequence of sizers. The previously computed results will\n   * have no effect on the new output. It is therefore not necessary to\n   * create new sizer objects on each resize event.\n   */\n  export function calc(sizers: ArrayLike<BoxSizer>, space: number): number {\n    // Bail early if there is nothing to do.\n    let count = sizers.length;\n    if (count === 0) {\n      return space;\n    }\n\n    // Setup the size and stretch counters.\n    let totalMin = 0;\n    let totalMax = 0;\n    let totalSize = 0;\n    let totalStretch = 0;\n    let stretchCount = 0;\n\n    // Setup the sizers and compute the totals.\n    for (let i = 0; i < count; ++i) {\n      let sizer = sizers[i];\n      let min = sizer.minSize;\n      let max = sizer.maxSize;\n      let hint = sizer.sizeHint;\n      sizer.done = false;\n      sizer.size = Math.max(min, Math.min(hint, max));\n      totalSize += sizer.size;\n      totalMin += min;\n      totalMax += max;\n      if (sizer.stretch > 0) {\n        totalStretch += sizer.stretch;\n        stretchCount++;\n      }\n    }\n\n    // If the space is equal to the total size, return early.\n    if (space === totalSize) {\n      return 0;\n    }\n\n    // If the space is less than the total min, minimize each sizer.\n    if (space <= totalMin) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.minSize;\n      }\n      return space - totalMin;\n    }\n\n    // If the space is greater than the total max, maximize each sizer.\n    if (space >= totalMax) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.maxSize;\n      }\n      return space - totalMax;\n    }\n\n    // The loops below perform sub-pixel precision sizing. A near zero\n    // value is used for compares instead of zero to ensure that the\n    // loop terminates when the subdivided space is reasonably small.\n    let nearZero = 0.01;\n\n    // A counter which is decremented each time a sizer is resized to\n    // its limit. This ensures the loops terminate even if there is\n    // space remaining to distribute.\n    let notDoneCount = count;\n\n    // Distribute negative delta space.\n    if (space < totalSize) {\n      // Shrink each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its min size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = totalSize - space;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n    }\n    // Distribute positive delta space.\n    else {\n      // Expand each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its max size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = space - totalSize;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n    }\n\n    // Indicate that the consumed space equals the available space.\n    return 0;\n  }\n\n  /**\n   * Adjust a sizer by a delta and update its neighbors accordingly.\n   *\n   * @param sizers - The sizers which should be adjusted.\n   *\n   * @param index - The index of the sizer to grow.\n   *\n   * @param delta - The amount to adjust the sizer, positive or negative.\n   *\n   * #### Notes\n   * This will adjust the indicated sizer by the specified amount, along\n   * with the sizes of the appropriate neighbors, subject to the limits\n   * specified by each of the sizers.\n   *\n   * This is useful when implementing box layouts where the boundaries\n   * between the sizers are interactively adjustable by the user.\n   */\n  export function adjust(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Bail early when there is nothing to do.\n    if (sizers.length === 0 || delta === 0) {\n      return;\n    }\n\n    // Dispatch to the proper implementation.\n    if (delta > 0) {\n      growSizer(sizers, index, delta);\n    } else {\n      shrinkSizer(sizers, index, -delta);\n    }\n  }\n\n  /**\n   * Grow a sizer by a positive delta and adjust neighbors.\n   */\n  function growSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the left can expand.\n    let growLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the right can shrink.\n    let shrinkLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the left by the delta.\n    let grow = delta;\n    for (let i = index; i >= 0 && grow > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the right by the delta.\n    let shrink = delta;\n    for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n\n  /**\n   * Shrink a sizer by a positive delta and adjust neighbors.\n   */\n  function shrinkSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the right can expand.\n    let growLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the left can shrink.\n    let shrinkLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the right by the delta.\n    let grow = delta;\n    for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the left by the delta.\n    let shrink = delta;\n    for (let i = index; i >= 0 && shrink > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title<T> implements IDisposable {\n  /**\n   * Construct a new title.\n   *\n   * @param options - The options for initializing the title.\n   */\n  constructor(options: Title.IOptions<T>) {\n    this.owner = options.owner;\n    if (options.label !== undefined) {\n      this._label = options.label;\n    }\n    if (options.mnemonic !== undefined) {\n      this._mnemonic = options.mnemonic;\n    }\n    if (options.icon !== undefined) {\n      this._icon = options.icon;\n    }\n\n    if (options.iconClass !== undefined) {\n      this._iconClass = options.iconClass;\n    }\n    if (options.iconLabel !== undefined) {\n      this._iconLabel = options.iconLabel;\n    }\n    if (options.caption !== undefined) {\n      this._caption = options.caption;\n    }\n    if (options.className !== undefined) {\n      this._className = options.className;\n    }\n    if (options.closable !== undefined) {\n      this._closable = options.closable;\n    }\n    this._dataset = options.dataset || {};\n  }\n\n  /**\n   * A signal emitted when the state of the title changes.\n   */\n  get changed(): ISignal<this, void> {\n    return this._changed;\n  }\n\n  /**\n   * The object which owns the title.\n   */\n  readonly owner: T;\n\n  /**\n   * Get the label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get label(): string {\n    return this._label;\n  }\n\n  /**\n   * Set the label for the title.\n   */\n  set label(value: string) {\n    if (this._label === value) {\n      return;\n    }\n    this._label = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the mnemonic index for the title.\n   *\n   * #### Notes\n   * The default value is `-1`.\n   */\n  get mnemonic(): number {\n    return this._mnemonic;\n  }\n\n  /**\n   * Set the mnemonic index for the title.\n   */\n  set mnemonic(value: number) {\n    if (this._mnemonic === value) {\n      return;\n    }\n    this._mnemonic = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon renderer for the title.\n   *\n   * #### Notes\n   * The default value is undefined.\n   */\n  get icon(): VirtualElement.IRenderer | undefined {\n    return this._icon;\n  }\n\n  /**\n   * Set the icon renderer for the title.\n   *\n   * #### Notes\n   * A renderer is an object that supplies a render and unrender function.\n   */\n  set icon(value: VirtualElement.IRenderer | undefined) {\n    if (this._icon === value) {\n      return;\n    }\n    this._icon = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconClass(): string {\n    return this._iconClass;\n  }\n\n  /**\n   * Set the icon class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconClass(value: string) {\n    if (this._iconClass === value) {\n      return;\n    }\n    this._iconClass = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconLabel(): string {\n    return this._iconLabel;\n  }\n\n  /**\n   * Set the icon label for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconLabel(value: string) {\n    if (this._iconLabel === value) {\n      return;\n    }\n    this._iconLabel = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the caption for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get caption(): string {\n    return this._caption;\n  }\n\n  /**\n   * Set the caption for the title.\n   */\n  set caption(value: string) {\n    if (this._caption === value) {\n      return;\n    }\n    this._caption = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the extra class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get className(): string {\n    return this._className;\n  }\n\n  /**\n   * Set the extra class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set className(value: string) {\n    if (this._className === value) {\n      return;\n    }\n    this._className = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the closable state for the title.\n   *\n   * #### Notes\n   * The default value is `false`.\n   */\n  get closable(): boolean {\n    return this._closable;\n  }\n\n  /**\n   * Set the closable state for the title.\n   *\n   * #### Notes\n   * This controls the presence of a close icon when applicable.\n   */\n  set closable(value: boolean) {\n    if (this._closable === value) {\n      return;\n    }\n    this._closable = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the dataset for the title.\n   *\n   * #### Notes\n   * The default value is an empty dataset.\n   */\n  get dataset(): Title.Dataset {\n    return this._dataset;\n  }\n\n  /**\n   * Set the dataset for the title.\n   *\n   * #### Notes\n   * This controls the data attributes when applicable.\n   */\n  set dataset(value: Title.Dataset) {\n    if (this._dataset === value) {\n      return;\n    }\n    this._dataset = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Test whether the title has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this._isDisposed;\n  }\n\n  /**\n   * Dispose of the resources held by the title.\n   *\n   * #### Notes\n   * It is the responsibility of the owner to call the title disposal.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n    this._isDisposed = true;\n\n    Signal.clearData(this);\n  }\n\n  private _label = '';\n  private _caption = '';\n  private _mnemonic = -1;\n  private _icon: VirtualElement.IRenderer | undefined = undefined;\n  private _iconClass = '';\n  private _iconLabel = '';\n  private _className = '';\n  private _closable = false;\n  private _dataset: Title.Dataset;\n  private _changed = new Signal<this, void>(this);\n  private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n  /**\n   * A type alias for a simple immutable string dataset.\n   */\n  export type Dataset = { readonly [key: string]: string };\n\n  /**\n   * An options object for initializing a title.\n   */\n  export interface IOptions<T> {\n    /**\n     * The object which owns the title.\n     */\n    owner: T;\n\n    /**\n     * The label for the title.\n     */\n    label?: string;\n\n    /**\n     * The mnemonic index for the title.\n     */\n    mnemonic?: number;\n\n    /**\n     * The icon renderer for the title.\n     */\n    icon?: VirtualElement.IRenderer;\n\n    /**\n     * The icon class name for the title.\n     */\n    iconClass?: string;\n\n    /**\n     * The icon label for the title.\n     */\n    iconLabel?: string;\n\n    /**\n     * The caption for the title.\n     */\n    caption?: string;\n\n    /**\n     * The extra class name for the title.\n     */\n    className?: string;\n\n    /**\n     * The closable state for the title.\n     */\n    closable?: boolean;\n\n    /**\n     * The dataset for the title.\n     */\n    dataset?: Dataset;\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n  ConflatableMessage,\n  IMessageHandler,\n  Message,\n  MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n  /**\n   * Construct a new widget.\n   *\n   * @param options - The options for initializing the widget.\n   */\n  constructor(options: Widget.IOptions = {}) {\n    this.node = Private.createNode(options);\n    this.addClass('lm-Widget');\n  }\n\n  /**\n   * Dispose of the widget and its descendant widgets.\n   *\n   * #### Notes\n   * It is unsafe to use the widget after it has been disposed.\n   *\n   * All calls made to this method after the first are a no-op.\n   */\n  dispose(): void {\n    // Do nothing if the widget is already disposed.\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Set the disposed flag and emit the disposed signal.\n    this.setFlag(Widget.Flag.IsDisposed);\n    this._disposed.emit(undefined);\n\n    // Remove or detach the widget if necessary.\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n\n    // Dispose of the widget layout.\n    if (this._layout) {\n      this._layout.dispose();\n      this._layout = null;\n    }\n\n    // Dispose the title\n    this.title.dispose();\n\n    // Clear the extra data associated with the widget.\n    Signal.clearData(this);\n    MessageLoop.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * A signal emitted when the widget is disposed.\n   */\n  get disposed(): ISignal<this, void> {\n    return this._disposed;\n  }\n\n  /**\n   * Get the DOM node owned by the widget.\n   */\n  readonly node: HTMLElement;\n\n  /**\n   * Test whether the widget has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this.testFlag(Widget.Flag.IsDisposed);\n  }\n\n  /**\n   * Test whether the widget's node is attached to the DOM.\n   */\n  get isAttached(): boolean {\n    return this.testFlag(Widget.Flag.IsAttached);\n  }\n\n  /**\n   * Test whether the widget is explicitly hidden.\n   *\n   * #### Notes\n   * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n   * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n   */\n  get isHidden(): boolean {\n    return this.testFlag(Widget.Flag.IsHidden);\n  }\n\n  /**\n   * Test whether the widget is visible.\n   *\n   * #### Notes\n   * A widget is visible when it is attached to the DOM, is not\n   * explicitly hidden, and has no explicitly hidden ancestors.\n   *\n   * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n   * It recursively checks the visibility of all parent widgets.\n   */\n  get isVisible(): boolean {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let parent: Widget | null = this;\n    do {\n      if (parent.isHidden || !parent.isAttached) {\n        return false;\n      }\n      parent = parent.parent;\n    } while (parent != null);\n    return true;\n  }\n\n  /**\n   * The title object for the widget.\n   *\n   * #### Notes\n   * The title object is used by some container widgets when displaying\n   * the widget alongside some title, such as a tab panel or side bar.\n   *\n   * Since not all widgets will use the title, it is created on demand.\n   *\n   * The `owner` property of the title is set to this widget.\n   */\n  get title(): Title<Widget> {\n    return Private.titleProperty.get(this);\n  }\n\n  /**\n   * Get the id of the widget's DOM node.\n   */\n  get id(): string {\n    return this.node.id;\n  }\n\n  /**\n   * Set the id of the widget's DOM node.\n   */\n  set id(value: string) {\n    this.node.id = value;\n  }\n\n  /**\n   * The dataset for the widget's DOM node.\n   */\n  get dataset(): DOMStringMap {\n    return this.node.dataset;\n  }\n\n  /**\n   * Get the method for hiding the widget.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding the widget.\n   */\n  set hiddenMode(value: Widget.HiddenMode) {\n    if (this._hiddenMode === value) {\n      return;\n    }\n\n    if (this.isHidden) {\n      // Reset styles set by previous mode.\n      this._toggleHidden(false);\n    }\n\n    if (value == Widget.HiddenMode.Scale) {\n      this.node.style.willChange = 'transform';\n    } else {\n      this.node.style.willChange = 'auto';\n    }\n\n    this._hiddenMode = value;\n\n    if (this.isHidden) {\n      // Set styles for new mode.\n      this._toggleHidden(true);\n    }\n  }\n\n  /**\n   * Get the parent of the widget.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent of the widget.\n   *\n   * #### Notes\n   * Children are typically added to a widget by using a layout, which\n   * means user code will not normally set the parent widget directly.\n   *\n   * The widget will be automatically removed from its old parent.\n   *\n   * This is a no-op if there is no effective parent change.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (value && this.contains(value)) {\n      throw new Error('Invalid parent widget.');\n    }\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-removed', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    this._parent = value;\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-added', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    if (!this.isDisposed) {\n      MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n    }\n  }\n\n  /**\n   * Get the layout for the widget.\n   */\n  get layout(): Layout | null {\n    return this._layout;\n  }\n\n  /**\n   * Set the layout for the widget.\n   *\n   * #### Notes\n   * The layout is single-use only. It cannot be changed after the\n   * first assignment.\n   *\n   * The layout is disposed automatically when the widget is disposed.\n   */\n  set layout(value: Layout | null) {\n    if (this._layout === value) {\n      return;\n    }\n    if (this.testFlag(Widget.Flag.DisallowLayout)) {\n      throw new Error('Cannot set widget layout.');\n    }\n    if (this._layout) {\n      throw new Error('Cannot change widget layout.');\n    }\n    if (value!.parent) {\n      throw new Error('Cannot change layout parent.');\n    }\n    this._layout = value;\n    value!.parent = this;\n  }\n\n  /**\n   * Create an iterator over the widget's children.\n   *\n   * @returns A new iterator over the children of the widget.\n   *\n   * #### Notes\n   * The widget must have a populated layout in order to have children.\n   *\n   * If a layout is not installed, the returned iterator will be empty.\n   */\n  *children(): IterableIterator<Widget> {\n    if (this._layout) {\n      yield* this._layout;\n    }\n  }\n\n  /**\n   * Test whether a widget is a descendant of this widget.\n   *\n   * @param widget - The descendant widget of interest.\n   *\n   * @returns `true` if the widget is a descendant, `false` otherwise.\n   */\n  contains(widget: Widget): boolean {\n    for (let value: Widget | null = widget; value; value = value._parent) {\n      if (value === this) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Test whether the widget's DOM node has the given class name.\n   *\n   * @param name - The class name of interest.\n   *\n   * @returns `true` if the node has the class, `false` otherwise.\n   */\n  hasClass(name: string): boolean {\n    return this.node.classList.contains(name);\n  }\n\n  /**\n   * Add a class name to the widget's DOM node.\n   *\n   * @param name - The class name to add to the node.\n   *\n   * #### Notes\n   * If the class name is already added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  addClass(name: string): void {\n    this.node.classList.add(name);\n  }\n\n  /**\n   * Remove a class name from the widget's DOM node.\n   *\n   * @param name - The class name to remove from the node.\n   *\n   * #### Notes\n   * If the class name is not yet added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  removeClass(name: string): void {\n    this.node.classList.remove(name);\n  }\n\n  /**\n   * Toggle a class name on the widget's DOM node.\n   *\n   * @param name - The class name to toggle on the node.\n   *\n   * @param force - Whether to force add the class (`true`) or force\n   *   remove the class (`false`). If not provided, the presence of\n   *   the class will be toggled from its current state.\n   *\n   * @returns `true` if the class is now present, `false` otherwise.\n   *\n   * #### Notes\n   * The class name must not contain whitespace.\n   */\n  toggleClass(name: string, force?: boolean): boolean {\n    if (force === true) {\n      this.node.classList.add(name);\n      return true;\n    }\n    if (force === false) {\n      this.node.classList.remove(name);\n      return false;\n    }\n    return this.node.classList.toggle(name);\n  }\n\n  /**\n   * Post an `'update-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  update(): void {\n    MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n  }\n\n  /**\n   * Post a `'fit-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  fit(): void {\n    MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n  }\n\n  /**\n   * Post an `'activate-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  activate(): void {\n    MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n  }\n\n  /**\n   * Send a `'close-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for sending the message.\n   */\n  close(): void {\n    MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n  }\n\n  /**\n   * Show the widget and make it visible to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `false`.\n   *\n   * If the widget is not explicitly hidden, this is a no-op.\n   */\n  show(): void {\n    if (!this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n    }\n    this.clearFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(false);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-shown', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Hide the widget and make it hidden to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `true`.\n   *\n   * If the widget is explicitly hidden, this is a no-op.\n   */\n  hide(): void {\n    if (this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n    }\n    this.setFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(true);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-hidden', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Show or hide the widget according to a boolean value.\n   *\n   * @param hidden - `true` to hide the widget, or `false` to show it.\n   *\n   * #### Notes\n   * This is a convenience method for `hide()` and `show()`.\n   */\n  setHidden(hidden: boolean): void {\n    if (hidden) {\n      this.hide();\n    } else {\n      this.show();\n    }\n  }\n\n  /**\n   * Test whether the given widget flag is set.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  testFlag(flag: Widget.Flag): boolean {\n    return (this._flags & flag) !== 0;\n  }\n\n  /**\n   * Set the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  setFlag(flag: Widget.Flag): void {\n    this._flags |= flag;\n  }\n\n  /**\n   * Clear the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  clearFlag(flag: Widget.Flag): void {\n    this._flags &= ~flag;\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   *\n   * #### Notes\n   * Subclasses may reimplement this method as needed.\n   */\n  processMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.notifyLayout(msg);\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.notifyLayout(msg);\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.notifyLayout(msg);\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.notifyLayout(msg);\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.setFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.notifyLayout(msg);\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.notifyLayout(msg);\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n          this.setFlag(Widget.Flag.IsVisible);\n        }\n        this.setFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.notifyLayout(msg);\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.clearFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterDetach(msg);\n        break;\n      case 'activate-request':\n        this.notifyLayout(msg);\n        this.onActivateRequest(msg);\n        break;\n      case 'close-request':\n        this.notifyLayout(msg);\n        this.onCloseRequest(msg);\n        break;\n      case 'child-added':\n        this.notifyLayout(msg);\n        this.onChildAdded(msg as Widget.ChildMessage);\n        break;\n      case 'child-removed':\n        this.notifyLayout(msg);\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      default:\n        this.notifyLayout(msg);\n        break;\n    }\n  }\n\n  /**\n   * Invoke the message processing routine of the widget's layout.\n   *\n   * @param msg - The message to dispatch to the layout.\n   *\n   * #### Notes\n   * This is a no-op if the widget does not have a layout.\n   *\n   * This will not typically be called directly by user code.\n   */\n  protected notifyLayout(msg: Message): void {\n    if (this._layout) {\n      this._layout.processParentMessage(msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   *\n   * #### Notes\n   * The default implementation unparents or detaches the widget.\n   */\n  protected onCloseRequest(msg: Message): void {\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {}\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onUpdateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onActivateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n  private _toggleHidden(hidden: boolean) {\n    if (hidden) {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.addClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = 'scale(0)';\n          this.node.setAttribute('aria-hidden', 'true');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = 'hidden';\n          this.node.style.zIndex = '-1';\n          break;\n      }\n    } else {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.removeClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = '';\n          this.node.removeAttribute('aria-hidden');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = '';\n          this.node.style.zIndex = '';\n          break;\n      }\n    }\n  }\n\n  private _flags = 0;\n  private _layout: Layout | null = null;\n  private _parent: Widget | null = null;\n  private _disposed = new Signal<this, void>(this);\n  private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n  /**\n   * An options object for initializing a widget.\n   */\n  export interface IOptions {\n    /**\n     * The optional node to use for the widget.\n     *\n     * If a node is provided, the widget will assume full ownership\n     * and control of the node, as if it had created the node itself.\n     *\n     * The default is a new `<div>`.\n     */\n    node?: HTMLElement;\n\n    /**\n     * The optional element tag, used for constructing the widget's node.\n     *\n     * If a pre-constructed node is provided via the `node` arg, this\n     * value is ignored.\n     */\n    tag?: keyof HTMLElementTagNameMap;\n  }\n\n  /**\n   * The method for hiding the widget.\n   *\n   * The default is Display.\n   *\n   * Using `Scale` will often increase performance as most browsers will not\n   * trigger style computation for the `transform` action. This should be used\n   * sparingly and tested, since increasing the number of composition layers\n   * may slow things down.\n   *\n   * To ensure the transformation does not trigger style recomputation, you\n   * may need to set the widget CSS style `will-change: transform`. This\n   * should be used only when needed as it may overwhelm the browser with a\n   * high number of layers. See\n   * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n   */\n  export enum HiddenMode {\n    /**\n     * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n     * CSS from the standard Lumino CSS.\n     */\n    Display = 0,\n\n    /**\n     * Hide the widget by setting the `transform` to `'scale(0)'`.\n     */\n    Scale,\n\n    /**\n     *Hide the widget by setting the `content-visibility` to `'hidden'`.\n     */\n    ContentVisibility\n  }\n\n  /**\n   * An enum of widget bit flags.\n   */\n  export enum Flag {\n    /**\n     * The widget has been disposed.\n     */\n    IsDisposed = 0x1,\n\n    /**\n     * The widget is attached to the DOM.\n     */\n    IsAttached = 0x2,\n\n    /**\n     * The widget is hidden.\n     */\n    IsHidden = 0x4,\n\n    /**\n     * The widget is visible.\n     *\n     * @deprecated since 2.7.0, apply that flag consistently was not reliable\n     * so it was dropped in favor of a recursive check of the visibility of all parents.\n     */\n    IsVisible = 0x8,\n\n    /**\n     * A layout cannot be set on the widget.\n     */\n    DisallowLayout = 0x10\n  }\n\n  /**\n   * A collection of stateless messages related to widgets.\n   */\n  export namespace Msg {\n    /**\n     * A singleton `'before-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const BeforeShow = new Message('before-show');\n\n    /**\n     * A singleton `'after-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const AfterShow = new Message('after-show');\n\n    /**\n     * A singleton `'before-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const BeforeHide = new Message('before-hide');\n\n    /**\n     * A singleton `'after-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const AfterHide = new Message('after-hide');\n\n    /**\n     * A singleton `'before-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is attached.\n     */\n    export const BeforeAttach = new Message('before-attach');\n\n    /**\n     * A singleton `'after-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is attached.\n     */\n    export const AfterAttach = new Message('after-attach');\n\n    /**\n     * A singleton `'before-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is detached.\n     */\n    export const BeforeDetach = new Message('before-detach');\n\n    /**\n     * A singleton `'after-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is detached.\n     */\n    export const AfterDetach = new Message('after-detach');\n\n    /**\n     * A singleton `'parent-changed'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget when its parent has changed.\n     */\n    export const ParentChanged = new Message('parent-changed');\n\n    /**\n     * A singleton conflatable `'update-request'` message.\n     *\n     * #### Notes\n     * This message can be dispatched to supporting widgets in order to\n     * update their content based on the current widget state. Not all\n     * widgets will respond to messages of this type.\n     *\n     * For widgets with a layout, this message will inform the layout to\n     * update the position and size of its child widgets.\n     */\n    export const UpdateRequest = new ConflatableMessage('update-request');\n\n    /**\n     * A singleton conflatable `'fit-request'` message.\n     *\n     * #### Notes\n     * For widgets with a layout, this message will inform the layout to\n     * recalculate its size constraints to fit the space requirements of\n     * its child widgets, and to update their position and size. Not all\n     * layouts will respond to messages of this type.\n     */\n    export const FitRequest = new ConflatableMessage('fit-request');\n\n    /**\n     * A singleton conflatable `'activate-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should\n     * perform the actions necessary to activate the widget, which\n     * may include focusing its node or descendant node.\n     */\n    export const ActivateRequest = new ConflatableMessage('activate-request');\n\n    /**\n     * A singleton conflatable `'close-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should close\n     * and remove itself from the widget hierarchy.\n     */\n    export const CloseRequest = new ConflatableMessage('close-request');\n  }\n\n  /**\n   * A message class for child related messages.\n   */\n  export class ChildMessage extends Message {\n    /**\n     * Construct a new child message.\n     *\n     * @param type - The message type.\n     *\n     * @param child - The child widget for the message.\n     */\n    constructor(type: string, child: Widget) {\n      super(type);\n      this.child = child;\n    }\n\n    /**\n     * The child widget for the message.\n     */\n    readonly child: Widget;\n  }\n\n  /**\n   * A message class for `'resize'` messages.\n   */\n  export class ResizeMessage extends Message {\n    /**\n     * Construct a new resize message.\n     *\n     * @param width - The **offset width** of the widget, or `-1` if\n     *   the width is not known.\n     *\n     * @param height - The **offset height** of the widget, or `-1` if\n     *   the height is not known.\n     */\n    constructor(width: number, height: number) {\n      super('resize');\n      this.width = width;\n      this.height = height;\n    }\n\n    /**\n     * The offset width of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the width is unknown.\n     */\n    readonly width: number;\n\n    /**\n     * The offset height of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the height is unknown.\n     */\n    readonly height: number;\n  }\n\n  /**\n   * The namespace for the `ResizeMessage` class statics.\n   */\n  export namespace ResizeMessage {\n    /**\n     * A singleton `'resize'` message with an unknown size.\n     */\n    export const UnknownSize = new ResizeMessage(-1, -1);\n  }\n\n  /**\n   * Attach a widget to a host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param host - The DOM node to use as the widget's host.\n   *\n   * @param ref - The child of `host` to use as the reference element.\n   *   If this is provided, the widget will be inserted before this\n   *   node in the host. The default is `null`, which will cause the\n   *   widget to be added as the last child of the host.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget, if\n   * the widget is already attached, or if the host is not attached\n   * to the DOM.\n   */\n  export function attach(\n    widget: Widget,\n    host: HTMLElement,\n    ref: HTMLElement | null = null\n  ): void {\n    if (widget.parent) {\n      throw new Error('Cannot attach a child widget.');\n    }\n    if (widget.isAttached || widget.node.isConnected) {\n      throw new Error('Widget is already attached.');\n    }\n    if (!host.isConnected) {\n      throw new Error('Host is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    host.insertBefore(widget.node, ref);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n  }\n\n  /**\n   * Detach the widget from its host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget,\n   * or if the widget is not attached to the DOM.\n   */\n  export function detach(widget: Widget): void {\n    if (widget.parent) {\n      throw new Error('Cannot detach a child widget.');\n    }\n    if (!widget.isAttached || !widget.node.isConnected) {\n      throw new Error('Widget is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    widget.node.parentNode!.removeChild(widget.node);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An attached property for the widget title object.\n   */\n  export const titleProperty = new AttachedProperty<Widget, Title<Widget>>({\n    name: 'title',\n    create: owner => new Title<Widget>({ owner })\n  });\n\n  /**\n   * Create a DOM node for the given widget options.\n   */\n  export function createNode(options: Widget.IOptions): HTMLElement {\n    return options.node || document.createElement(options.tag || 'div');\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable<Widget>, IDisposable {\n  /**\n   * Construct a new layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: Layout.IOptions = {}) {\n    this._fitPolicy = options.fitPolicy || 'set-min-size';\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This should be reimplemented to clear and dispose of the widgets.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    this._parent = null;\n    this._disposed = true;\n    Signal.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * Test whether the layout is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Get the parent widget of the layout.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent widget of the layout.\n   *\n   * #### Notes\n   * This is set automatically when installing the layout on the parent\n   * widget. The parent widget should not be set directly by user code.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (this._parent) {\n      throw new Error('Cannot change parent widget.');\n    }\n    if (value!.layout !== this) {\n      throw new Error('Invalid parent widget.');\n    }\n    this._parent = value;\n    this.init();\n  }\n\n  /**\n   * Get the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  get fitPolicy(): Layout.FitPolicy {\n    return this._fitPolicy;\n  }\n\n  /**\n   * Set the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   *\n   * Changing the fit policy will clear the current size constraint\n   * for the parent widget and then re-fit the parent.\n   */\n  set fitPolicy(value: Layout.FitPolicy) {\n    // Bail if the policy does not change\n    if (this._fitPolicy === value) {\n      return;\n    }\n\n    // Update the internal policy.\n    this._fitPolicy = value;\n\n    // Clear the size constraints and schedule a fit of the parent.\n    if (this._parent) {\n      let style = this._parent.node.style;\n      style.minWidth = '';\n      style.minHeight = '';\n      style.maxWidth = '';\n      style.maxHeight = '';\n      this._parent.fit();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This abstract method must be implemented by a subclass.\n   */\n  abstract [Symbol.iterator](): IterableIterator<Widget>;\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method should *not* modify the widget's `parent`.\n   */\n  abstract removeWidget(widget: Widget): void;\n\n  /**\n   * Process a message sent to the parent widget.\n   *\n   * @param msg - The message sent to the parent widget.\n   *\n   * #### Notes\n   * This method is called by the parent widget to process a message.\n   *\n   * Subclasses may reimplement this method as needed.\n   */\n  processParentMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.onAfterDetach(msg);\n        break;\n      case 'child-removed':\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      case 'child-shown':\n        this.onChildShown(msg as Widget.ChildMessage);\n        break;\n      case 'child-hidden':\n        this.onChildHidden(msg as Widget.ChildMessage);\n        break;\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   *\n   * #### Notes\n   * This method is invoked immediately after the layout is installed\n   * on the parent widget.\n   *\n   * The default implementation reparents all of the widgets to the\n   * layout parent widget.\n   *\n   * Subclasses should reimplement this method and attach the child\n   * widget nodes to the parent widget's node.\n   */\n  protected init(): void {\n    for (const widget of this) {\n      widget.parent = this.parent;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the specified layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the available layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * This will remove the child widget from the layout.\n   *\n   * Subclasses should **not** typically reimplement this method.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    this.removeWidget(msg.child);\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n  private _disposed = false;\n  private _fitPolicy: Layout.FitPolicy;\n  private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n  /**\n   * A type alias for the layout fit policy.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  export type FitPolicy =\n    | /**\n     * No size constraint will be applied to the parent widget.\n     */\n    'set-no-constraint'\n\n    /**\n     * The computed min size will be applied to the parent widget.\n     */\n    | 'set-min-size';\n\n  /**\n   * An options object for initializing a layout.\n   */\n  export interface IOptions {\n    /**\n     * The fit policy for the layout.\n     *\n     * The default is `'set-min-size'`.\n     */\n    fitPolicy?: FitPolicy;\n  }\n\n  /**\n   * A type alias for the horizontal alignment of a widget.\n   */\n  export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n  /**\n   * A type alias for the vertical alignment of a widget.\n   */\n  export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n  /**\n   * Get the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The horizontal alignment for the widget.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   */\n  export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n    return Private.horizontalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the horizontal alignment.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setHorizontalAlignment(\n    widget: Widget,\n    value: HorizontalAlignment\n  ): void {\n    Private.horizontalAlignmentProperty.set(widget, value);\n  }\n\n  /**\n   * Get the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The vertical alignment for the widget.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   */\n  export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n    return Private.verticalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the vertical alignment.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setVerticalAlignment(\n    widget: Widget,\n    value: VerticalAlignment\n  ): void {\n    Private.verticalAlignmentProperty.set(widget, value);\n  }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n  /**\n   * Construct a new layout item.\n   *\n   * @param widget - The widget to be managed by the item.\n   *\n   * #### Notes\n   * The widget will be set to absolute positioning.\n   * The widget will use strict CSS containment.\n   */\n  constructor(widget: Widget) {\n    this.widget = widget;\n    this.widget.node.style.position = 'absolute';\n    this.widget.node.style.contain = 'strict';\n  }\n\n  /**\n   * Dispose of the the layout item.\n   *\n   * #### Notes\n   * This will reset the positioning of the widget.\n   */\n  dispose(): void {\n    // Do nothing if the item is already disposed.\n    if (this._disposed) {\n      return;\n    }\n\n    // Mark the item as disposed.\n    this._disposed = true;\n\n    // Reset the widget style.\n    let style = this.widget.node.style;\n    style.position = '';\n    style.top = '';\n    style.left = '';\n    style.width = '';\n    style.height = '';\n    style.contain = '';\n  }\n\n  /**\n   * The widget managed by the layout item.\n   */\n  readonly widget: Widget;\n\n  /**\n   * The computed minimum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minWidth(): number {\n    return this._minWidth;\n  }\n\n  /**\n   * The computed minimum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minHeight(): number {\n    return this._minHeight;\n  }\n\n  /**\n   * The computed maximum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxWidth(): number {\n    return this._maxWidth;\n  }\n\n  /**\n   * The computed maximum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxHeight(): number {\n    return this._maxHeight;\n  }\n\n  /**\n   * Whether the layout item is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Whether the managed widget is hidden.\n   */\n  get isHidden(): boolean {\n    return this.widget.isHidden;\n  }\n\n  /**\n   * Whether the managed widget is visible.\n   */\n  get isVisible(): boolean {\n    return this.widget.isVisible;\n  }\n\n  /**\n   * Whether the managed widget is attached.\n   */\n  get isAttached(): boolean {\n    return this.widget.isAttached;\n  }\n\n  /**\n   * Update the computed size limits of the managed widget.\n   */\n  fit(): void {\n    let limits = ElementExt.sizeLimits(this.widget.node);\n    this._minWidth = limits.minWidth;\n    this._minHeight = limits.minHeight;\n    this._maxWidth = limits.maxWidth;\n    this._maxHeight = limits.maxHeight;\n  }\n\n  /**\n   * Update the position and size of the managed widget.\n   *\n   * @param left - The left edge position of the layout box.\n   *\n   * @param top - The top edge position of the layout box.\n   *\n   * @param width - The width of the layout box.\n   *\n   * @param height - The height of the layout box.\n   */\n  update(left: number, top: number, width: number, height: number): void {\n    // Clamp the size to the computed size limits.\n    let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n    let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n    // Adjust the left edge for the horizontal alignment, if needed.\n    if (clampW < width) {\n      switch (Layout.getHorizontalAlignment(this.widget)) {\n        case 'left':\n          break;\n        case 'center':\n          left += (width - clampW) / 2;\n          break;\n        case 'right':\n          left += width - clampW;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Adjust the top edge for the vertical alignment, if needed.\n    if (clampH < height) {\n      switch (Layout.getVerticalAlignment(this.widget)) {\n        case 'top':\n          break;\n        case 'center':\n          top += (height - clampH) / 2;\n          break;\n        case 'bottom':\n          top += height - clampH;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Set up the resize variables.\n    let resized = false;\n    let style = this.widget.node.style;\n\n    // Update the top edge of the widget if needed.\n    if (this._top !== top) {\n      this._top = top;\n      style.top = `${top}px`;\n    }\n\n    // Update the left edge of the widget if needed.\n    if (this._left !== left) {\n      this._left = left;\n      style.left = `${left}px`;\n    }\n\n    // Update the width of the widget if needed.\n    if (this._width !== clampW) {\n      resized = true;\n      this._width = clampW;\n      style.width = `${clampW}px`;\n    }\n\n    // Update the height of the widget if needed.\n    if (this._height !== clampH) {\n      resized = true;\n      this._height = clampH;\n      style.height = `${clampH}px`;\n    }\n\n    // Send a resize message to the widget if needed.\n    if (resized) {\n      let msg = new Widget.ResizeMessage(clampW, clampH);\n      MessageLoop.sendMessage(this.widget, msg);\n    }\n  }\n\n  private _top = NaN;\n  private _left = NaN;\n  private _width = NaN;\n  private _height = NaN;\n  private _minWidth = 0;\n  private _minHeight = 0;\n  private _maxWidth = Infinity;\n  private _maxHeight = Infinity;\n  private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The attached property for a widget horizontal alignment.\n   */\n  export const horizontalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.HorizontalAlignment\n  >({\n    name: 'horizontalAlignment',\n    create: () => 'center',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The attached property for a widget vertical alignment.\n   */\n  export const verticalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.VerticalAlignment\n  >({\n    name: 'verticalAlignment',\n    create: () => 'top',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The change handler for the attached alignment properties.\n   */\n  function onAlignmentChanged(child: Widget): void {\n    if (child.parent && child.parent.layout) {\n      child.parent.update();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    while (this._widgets.length > 0) {\n      this._widgets.pop()!.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * A read-only array of the widgets in the layout.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this._widgets;\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    yield* this._widgets;\n  }\n\n  /**\n   * Add a widget to the end of the layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this._widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    widget.parent = this.parent;\n\n    // Look up the current index of the widget.\n    let i = this._widgets.indexOf(widget);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._widgets.length));\n\n    // If the widget is not in the array, insert it.\n    if (i === -1) {\n      // Insert the widget into the array.\n      ArrayExt.insert(this._widgets, j, widget);\n\n      // If the layout is parented, attach the widget to the DOM.\n      if (this.parent) {\n        this.attachWidget(j, widget);\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the widget exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._widgets.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the widget to the new location.\n    ArrayExt.move(this._widgets, i, j);\n\n    // If the layout is parented, move the widget in the DOM.\n    if (this.parent) {\n      this.moveWidget(i, j, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    this.removeWidgetAt(this._widgets.indexOf(widget));\n  }\n\n  /**\n   * Remove the widget at a given index from the layout.\n   *\n   * @param index - The index of the widget to remove.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  removeWidgetAt(index: number): void {\n    // Remove the widget from the array.\n    let widget = ArrayExt.removeAt(this._widgets, index);\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (widget && this.parent) {\n      this.detachWidget(index, widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    let index = 0;\n    for (const widget of this) {\n      this.attachWidget(index++, widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[index];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation moves the widget's node to the proper\n   * location in the parent's node and sends the appropriate attach and\n   * detach messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is moved in the parent's node.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` and  message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[toIndex];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n  /**\n   * Clamp a dimension value to an integer >= 0.\n   */\n  export function clampDimension(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n  /**\n   * Construct a new split layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: SplitLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.orientation !== undefined) {\n      this._orientation = options.orientation;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n    this._handles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the split layout.\n   */\n  readonly renderer: SplitLayout.IRenderer;\n\n  /**\n   * Get the layout orientation for the split layout.\n   */\n  get orientation(): SplitLayout.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split layout.\n   */\n  set orientation(value: SplitLayout.Orientation) {\n    if (this._orientation === value) {\n      return;\n    }\n    this._orientation = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['orientation'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  get alignment(): SplitLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  set alignment(value: SplitLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the split layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the split handles in the layout.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return this._handles;\n  }\n\n  /**\n   * Get the absolute sizes of the widgets in the layout.\n   *\n   * @returns A new array of the absolute sizes of the widgets.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  absoluteSizes(): number[] {\n    return this._sizers.map(sizer => sizer.size);\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the layout.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return Private.normalize(this._sizers.map(sizer => sizer.size));\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the layout.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    // Copy the sizes and pad with zeros as needed.\n    let n = this._sizers.length;\n    let temp = sizes.slice(0, n);\n    while (temp.length < n) {\n      temp.push(0);\n    }\n\n    // Normalize the padded sizes.\n    let normed = Private.normalize(temp);\n\n    // Apply the normalized sizes to the sizers.\n    for (let i = 0; i < n; ++i) {\n      let sizer = this._sizers[i];\n      sizer.sizeHint = normed[i];\n      sizer.size = normed[i];\n    }\n\n    // Set the flag indicating the sizes are normalized.\n    this._hasNormedSizes = true;\n\n    // Trigger an update of the parent widget.\n    if (update && this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Move the offset position of a split handle.\n   *\n   * @param index - The index of the handle of the interest.\n   *\n   * @param position - The desired offset position of the handle.\n   *\n   * #### Notes\n   * The position is relative to the offset parent.\n   *\n   * This will move the handle as close as possible to the desired\n   * position. The sibling widgets will be adjusted as necessary.\n   */\n  moveHandle(index: number, position: number): void {\n    // Bail if the index is invalid or the handle is hidden.\n    let handle = this._handles[index];\n    if (!handle || handle.classList.contains('lm-mod-hidden')) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (this._orientation === 'horizontal') {\n      delta = position - handle.offsetLeft;\n    } else {\n      delta = position - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent widget resizing unless needed.\n    for (let sizer of this._sizers) {\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(this._sizers, index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['orientation'] = this.orientation;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create the item, handle, and sizer for the new widget.\n    let item = new LayoutItem(widget);\n    let handle = Private.createHandle(this.renderer);\n    let average = Private.averageSize(this._sizers);\n    let sizer = Private.createSizer(average);\n\n    // Insert the item, handle, and sizer into the internal arrays.\n    ArrayExt.insert(this._items, index, item);\n    ArrayExt.insert(this._sizers, index, sizer);\n    ArrayExt.insert(this._handles, index, handle);\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget and handle nodes to the parent.\n    this.parent!.node.appendChild(widget.node);\n    this.parent!.node.appendChild(handle);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the item, sizer, and handle for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n    ArrayExt.move(this._handles, fromIndex, toIndex);\n\n    // Post a fit request to the parent to show/hide last handle.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the item, handle, and sizer for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n    let handle = ArrayExt.removeAt(this._handles, index);\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget and handle nodes from the parent.\n    this.parent!.node.removeChild(widget.node);\n    this.parent!.node.removeChild(handle!);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const item = this._items[i];\n    if (item.isHidden) {\n      return;\n    }\n\n    // Fetch the style for the handle.\n    let handleStyle = this._handles[i].style;\n\n    // Update the widget and handle, and advance the relevant edge.\n    if (isHorizontal) {\n      left += this.widgetOffset;\n      item.update(left, top, size, height);\n      left += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${this._spacing}px`;\n      handleStyle.height = `${height}px`;\n    } else {\n      top += this.widgetOffset;\n      item.update(left, top, width, size);\n      top += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${width}px`;\n      handleStyle.height = `${this._spacing}px`;\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Update the handles and track the visible widget count.\n    let nVisible = 0;\n    let lastHandleIndex = -1;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      if (this._items[i].isHidden) {\n        this._handles[i].classList.add('lm-mod-hidden');\n      } else {\n        this._handles[i].classList.remove('lm-mod-hidden');\n        lastHandleIndex = i;\n        nVisible++;\n      }\n    }\n\n    // Hide the handle for the last visible widget.\n    if (lastHandleIndex !== -1) {\n      this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed =\n      this._spacing * Math.max(0, nVisible - 1) +\n      this.widgetOffset * this._items.length;\n\n    // Setup the computed minimum size.\n    let horz = this._orientation === 'horizontal';\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed size limits.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // Prevent resizing unless necessary.\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the stretch factor.\n      sizer.stretch = SplitLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0 && this.widgetOffset === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Set up the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n    let horz = this._orientation === 'horizontal';\n\n    if (nVisible > 0) {\n      // Compute the adjusted layout space.\n      let space: number;\n      if (horz) {\n        // left += this.widgetOffset;\n        space = Math.max(0, width - this._fixed);\n      } else {\n        // top += this.widgetOffset;\n        space = Math.max(0, height - this._fixed);\n      }\n\n      // Scale the size hints if they are normalized.\n      if (this._hasNormedSizes) {\n        for (let sizer of this._sizers) {\n          sizer.sizeHint *= space;\n        }\n        this._hasNormedSizes = false;\n      }\n\n      // Distribute the layout space to the box sizers.\n      let delta = BoxEngine.calc(this._sizers, space);\n\n      // Account for alignment if there is extra layout space.\n      if (delta > 0) {\n        switch (this._alignment) {\n          case 'start':\n            break;\n          case 'center':\n            extra = 0;\n            offset = delta / 2;\n            break;\n          case 'end':\n            extra = 0;\n            offset = delta;\n            break;\n          case 'justify':\n            extra = delta / nVisible;\n            offset = 0;\n            break;\n          default:\n            throw 'unreachable';\n        }\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      const item = this._items[i];\n\n      // Fetch the computed size for the widget.\n      const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n      this.updateItemPosition(\n        i,\n        horz,\n        horz ? left + offset : left,\n        horz ? top : top + offset,\n        height,\n        width,\n        size\n      );\n\n      const fullOffset =\n        this.widgetOffset +\n        (this._handles[i].classList.contains('lm-mod-hidden')\n          ? 0\n          : this._spacing);\n\n      if (horz) {\n        left += size + fullOffset;\n      } else {\n        top += size + fullOffset;\n      }\n    }\n  }\n\n  protected widgetOffset = 0;\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _hasNormedSizes = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _handles: HTMLDivElement[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: SplitLayout.Alignment = 'start';\n  private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n  /**\n   * A type alias for a split layout orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a split layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a split layout.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The orientation of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Orientation}.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a split layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new handle for use with a split layout.\n     *\n     * @returns A new handle element.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * Get the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Create a new box sizer with the given size hint.\n   */\n  export function createSizer(size: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = Math.floor(size);\n    return sizer;\n  }\n\n  /**\n   * Create a new split handle node using the given renderer.\n   */\n  export function createHandle(\n    renderer: SplitLayout.IRenderer\n  ): HTMLDivElement {\n    let handle = renderer.createHandle();\n    handle.style.position = 'absolute';\n    // Do not use size containment to allow the handle to fill the available space\n    handle.style.contain = 'style';\n    return handle;\n  }\n\n  /**\n   * Compute the average size of an array of box sizers.\n   */\n  export function averageSize(sizers: BoxSizer[]): number {\n    return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n  }\n\n  /**\n   * Normalize an array of values.\n   */\n  export function normalize(values: number[]): number[] {\n    let n = values.length;\n    if (n === 0) {\n      return [];\n    }\n    let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n    return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof SplitLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n  /**\n   * Construct a new accordion layout.\n   *\n   * @param options - The options for initializing the layout.\n   *\n   * #### Notes\n   * The default orientation will be vertical.\n   *\n   * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n   */\n  constructor(options: AccordionLayout.IOptions) {\n    super({ ...options, orientation: options.orientation || 'vertical' });\n    this.titleSpace = options.titleSpace || 22;\n  }\n\n  /**\n   * The section title height or width depending on the orientation.\n   */\n  get titleSpace(): number {\n    return this.widgetOffset;\n  }\n  set titleSpace(value: number) {\n    value = Utils.clampDimension(value);\n    if (this.widgetOffset === value) {\n      return;\n    }\n    this.widgetOffset = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return this._titles;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Clear the layout state.\n    this._titles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the accordion layout.\n   */\n  readonly renderer: AccordionLayout.IRenderer;\n\n  public updateTitle(index: number, widget: Widget): void {\n    const oldTitle = this._titles[index];\n    const expanded = oldTitle.classList.contains('lm-mod-expanded');\n    const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n    this._titles[index] = newTitle;\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.replaceChild(newTitle, oldTitle);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (!widget.id) {\n      widget.id = `id-${UUID.uuid4()}`;\n    }\n    super.insertWidget(index, widget);\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    const title = Private.createTitle(this.renderer, widget.title);\n\n    ArrayExt.insert(this._titles, index, title);\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.appendChild(title);\n\n    widget.node.setAttribute('role', 'region');\n    widget.node.setAttribute('aria-labelledby', title.id);\n\n    super.attachWidget(index, widget);\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    ArrayExt.move(this._titles, fromIndex, toIndex);\n    super.moveWidget(fromIndex, toIndex, widget);\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    const title = ArrayExt.removeAt(this._titles, index);\n\n    this.parent!.node.removeChild(title!);\n\n    super.detachWidget(index, widget);\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const titleStyle = this._titles[i].style;\n\n    // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n    titleStyle.top = `${top}px`;\n    titleStyle.left = `${left}px`;\n    titleStyle.height = `${this.widgetOffset}px`;\n    if (isHorizontal) {\n      titleStyle.width = `${height}px`;\n    } else {\n      titleStyle.width = `${width}px`;\n    }\n\n    super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n  }\n\n  private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n  /**\n   * A type alias for a accordion layout orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion layout alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * An options object for initializing a accordion layout.\n   */\n  export interface IOptions extends SplitLayout.IOptions {\n    /**\n     * The renderer to use for the accordion layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The section title height or width depending on the orientation.\n     *\n     * The default is `22`.\n     */\n    titleSpace?: number;\n  }\n\n  /**\n   * A renderer for use with an accordion layout.\n   */\n  export interface IRenderer extends SplitLayout.IRenderer {\n    /**\n     * Common class name for all accordion titles.\n     */\n    readonly titleClassName: string;\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param title - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(title: Title<Widget>): HTMLElement;\n  }\n}\n\nnamespace Private {\n  /**\n   * Create the title HTML element.\n   *\n   * @param renderer Accordion renderer\n   * @param data Widget title\n   * @returns Title HTML element\n   */\n  export function createTitle(\n    renderer: AccordionLayout.IRenderer,\n    data: Title<Widget>,\n    expanded: boolean = true\n  ): HTMLElement {\n    const title = renderer.createSectionTitle(data);\n    title.style.position = 'absolute';\n    title.style.contain = 'strict';\n    title.setAttribute('aria-label', `${data.label} Section`);\n    title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n    title.setAttribute('aria-controls', data.owner.id);\n    if (expanded) {\n      title.classList.add('lm-mod-expanded');\n    }\n    return title;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n  /**\n   * Construct a new panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: Panel.IOptions = {}) {\n    super();\n    this.addClass('lm-Panel');\n    this.layout = Private.createLayout(options);\n  }\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return (this.layout as PanelLayout).widgets;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    (this.layout as PanelLayout).addWidget(widget);\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    (this.layout as PanelLayout).insertWidget(index, widget);\n  }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n  /**\n   * An options object for creating a panel.\n   */\n  export interface IOptions {\n    /**\n     * The panel layout to use for the panel.\n     *\n     * The default is a new `PanelLayout`.\n     */\n    layout?: PanelLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a panel layout for the given panel options.\n   */\n  export function createLayout(options: Panel.IOptions): PanelLayout {\n    return options.layout || new PanelLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n  /**\n   * Construct a new split panel.\n   *\n   * @param options - The options for initializing the split panel.\n   */\n  constructor(options: SplitPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-SplitPanel');\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    super.dispose();\n  }\n\n  /**\n   * Get the layout orientation for the split panel.\n   */\n  get orientation(): SplitPanel.Orientation {\n    return (this.layout as SplitLayout).orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split panel.\n   */\n  set orientation(value: SplitPanel.Orientation) {\n    (this.layout as SplitLayout).orientation = value;\n  }\n\n  /**\n   * Get the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  get alignment(): SplitPanel.Alignment {\n    return (this.layout as SplitLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  set alignment(value: SplitPanel.Alignment) {\n    (this.layout as SplitLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the split panel.\n   */\n  get spacing(): number {\n    return (this.layout as SplitLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split panel.\n   */\n  set spacing(value: number) {\n    (this.layout as SplitLayout).spacing = value;\n  }\n\n  /**\n   * The renderer used by the split panel.\n   */\n  get renderer(): SplitPanel.IRenderer {\n    return (this.layout as SplitLayout).renderer;\n  }\n\n  /**\n   * A signal emitted when a split handle has moved.\n   */\n  get handleMoved(): ISignal<this, void> {\n    return this._handleMoved;\n  }\n\n  /**\n   * A read-only array of the split handles in the panel.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return (this.layout as SplitLayout).handles;\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the panel.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return (this.layout as SplitLayout).relativeSizes();\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the panel.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n  }\n\n  /**\n   * Handle the DOM events for the split panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the `'keydown'` event for the split panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    if (this._pressData) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the split panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the primary button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the target, if any.\n    let layout = this.layout as SplitLayout;\n    let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n      return handle.contains(event.target as HTMLElement);\n    });\n\n    // Bail early if the mouse press was not on a handle.\n    if (index === -1) {\n      return;\n    }\n\n    // Stop the event when a split handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    document.addEventListener('pointerup', this, true);\n    document.addEventListener('pointermove', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset delta for the handle press.\n    let delta: number;\n    let handle = layout.handles[index];\n    let rect = handle.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      delta = event.clientX - rect.left;\n    } else {\n      delta = event.clientY - rect.top;\n    }\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!);\n    this._pressData = { index, delta, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the split panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Stop the event when dragging a split handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let pos: number;\n    let layout = this.layout as SplitLayout;\n    let rect = this.node.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      pos = event.clientX - rect.left - this._pressData!.delta;\n    } else {\n      pos = event.clientY - rect.top - this._pressData!.delta;\n    }\n\n    // Move the handle as close to the desired position as possible.\n    layout.moveHandle(this._pressData!.index, pos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the split panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the primary button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse grab for the split panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Emit the handle moved signal.\n    this._handleMoved.emit();\n\n    // Remove the extra document listeners.\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('pointerup', this, true);\n    document.removeEventListener('pointermove', this, true);\n    document.removeEventListener('contextmenu', this, true);\n  }\n\n  private _handleMoved = new Signal<any, void>(this);\n  private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n  /**\n   * A type alias for a split panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a split panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a split panel renderer.\n   */\n  export type IRenderer = SplitLayout.IRenderer;\n\n  /**\n   * An options object for initializing a split panel.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The layout orientation of the panel.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The split layout to use for the split panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `SplitLayout`.\n     */\n    layout?: SplitLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new handle for use with a split panel.\n     *\n     * @returns A new handle element for a split panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-SplitPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * Get the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return SplitLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    SplitLayout.setStretch(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The index of the pressed handle.\n     */\n    index: number;\n\n    /**\n     * The offset of the press in handle coordinates.\n     */\n    delta: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * Create a split layout for the given panel options.\n   */\n  export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n    return (\n      options.layout ||\n      new SplitLayout({\n        renderer: options.renderer || SplitPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n  /**\n   * Construct a new accordion panel.\n   *\n   * @param options - The options for initializing the accordion panel.\n   *\n   */\n  constructor(options: AccordionPanel.IOptions = {}) {\n    super({ ...options, layout: Private.createLayout(options) });\n    this.addClass('lm-AccordionPanel');\n  }\n\n  /**\n   * The renderer used by the accordion panel.\n   */\n  get renderer(): AccordionPanel.IRenderer {\n    return (this.layout as AccordionLayout).renderer;\n  }\n\n  /**\n   * The section title space.\n   *\n   * This is the height if the panel is vertical and the width if it is\n   * horizontal.\n   */\n  get titleSpace(): number {\n    return (this.layout as AccordionLayout).titleSpace;\n  }\n  set titleSpace(value: number) {\n    (this.layout as AccordionLayout).titleSpace = value;\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return (this.layout as AccordionLayout).titles;\n  }\n\n  /**\n   * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n   */\n  get expansionToggled(): ISignal<this, number> {\n    return this._expansionToggled;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    super.addWidget(widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Collapse the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  collapse(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && !widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Expand the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  expand(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    super.insertWidget(index, widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Handle the DOM events for the accordion panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    super.handleEvent(event);\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._eventKeyDown(event as KeyboardEvent);\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    super.onBeforeAttach(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    super.onAfterDetach(msg);\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<Widget>): void {\n    const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n      return widget.contains(sender.owner);\n    });\n\n    if (index >= 0) {\n      (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n      this.update();\n    }\n  }\n\n  /**\n   * Compute the size of widgets in this panel on the title click event.\n   * On closing, the size of the widget is cached and we will try to expand\n   * the last opened widget.\n   * On opening, we will use the cached size if it is available to restore the\n   * widget.\n   * In both cases, if we can not compute the size of widgets, we will let\n   * `SplitLayout` decide.\n   *\n   * @param index - The index of widget to be opened of closed\n   *\n   * @returns Relative size of widgets in this panel, if this size can\n   * not be computed, return `undefined`\n   */\n  private _computeWidgetSize(index: number): number[] | undefined {\n    const layout = this.layout as AccordionLayout;\n\n    const widget = layout.widgets[index];\n    if (!widget) {\n      return undefined;\n    }\n    const isHidden = widget.isHidden;\n    const widgetSizes = layout.absoluteSizes();\n    const delta = (isHidden ? -1 : 1) * this.spacing;\n    const totalSize = widgetSizes.reduce(\n      (prev: number, curr: number) => prev + curr\n    );\n\n    let newSize = [...widgetSizes];\n\n    if (!isHidden) {\n      // Hide the widget\n      const currentSize = widgetSizes[index];\n\n      this._widgetSizesCache.set(widget, currentSize);\n      newSize[index] = 0;\n\n      const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // All widget are closed, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n\n      newSize[widgetToCollapse] =\n        widgetSizes[widgetToCollapse] + currentSize + delta;\n    } else {\n      // Show the widget\n      const previousSize = this._widgetSizesCache.get(widget);\n      if (!previousSize) {\n        // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n      newSize[index] += previousSize;\n\n      const widgetToCollapse = newSize\n        .map(sz => sz - previousSize > 0)\n        .lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // Can not reduce the size of one widget, reduce all opened widgets\n        // proportionally with its size.\n        newSize.forEach((_, idx) => {\n          if (idx !== index) {\n            newSize[idx] -=\n              (widgetSizes[idx] / totalSize) * (previousSize - delta);\n          }\n        });\n      } else {\n        newSize[widgetToCollapse] -= previousSize - delta;\n      }\n    }\n    return newSize.map(sz => sz / (totalSize + delta));\n  }\n  /**\n   * Handle the `'click'` event for the accordion panel\n   */\n  private _evtClick(event: MouseEvent): void {\n    const target = event.target as HTMLElement | null;\n\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._toggleExpansion(index);\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the accordion panel.\n   */\n  private _eventKeyDown(event: KeyboardEvent): void {\n    if (event.defaultPrevented) {\n      return;\n    }\n\n    const target = event.target as HTMLElement | null;\n    let handled = false;\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        const keyCode = event.keyCode.toString();\n\n        // If Space or Enter is pressed on title, emulate click event\n        if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n          target.click();\n          handled = true;\n        } else if (\n          this.orientation === 'horizontal'\n            ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n            : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n        ) {\n          // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n          const direction =\n            event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n              ? -1\n              : 1;\n          const length = this.titles.length;\n          const newIndex = (index + length + direction) % length;\n\n          this.titles[newIndex].focus();\n          handled = true;\n        } else if (event.key === 'End' || keyCode === '35') {\n          // If End is pressed on title, focus on the last title\n          this.titles[this.titles.length - 1].focus();\n          handled = true;\n        } else if (event.key === 'Home' || keyCode === '36') {\n          // If Home is pressed on title, focus on the first title\n          this.titles[0].focus();\n          handled = true;\n        }\n      }\n\n      if (handled) {\n        event.preventDefault();\n      }\n    }\n  }\n\n  private _toggleExpansion(index: number) {\n    const title = this.titles[index];\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    const newSize = this._computeWidgetSize(index);\n    if (newSize) {\n      this.setRelativeSizes(newSize, false);\n    }\n\n    if (widget.isHidden) {\n      title.classList.add('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'true');\n      widget.show();\n    } else {\n      title.classList.remove('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'false');\n      widget.hide();\n    }\n\n    // Emit the expansion state signal.\n    this._expansionToggled.emit(index);\n  }\n\n  private _widgetSizesCache: WeakMap<Widget, number> = new WeakMap();\n  private _expansionToggled = new Signal<this, number>(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n  /**\n   * A type alias for a accordion panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a accordion panel renderer.\n   */\n  export type IRenderer = AccordionLayout.IRenderer;\n\n  /**\n   * An options object for initializing a accordion panel.\n   */\n  export interface IOptions extends Partial<AccordionLayout.IOptions> {\n    /**\n     * The accordion layout to use for the accordion panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `AccordionLayout`.\n     */\n    layout?: AccordionLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer extends SplitPanel.Renderer implements IRenderer {\n    constructor() {\n      super();\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches any title node in the accordion.\n     */\n    readonly titleClassName = 'lm-AccordionPanel-title';\n\n    /**\n     * Render the collapse indicator for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the collapse indicator.\n     */\n    createCollapseIcon(data: Title<Widget>): HTMLElement {\n      return document.createElement('span');\n    }\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(data: Title<Widget>): HTMLElement {\n      const handle = document.createElement('h3');\n      handle.setAttribute('tabindex', '0');\n      handle.id = this.createTitleKey(data);\n      handle.className = this.titleClassName;\n      for (const aData in data.dataset) {\n        handle.dataset[aData] = data.dataset[aData];\n      }\n\n      const collapser = handle.appendChild(this.createCollapseIcon(data));\n      collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n      const label = handle.appendChild(document.createElement('span'));\n      label.className = 'lm-AccordionPanel-titleLabel';\n      label.textContent = data.label;\n      label.title = data.caption || data.label;\n\n      return handle;\n    }\n\n    /**\n     * Create a unique render key for the title.\n     *\n     * @param data - The data to use for the title.\n     *\n     * @returns The unique render key for the title.\n     *\n     * #### Notes\n     * This method caches the key against the section title the first time\n     * the key is generated.\n     */\n    createTitleKey(data: Title<Widget>): string {\n      let key = this._titleKeys.get(data);\n      if (key === undefined) {\n        key = `title-key-${this._uuid}-${this._titleID++}`;\n        this._titleKeys.set(data, key);\n      }\n      return key;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _titleID = 0;\n    private _titleKeys = new WeakMap<Title<Widget>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n  /**\n   * Create an accordion layout for the given panel options.\n   *\n   * @param options Panel options\n   * @returns Panel layout\n   */\n  export function createLayout(\n    options: AccordionPanel.IOptions\n  ): AccordionLayout {\n    return (\n      options.layout ||\n      new AccordionLayout({\n        renderer: options.renderer || AccordionPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing,\n        titleSpace: options.titleSpace\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n  /**\n   * Construct a new box layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: BoxLayout.IOptions = {}) {\n    super();\n    if (options.direction !== undefined) {\n      this._direction = options.direction;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the layout direction for the box layout.\n   */\n  get direction(): BoxLayout.Direction {\n    return this._direction;\n  }\n\n  /**\n   * Set the layout direction for the box layout.\n   */\n  set direction(value: BoxLayout.Direction) {\n    if (this._direction === value) {\n      return;\n    }\n    this._direction = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['direction'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the box layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['direction'] = this.direction;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Create and add a new sizer for the widget.\n    ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Move the sizer for the widget.\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Remove the sizer for the widget.\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n    // Setup the computed minimum size.\n    let horz = Private.isHorizontal(this._direction);\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the size basis and stretch factor.\n      sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n      sizer.stretch = BoxLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Distribute the layout space and adjust the start position.\n    let delta: number;\n    switch (this._direction) {\n      case 'left-to-right':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        break;\n      case 'top-to-bottom':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        break;\n      case 'right-to-left':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        left += width;\n        break;\n      case 'bottom-to-top':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        top += height;\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Setup the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n\n    // Account for alignment if there is extra layout space.\n    if (delta > 0) {\n      switch (this._alignment) {\n        case 'start':\n          break;\n        case 'center':\n          extra = 0;\n          offset = delta / 2;\n          break;\n        case 'end':\n          extra = 0;\n          offset = delta;\n          break;\n        case 'justify':\n          extra = delta / nVisible;\n          offset = 0;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the computed size for the widget.\n      let size = this._sizers[i].size;\n\n      // Update the widget geometry and advance the relevant edge.\n      switch (this._direction) {\n        case 'left-to-right':\n          item.update(left + offset, top, size + extra, height);\n          left += size + extra + this._spacing;\n          break;\n        case 'top-to-bottom':\n          item.update(left, top + offset, width, size + extra);\n          top += size + extra + this._spacing;\n          break;\n        case 'right-to-left':\n          item.update(left - offset - size - extra, top, size + extra, height);\n          left -= size + extra + this._spacing;\n          break;\n        case 'bottom-to-top':\n          item.update(left, top - offset - size - extra, width, size + extra);\n          top -= size + extra + this._spacing;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n  }\n\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: BoxLayout.Alignment = 'start';\n  private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n  /**\n   * A type alias for a box layout direction.\n   */\n  export type Direction =\n    | 'left-to-right'\n    | 'right-to-left'\n    | 'top-to-bottom'\n    | 'bottom-to-top';\n\n  /**\n   * A type alias for a box layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a box layout.\n   */\n  export interface IOptions {\n    /**\n     * The direction of the layout.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * Get the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n\n  /**\n   * Get the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return Private.sizeBasisProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    Private.sizeBasisProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * The property descriptor for a widget size basis.\n   */\n  export const sizeBasisProperty = new AttachedProperty<Widget, number>({\n    name: 'sizeBasis',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Test whether a direction has horizontal orientation.\n   */\n  export function isHorizontal(dir: BoxLayout.Direction): boolean {\n    return dir === 'left-to-right' || dir === 'right-to-left';\n  }\n\n  /**\n   * Clamp a spacing value to an integer >= 0.\n   */\n  export function clampSpacing(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof BoxLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n  /**\n   * Construct a new box panel.\n   *\n   * @param options - The options for initializing the box panel.\n   */\n  constructor(options: BoxPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-BoxPanel');\n  }\n\n  /**\n   * Get the layout direction for the box panel.\n   */\n  get direction(): BoxPanel.Direction {\n    return (this.layout as BoxLayout).direction;\n  }\n\n  /**\n   * Set the layout direction for the box panel.\n   */\n  set direction(value: BoxPanel.Direction) {\n    (this.layout as BoxLayout).direction = value;\n  }\n\n  /**\n   * Get the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxPanel.Alignment {\n    return (this.layout as BoxLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxPanel.Alignment) {\n    (this.layout as BoxLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the box panel.\n   */\n  get spacing(): number {\n    return (this.layout as BoxLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box panel.\n   */\n  set spacing(value: number) {\n    (this.layout as BoxLayout).spacing = value;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-BoxPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-BoxPanel-child');\n  }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n  /**\n   * A type alias for a box panel direction.\n   */\n  export type Direction = BoxLayout.Direction;\n\n  /**\n   * A type alias for a box panel alignment.\n   */\n  export type Alignment = BoxLayout.Alignment;\n\n  /**\n   * An options object for initializing a box panel.\n   */\n  export interface IOptions {\n    /**\n     * The layout direction of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Direction}.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The box layout to use for the box panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `BoxLayout`.\n     */\n    layout?: BoxLayout;\n  }\n\n  /**\n   * Get the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return BoxLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    BoxLayout.setStretch(widget, value);\n  }\n\n  /**\n   * Get the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return BoxLayout.getSizeBasis(widget);\n  }\n\n  /**\n   * Set the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    BoxLayout.setSizeBasis(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a box layout for the given panel options.\n   */\n  export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n    return options.layout || new BoxLayout(options);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n  /**\n   * Construct a new command palette.\n   *\n   * @param options - The options for initializing the palette.\n   */\n  constructor(options: CommandPalette.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-CommandPalette');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || CommandPalette.defaultRenderer;\n    this.commands.commandChanged.connect(this._onGenericChange, this);\n    this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._items.length = 0;\n    this._results = null;\n    super.dispose();\n  }\n\n  /**\n   * The command registry used by the command palette.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the command palette.\n   */\n  readonly renderer: CommandPalette.IRenderer;\n\n  /**\n   * The command palette search node.\n   *\n   * #### Notes\n   * This is the node which contains the search-related elements.\n   */\n  get searchNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-search'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The command palette input node.\n   *\n   * #### Notes\n   * This is the actual input node for the search area.\n   */\n  get inputNode(): HTMLInputElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-input'\n    )[0] as HTMLInputElement;\n  }\n\n  /**\n   * The command palette content node.\n   *\n   * #### Notes\n   * This is the node which holds the command item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * A read-only array of the command items in the palette.\n   */\n  get items(): ReadonlyArray<CommandPalette.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Add a command item to the command palette.\n   *\n   * @param options - The options for creating the command item.\n   *\n   * @returns The command item added to the palette.\n   */\n  addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n    // Create a new command item for the options.\n    let item = Private.createItem(this.commands, options);\n\n    // Add the item to the array.\n    this._items.push(item);\n\n    // Refresh the search results.\n    this.refresh();\n\n    // Return the item added to the palette.\n    return item;\n  }\n\n  /**\n   * Adds command items to the command palette.\n   *\n   * @param items - An array of options for creating each command item.\n   *\n   * @returns The command items added to the palette.\n   */\n  addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n    const newItems = items.map(item => Private.createItem(this.commands, item));\n    newItems.forEach(item => this._items.push(item));\n    this.refresh();\n    return newItems;\n  }\n\n  /**\n   * Remove an item from the command palette.\n   *\n   * @param item - The item to remove from the palette.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the palette.\n   */\n  removeItem(item: CommandPalette.IItem): void {\n    this.removeItemAt(this._items.indexOf(item));\n  }\n\n  /**\n   * Remove the item at a given index from the command palette.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Remove all items from the command palette.\n   */\n  clearItems(): void {\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the array of items.\n    this._items.length = 0;\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Clear the search results and schedule an update.\n   *\n   * #### Notes\n   * This should be called whenever the search results of the palette\n   * should be updated.\n   *\n   * This is typically called automatically by the palette as needed,\n   * but can be called manually if the input text is programatically\n   * changed.\n   *\n   * The rendered results are updated asynchronously.\n   */\n  refresh(): void {\n    this._results = null;\n    if (this.inputNode.value !== '') {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'inherit';\n    } else {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'none';\n    }\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the command palette.\n   *\n   * @param event - The DOM event sent to the command palette.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the command palette's DOM node.\n   * It should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'input':\n        this.refresh();\n        break;\n      case 'focus':\n      case 'blur':\n        this._toggleFocused();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('input', this);\n    this.node.addEventListener('focus', this, true);\n    this.node.addEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('input', this);\n    this.node.removeEventListener('focus', this, true);\n    this.node.removeEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   */\n  protected onAfterShow(msg: Message): void {\n    this.update();\n    super.onAfterShow(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      let input = this.inputNode;\n      input.focus();\n      input.select();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (!this.isVisible) {\n      // Ensure to clear the content if the widget is hidden\n      VirtualDOM.render(null, this.contentNode);\n      return;\n    }\n\n    // Fetch the current query text and content node.\n    let query = this.inputNode.value;\n    let contentNode = this.contentNode;\n\n    // Ensure the search results are generated.\n    let results = this._results;\n    if (!results) {\n      // Generate and store the new search results.\n      results = this._results = Private.search(this._items, query);\n\n      // Reset the active index.\n      this._activeIndex = query\n        ? ArrayExt.findFirstIndex(results, Private.canActivate)\n        : -1;\n    }\n\n    // If there is no query and no results, clear the content.\n    if (!query && results.length === 0) {\n      VirtualDOM.render(null, contentNode);\n      return;\n    }\n\n    // If the is a query but no results, render the empty message.\n    if (query && results.length === 0) {\n      let content = this.renderer.renderEmptyMessage({ query });\n      VirtualDOM.render(content, contentNode);\n      return;\n    }\n\n    // Create the render content for the search results.\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let content = new Array<VirtualElement>(results.length);\n    for (let i = 0, n = results.length; i < n; ++i) {\n      let result = results[i];\n      if (result.type === 'header') {\n        let indices = result.indices;\n        let category = result.category;\n        content[i] = renderer.renderHeader({ category, indices });\n      } else {\n        let item = result.item;\n        let indices = result.indices;\n        let active = i === activeIndex;\n        content[i] = renderer.renderItem({ item, indices, active });\n      }\n    }\n\n    // Render the search result content.\n    VirtualDOM.render(content, contentNode);\n\n    // Adjust the scroll position as needed.\n    if (activeIndex < 0 || activeIndex >= results.length) {\n      contentNode.scrollTop = 0;\n    } else {\n      let element = contentNode.children[activeIndex];\n      ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n    }\n  }\n\n  /**\n   * Handle the `'click'` event for the command palette.\n   */\n  private _evtClick(event: MouseEvent): void {\n    // Bail if the click is not the left button.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Clear input if the target is clear button\n    if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n      this.inputNode.value = '';\n      this.refresh();\n      return;\n    }\n\n    // Find the index of the item which was clicked.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return node.contains(event.target as HTMLElement);\n    });\n\n    // Bail if the click was not on an item.\n    if (index === -1) {\n      return;\n    }\n\n    // Kill the event when a content item is clicked.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Execute the item if possible.\n    this._execute(index);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the command palette.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n      return;\n    }\n    switch (event.keyCode) {\n      case 13: // Enter\n        event.preventDefault();\n        event.stopPropagation();\n        this._execute(this._activeIndex);\n        break;\n      case 38: // Up Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activatePreviousItem();\n        break;\n      case 40: // Down Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activateNextItem();\n        break;\n    }\n  }\n\n  /**\n   * Activate the next enabled command item.\n   */\n  private _activateNextItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the next enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this._activeIndex = ArrayExt.findFirstIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Activate the previous enabled command item.\n   */\n  private _activatePreviousItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the previous enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this._activeIndex = ArrayExt.findLastIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Execute the command item at the given index, if possible.\n   */\n  private _execute(index: number): void {\n    // Bail if there are no search results.\n    if (!this._results) {\n      return;\n    }\n\n    // Bail if the index is out of range.\n    let part = this._results[index];\n    if (!part) {\n      return;\n    }\n\n    // Update the search text if the item is a header.\n    if (part.type === 'header') {\n      let input = this.inputNode;\n      input.value = `${part.category.toLowerCase()} `;\n      input.focus();\n      this.refresh();\n      return;\n    }\n\n    // Bail if item is not enabled.\n    if (!part.item.isEnabled) {\n      return;\n    }\n\n    // Execute the item.\n    this.commands.execute(part.item.command, part.item.args);\n\n    // Clear the query text.\n    this.inputNode.value = '';\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Toggle the focused modifier based on the input node focus state.\n   */\n  private _toggleFocused(): void {\n    let focused = document.activeElement === this.inputNode;\n    this.toggleClass('lm-mod-focused', focused);\n  }\n\n  /**\n   * A signal handler for generic command changes.\n   */\n  private _onGenericChange(): void {\n    this.refresh();\n  }\n\n  private _activeIndex = -1;\n  private _items: CommandPalette.IItem[] = [];\n  private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n  /**\n   * An options object for creating a command palette.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the command palette.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the command palette.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for creating a command item.\n   */\n  export interface IItemOptions {\n    /**\n     * The category for the item.\n     */\n    category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    command: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     *\n     * The rank is used as a tie-breaker when ordering command items\n     * for display. Items are sorted in the following order:\n     *   1. Text match (lower is better)\n     *   2. Category (locale order)\n     *   3. Rank (lower is better)\n     *   4. Label (locale order)\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n\n  /**\n   * An object which represents an item in a command palette.\n   *\n   * #### Notes\n   * Item objects are created automatically by a command palette.\n   */\n  export interface IItem {\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    readonly label: string;\n\n    /**\n     * The display caption for the command item.\n     */\n    readonly caption: string;\n\n    /**\n     * The icon renderer for the command item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the command item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the command item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The extra class name for the command item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the command item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the command item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the command item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    readonly isToggleable: boolean;\n\n    /**\n     * Whether the command item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the command item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * The render data for a command palette header.\n   */\n  export interface IHeaderRenderData {\n    /**\n     * The category of the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched characters in the category.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * The render data for a command palette item.\n   */\n  export interface IItemRenderData {\n    /**\n     * The command palette item to render.\n     */\n    readonly item: IItem;\n\n    /**\n     * The indices of the matched characters in the label.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n  }\n\n  /**\n   * The render data for a command palette empty message.\n   */\n  export interface IEmptyMessageRenderData {\n    /**\n     * The query which failed to match any commands.\n     */\n    query: string;\n  }\n\n  /**\n   * A renderer for use with a command palette.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement;\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     *\n     * #### Notes\n     * The command palette will not render invisible items.\n     */\n    renderItem(data: IItemRenderData): VirtualElement;\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement {\n      let content = this.formatHeader(data);\n      return h.li({ className: 'lm-CommandPalette-header' }, content);\n    }\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IItemRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      if (data.item.isToggleable) {\n        return h.li(\n          {\n            className,\n            dataset,\n            role: 'menuitemcheckbox',\n            'aria-checked': `${data.item.isToggled}`\n          },\n          this.renderItemIcon(data),\n          this.renderItemContent(data),\n          this.renderItemShortcut(data)\n        );\n      }\n      return h.li(\n        {\n          className,\n          dataset,\n          role: 'menuitem'\n        },\n        this.renderItemIcon(data),\n        this.renderItemContent(data),\n        this.renderItemShortcut(data)\n      );\n    }\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n      let content = this.formatEmptyMessage(data);\n      return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n    }\n\n    /**\n     * Render the icon for a command palette item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the icon.\n     */\n    renderItemIcon(data: IItemRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the content for a command palette item.\n     *\n     * @param data - The data to use for rendering the content.\n     *\n     * @returns A virtual element representing the content.\n     */\n    renderItemContent(data: IItemRenderData): VirtualElement {\n      return h.div(\n        { className: 'lm-CommandPalette-itemContent' },\n        this.renderItemLabel(data),\n        this.renderItemCaption(data)\n      );\n    }\n\n    /**\n     * Render the label for a command palette item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the label.\n     */\n    renderItemLabel(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemLabel(data);\n      return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n    }\n\n    /**\n     * Render the caption for a command palette item.\n     *\n     * @param data - The data to use for rendering the caption.\n     *\n     * @returns A virtual element representing the caption.\n     */\n    renderItemCaption(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemCaption(data);\n      return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n    }\n\n    /**\n     * Render the shortcut for a command palette item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the shortcut.\n     */\n    renderItemShortcut(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemShortcut(data);\n      return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n    }\n\n    /**\n     * Create the class name for the command palette item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the command palette item.\n     */\n    createItemClass(data: IItemRenderData): string {\n      // Set up the initial class name.\n      let name = 'lm-CommandPalette-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the command palette item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the command palette item.\n     */\n    createItemDataset(data: IItemRenderData): ElementDataset {\n      return { ...data.item.dataset, command: data.item.command };\n    }\n\n    /**\n     * Create the class name for the command item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IItemRenderData): string {\n      let name = 'lm-CommandPalette-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the header node.\n     *\n     * @param data - The data to use for the header content.\n     *\n     * @returns The content to add to the header node.\n     */\n    formatHeader(data: IHeaderRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.category;\n      }\n      return StringExt.highlight(data.category, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the empty message node.\n     *\n     * @param data - The data to use for the empty message content.\n     *\n     * @returns The content to add to the empty message node.\n     */\n    formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n      return `No commands found that match '${data.query}'`;\n    }\n\n    /**\n     * Create the render content for the item shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatItemShortcut(data: IItemRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n\n    /**\n     * Create the render content for the item label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatItemLabel(data: IItemRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.item.label;\n      }\n      return StringExt.highlight(data.item.label, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the item caption node.\n     *\n     * @param data - The data to use for the caption content.\n     *\n     * @returns The content to add to the caption node.\n     */\n    formatItemCaption(data: IItemRenderData): h.Child {\n      return data.item.caption;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a command palette.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let search = document.createElement('div');\n    let wrapper = document.createElement('div');\n    let input = document.createElement('input');\n    let content = document.createElement('ul');\n    let clear = document.createElement('button');\n    search.className = 'lm-CommandPalette-search';\n    wrapper.className = 'lm-CommandPalette-wrapper';\n    input.className = 'lm-CommandPalette-input';\n    clear.className = 'lm-close-icon';\n\n    content.className = 'lm-CommandPalette-content';\n    content.setAttribute('role', 'menu');\n    input.spellcheck = false;\n    wrapper.appendChild(input);\n    wrapper.appendChild(clear);\n    search.appendChild(wrapper);\n    node.appendChild(search);\n    node.appendChild(content);\n    return node;\n  }\n\n  /**\n   * Create a new command item from a command registry and options.\n   */\n  export function createItem(\n    commands: CommandRegistry,\n    options: CommandPalette.IItemOptions\n  ): CommandPalette.IItem {\n    return new CommandItem(commands, options);\n  }\n\n  /**\n   * A search result object for a header label.\n   */\n  export interface IHeaderResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'header';\n\n    /**\n     * The category for the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A search result object for a command item.\n   */\n  export interface IItemResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'item';\n\n    /**\n     * The command item which was matched.\n     */\n    readonly item: CommandPalette.IItem;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A type alias for a search result item.\n   */\n  export type SearchResult = IHeaderResult | IItemResult;\n\n  /**\n   * Search an array of command items for fuzzy matches.\n   */\n  export function search(\n    items: CommandPalette.IItem[],\n    query: string\n  ): SearchResult[] {\n    // Fuzzy match the items for the query.\n    let scores = matchItems(items, query);\n\n    // Sort the items based on their score.\n    scores.sort(scoreCmp);\n\n    // Create the results for the search.\n    return createResults(scores);\n  }\n\n  /**\n   * Test whether a result item can be activated.\n   */\n  export function canActivate(result: SearchResult): boolean {\n    return result.type === 'item' && result.item.isEnabled;\n  }\n\n  /**\n   * Normalize a category for a command item.\n   */\n  function normalizeCategory(category: string): string {\n    return category.trim().replace(/\\s+/g, ' ');\n  }\n\n  /**\n   * Normalize the query text for a fuzzy search.\n   */\n  function normalizeQuery(text: string): string {\n    return text.replace(/\\s+/g, '').toLowerCase();\n  }\n\n  /**\n   * An enum of the supported match types.\n   */\n  const enum MatchType {\n    Label,\n    Category,\n    Split,\n    Default\n  }\n\n  /**\n   * A text match score with associated command item.\n   */\n  interface IScore {\n    /**\n     * The numerical type for the text match.\n     */\n    matchType: MatchType;\n\n    /**\n     * The numerical score for the text match.\n     */\n    score: number;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    categoryIndices: number[] | null;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    labelIndices: number[] | null;\n\n    /**\n     * The command item associated with the match.\n     */\n    item: CommandPalette.IItem;\n  }\n\n  /**\n   * Perform a fuzzy match on an array of command items.\n   */\n  function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n    // Normalize the query text to lower case with no whitespace.\n    query = normalizeQuery(query);\n\n    // Create the array to hold the scores.\n    let scores: IScore[] = [];\n\n    // Iterate over the items and match against the query.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Ignore items which are not visible.\n      let item = items[i];\n      if (!item.isVisible) {\n        continue;\n      }\n\n      // If the query is empty, all items are matched by default.\n      if (!query) {\n        scores.push({\n          matchType: MatchType.Default,\n          categoryIndices: null,\n          labelIndices: null,\n          score: 0,\n          item\n        });\n        continue;\n      }\n\n      // Run the fuzzy search for the item and query.\n      let score = fuzzySearch(item, query);\n\n      // Ignore the item if it is not a match.\n      if (!score) {\n        continue;\n      }\n\n      // Penalize disabled items.\n      // TODO - push disabled items all the way down in sort cmp?\n      if (!item.isEnabled) {\n        score.score += 1000;\n      }\n\n      // Add the score to the results.\n      scores.push(score);\n    }\n\n    // Return the final array of scores.\n    return scores;\n  }\n\n  /**\n   * Perform a fuzzy search on a single command item.\n   */\n  function fuzzySearch(\n    item: CommandPalette.IItem,\n    query: string\n  ): IScore | null {\n    // Create the source text to be searched.\n    let category = item.category.toLowerCase();\n    let label = item.label.toLowerCase();\n    let source = `${category} ${label}`;\n\n    // Set up the match score and indices array.\n    let score = Infinity;\n    let indices: number[] | null = null;\n\n    // The regex for search word boundaries\n    let rgx = /\\b\\w/g;\n\n    // Search the source by word boundary.\n    // eslint-disable-next-line no-constant-condition\n    while (true) {\n      // Find the next word boundary in the source.\n      let rgxMatch = rgx.exec(source);\n\n      // Break if there is no more source context.\n      if (!rgxMatch) {\n        break;\n      }\n\n      // Run the string match on the relevant substring.\n      let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n      // Break if there is no match.\n      if (!match) {\n        break;\n      }\n\n      // Update the match if the score is better.\n      if (match.score <= score) {\n        score = match.score;\n        indices = match.indices;\n      }\n    }\n\n    // Bail if there was no match.\n    if (!indices || score === Infinity) {\n      return null;\n    }\n\n    // Compute the pivot index between category and label text.\n    let pivot = category.length + 1;\n\n    // Find the slice index to separate matched indices.\n    let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n    // Extract the matched category and label indices.\n    let categoryIndices = indices.slice(0, j);\n    let labelIndices = indices.slice(j);\n\n    // Adjust the label indices for the pivot offset.\n    for (let i = 0, n = labelIndices.length; i < n; ++i) {\n      labelIndices[i] -= pivot;\n    }\n\n    // Handle a pure label match.\n    if (categoryIndices.length === 0) {\n      return {\n        matchType: MatchType.Label,\n        categoryIndices: null,\n        labelIndices,\n        score,\n        item\n      };\n    }\n\n    // Handle a pure category match.\n    if (labelIndices.length === 0) {\n      return {\n        matchType: MatchType.Category,\n        categoryIndices,\n        labelIndices: null,\n        score,\n        item\n      };\n    }\n\n    // Handle a split match.\n    return {\n      matchType: MatchType.Split,\n      categoryIndices,\n      labelIndices,\n      score,\n      item\n    };\n  }\n\n  /**\n   * A sort comparison function for a match score.\n   */\n  function scoreCmp(a: IScore, b: IScore): number {\n    // First compare based on the match type\n    let m1 = a.matchType - b.matchType;\n    if (m1 !== 0) {\n      return m1;\n    }\n\n    // Otherwise, compare based on the match score.\n    let d1 = a.score - b.score;\n    if (d1 !== 0) {\n      return d1;\n    }\n\n    // Find the match index based on the match type.\n    let i1 = 0;\n    let i2 = 0;\n    switch (a.matchType) {\n      case MatchType.Label:\n        i1 = a.labelIndices![0];\n        i2 = b.labelIndices![0];\n        break;\n      case MatchType.Category:\n      case MatchType.Split:\n        i1 = a.categoryIndices![0];\n        i2 = b.categoryIndices![0];\n        break;\n    }\n\n    // Compare based on the match index.\n    if (i1 !== i2) {\n      return i1 - i2;\n    }\n\n    // Otherwise, compare by category.\n    let d2 = a.item.category.localeCompare(b.item.category);\n    if (d2 !== 0) {\n      return d2;\n    }\n\n    // Otherwise, compare by rank.\n    let r1 = a.item.rank;\n    let r2 = b.item.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity safe\n    }\n\n    // Finally, compare by label.\n    return a.item.label.localeCompare(b.item.label);\n  }\n\n  /**\n   * Create the results from an array of sorted scores.\n   */\n  function createResults(scores: IScore[]): SearchResult[] {\n    // Set up the search results array.\n    let results: SearchResult[] = [];\n\n    // Iterate over each score in the array.\n    for (let i = 0, n = scores.length; i < n; ++i) {\n      // Extract the current item and indices.\n      let { item, categoryIndices, labelIndices } = scores[i];\n\n      // Extract the category for the current item.\n      let category = item.category;\n\n      // Is this the same category as the preceding result?\n      if (i === 0 || category !== scores[i - 1].item.category) {\n        // Add the header result for the category.\n        results.push({ type: 'header', category, indices: categoryIndices });\n      }\n\n      // Create the item result for the score.\n      results.push({ type: 'item', item, indices: labelIndices });\n    }\n\n    // Return the final results.\n    return results;\n  }\n\n  /**\n   * A concrete implementation of `CommandPalette.IItem`.\n   */\n  class CommandItem implements CommandPalette.IItem {\n    /**\n     * Construct a new command item.\n     */\n    constructor(\n      commands: CommandRegistry,\n      options: CommandPalette.IItemOptions\n    ) {\n      this._commands = commands;\n      this.category = normalizeCategory(options.category);\n      this.command = options.command;\n      this.args = options.args || JSONExt.emptyObject;\n      this.rank = options.rank !== undefined ? options.rank : Infinity;\n    }\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    get label(): string {\n      return this._commands.label(this.command, this.args);\n    }\n\n    /**\n     * The icon renderer for the command item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      return this._commands.icon(this.command, this.args);\n    }\n\n    /**\n     * The icon class for the command item.\n     */\n    get iconClass(): string {\n      return this._commands.iconClass(this.command, this.args);\n    }\n\n    /**\n     * The icon label for the command item.\n     */\n    get iconLabel(): string {\n      return this._commands.iconLabel(this.command, this.args);\n    }\n\n    /**\n     * The display caption for the command item.\n     */\n    get caption(): string {\n      return this._commands.caption(this.command, this.args);\n    }\n\n    /**\n     * The extra class name for the command item.\n     */\n    get className(): string {\n      return this._commands.className(this.command, this.args);\n    }\n\n    /**\n     * The dataset for the command item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      return this._commands.dataset(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is enabled.\n     */\n    get isEnabled(): boolean {\n      return this._commands.isEnabled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggled.\n     */\n    get isToggled(): boolean {\n      return this._commands.isToggled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    get isToggleable(): boolean {\n      return this._commands.isToggleable(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is visible.\n     */\n    get isVisible(): boolean {\n      return this._commands.isVisible(this.command, this.args);\n    }\n\n    /**\n     * The key binding for the command item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      let { command, args } = this;\n      return (\n        ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n          return kb.command === command && JSONExt.deepEqual(kb.args, args);\n        }) || null\n      );\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ARIAAttrNames,\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n  pageXOffset: number;\n  pageYOffset: number;\n  clientWidth: number;\n  clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n  /**\n   * Construct a new menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: Menu.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-Menu');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || Menu.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the menu.\n   */\n  dispose(): void {\n    this.close();\n    this._items.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted just before the menu is closed.\n   *\n   * #### Notes\n   * This signal is emitted when the menu receives a `'close-request'`\n   * message, just before it removes itself from the DOM.\n   *\n   * This signal is not emitted if the menu is already detached from\n   * the DOM when it receives the `'close-request'` message.\n   */\n  get aboutToClose(): ISignal<this, void> {\n    return this._aboutToClose;\n  }\n\n  /**\n   * A signal emitted when a new menu is requested by the user.\n   *\n   * #### Notes\n   * This signal is emitted whenever the user presses the right or left\n   * arrow keys, and a submenu cannot be opened or closed in response.\n   *\n   * This signal is useful when implementing menu bars in order to open\n   * the next or previous menu in response to a user key press.\n   *\n   * This signal is only emitted for the root menu in a hierarchy.\n   */\n  get menuRequested(): ISignal<this, 'next' | 'previous'> {\n    return this._menuRequested;\n  }\n\n  /**\n   * The command registry used by the menu.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the menu.\n   */\n  readonly renderer: Menu.IRenderer;\n\n  /**\n   * The parent menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu is an open submenu.\n   */\n  get parentMenu(): Menu | null {\n    return this._parentMenu;\n  }\n\n  /**\n   * The child menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu has an open submenu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The root menu of the menu hierarchy.\n   */\n  get rootMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._parentMenu) {\n      menu = menu._parentMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The leaf menu of the menu hierarchy.\n   */\n  get leafMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._childMenu) {\n      menu = menu._childMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The menu content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-Menu-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu item.\n   */\n  get activeItem(): Menu.IItem | null {\n    return this._items[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the item will be set to `null`.\n   */\n  set activeItem(value: Menu.IItem | null) {\n    this.activeIndex = value ? this._items.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu item.\n   *\n   * #### Notes\n   * This will be `-1` if no menu item is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._items.length) {\n      value = -1;\n    }\n\n    // Ensure the item can be activated.\n    if (value !== -1 && !Private.canActivate(this._items[value])) {\n      value = -1;\n    }\n\n    // Bail if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Make active element in focus\n    if (\n      this._activeIndex >= 0 &&\n      this.contentNode.childNodes[this._activeIndex]\n    ) {\n      (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n    }\n\n    // schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menu items in the menu.\n   */\n  get items(): ReadonlyArray<Menu.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Activate the next selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activateNextItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this.activeIndex = ArrayExt.findFirstIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Activate the previous selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activatePreviousItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this.activeIndex = ArrayExt.findLastIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Trigger the active menu item.\n   *\n   * #### Notes\n   * If the active item is a submenu, it will be opened and the first\n   * item will be activated.\n   *\n   * If the active item is a command, the command will be executed.\n   *\n   * If the menu is not attached, this is a no-op.\n   *\n   * If there is no active item, this is a no-op.\n   */\n  triggerActiveItem(): void {\n    // Bail if the menu is not attached.\n    if (!this.isAttached) {\n      return;\n    }\n\n    // Bail if there is no active item.\n    let item = this.activeItem;\n    if (!item) {\n      return;\n    }\n\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // If the item is a submenu, open it.\n    if (item.type === 'submenu') {\n      this._openChildMenu(true);\n      return;\n    }\n\n    // Close the root menu before executing the command.\n    this.rootMenu.close();\n\n    // Execute the command for the item.\n    let { command, args } = item;\n    if (this.commands.isEnabled(command, args)) {\n      this.commands.execute(command, args);\n    } else {\n      console.log(`Command '${command}' is disabled.`);\n    }\n  }\n\n  /**\n   * Add a menu item to the end of the menu.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   */\n  addItem(options: Menu.IItemOptions): Menu.IItem {\n    return this.insertItem(this._items.length, options);\n  }\n\n  /**\n   * Insert a menu item into the menu at the specified index.\n   *\n   * @param index - The index at which to insert the item.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the items.\n   */\n  insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Clamp the insert index to the array bounds.\n    let i = Math.max(0, Math.min(index, this._items.length));\n\n    // Create the item for the options.\n    let item = Private.createItem(this, options);\n\n    // Insert the item into the array.\n    ArrayExt.insert(this._items, i, item);\n\n    // Schedule an update of the items.\n    this.update();\n\n    // Return the item added to the menu.\n    return item;\n  }\n\n  /**\n   * Remove an item from the menu.\n   *\n   * @param item - The item to remove from the menu.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the menu.\n   */\n  removeItem(item: Menu.IItem): void {\n    let index = this._items.indexOf(item);\n    if (index === -1) {\n      return;\n    }\n    this.removeItemAt(index);\n  }\n\n  /**\n   * Remove the item at a given index from the menu.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Remove all menu items from the menu.\n   */\n  clearItems(): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the items.\n    this._items.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Open the menu at the specified location.\n   *\n   * @param x - The client X coordinate of the menu location.\n   *\n   * @param y - The client Y coordinate of the menu location.\n   *\n   * @param options - The additional options for opening the menu.\n   *\n   * #### Notes\n   * The menu will be opened at the given location unless it will not\n   * fully fit on the screen. If it will not fit, it will be adjusted\n   * to fit naturally on the screen.\n   *\n   * The menu will be attached under the `host` element in the DOM\n   * (or `document.body` if `host` is `null`) and before the `ref`\n   * element (or as the last child of `host` if `ref` is `null`).\n   * The menu may be displayed outside of the `host` element\n   * following the rules of CSS absolute positioning.\n   *\n   * This is a no-op if the menu is already attached to the DOM.\n   */\n  open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n    // Bail early if the menu is already attached.\n    if (this.isAttached) {\n      return;\n    }\n\n    // Extract the menu options.\n    let forceX = options.forceX || false;\n    let forceY = options.forceY || false;\n    const host = options.host ?? null;\n    const ref = options.ref ?? null;\n    const horizontalAlignment =\n      options.horizontalAlignment ??\n      (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n    // Open the menu as a root menu.\n    Private.openRootMenu(\n      this,\n      x,\n      y,\n      forceX,\n      forceY,\n      horizontalAlignment,\n      host,\n      ref\n    );\n\n    // Activate the menu to accept keyboard input.\n    this.activate();\n  }\n\n  /**\n   * Handle the DOM events for the menu.\n   *\n   * @param event - The DOM event sent to the menu.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu's DOM nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseenter':\n        this._evtMouseEnter(event as MouseEvent);\n        break;\n      case 'mouseleave':\n        this._evtMouseLeave(event as MouseEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'after-attach'` message.\n   */\n  protected override onAfterAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mouseup', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseenter', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('contextmenu', this);\n    this.node.ownerDocument.addEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'before-detach'` message.\n   */\n  protected override onBeforeDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mouseup', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseenter', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('contextmenu', this);\n    this.node.ownerDocument.removeEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this.node.focus();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let items = this._items;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let collapsedFlags = Private.computeCollapsed(items);\n    let content = new Array<VirtualElement>(items.length);\n    for (let i = 0, n = items.length; i < n; ++i) {\n      let item = items[i];\n      let active = i === activeIndex;\n      let collapsed = collapsedFlags[i];\n      content[i] = renderer.renderItem({\n        item,\n        active,\n        collapsed,\n        onfocus: () => {\n          this.activeIndex = i;\n        }\n      });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   */\n  protected onCloseRequest(msg: Message): void {\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Close any open child menu.\n    let childMenu = this._childMenu;\n    if (childMenu) {\n      this._childIndex = -1;\n      this._childMenu = null;\n      childMenu._parentMenu = null;\n      childMenu.close();\n    }\n\n    // Remove this menu from its parent and activate the parent.\n    let parentMenu = this._parentMenu;\n    if (parentMenu) {\n      this._parentMenu = null;\n      parentMenu._childIndex = -1;\n      parentMenu._childMenu = null;\n      parentMenu.activate();\n    }\n\n    // Emit the `aboutToClose` signal if the menu is attached.\n    if (this.isAttached) {\n      this._aboutToClose.emit(undefined);\n    }\n\n    // Finish closing the menu.\n    super.onCloseRequest(msg);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // A menu handles all keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Enter\n    if (kc === 13) {\n      this.triggerActiveItem();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this.close();\n      return;\n    }\n\n    // Left Arrow\n    if (kc === 37) {\n      if (this._parentMenu) {\n        this.close();\n      } else {\n        this._menuRequested.emit('previous');\n      }\n      return;\n    }\n\n    // Up Arrow\n    if (kc === 38) {\n      this.activatePreviousItem();\n      return;\n    }\n\n    // Right Arrow\n    if (kc === 39) {\n      let item = this.activeItem;\n      if (item && item.type === 'submenu') {\n        this.triggerActiveItem();\n      } else {\n        this.rootMenu._menuRequested.emit('next');\n      }\n      return;\n    }\n\n    // Down Arrow\n    if (kc === 40) {\n      this.activateNextItem();\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._items, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that item is triggered.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.triggerActiveItem();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n    }\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    if (event.button !== 0) {\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n    this.triggerActiveItem();\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Hit test the item nodes for the item under the mouse.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the mouse is already over the active index.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Update and coerce the active index.\n    this.activeIndex = index;\n    index = this.activeIndex;\n\n    // If the index is the current child index, cancel the timers.\n    if (index === this._childIndex) {\n      this._cancelOpenTimer();\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // If a child menu is currently open, start the close timer.\n    if (this._childIndex !== -1) {\n      this._startCloseTimer();\n    }\n\n    // Cancel the open timer to give a full delay for opening.\n    this._cancelOpenTimer();\n\n    // Bail if the active item is not a valid submenu item.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      return;\n    }\n\n    // Start the open timer to open the active item submenu.\n    this._startOpenTimer();\n  }\n\n  /**\n   * Handle the `'mouseenter'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseEnter(event: MouseEvent): void {\n    // Synchronize the active ancestor items.\n    for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n      menu._cancelOpenTimer();\n      menu._cancelCloseTimer();\n      menu.activeIndex = menu._childIndex;\n    }\n  }\n\n  /**\n   * Handle the `'mouseleave'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseLeave(event: MouseEvent): void {\n    // Cancel any pending submenu opening.\n    this._cancelOpenTimer();\n\n    // If there is no open child menu, just reset the active index.\n    if (!this._childMenu) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // If the mouse is over the child menu, cancel the close timer.\n    let { clientX, clientY } = event;\n    if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // Otherwise, reset the active index and start the close timer.\n    this.activeIndex = -1;\n    this._startCloseTimer();\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the document node.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the menu is not a root menu.\n    if (this._parentMenu) {\n      return;\n    }\n\n    // The mouse button which is pressed is irrelevant. If the press\n    // is not on a menu, the entire hierarchy is closed and the event\n    // is allowed to propagate. This allows other code to act on the\n    // event, such as focusing the clicked element.\n    if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n      event.preventDefault();\n      event.stopPropagation();\n    } else {\n      this.close();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if the active item is not a valid submenu.\n   */\n  private _openChildMenu(activateFirst = false): void {\n    // If the item is not a valid submenu, close the child menu.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Do nothing if the child menu will not change.\n    let submenu = item.submenu;\n    if (submenu === this._childMenu) {\n      return;\n    }\n\n    // Prior to any DOM modifications save window data\n    Menu.saveWindowData();\n\n    // Ensure the current child menu is closed.\n    this._closeChildMenu();\n\n    // Update the private child state.\n    this._childMenu = submenu;\n    this._childIndex = this._activeIndex;\n\n    // Set the parent menu reference for the child.\n    submenu._parentMenu = this;\n\n    // Ensure the menu is updated and lookup the item node.\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    let itemNode = this.contentNode.children[this._activeIndex];\n\n    // Open the submenu at the active node.\n    Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n    // Activate the first item if desired.\n    if (activateFirst) {\n      submenu.activeIndex = -1;\n      submenu.activateNextItem();\n    }\n\n    // Activate the child menu.\n    submenu.activate();\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    if (this._childMenu) {\n      this._childMenu.close();\n    }\n  }\n\n  /**\n   * Start the open timer, unless it is already pending.\n   */\n  private _startOpenTimer(): void {\n    if (this._openTimerID === 0) {\n      this._openTimerID = window.setTimeout(() => {\n        this._openTimerID = 0;\n        this._openChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Start the close timer, unless it is already pending.\n   */\n  private _startCloseTimer(): void {\n    if (this._closeTimerID === 0) {\n      this._closeTimerID = window.setTimeout(() => {\n        this._closeTimerID = 0;\n        this._closeChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Cancel the open timer, if the timer is pending.\n   */\n  private _cancelOpenTimer(): void {\n    if (this._openTimerID !== 0) {\n      clearTimeout(this._openTimerID);\n      this._openTimerID = 0;\n    }\n  }\n\n  /**\n   * Cancel the close timer, if the timer is pending.\n   */\n  private _cancelCloseTimer(): void {\n    if (this._closeTimerID !== 0) {\n      clearTimeout(this._closeTimerID);\n      this._closeTimerID = 0;\n    }\n  }\n\n  /**\n   * Save window data used for menu positioning in transient cache.\n   *\n   * In order to avoid layout trashing it is recommended to invoke this\n   * method immediately prior to opening the menu and any DOM modifications\n   * (like closing previously visible menu, or adding a class to menu widget).\n   *\n   * The transient cache will be released upon `open()` call.\n   */\n  static saveWindowData(): void {\n    Private.saveWindowData();\n  }\n\n  private _childIndex = -1;\n  private _activeIndex = -1;\n  private _openTimerID = 0;\n  private _closeTimerID = 0;\n  private _items: Menu.IItem[] = [];\n  private _childMenu: Menu | null = null;\n  private _parentMenu: Menu | null = null;\n  private _aboutToClose = new Signal<this, void>(this);\n  private _menuRequested = new Signal<this, 'next' | 'previous'>(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n  /**\n   * An options object for creating a menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the menu.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for the `open` method on a menu.\n   */\n  export interface IOpenOptions {\n    /**\n     * Whether to force the X position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * X coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceX?: boolean;\n\n    /**\n     * Whether to force the Y position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * Y coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceY?: boolean;\n\n    /**\n     * The DOM node to use as the menu's host.\n     *\n     * If not specified then uses `document.body`.\n     */\n    host?: HTMLElement;\n\n    /**\n     * The child of `host` to use as the reference element.\n     * If this is provided, the menu will be inserted before this\n     * node in the host. The default is `null`, which will cause the\n     * menu to be added as the last child of the host.\n     */\n    ref?: HTMLElement;\n\n    /**\n     * The alignment of the menu.\n     *\n     * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n     */\n    horizontalAlignment?: 'left' | 'right';\n  }\n\n  /**\n   * A type alias for a menu item type.\n   */\n  export type ItemType = 'command' | 'submenu' | 'separator';\n\n  /**\n   * An options object for creating a menu item.\n   */\n  export interface IItemOptions {\n    /**\n     * The type of the menu item.\n     *\n     * The default value is `'command'`.\n     */\n    type?: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     *\n     * The default value is an empty string.\n     */\n    command?: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     *\n     * The default value is `null`.\n     */\n    submenu?: Menu | null;\n  }\n\n  /**\n   * An object which represents a menu item.\n   *\n   * #### Notes\n   * Item objects are created automatically by a menu.\n   */\n  export interface IItem {\n    /**\n     * The type of the menu item.\n     */\n    readonly type: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    readonly label: string;\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    readonly mnemonic: number;\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the menu item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the menu item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The display caption for the menu item.\n     */\n    readonly caption: string;\n\n    /**\n     * The extra class name for the menu item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the menu item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the menu item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the menu item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * An object which holds the data to render a menu item.\n   */\n  export interface IRenderData {\n    /**\n     * The item to be rendered.\n     */\n    readonly item: IItem;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the item should be collapsed.\n     */\n    readonly collapsed: boolean;\n\n    /**\n     * Handler for when element is in focus.\n     */\n    readonly onfocus?: () => void;\n  }\n\n  /**\n   * A renderer for use with a menu.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          tabindex: '0',\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data),\n        this.renderShortcut(data),\n        this.renderSubmenu(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-Menu-itemLabel' }, content);\n    }\n\n    /**\n     * Render the shortcut element for a menu item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the item shortcut.\n     */\n    renderShortcut(data: IRenderData): VirtualElement {\n      let content = this.formatShortcut(data);\n      return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n    }\n\n    /**\n     * Render the submenu icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the submenu icon.\n     *\n     * @returns A virtual element representing the submenu icon.\n     */\n    renderSubmenu(data: IRenderData): VirtualElement {\n      return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n    }\n\n    /**\n     * Create the class name for the menu item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      // Setup the initial class name.\n      let name = 'lm-Menu-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (!data.item.isVisible) {\n        name += ' lm-mod-hidden';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n      if (data.collapsed) {\n        name += ' lm-mod-collapsed';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the menu item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the menu item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      let result: ElementDataset;\n      let { type, command, dataset } = data.item;\n      if (type === 'command') {\n        result = { ...dataset, type, command };\n      } else {\n        result = { ...dataset, type };\n      }\n      return result;\n    }\n\n    /**\n     * Create the class name for the menu item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-Menu-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the aria attributes for menu item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      let aria: { [T in ARIAAttrNames]?: string } = {};\n      switch (data.item.type) {\n        case 'separator':\n          aria.role = 'presentation';\n          break;\n        case 'submenu':\n          aria['aria-haspopup'] = 'true';\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          break;\n        default:\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          if (data.item.isToggled) {\n            aria.role = 'menuitemcheckbox';\n            aria['aria-checked'] = 'true';\n          } else {\n            aria.role = 'menuitem';\n          }\n      }\n      return aria;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.item;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n\n    /**\n     * Create the render content for the shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatShortcut(data: IRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The ms delay for opening and closing a submenu.\n   */\n  export const TIMER_DELAY = 300;\n\n  /**\n   * The horizontal pixel overlap for an open submenu.\n   */\n  export const SUBMENU_OVERLAP = 3;\n\n  function getWindowData(element: HTMLElement): IWindowData {\n\n    return _getWindowData(element);\n  }\n\n  /**\n   * Store window data in transient cache.\n   *\n   * The transient cache will be released upon `getWindowData()` call.\n   * If this function is called multiple times, the cache will be\n   * retained until as many calls to `getWindowData()` were made.\n   *\n   * Note: should be called before any DOM modifications.\n   */\n  export function saveWindowData(): void {\n  }\n\n  /**\n   * Create the DOM node for a menu.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-Menu-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menu');\n    node.tabIndex = 0;\n    return node;\n  }\n\n  /**\n   * Test whether a menu item can be activated.\n   */\n  export function canActivate(item: Menu.IItem): boolean {\n    return item.type !== 'separator' && item.isEnabled && item.isVisible;\n  }\n\n  /**\n   * Create a new menu item for an owner menu.\n   */\n  export function createItem(\n    owner: Menu,\n    options: Menu.IItemOptions\n  ): Menu.IItem {\n    return new MenuItem(owner.commands, options);\n  }\n\n  /**\n   * Hit test a menu hierarchy starting at the given root.\n   */\n  export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n    for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n      if (ElementExt.hitTest(temp.node, x, y)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Compute which extra separator items should be collapsed.\n   */\n  export function computeCollapsed(\n    items: ReadonlyArray<Menu.IItem>\n  ): boolean[] {\n    // Allocate the return array and fill it with `false`.\n    let result = new Array<boolean>(items.length);\n    ArrayExt.fill(result, false);\n\n    // Collapse the leading separators.\n    let k1 = 0;\n    let n = items.length;\n    for (; k1 < n; ++k1) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k1] = true;\n    }\n\n    // Hide the trailing separators.\n    let k2 = n - 1;\n    for (; k2 >= 0; --k2) {\n      let item = items[k2];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k2] = true;\n    }\n\n    // Hide the remaining consecutive separators.\n    let hide = false;\n    while (++k1 < k2) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        hide = false;\n      } else if (hide) {\n        result[k1] = true;\n      } else {\n        hide = true;\n      }\n    }\n\n    // Return the resulting flags.\n    return result;\n  }\n\n  function _getWindowData(element: HTMLElement): IWindowData {\n    return {\n      pageXOffset: element.ownerDocument.defaultView?.window.scrollX || 0,\n      pageYOffset: element.ownerDocument.defaultView?.window.scrollY || 0,\n      clientWidth: element.ownerDocument.documentElement.clientWidth,\n      clientHeight: element.ownerDocument.documentElement.clientHeight\n    };\n  }\n\n  /**\n   * Open a menu as a root menu at the target location.\n   */\n  export function openRootMenu(\n    menu: Menu,\n    x: number,\n    y: number,\n    forceX: boolean,\n    forceY: boolean,\n    horizontalAlignment: 'left' | 'right',\n    host: HTMLElement | null,\n    ref: HTMLElement | null\n  ): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData(host || menu.node);\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before attaching and measuring.\n    MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch - (forceY ? y : 0);\n\n    // Fetch common variables.\n    let node = menu.node;\n    let style = node.style;\n    style.top = '0';\n    style.left = '0';\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(menu, host || document.body, ref);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // align the menu to the right of the target if requested or language is RTL\n    if (horizontalAlignment === 'right') {\n      x -= width;\n    }\n\n    // Adjust the X position of the menu to fit on-screen.\n    if (!forceX && x + width > px + cw) {\n      x = px + cw - width;\n    }\n\n    // Adjust the Y position of the menu to fit on-screen.\n    if (!forceY && y + height > py + ch) {\n      if (y > py + ch) {\n        y = py + ch - height;\n      } else {\n        y = y - height;\n      }\n    }\n\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * Open a menu as a submenu using an item node for positioning.\n   */\n  export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData(itemNode);\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before opening.\n    MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch;\n\n    // Fetch common variables.\n    let node = submenu.node;\n    let style = node.style;\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(submenu, itemNode.ownerDocument.body);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // Compute the box sizing for the menu.\n    let box = ElementExt.boxSizing(submenu.node);\n\n    // Get the bounding rect for the target item node.\n    let itemRect = itemNode.getBoundingClientRect();\n\n    // Compute the target X position.\n    let x = itemRect.right - SUBMENU_OVERLAP;\n\n    // Adjust the X position to fit on the screen.\n    if (x + width > px + cw) {\n      x = itemRect.left + SUBMENU_OVERLAP - width;\n    }\n\n    // Compute the target Y position.\n    let y = itemRect.top - box.borderTop - box.paddingTop;\n\n    // Adjust the Y position to fit on the screen.\n    if (y + height > py + ch) {\n      y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n    }\n\n    style.top = '0';\n    style.left = '0';\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    items: ReadonlyArray<Menu.IItem>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Lookup the item\n      let item = items[k];\n\n      // Ignore items which cannot be activated.\n      if (!canActivate(item)) {\n        continue;\n      }\n\n      // Ignore items with an empty label.\n      let label = item.label;\n      if (label.length === 0) {\n        continue;\n      }\n\n      // Lookup the mnemonic index for the label.\n      let mn = item.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < label.length) {\n        if (label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n\n  /**\n   * A concrete implementation of `Menu.IItem`.\n   */\n  class MenuItem implements Menu.IItem {\n    /**\n     * Construct a new menu item.\n     */\n    constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n      this._commands = commands;\n      this.type = options.type || 'command';\n      this.command = options.command || '';\n      this.args = options.args || JSONExt.emptyObject;\n      this.submenu = options.submenu || null;\n    }\n\n    /**\n     * The type of the menu item.\n     */\n    readonly type: Menu.ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    get label(): string {\n      if (this.type === 'command') {\n        return this._commands.label(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.label;\n      }\n      return '';\n    }\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    get mnemonic(): number {\n      if (this.type === 'command') {\n        return this._commands.mnemonic(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.mnemonic;\n      }\n      return -1;\n    }\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      if (this.type === 'command') {\n        return this._commands.icon(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.icon;\n      }\n      return undefined;\n    }\n\n    /**\n     * The icon class for the menu item.\n     */\n    get iconClass(): string {\n      if (this.type === 'command') {\n        return this._commands.iconClass(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconClass;\n      }\n      return '';\n    }\n\n    /**\n     * The icon label for the menu item.\n     */\n    get iconLabel(): string {\n      if (this.type === 'command') {\n        return this._commands.iconLabel(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconLabel;\n      }\n      return '';\n    }\n\n    /**\n     * The display caption for the menu item.\n     */\n    get caption(): string {\n      if (this.type === 'command') {\n        return this._commands.caption(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.caption;\n      }\n      return '';\n    }\n\n    /**\n     * The extra class name for the menu item.\n     */\n    get className(): string {\n      if (this.type === 'command') {\n        return this._commands.className(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.className;\n      }\n      return '';\n    }\n\n    /**\n     * The dataset for the menu item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      if (this.type === 'command') {\n        return this._commands.dataset(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.dataset;\n      }\n      return {};\n    }\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    get isEnabled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isEnabled(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    get isToggled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isToggled(this.command, this.args);\n      }\n      return false;\n    }\n\n    /**\n     * Whether the menu item is visible.\n     */\n    get isVisible(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isVisible(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * The key binding for the menu item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      if (this.type === 'command') {\n        let { command, args } = this;\n        return (\n          ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n            return kb.command === command && JSONExt.deepEqual(kb.args, args);\n          }) || null\n        );\n      }\n      return null;\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n  /**\n   * Construct a new context menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: ContextMenu.IOptions) {\n    const { groupByTarget, sortBySelector, ...others } = options;\n    this.menu = new Menu(others);\n    this._groupByTarget = groupByTarget !== false;\n    this._sortBySelector = sortBySelector !== false;\n  }\n\n  /**\n   * The menu widget which displays the matched context items.\n   */\n  readonly menu: Menu;\n\n  /**\n   * Add an item to the context menu.\n   *\n   * @param options - The options for creating the item.\n   *\n   * @returns A disposable which will remove the item from the menu.\n   */\n  addItem(options: ContextMenu.IItemOptions): IDisposable {\n    // Create an item from the given options.\n    let item = Private.createItem(options, this._idTick++);\n\n    // Add the item to the internal array.\n    this._items.push(item);\n\n    // Return a disposable which will remove the item.\n    return new DisposableDelegate(() => {\n      ArrayExt.removeFirstOf(this._items, item);\n    });\n  }\n\n  /**\n   * Open the context menu in response to a `'contextmenu'` event.\n   *\n   * @param event - The `'contextmenu'` event of interest.\n   *\n   * @returns `true` if the menu was opened, or `false` if no items\n   *   matched the event and the menu was not opened.\n   *\n   * #### Notes\n   * This method will populate the context menu with items which match\n   * the propagation path of the event, then open the menu at the mouse\n   * position indicated by the event.\n   */\n  open(event: MouseEvent): boolean {\n    // Prior to any DOM modifications update the window data.\n    Menu.saveWindowData();\n\n    // Clear the current contents of the context menu.\n    this.menu.clearItems();\n\n    // Bail early if there are no items to match.\n    if (this._items.length === 0) {\n      return false;\n    }\n\n    // Find the matching items for the event.\n    let items = Private.matchItems(\n      this._items,\n      event,\n      this._groupByTarget,\n      this._sortBySelector\n    );\n\n    // Bail if there are no matching items.\n    if (!items || items.length === 0) {\n      return false;\n    }\n\n    // Add the filtered items to the menu.\n    for (const item of items) {\n      this.menu.addItem(item);\n    }\n\n    // Open the context menu at the current mouse position.\n    this.menu.open(event.clientX, event.clientY);\n\n    // Indicate success.\n    return true;\n  }\n\n  private _groupByTarget: boolean = true;\n  private _idTick = 0;\n  private _items: Private.IItem[] = [];\n  private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n  /**\n   * An options object for initializing a context menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry to use with the context menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the context menu.\n     */\n    renderer?: Menu.IRenderer;\n\n    /**\n     * Whether to sort by selector and rank or only rank.\n     *\n     * Default true.\n     */\n    sortBySelector?: boolean;\n\n    /**\n     * Whether to group items following the DOM hierarchy.\n     *\n     * Default true.\n     *\n     * #### Note\n     * If true, when the mouse event occurs on element `span` within `div.top`,\n     * the items matching `div.top` will be shown before the ones matching `body`.\n     */\n    groupByTarget?: boolean;\n  }\n\n  /**\n   * An options object for creating a context menu item.\n   */\n  export interface IItemOptions extends Menu.IItemOptions {\n    /**\n     * The CSS selector for the context menu item.\n     *\n     * The context menu item will only be displayed in the context menu\n     * when the selector matches a node on the propagation path of the\n     * contextmenu event. This allows the menu item to be restricted to\n     * user-defined contexts.\n     *\n     * The selector must not contain commas.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     *\n     * The rank is used as a tie-breaker when ordering context menu\n     * items for display. Items are sorted in the following order:\n     *   1. Depth in the DOM tree (deeper is better)\n     *   2. Selector specificity (higher is better)\n     *   3. Rank (lower is better)\n     *   4. Insertion order\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A normalized item for a context menu.\n   */\n  export interface IItem extends Menu.IItemOptions {\n    /**\n     * The selector for the item.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     */\n    rank: number;\n\n    /**\n     * The tie-breaking id for the item.\n     */\n    id: number;\n  }\n\n  /**\n   * Create a normalized context menu item from an options object.\n   */\n  export function createItem(\n    options: ContextMenu.IItemOptions,\n    id: number\n  ): IItem {\n    let selector = validateSelector(options.selector);\n    let rank = options.rank !== undefined ? options.rank : Infinity;\n    return { ...options, selector, rank, id };\n  }\n\n  /**\n   * Find the items which match a context menu event.\n   *\n   * The results are sorted by DOM level, specificity, and rank.\n   */\n  export function matchItems(\n    items: IItem[],\n    event: MouseEvent,\n    groupByTarget: boolean,\n    sortBySelector: boolean\n  ): IItem[] | null {\n    // Look up the target of the event.\n    let target = event.target as Element | null;\n\n    // Bail if there is no target.\n    if (!target) {\n      return null;\n    }\n\n    // Look up the current target of the event.\n    let currentTarget = event.currentTarget as Element | null;\n\n    // Bail if there is no current target.\n    if (!currentTarget) {\n      return null;\n    }\n\n    // There are some third party libraries that cause the `target` to\n    // be detached from the DOM before lumino can process the event.\n    // If that happens, search for a new target node by point. If that\n    // node is still dangling, bail.\n    if (!currentTarget.contains(target)) {\n      target = document.elementFromPoint(event.clientX, event.clientY);\n      if (!target || !currentTarget.contains(target)) {\n        return null;\n      }\n    }\n\n    // Set up the result array.\n    let result: IItem[] = [];\n\n    // Copy the items array to allow in-place modification.\n    let availableItems: Array<IItem | null> = items.slice();\n\n    // Walk up the DOM hierarchy searching for matches.\n    while (target !== null) {\n      // Set up the match array for this DOM level.\n      let matches: IItem[] = [];\n\n      // Search the remaining items for matches.\n      for (let i = 0, n = availableItems.length; i < n; ++i) {\n        // Fetch the item.\n        let item = availableItems[i];\n\n        // Skip items which are already consumed.\n        if (!item) {\n          continue;\n        }\n\n        // Skip items which do not match the element.\n        if (!Selector.matches(target, item.selector)) {\n          continue;\n        }\n\n        // Add the matched item to the result for this DOM level.\n        matches.push(item);\n\n        // Mark the item as consumed.\n        availableItems[i] = null;\n      }\n\n      // Sort the matches for this level and add them to the results.\n      if (matches.length !== 0) {\n        if (groupByTarget) {\n          matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n        }\n        result.push(...matches);\n      }\n\n      // Stop searching at the limits of the DOM range.\n      if (target === currentTarget) {\n        break;\n      }\n\n      // Step to the parent DOM level.\n      target = target.parentElement;\n    }\n\n    if (!groupByTarget) {\n      result.sort(sortBySelector ? itemCmp : itemCmpRank);\n    }\n\n    // Return the matched and sorted results.\n    return result;\n  }\n\n  /**\n   * Validate the selector for a menu item.\n   *\n   * This returns the validated selector, or throws if the selector is\n   * invalid or contains commas.\n   */\n  function validateSelector(selector: string): string {\n    if (selector.indexOf(',') !== -1) {\n      throw new Error(`Selector cannot contain commas: ${selector}`);\n    }\n    if (!Selector.isValid(selector)) {\n      throw new Error(`Invalid selector: ${selector}`);\n    }\n    return selector;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by ranks.\n   */\n  function itemCmpRank(a: IItem, b: IItem): number {\n    // Sort based on rank.\n    let r1 = a.rank;\n    let r2 = b.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity-safe\n    }\n\n    // When all else fails, sort by item id.\n    return a.id - b.id;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by selectors and ranks.\n   */\n  function itemCmp(a: IItem, b: IItem): number {\n    // Sort first based on selector specificity.\n    let s1 = Selector.calculateSpecificity(a.selector);\n    let s2 = Selector.calculateSpecificity(b.selector);\n    if (s1 !== s2) {\n      return s2 - s1;\n    }\n\n    // If specificities are equal\n    return itemCmpRank(a, b);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ElementARIAAttrs,\n  ElementBaseAttrs,\n  ElementDataset,\n  ElementInlineStyle,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n  'ArrowLeft',\n  'ArrowUp',\n  'ArrowRight',\n  'ArrowDown',\n  'Home',\n  'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar<T> extends Widget {\n  /**\n   * Construct a new tab bar.\n   *\n   * @param options - The options for initializing the tab bar.\n   */\n  constructor(options: TabBar.IOptions<T> = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-TabBar');\n    this.contentNode.setAttribute('role', 'tablist');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this._document = options.document || document;\n    this.tabsMovable = options.tabsMovable || false;\n    this.titlesEditable = options.titlesEditable || false;\n    this.allowDeselect = options.allowDeselect || false;\n    this.addButtonEnabled = options.addButtonEnabled || false;\n    this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n    this.name = options.name || '';\n    this.orientation = options.orientation || 'horizontal';\n    this.removeBehavior = options.removeBehavior || 'select-tab-after';\n    this.renderer = options.renderer || TabBar.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    this._titles.length = 0;\n    this._previousTitle = null;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabBar.ICurrentChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when a tab is moved by the user.\n   *\n   * #### Notes\n   * This signal is emitted when a tab is moved by user interaction.\n   *\n   * This signal is not emitted when a tab is moved programmatically.\n   */\n  get tabMoved(): ISignal<this, TabBar.ITabMovedArgs<T>> {\n    return this._tabMoved;\n  }\n\n  /**\n   * A signal emitted when a tab is clicked by the user.\n   *\n   * #### Notes\n   * If the clicked tab is not the current tab, the clicked tab will be\n   * made current and the `currentChanged` signal will be emitted first.\n   *\n   * This signal is emitted even if the clicked tab is the current tab.\n   */\n  get tabActivateRequested(): ISignal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  > {\n    return this._tabActivateRequested;\n  }\n\n  /**\n   * A signal emitted when the tab bar add button is clicked.\n   */\n  get addRequested(): ISignal<this, void> {\n    return this._addRequested;\n  }\n\n  /**\n   * A signal emitted when a tab close icon is clicked.\n   *\n   * #### Notes\n   * This signal is not emitted unless the tab title is `closable`.\n   */\n  get tabCloseRequested(): ISignal<this, TabBar.ITabCloseRequestedArgs<T>> {\n    return this._tabCloseRequested;\n  }\n\n  /**\n   * A signal emitted when a tab is dragged beyond the detach threshold.\n   *\n   * #### Notes\n   * This signal is emitted when the user drags a tab with the mouse,\n   * and mouse is dragged beyond the detach threshold.\n   *\n   * The consumer of the signal should call `releaseMouse` and remove\n   * the tab in order to complete the detach.\n   *\n   * This signal is only emitted once per drag cycle.\n   */\n  get tabDetachRequested(): ISignal<this, TabBar.ITabDetachRequestedArgs<T>> {\n    return this._tabDetachRequested;\n  }\n\n  /**\n   * The renderer used by the tab bar.\n   */\n  readonly renderer: TabBar.IRenderer<T>;\n\n  /**\n   * The document to use with the tab bar.\n   *\n   * The default is the global `document` instance.\n   */\n  get document(): Document | ShadowRoot {\n    return this._document;\n  }\n\n  /**\n   * Whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  tabsMovable: boolean;\n\n  /**\n   * Whether the titles can be user-edited.\n   *\n   */\n  get titlesEditable(): boolean {\n    return this._titlesEditable;\n  }\n\n  /**\n   * Set whether titles can be user edited.\n   *\n   */\n  set titlesEditable(value: boolean) {\n    this._titlesEditable = value;\n  }\n\n  /**\n   * Whether a tab can be deselected by the user.\n   *\n   * #### Notes\n   * Tabs can be always be deselected programmatically.\n   */\n  allowDeselect: boolean;\n\n  /**\n   * The selection behavior when inserting a tab.\n   */\n  insertBehavior: TabBar.InsertBehavior;\n\n  /**\n   * The selection behavior when removing a tab.\n   */\n  removeBehavior: TabBar.RemoveBehavior;\n\n  /**\n   * Get the currently selected title.\n   *\n   * #### Notes\n   * This will be `null` if no tab is selected.\n   */\n  get currentTitle(): Title<T> | null {\n    return this._titles[this._currentIndex] || null;\n  }\n\n  /**\n   * Set the currently selected title.\n   *\n   * #### Notes\n   * If the title does not exist, the title will be set to `null`.\n   */\n  set currentTitle(value: Title<T> | null) {\n    this.currentIndex = value ? this._titles.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this._currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the value is out of range, the index will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    // Adjust for an out of range index.\n    if (value < 0 || value >= this._titles.length) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._currentIndex === value) {\n      return;\n    }\n\n    // Look up the previous index and title.\n    let pi = this._currentIndex;\n    let pt = this._titles[pi] || null;\n\n    // Look up the current index and title.\n    let ci = value;\n    let ct = this._titles[ci] || null;\n\n    // Update the current index and previous title.\n    this._currentIndex = ci;\n    this._previousTitle = pt;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: ci,\n      currentTitle: ct\n    });\n  }\n\n  /**\n   * Get the name of the tab bar.\n   */\n  get name(): string {\n    return this._name;\n  }\n\n  /**\n   * Set the name of the tab bar.\n   */\n  set name(value: string) {\n    this._name = value;\n    if (value) {\n      this.contentNode.setAttribute('aria-label', value);\n    } else {\n      this.contentNode.removeAttribute('aria-label');\n    }\n  }\n\n  /**\n   * Get the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  get orientation(): TabBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  set orientation(value: TabBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Toggle the orientation values.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n    this.contentNode.setAttribute('aria-orientation', value);\n  }\n\n  /**\n   * Whether the add button is enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add button is enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    // Do nothing if the value does not change.\n    if (this._addButtonEnabled === value) {\n      return;\n    }\n\n    this._addButtonEnabled = value;\n    if (value) {\n      this.addButtonNode.classList.remove('lm-mod-hidden');\n    } else {\n      this.addButtonNode.classList.add('lm-mod-hidden');\n    }\n  }\n\n  /**\n   * A read-only array of the titles in the tab bar.\n   */\n  get titles(): ReadonlyArray<Title<T>> {\n    return this._titles;\n  }\n\n  /**\n   * The tab bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the tab nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * The tab bar add button node.\n   *\n   * #### Notes\n   * This is the node which holds the add button.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get addButtonNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-addButton'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Add a tab to the end of the tab bar.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  addTab(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return this.insertTab(this._titles.length, value);\n  }\n\n  /**\n   * Insert a tab into the tab bar at the specified index.\n   *\n   * @param index - The index at which to insert the tab.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the tabs.\n   *\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  insertTab(index: number, value: Title<T> | Title.IOptions<T>): Title<T> {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Coerce the value to a title.\n    let title = Private.asTitle(value);\n\n    // Look up the index of the title.\n    let i = this._titles.indexOf(title);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._titles.length));\n\n    // If the title is not in the array, insert it.\n    if (i === -1) {\n      // Insert the title into the array.\n      ArrayExt.insert(this._titles, j, title);\n\n      // Connect to the title changed signal.\n      title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the tabs.\n      this.update();\n\n      // Adjust the current index for the insert.\n      this._adjustCurrentForInsert(j, title);\n\n      // Return the title added to the tab bar.\n      return title;\n    }\n\n    // Otherwise, the title exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._titles.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return title;\n    }\n\n    // Move the title to the new location.\n    ArrayExt.move(this._titles, i, j);\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the move.\n    this._adjustCurrentForMove(i, j);\n\n    // Return the title added to the tab bar.\n    return title;\n  }\n\n  /**\n   * Remove a tab from the tab bar.\n   *\n   * @param title - The title for the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the title is not in the tab bar.\n   */\n  removeTab(title: Title<T>): void {\n    this.removeTabAt(this._titles.indexOf(title));\n  }\n\n  /**\n   * Remove the tab at a given index from the tab bar.\n   *\n   * @param index - The index of the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeTabAt(index: number): void {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Remove the title from the array.\n    let title = ArrayExt.removeAt(this._titles, index);\n\n    // Bail if the index is out of range.\n    if (!title) {\n      return;\n    }\n\n    // Disconnect from the title changed signal.\n    title.changed.disconnect(this._onTitleChanged, this);\n\n    // Clear the previous title if it's being removed.\n    if (title === this._previousTitle) {\n      this._previousTitle = null;\n    }\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the remove.\n    this._adjustCurrentForRemove(index, title);\n  }\n\n  /**\n   * Remove all tabs from the tab bar.\n   */\n  clearTabs(): void {\n    // Bail if there is nothing to remove.\n    if (this._titles.length === 0) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Disconnect from the title changed signals.\n    for (let title of this._titles) {\n      title.changed.disconnect(this._onTitleChanged, this);\n    }\n\n    // Get the current index and title.\n    let pi = this.currentIndex;\n    let pt = this.currentTitle;\n\n    // Reset the current index and previous title.\n    this._currentIndex = -1;\n    this._previousTitle = null;\n\n    // Clear the title array.\n    this._titles.length = 0;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // If no tab was selected, there's nothing else to do.\n    if (pi === -1) {\n      return;\n    }\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   *\n   * #### Notes\n   * This will cause the tab bar to stop handling mouse events and to\n   * restore the tabs to their non-dragged positions.\n   */\n  releaseMouse(): void {\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the DOM events for the tab bar.\n   *\n   * @param event - The DOM event sent to the tab bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tab bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'dblclick':\n        this._evtDblClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        event.eventPhase === Event.CAPTURING_PHASE\n          ? this._evtKeyDownCapturing(event as KeyboardEvent)\n          : this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n    this.node.addEventListener('dblclick', this);\n    this.node.addEventListener('keydown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this.node.removeEventListener('dblclick', this);\n    this.node.removeEventListener('keydown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let titles = this._titles;\n    let renderer = this.renderer;\n    let currentTitle = this.currentTitle;\n    let content = new Array<VirtualElement>(titles.length);\n    // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n    // If the add button handles it, no need to do anything. If no element of the tab\n    // bar handles it, set it on the current or the first tab to ensure one element\n    // handles it after update.\n    const tabHandlingTabindex =\n      this._getCurrentTabindex() ??\n      (this._currentIndex > -1 ? this._currentIndex : 0);\n\n    for (let i = 0, n = titles.length; i < n; ++i) {\n      let title = titles[i];\n      let current = title === currentTitle;\n      let zIndex = current ? n : n - i - 1;\n      let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n      content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * Get the index of the tab which handles tabindex=\"0\".\n   * If the add button handles tabindex=\"0\", -1 is returned.\n   * If none of the previous handles tabindex=\"0\", null is returned.\n   */\n  private _getCurrentTabindex(): number | null {\n    let index = null;\n    const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n    if (elemTabindex) {\n      index = [...this.contentNode.children].indexOf(elemTabindex);\n    } else if (\n      this._addButtonEnabled &&\n      this.addButtonNode.getAttribute('tabindex') === '0'\n    ) {\n      index = -1;\n    }\n    return index;\n  }\n\n  /**\n   * Handle the `'dblclick'` event for the tab bar.\n   */\n  private _evtDblClick(event: MouseEvent): void {\n    // Do nothing if titles are not editable\n    if (!this.titlesEditable) {\n      return;\n    }\n\n    let tabs = this.contentNode.children;\n\n    // Find the index of the targeted tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab.\n    if (index === -1) {\n      return;\n    }\n\n    let title = this.titles[index];\n    let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n    if (label && label.contains(event.target as HTMLElement)) {\n      let value = title.label || '';\n\n      // Clear the label element\n      let oldValue = label.innerHTML;\n      label.innerHTML = '';\n\n      let input = document.createElement('input');\n      input.classList.add('lm-TabBar-tabInput');\n      input.value = value;\n      label.appendChild(input);\n\n      let onblur = () => {\n        input.removeEventListener('blur', onblur);\n        label.innerHTML = oldValue;\n        this.node.addEventListener('keydown', this);\n      };\n\n      input.addEventListener('dblclick', (event: Event) =>\n        event.stopPropagation()\n      );\n      input.addEventListener('blur', onblur);\n      input.addEventListener('keydown', (event: KeyboardEvent) => {\n        if (event.key === 'Enter') {\n          if (input.value !== '') {\n            title.label = title.caption = input.value;\n          }\n          onblur();\n        } else if (event.key === 'Escape') {\n          onblur();\n        }\n      });\n      this.node.removeEventListener('keydown', this);\n      input.select();\n      input.focus();\n\n      if (label.children.length > 0) {\n        (label.children[0] as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at capturing phase.\n   */\n  private _evtKeyDownCapturing(event: KeyboardEvent): void {\n    if (event.eventPhase !== Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.key === 'Escape') {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at target phase.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Allow for navigation using tab key\n    if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Check if Enter or Spacebar key has been pressed and open that tab\n    if (\n      event.key === 'Enter' ||\n      event.key === 'Spacebar' ||\n      event.key === ' '\n    ) {\n      // Get focus element that is in focus by the tab key\n      const focusedElement = document.activeElement;\n\n      // Test first if the focus is on the add button node\n      if (\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(focusedElement)\n      ) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._addRequested.emit();\n      } else {\n        const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n          tab.contains(focusedElement)\n        );\n        if (index >= 0) {\n          event.preventDefault();\n          event.stopPropagation();\n          this.currentIndex = index;\n        }\n      }\n      // Handle the arrow keys to switch tabs.\n    } else if (ARROW_KEYS.includes(event.key)) {\n      // Create a list of all focusable elements in the tab bar.\n      const focusable: Element[] = [...this.contentNode.children];\n      if (this.addButtonEnabled) {\n        focusable.push(this.addButtonNode);\n      }\n      // If the tab bar contains only one element, nothing to do.\n      if (focusable.length <= 1) {\n        return;\n      }\n      event.preventDefault();\n      event.stopPropagation();\n\n      // Get the current focused element.\n      let focusedIndex = focusable.indexOf(document.activeElement as Element);\n      if (focusedIndex === -1) {\n        focusedIndex = this._currentIndex;\n      }\n\n      // Find the next element to focus on.\n      let nextFocused: Element | null | undefined;\n      if (\n        (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowDown' && this._orientation === 'vertical')\n      ) {\n        nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n      } else if (\n        (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowUp' && this._orientation === 'vertical')\n      ) {\n        nextFocused =\n          focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n      } else if (event.key === 'Home') {\n        nextFocused = focusable[0];\n      } else if (event.key === 'End') {\n        nextFocused = focusable[focusable.length - 1];\n      }\n\n      // Change the focused element and the tabindex value.\n      if (nextFocused) {\n        focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n        nextFocused?.setAttribute('tabindex', '0');\n        (nextFocused as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the tab bar.\n   */\n  private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse press.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if a drag is in progress.\n    if (this._dragData) {\n      return;\n    }\n\n    // Do nothing if a title editable input was clicked.\n    if (\n      (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n    ) {\n      return;\n    }\n\n    // Check if the add button was clicked.\n    let addButtonClicked =\n      this.addButtonEnabled &&\n      this.addButtonNode.contains(event.target as HTMLElement);\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Find the index of the pressed tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab or the add button.\n    if (index === -1 && !addButtonClicked) {\n      return;\n    }\n\n    // Pressing on a tab stops the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Initialize the non-measured parts of the drag data.\n    this._dragData = {\n      tab: tabs[index] as HTMLElement,\n      index: index,\n      pressX: event.clientX,\n      pressY: event.clientY,\n      tabPos: -1,\n      tabSize: -1,\n      tabPressPos: -1,\n      targetIndex: -1,\n      tabLayout: null,\n      contentRect: null,\n      override: null,\n      dragActive: false,\n      dragAborted: false,\n      detachRequested: false\n    };\n\n    // Add the document pointer up listener.\n    this.document.addEventListener('pointerup', this, true);\n\n    // Do nothing else if the middle button or add button is clicked.\n    if (event.button === 1 || addButtonClicked) {\n      return;\n    }\n\n    // Do nothing else if the close icon is clicked.\n    let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n    if (icon && icon.contains(event.target as HTMLElement)) {\n      return;\n    }\n\n    // Add the extra listeners if the tabs are movable.\n    if (this.tabsMovable) {\n      this.document.addEventListener('pointermove', this, true);\n      this.document.addEventListener('keydown', this, true);\n      this.document.addEventListener('contextmenu', this, true);\n    }\n\n    // Update the current index as appropriate.\n    if (this.allowDeselect && this.currentIndex === index) {\n      this.currentIndex = -1;\n    } else {\n      this.currentIndex = index;\n    }\n\n    // Do nothing else if there is no current tab.\n    if (this.currentIndex === -1) {\n      return;\n    }\n\n    // Emit the tab activate request signal.\n    this._tabActivateRequested.emit({\n      index: this.currentIndex,\n      title: this.currentTitle!\n    });\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the tab bar.\n   */\n  private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Suppress the event during a drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Bail early if the drag threshold has not been met.\n    if (!data.dragActive && !Private.dragExceeded(data, event)) {\n      return;\n    }\n\n    // Activate the drag if necessary.\n    if (!data.dragActive) {\n      // Fill in the rest of the drag data measurements.\n      let tabRect = data.tab.getBoundingClientRect();\n      if (this._orientation === 'horizontal') {\n        data.tabPos = data.tab.offsetLeft;\n        data.tabSize = tabRect.width;\n        data.tabPressPos = data.pressX - tabRect.left;\n      } else {\n        data.tabPos = data.tab.offsetTop;\n        data.tabSize = tabRect.height;\n        data.tabPressPos = data.pressY - tabRect.top;\n      }\n      data.tabPressOffset = {\n        x: data.pressX - tabRect.left,\n        y: data.pressY - tabRect.top\n      };\n      data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n      data.contentRect = this.contentNode.getBoundingClientRect();\n      data.override = Drag.overrideCursor('default');\n\n      // Add the dragging style classes.\n      data.tab.classList.add('lm-mod-dragging');\n      this.addClass('lm-mod-dragging');\n\n      // Mark the drag as active.\n      data.dragActive = true;\n    }\n\n    // Emit the detach requested signal if the threshold is exceeded.\n    if (!data.detachRequested && Private.detachExceeded(data, event)) {\n      // Only emit the signal once per drag cycle.\n      data.detachRequested = true;\n\n      // Setup the arguments for the signal.\n      let index = data.index;\n      let clientX = event.clientX;\n      let clientY = event.clientY;\n      let tab = tabs[index] as HTMLElement;\n      let title = this._titles[index];\n\n      // Emit the tab detach requested signal.\n      this._tabDetachRequested.emit({\n        index,\n        title,\n        tab,\n        clientX,\n        clientY,\n        offset: data.tabPressOffset\n      });\n\n      // Bail if the signal handler aborted the drag.\n      if (data.dragAborted) {\n        return;\n      }\n    }\n\n    // Update the positions of the tabs.\n    Private.layoutTabs(tabs, data, event, this._orientation);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the document.\n   */\n  private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse release.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if no drag is in progress.\n    const data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Remove the extra mouse event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Handle a release when the drag is not active.\n    if (!data.dragActive) {\n      // Clear the drag data.\n      this._dragData = null;\n\n      // Handle clicking the add button.\n      let addButtonClicked =\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(event.target as HTMLElement);\n      if (addButtonClicked) {\n        this._addRequested.emit(undefined);\n        return;\n      }\n\n      // Lookup the tab nodes.\n      let tabs = this.contentNode.children;\n\n      // Find the index of the released tab.\n      let index = ArrayExt.findFirstIndex(tabs, tab => {\n        return ElementExt.hitTest(tab, event.clientX, event.clientY);\n      });\n\n      // Do nothing if the release is not on the original pressed tab.\n      if (index !== data.index) {\n        return;\n      }\n\n      // Ignore the release if the title is not closable.\n      let title = this._titles[index];\n      if (!title.closable) {\n        return;\n      }\n\n      // Emit the close requested signal if the middle button is released.\n      if (event.button === 1) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Emit the close requested signal if the close icon was released.\n      let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n      if (icon && icon.contains(event.target as HTMLElement)) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Otherwise, there is nothing left to do.\n      return;\n    }\n\n    // Do nothing if the left button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Position the tab at its final resting position.\n    Private.finalizeTabPosition(data, this._orientation);\n\n    // Remove the dragging class from the tab so it can be transitioned.\n    data.tab.classList.remove('lm-mod-dragging');\n\n    // Parse the transition duration for releasing the tab.\n    let duration = Private.parseTransitionDuration(data.tab);\n\n    // Complete the release on a timer to allow the tab to transition.\n    setTimeout(() => {\n      // Do nothing if the drag has been aborted.\n      if (data.dragAborted) {\n        return;\n      }\n\n      // Clear the drag data reference.\n      this._dragData = null;\n\n      // Reset the positions of the tabs.\n      Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n      // Clear the cursor grab.\n      data.override!.dispose();\n\n      // Remove the remaining dragging style.\n      this.removeClass('lm-mod-dragging');\n\n      // If the tab was not moved, there is nothing else to do.\n      let i = data.index;\n      let j = data.targetIndex;\n      if (j === -1 || i === j) {\n        return;\n      }\n\n      // Move the title to the new locations.\n      ArrayExt.move(this._titles, i, j);\n\n      // Adjust the current index for the move.\n      this._adjustCurrentForMove(i, j);\n\n      // Emit the tab moved signal.\n      this._tabMoved.emit({\n        fromIndex: i,\n        toIndex: j,\n        title: this._titles[j]\n      });\n\n      // Update the tabs immediately to prevent flicker.\n      MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    }, duration);\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   */\n  private _releaseMouse(): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Clear the drag data reference.\n    this._dragData = null;\n\n    // Remove the extra document event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Indicate the drag has been aborted. This allows the mouse\n    // event handlers to return early when the drag is canceled.\n    data.dragAborted = true;\n\n    // If the drag is not active, there's nothing more to do.\n    if (!data.dragActive) {\n      return;\n    }\n\n    // Reset the tabs to their non-dragged positions.\n    Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n    // Clear the cursor override.\n    data.override!.dispose();\n\n    // Clear the dragging style classes.\n    data.tab.classList.remove('lm-mod-dragging');\n    this.removeClass('lm-mod-dragging');\n  }\n\n  /**\n   * Adjust the current index for a tab insert operation.\n   *\n   * This method accounts for the tab bar's insertion behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForInsert(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ct = this.currentTitle;\n    let ci = this._currentIndex;\n    let bh = this.insertBehavior;\n\n    // TODO: do we need to do an update to update the aria-selected attribute?\n\n    // Handle the behavior where the new tab is always selected,\n    // or the behavior where the new tab is selected if needed.\n    if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n      this._currentIndex = i;\n      this._previousTitle = ct;\n      this._currentChanged.emit({\n        previousIndex: ci,\n        previousTitle: ct,\n        currentIndex: i,\n        currentTitle: title\n      });\n      return;\n    }\n\n    // Otherwise, silently adjust the current index if needed.\n    if (ci >= i) {\n      this._currentIndex++;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab move operation.\n   *\n   * This method will not cause the actual current tab to change.\n   * It silently adjusts the index to account for the given move.\n   */\n  private _adjustCurrentForMove(i: number, j: number): void {\n    if (this._currentIndex === i) {\n      this._currentIndex = j;\n    } else if (this._currentIndex < i && this._currentIndex >= j) {\n      this._currentIndex++;\n    } else if (this._currentIndex > i && this._currentIndex <= j) {\n      this._currentIndex--;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab remove operation.\n   *\n   * This method accounts for the tab bar's remove behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForRemove(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ci = this._currentIndex;\n    let bh = this.removeBehavior;\n\n    // Silently adjust the index if the current tab is not removed.\n    if (ci !== i) {\n      if (ci > i) {\n        this._currentIndex--;\n      }\n      return;\n    }\n\n    // TODO: do we need to do an update to adjust the aria-selected value?\n\n    // No tab gets selected if the tab bar is empty.\n    if (this._titles.length === 0) {\n      this._currentIndex = -1;\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: -1,\n        currentTitle: null\n      });\n      return;\n    }\n\n    // Handle behavior where the next sibling tab is selected.\n    if (bh === 'select-tab-after') {\n      this._currentIndex = Math.min(i, this._titles.length - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous sibling tab is selected.\n    if (bh === 'select-tab-before') {\n      this._currentIndex = Math.max(0, i - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous history tab is selected.\n    if (bh === 'select-previous-tab') {\n      if (this._previousTitle) {\n        this._currentIndex = this._titles.indexOf(this._previousTitle);\n        this._previousTitle = null;\n      } else {\n        this._currentIndex = Math.min(i, this._titles.length - 1);\n      }\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Otherwise, no tab gets selected.\n    this._currentIndex = -1;\n    this._currentChanged.emit({\n      previousIndex: i,\n      previousTitle: title,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<T>): void {\n    this.update();\n  }\n\n  private _name: string;\n  private _currentIndex = -1;\n  private _titles: Title<T>[] = [];\n  private _orientation: TabBar.Orientation;\n  private _document: Document | ShadowRoot;\n  private _titlesEditable: boolean = false;\n  private _previousTitle: Title<T> | null = null;\n  private _dragData: Private.IDragData | null = null;\n  private _addButtonEnabled: boolean = false;\n  private _tabMoved = new Signal<this, TabBar.ITabMovedArgs<T>>(this);\n  private _currentChanged = new Signal<this, TabBar.ICurrentChangedArgs<T>>(\n    this\n  );\n  private _addRequested = new Signal<this, void>(this);\n  private _tabCloseRequested = new Signal<\n    this,\n    TabBar.ITabCloseRequestedArgs<T>\n  >(this);\n  private _tabDetachRequested = new Signal<\n    this,\n    TabBar.ITabDetachRequestedArgs<T>\n  >(this);\n  private _tabActivateRequested = new Signal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n  /**\n   * A type alias for a tab bar orientation.\n   */\n  export type Orientation =\n    | /**\n     * The tabs are arranged in a single row, left-to-right.\n     *\n     * The tab text orientation is horizontal.\n     */\n    'horizontal'\n\n    /**\n     * The tabs are arranged in a single column, top-to-bottom.\n     *\n     * The tab text orientation is horizontal.\n     */\n    | 'vertical';\n\n  /**\n   * A type alias for the selection behavior on tab insert.\n   */\n  export type InsertBehavior =\n    | /**\n     * The selected tab will not be changed.\n     */\n    'none'\n\n    /**\n     * The inserted tab will be selected.\n     */\n    | 'select-tab'\n\n    /**\n     * The inserted tab will be selected if the current tab is null.\n     */\n    | 'select-tab-if-needed';\n\n  /**\n   * A type alias for the selection behavior on tab remove.\n   */\n  export type RemoveBehavior =\n    | /**\n     * No tab will be selected.\n     */\n    'none'\n\n    /**\n     * The tab after the removed tab will be selected if possible.\n     */\n    | 'select-tab-after'\n\n    /**\n     * The tab before the removed tab will be selected if possible.\n     */\n    | 'select-tab-before'\n\n    /**\n     * The previously selected tab will be selected if possible.\n     */\n    | 'select-previous-tab';\n\n  /**\n   * An options object for creating a tab bar.\n   */\n  export interface IOptions<T> {\n    /**\n     * The document to use with the tab bar.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n\n    /**\n     * Name of the tab bar.\n     *\n     * This is used for accessibility reasons. The default is the empty string.\n     */\n    name?: string;\n\n    /**\n     * The layout orientation of the tab bar.\n     *\n     * The default is `horizontal`.\n     */\n    orientation?: TabBar.Orientation;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether a tab can be deselected by the user.\n     *\n     * The default is `false`.\n     */\n    allowDeselect?: boolean;\n\n    /**\n     * Whether the titles can be directly edited by the user.\n     *\n     * The default is `false`.\n     */\n    titlesEditable?: boolean;\n\n    /**\n     * Whether the add button is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The selection behavior when inserting a tab.\n     *\n     * The default is `'select-tab-if-needed'`.\n     */\n    insertBehavior?: TabBar.InsertBehavior;\n\n    /**\n     * The selection behavior when removing a tab.\n     *\n     * The default is `'select-tab-after'`.\n     */\n    removeBehavior?: TabBar.RemoveBehavior;\n\n    /**\n     * A renderer to use with the tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer<T>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs<T> {\n    /**\n     * The previously selected index.\n     */\n    readonly previousIndex: number;\n\n    /**\n     * The previously selected title.\n     */\n    readonly previousTitle: Title<T> | null;\n\n    /**\n     * The currently selected index.\n     */\n    readonly currentIndex: number;\n\n    /**\n     * The currently selected title.\n     */\n    readonly currentTitle: Title<T> | null;\n  }\n\n  /**\n   * The arguments object for the `tabMoved` signal.\n   */\n  export interface ITabMovedArgs<T> {\n    /**\n     * The previous index of the tab.\n     */\n    readonly fromIndex: number;\n\n    /**\n     * The current index of the tab.\n     */\n    readonly toIndex: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabActivateRequested` signal.\n   */\n  export interface ITabActivateRequestedArgs<T> {\n    /**\n     * The index of the tab to activate.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabCloseRequested` signal.\n   */\n  export interface ITabCloseRequestedArgs<T> {\n    /**\n     * The index of the tab to close.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabDetachRequested` signal.\n   */\n  export interface ITabDetachRequestedArgs<T> {\n    /**\n     * The index of the tab to detach.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * The node representing the tab.\n     */\n    readonly tab: HTMLElement;\n\n    /**\n     * The current client X position of the mouse.\n     */\n    readonly clientX: number;\n\n    /**\n     * The current client Y position of the mouse.\n     */\n    readonly clientY: number;\n\n    /**\n     * The mouse position in the tab coordinate.\n     */\n    readonly offset?: { x: number; y: number };\n  }\n\n  /**\n   * An object which holds the data to render a tab.\n   */\n  export interface IRenderData<T> {\n    /**\n     * The title associated with the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * Whether the tab is the current tab.\n     */\n    readonly current: boolean;\n\n    /**\n     * The z-index for the tab.\n     */\n    readonly zIndex: number;\n\n    /**\n     * The tabindex value for the tab.\n     */\n    readonly tabIndex?: number;\n  }\n\n  /**\n   * A renderer for use with a tab bar.\n   */\n  export interface IRenderer<T> {\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector: string;\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<T>): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer<any> {\n    constructor() {\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<any>): VirtualElement {\n      let title = data.title.caption;\n      let key = this.createTabKey(data);\n      let id = key;\n      let style = this.createTabStyle(data);\n      let className = this.createTabClass(data);\n      let dataset = this.createTabDataset(data);\n      let aria = this.createTabARIA(data);\n      if (data.title.closable) {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data),\n          this.renderCloseIcon(data)\n        );\n      } else {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data)\n        );\n      }\n    }\n\n    /**\n     * Render the icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab icon.\n     */\n    renderIcon(data: IRenderData<any>): VirtualElement {\n      const { title } = data;\n      let className = this.createIconClass(data);\n\n      // If title.icon is undefined, it will be ignored.\n      return h.div({ className }, title.icon!, title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab label.\n     */\n    renderLabel(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n    }\n\n    /**\n     * Render the close icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab close icon.\n     */\n    renderCloseIcon(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n    }\n\n    /**\n     * Create a unique render key for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The unique render key for the tab.\n     *\n     * #### Notes\n     * This method caches the key against the tab title the first time\n     * the key is generated. This enables efficient rendering of moved\n     * tabs and avoids subtle hover style artifacts.\n     */\n    createTabKey(data: IRenderData<any>): string {\n      let key = this._tabKeys.get(data.title);\n      if (key === undefined) {\n        key = `tab-key-${this._uuid}-${this._tabID++}`;\n        this._tabKeys.set(data.title, key);\n      }\n      return key;\n    }\n\n    /**\n     * Create the inline style object for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The inline style data for the tab.\n     */\n    createTabStyle(data: IRenderData<any>): ElementInlineStyle {\n      return { zIndex: `${data.zIndex}` };\n    }\n\n    /**\n     * Create the class name for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab.\n     */\n    createTabClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tab';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.title.closable) {\n        name += ' lm-mod-closable';\n      }\n      if (data.current) {\n        name += ' lm-mod-current';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The dataset for the tab.\n     */\n    createTabDataset(data: IRenderData<any>): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the ARIA attributes for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The ARIA attributes for the tab.\n     */\n    createTabARIA(data: IRenderData<any>): ElementARIAAttrs | ElementBaseAttrs {\n      return {\n        role: 'tab',\n        'aria-selected': data.current.toString(),\n        tabindex: `${data.tabIndex ?? '-1'}`\n      };\n    }\n\n    /**\n     * Create the class name for the tab icon.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab icon.\n     */\n    createIconClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tabIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _tabID = 0;\n    private _tabKeys = new WeakMap<Title<any>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * A selector which matches the add button node in the tab bar.\n   */\n  export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The start drag distance threshold.\n   */\n  export const DRAG_THRESHOLD = 5;\n\n  /**\n   * The detach distance threshold.\n   */\n  export const DETACH_THRESHOLD = 20;\n\n  /**\n   * A struct which holds the drag data for a tab bar.\n   */\n  export interface IDragData {\n    /**\n     * The tab node being dragged.\n     */\n    tab: HTMLElement;\n\n    /**\n     * The index of the tab being dragged.\n     */\n    index: number;\n\n    /**\n     * The mouse press client X position.\n     */\n    pressX: number;\n\n    /**\n     * The mouse press client Y position.\n     */\n    pressY: number;\n\n    /**\n     * The offset left/top of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPos: number;\n\n    /**\n     * The offset width/height of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabSize: number;\n\n    /**\n     * The original mouse X/Y position in tab coordinates.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPressPos: number;\n\n    /**\n     * The original mouse position in tab coordinates.\n     *\n     * This is undefined if the drag is not active.\n     */\n    tabPressOffset?: { x: number; y: number };\n\n    /**\n     * The tab target index upon mouse release.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    targetIndex: number;\n\n    /**\n     * The array of tab layout objects snapped at drag start.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    tabLayout: ITabLayout[] | null;\n\n    /**\n     * The bounding client rect of the tab bar content node.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    contentRect: DOMRect | null;\n\n    /**\n     * The disposable to clean up the cursor override.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    override: IDisposable | null;\n\n    /**\n     * Whether the drag is currently active.\n     */\n    dragActive: boolean;\n\n    /**\n     * Whether the drag has been aborted.\n     */\n    dragAborted: boolean;\n\n    /**\n     * Whether a detach request as been made.\n     */\n    detachRequested: boolean;\n  }\n\n  /**\n   * An object which holds layout data for a tab.\n   */\n  export interface ITabLayout {\n    /**\n     * The left/top margin value for the tab.\n     */\n    margin: number;\n\n    /**\n     * The offset left/top position of the tab.\n     */\n    pos: number;\n\n    /**\n     * The offset width/height of the tab.\n     */\n    size: number;\n  }\n\n  /**\n   * Create the DOM node for a tab bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.setAttribute('role', 'tablist');\n    content.className = 'lm-TabBar-content';\n    node.appendChild(content);\n\n    let add = document.createElement('div');\n    add.className = 'lm-TabBar-addButton lm-mod-hidden';\n    add.setAttribute('tabindex', '-1');\n    add.setAttribute('role', 'button');\n    node.appendChild(add);\n    return node;\n  }\n\n  /**\n   * Coerce a title or options into a real title.\n   */\n  export function asTitle<T>(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return value instanceof Title ? value : new Title<T>(value);\n  }\n\n  /**\n   * Parse the transition duration for a tab node.\n   */\n  export function parseTransitionDuration(tab: HTMLElement): number {\n    let style = window.getComputedStyle(tab);\n    return 1000 * (parseFloat(style.transitionDuration!) || 0);\n  }\n\n  /**\n   * Get a snapshot of the current tab layout values.\n   */\n  export function snapTabLayout(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): ITabLayout[] {\n    let layout = new Array<ITabLayout>(tabs.length);\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let node = tabs[i] as HTMLElement;\n      let style = window.getComputedStyle(node);\n      if (orientation === 'horizontal') {\n        layout[i] = {\n          pos: node.offsetLeft,\n          size: node.offsetWidth,\n          margin: parseFloat(style.marginLeft!) || 0\n        };\n      } else {\n        layout[i] = {\n          pos: node.offsetTop,\n          size: node.offsetHeight,\n          margin: parseFloat(style.marginTop!) || 0\n        };\n      }\n    }\n    return layout;\n  }\n\n  /**\n   * Test if the event exceeds the drag threshold.\n   */\n  export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n    let dx = Math.abs(event.clientX - data.pressX);\n    let dy = Math.abs(event.clientY - data.pressY);\n    return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n  }\n\n  /**\n   * Test if the event exceeds the drag detach threshold.\n   */\n  export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n    let rect = data.contentRect!;\n    return (\n      event.clientX < rect.left - DETACH_THRESHOLD ||\n      event.clientX >= rect.right + DETACH_THRESHOLD ||\n      event.clientY < rect.top - DETACH_THRESHOLD ||\n      event.clientY >= rect.bottom + DETACH_THRESHOLD\n    );\n  }\n\n  /**\n   * Update the relative tab positions and computed target index.\n   */\n  export function layoutTabs(\n    tabs: HTMLCollection,\n    data: IDragData,\n    event: MouseEvent,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive values.\n    let pressPos: number;\n    let localPos: number;\n    let clientPos: number;\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      pressPos = data.pressX;\n      localPos = event.clientX - data.contentRect!.left;\n      clientPos = event.clientX;\n      clientSize = data.contentRect!.width;\n    } else {\n      pressPos = data.pressY;\n      localPos = event.clientY - data.contentRect!.top;\n      clientPos = event.clientY;\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the target data.\n    let targetIndex = data.index;\n    let targetPos = localPos - data.tabPressPos;\n    let targetEnd = targetPos + data.tabSize;\n\n    // Update the relative tab positions.\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let pxPos: string;\n      let layout = data.tabLayout![i];\n      let threshold = layout.pos + (layout.size >> 1);\n      if (i < data.index && targetPos < threshold) {\n        pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n        targetIndex = Math.min(targetIndex, i);\n      } else if (i > data.index && targetEnd > threshold) {\n        pxPos = `${-data.tabSize - layout.margin}px`;\n        targetIndex = Math.max(targetIndex, i);\n      } else if (i === data.index) {\n        let ideal = clientPos - pressPos;\n        let limit = clientSize - (data.tabPos + data.tabSize);\n        pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n      } else {\n        pxPos = '';\n      }\n      if (orientation === 'horizontal') {\n        (tabs[i] as HTMLElement).style.left = pxPos;\n      } else {\n        (tabs[i] as HTMLElement).style.top = pxPos;\n      }\n    }\n\n    // Update the computed target index.\n    data.targetIndex = targetIndex;\n  }\n\n  /**\n   * Position the drag tab at its final resting relative position.\n   */\n  export function finalizeTabPosition(\n    data: IDragData,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive client size.\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      clientSize = data.contentRect!.width;\n    } else {\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the ideal final tab position.\n    let ideal: number;\n    if (data.targetIndex === data.index) {\n      ideal = 0;\n    } else if (data.targetIndex > data.index) {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n    } else {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos - data.tabPos;\n    }\n\n    // Compute the tab position limit.\n    let limit = clientSize - (data.tabPos + data.tabSize);\n    let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n    // Set the final orientation-sensitive position.\n    if (orientation === 'horizontal') {\n      data.tab.style.left = `${final}px`;\n    } else {\n      data.tab.style.top = `${final}px`;\n    }\n  }\n\n  /**\n   * Reset the relative positions of the given tabs.\n   */\n  export function resetTabPositions(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): void {\n    for (const tab of tabs) {\n      if (orientation === 'horizontal') {\n        (tab as HTMLElement).style.left = '';\n      } else {\n        (tab as HTMLElement).style.top = '';\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n  /**\n   * Construct a new dock layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: DockLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n    this._document = options.document || document;\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   */\n  dispose(): void {\n    // Get an iterator over the widgets in the layout.\n    let widgets = this[Symbol.iterator]();\n\n    // Dispose of the layout items.\n    this._items.forEach(item => {\n      item.dispose();\n    });\n\n    // Clear the layout state before disposing the widgets.\n    this._box = null;\n    this._root = null;\n    this._items.clear();\n\n    // Dispose of the widgets contained in the old layout root.\n    for (const widget of widgets) {\n      widget.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the dock layout.\n   */\n  readonly renderer: DockLayout.IRenderer;\n\n  /**\n   * The method for hiding child widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    for (const bar of this.tabBars()) {\n      if (bar.titles.length > 1) {\n        for (const title of bar.titles) {\n          title.owner.hiddenMode = this._hiddenMode;\n        }\n      }\n    }\n  }\n\n  /**\n   * Get the inter-element spacing for the dock layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the dock layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Whether the dock layout is empty.\n   */\n  get isEmpty(): boolean {\n    return this._root === null;\n  }\n\n  /**\n   * Create an iterator over all widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This iterator includes the generated tab bars.\n   */\n  [Symbol.iterator](): IterableIterator<Widget> {\n    return this._root ? this._root.iterAllWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the user widgets in the layout.\n   *\n   * @returns A new iterator over the user widgets in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  widgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterUserWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the layout.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the layout.\n   */\n  selectedWidgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterSelectedWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the layout.\n   *\n   * @returns A new iterator over the tab bars in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  tabBars(): IterableIterator<TabBar<Widget>> {\n    return this._root ? this._root.iterTabBars() : empty();\n  }\n\n  /**\n   * Create an iterator over the handles in the layout.\n   *\n   * @returns A new iterator over the handles in the layout.\n   */\n  handles(): IterableIterator<HTMLDivElement> {\n    return this._root ? this._root.iterHandles() : empty();\n  }\n\n  /**\n   * Move a handle to the given offset position.\n   *\n   * @param handle - The handle to move.\n   *\n   * @param offsetX - The desired offset X position of the handle.\n   *\n   * @param offsetY - The desired offset Y position of the handle.\n   *\n   * #### Notes\n   * If the given handle is not contained in the layout, this is no-op.\n   *\n   * The handle will be moved as close as possible to the desired\n   * position without violating any of the layout constraints.\n   *\n   * Only one of the coordinates is used depending on the orientation\n   * of the handle. This method accepts both coordinates to make it\n   * easy to invoke from a mouse move event without needing to know\n   * the handle orientation.\n   */\n  moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n    // Bail early if there is no root or if the handle is hidden.\n    let hidden = handle.classList.contains('lm-mod-hidden');\n    if (!this._root || hidden) {\n      return;\n    }\n\n    // Lookup the split node for the handle.\n    let data = this._root.findSplitNode(handle);\n    if (!data) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (data.node.orientation === 'horizontal') {\n      delta = offsetX - handle.offsetLeft;\n    } else {\n      delta = offsetY - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent sibling resizing unless needed.\n    data.node.holdSizes();\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Save the current configuration of the dock layout.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockLayout.ILayoutConfig {\n    // Bail early if there is no root.\n    if (!this._root) {\n      return { main: null };\n    }\n\n    // Hold the current sizes in the layout tree.\n    this._root.holdAllSizes();\n\n    // Return the layout config.\n    return { main: this._root.createConfig() };\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   */\n  restoreLayout(config: DockLayout.ILayoutConfig): void {\n    // Create the widget set for validating the config.\n    let widgetSet = new Set<Widget>();\n\n    // Normalize the main area config and collect the widgets.\n    let mainConfig: DockLayout.AreaConfig | null;\n    if (config.main) {\n      mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n    } else {\n      mainConfig = null;\n    }\n\n    // Create iterators over the old content.\n    let oldWidgets = this.widgets();\n    let oldTabBars = this.tabBars();\n    let oldHandles = this.handles();\n\n    // Clear the root before removing the old content.\n    this._root = null;\n\n    // Unparent the old widgets which are not in the new config.\n    for (const widget of oldWidgets) {\n      if (!widgetSet.has(widget)) {\n        widget.parent = null;\n      }\n    }\n\n    // Dispose of the old tab bars.\n    for (const tabBar of oldTabBars) {\n      tabBar.dispose();\n    }\n\n    // Remove the old handles.\n    for (const handle of oldHandles) {\n      if (handle.parentNode) {\n        handle.parentNode.removeChild(handle);\n      }\n    }\n\n    // Reparent the new widgets to the current parent.\n    for (const widget of widgetSet) {\n      widget.parent = this.parent;\n    }\n\n    // Create the root node for the new config.\n    if (mainConfig) {\n      this._root = Private.realizeAreaConfig(\n        mainConfig,\n        {\n          // Ignoring optional `document` argument as we must reuse `this._document`\n          createTabBar: (document?: Document | ShadowRoot) =>\n            this._createTabBar(),\n          createHandle: () => this._createHandle()\n        },\n        this._document\n      );\n    } else {\n      this._root = null;\n    }\n\n    // If there is no parent, there is nothing more to do.\n    if (!this.parent) {\n      return;\n    }\n\n    // Attach the new widgets to the parent.\n    widgetSet.forEach(widget => {\n      this.attachWidget(widget);\n    });\n\n    // Post a fit request to the parent.\n    this.parent.fit();\n  }\n\n  /**\n   * Add a widget to the dock layout.\n   *\n   * @param widget - The widget to add to the dock layout.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * The widget will be moved if it is already contained in the layout.\n   *\n   * An error will be thrown if the reference widget is invalid.\n   */\n  addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n    // Parse the options.\n    let ref = options.ref || null;\n    let mode = options.mode || 'tab-after';\n\n    // Find the tab node which holds the reference widget.\n    let refNode: Private.TabLayoutNode | null = null;\n    if (this._root && ref) {\n      refNode = this._root.findTabNode(ref);\n    }\n\n    // Throw an error if the reference widget is invalid.\n    if (ref && !refNode) {\n      throw new Error('Reference widget is not in the layout.');\n    }\n\n    // Reparent the widget to the current layout parent.\n    widget.parent = this.parent;\n\n    // Insert the widget according to the insert mode.\n    switch (mode) {\n      case 'tab-after':\n        this._insertTab(widget, ref, refNode, true);\n        break;\n      case 'tab-before':\n        this._insertTab(widget, ref, refNode, false);\n        break;\n      case 'split-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false);\n        break;\n      case 'split-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false);\n        break;\n      case 'split-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true);\n        break;\n      case 'split-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true);\n        break;\n      case 'merge-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n        break;\n      case 'merge-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n        break;\n      case 'merge-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n        break;\n      case 'merge-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n        break;\n    }\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Ensure the widget is attached to the parent widget.\n    this.attachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Remove the widget from its current layout location.\n    this._removeWidget(widget);\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Detach the widget from the parent widget.\n    this.detachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Find the tab area which contains the given client position.\n   *\n   * @param clientX - The client X position of interest.\n   *\n   * @param clientY - The client Y position of interest.\n   *\n   * @returns The geometry of the tab area at the given position, or\n   *   `null` if there is no tab area at the given position.\n   */\n  hitTestTabAreas(\n    clientX: number,\n    clientY: number\n  ): DockLayout.ITabAreaGeometry | null {\n    // Bail early if hit testing cannot produce valid results.\n    if (!this._root || !this.parent || !this.parent.isVisible) {\n      return null;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent.node);\n    }\n\n    // Convert from client to local coordinates.\n    let rect = this.parent.node.getBoundingClientRect();\n    let x = clientX - rect.left - this._box.borderLeft;\n    let y = clientY - rect.top - this._box.borderTop;\n\n    // Find the tab layout node at the local position.\n    let tabNode = this._root.hitTestTabNodes(x, y);\n\n    // Bail if a tab layout node was not found.\n    if (!tabNode) {\n      return null;\n    }\n\n    // Extract the data from the tab node.\n    let { tabBar, top, left, width, height } = tabNode;\n\n    // Compute the right and bottom edges of the tab area.\n    let borderWidth = this._box.borderLeft + this._box.borderRight;\n    let borderHeight = this._box.borderTop + this._box.borderBottom;\n    let right = rect.width - borderWidth - (left + width);\n    let bottom = rect.height - borderHeight - (top + height);\n\n    // Return the hit test results.\n    return { tabBar, x, y, top, left, right, bottom, width, height };\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    // Perform superclass initialization.\n    super.init();\n\n    // Attach each widget to the parent.\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n\n    // Attach each handle to the parent.\n    for (const handle of this.handles()) {\n      this.parent!.node.appendChild(handle);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Attach the widget to the layout parent widget.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is already attached.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Do nothing if the widget is already attached.\n    if (this.parent!.node === widget.node.parentNode) {\n      return;\n    }\n\n    // Create the layout item for the widget.\n    this._items.set(widget, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach the widget from the layout parent widget.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not attached.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Do nothing if the widget is not attached.\n    if (this.parent!.node !== widget.node.parentNode) {\n      return;\n    }\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Delete the layout item for the widget.\n    let item = this._items.get(widget);\n    if (item) {\n      this._items.delete(widget);\n      item.dispose();\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Remove the specified widget from the layout structure.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not in the layout tree.\n   *\n   * This does not detach the widget from the parent node.\n   */\n  private _removeWidget(widget: Widget): void {\n    // Bail early if there is no layout root.\n    if (!this._root) {\n      return;\n    }\n\n    // Find the tab node which contains the given widget.\n    let tabNode = this._root.findTabNode(widget);\n\n    // Bail early if the tab node is not found.\n    if (!tabNode) {\n      return;\n    }\n\n    Private.removeAria(widget);\n\n    // If there are multiple tabs, just remove the widget's tab.\n    if (tabNode.tabBar.titles.length > 1) {\n      tabNode.tabBar.removeTab(widget.title);\n      if (\n        this._hiddenMode === Widget.HiddenMode.Scale &&\n        tabNode.tabBar.titles.length == 1\n      ) {\n        const existingWidget = tabNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Display;\n      }\n      return;\n    }\n\n    // Otherwise, the tab node needs to be removed...\n\n    // Dispose the tab bar.\n    tabNode.tabBar.dispose();\n\n    // Handle the case where the tab node is the root.\n    if (this._root === tabNode) {\n      this._root = null;\n      return;\n    }\n\n    // Otherwise, remove the tab node from its parent...\n\n    // Prevent widget resizing unless needed.\n    this._root.holdAllSizes();\n\n    // Clear the parent reference on the tab node.\n    let splitNode = tabNode.parent!;\n    tabNode.parent = null;\n\n    // Remove the tab node from its parent split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n    let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n    ArrayExt.removeAt(splitNode.sizers, i);\n\n    // Remove the handle from its parent DOM node.\n    if (handle.parentNode) {\n      handle.parentNode.removeChild(handle);\n    }\n\n    // If there are multiple children, just update the handles.\n    if (splitNode.children.length > 1) {\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Otherwise, the split node also needs to be removed...\n\n    // Clear the parent reference on the split node.\n    let maybeParent = splitNode.parent;\n    splitNode.parent = null;\n\n    // Lookup the remaining child node and handle.\n    let childNode = splitNode.children[0];\n    let childHandle = splitNode.handles[0];\n\n    // Clear the split node data.\n    splitNode.children.length = 0;\n    splitNode.handles.length = 0;\n    splitNode.sizers.length = 0;\n\n    // Remove the child handle from its parent node.\n    if (childHandle.parentNode) {\n      childHandle.parentNode.removeChild(childHandle);\n    }\n\n    // Handle the case where the split node is the root.\n    if (this._root === splitNode) {\n      childNode.parent = null;\n      this._root = childNode;\n      return;\n    }\n\n    // Otherwise, move the child node to the parent node...\n    let parentNode = maybeParent!;\n\n    // Lookup the index of the split node.\n    let j = parentNode.children.indexOf(splitNode);\n\n    // Handle the case where the child node is a tab node.\n    if (childNode instanceof Private.TabLayoutNode) {\n      childNode.parent = parentNode;\n      parentNode.children[j] = childNode;\n      return;\n    }\n\n    // Remove the split data from the parent.\n    let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n    ArrayExt.removeAt(parentNode.children, j);\n    ArrayExt.removeAt(parentNode.sizers, j);\n\n    // Remove the handle from its parent node.\n    if (splitHandle.parentNode) {\n      splitHandle.parentNode.removeChild(splitHandle);\n    }\n\n    // The child node and the split parent node will have the same\n    // orientation. Merge the grand-children with the parent node.\n    for (let i = 0, n = childNode.children.length; i < n; ++i) {\n      let gChild = childNode.children[i];\n      let gHandle = childNode.handles[i];\n      let gSizer = childNode.sizers[i];\n      ArrayExt.insert(parentNode.children, j + i, gChild);\n      ArrayExt.insert(parentNode.handles, j + i, gHandle);\n      ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n      gChild.parent = parentNode;\n    }\n\n    // Clear the child node.\n    childNode.children.length = 0;\n    childNode.handles.length = 0;\n    childNode.sizers.length = 0;\n    childNode.parent = null;\n\n    // Sync the handles on the parent node.\n    parentNode.syncHandles();\n  }\n\n  /**\n   * Create the tab layout node to hold the widget.\n   */\n  private _createTabNode(widget: Widget): Private.TabLayoutNode {\n    let tabNode = new Private.TabLayoutNode(this._createTabBar());\n    tabNode.tabBar.addTab(widget.title);\n    Private.addAria(widget, tabNode.tabBar);\n    return tabNode;\n  }\n\n  /**\n   * Insert a widget next to an existing tab.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertTab(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    after: boolean\n  ): void {\n    // Do nothing if the tab is inserted next to itself.\n    if (widget === ref) {\n      return;\n    }\n\n    // Create the root if it does not exist.\n    if (!this._root) {\n      let tabNode = new Private.TabLayoutNode(this._createTabBar());\n      tabNode.tabBar.addTab(widget.title);\n      this._root = tabNode;\n      Private.addAria(widget, tabNode.tabBar);\n      return;\n    }\n\n    // Use the first tab node as the ref node if needed.\n    if (!refNode) {\n      refNode = this._root.findFirstTabNode()!;\n    }\n\n    // If the widget is not contained in the ref node, ensure it is\n    // removed from the layout and hidden before being added again.\n    if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n      this._removeWidget(widget);\n      widget.hide();\n    }\n\n    // Lookup the target index for inserting the tab.\n    let index: number;\n    if (ref) {\n      index = refNode.tabBar.titles.indexOf(ref.title);\n    } else {\n      index = refNode.tabBar.currentIndex;\n    }\n\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      if (refNode.tabBar.titles.length === 0) {\n        // Singular tab should use display mode to limit number of layers.\n        widget.hiddenMode = Widget.HiddenMode.Display;\n      } else if (refNode.tabBar.titles.length == 1) {\n        // If we are adding a second tab, switch the existing tab back to scale.\n        const existingWidget = refNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n      } else {\n        // For the third and subsequent tabs no special action is needed.\n        widget.hiddenMode = Widget.HiddenMode.Scale;\n      }\n    } else {\n      // For all other modes just propagate the current mode.\n      widget.hiddenMode = this._hiddenMode;\n    }\n\n    // Insert the widget's tab relative to the target index.\n    refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n    Private.addAria(widget, refNode.tabBar);\n  }\n\n  /**\n   * Insert a widget as a new split area.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertSplit(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    orientation: Private.Orientation,\n    after: boolean,\n    merge: boolean = false\n  ): void {\n    // Do nothing if there is no effective split.\n    if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n      return;\n    }\n\n    // Ensure the widget is removed from the current layout.\n    this._removeWidget(widget);\n\n    // Set the root if it does not exist.\n    if (!this._root) {\n      this._root = this._createTabNode(widget);\n      return;\n    }\n\n    // If the ref node parent is null, split the root.\n    if (!refNode || !refNode.parent) {\n      // Ensure the root is split with the correct orientation.\n      let root = this._splitRoot(orientation);\n\n      // Determine the insert index for the new tab node.\n      let i = after ? root.children.length : 0;\n\n      // Normalize the split node.\n      root.normalizeSizes();\n\n      // Create the sizer for new tab node.\n      let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n      // Insert the tab node sized to the golden ratio.\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(root.children, i, tabNode);\n      ArrayExt.insert(root.sizers, i, sizer);\n      ArrayExt.insert(root.handles, i, this._createHandle());\n      tabNode.parent = root;\n\n      // Re-normalize the split node to maintain the ratios.\n      root.normalizeSizes();\n\n      // Finally, synchronize the visibility of the handles.\n      root.syncHandles();\n      return;\n    }\n\n    // Lookup the split node for the ref widget.\n    let splitNode = refNode.parent;\n\n    // If the split node already had the correct orientation,\n    // the widget can be inserted into the split node directly.\n    if (splitNode.orientation === orientation) {\n      // Find the index of the ref node.\n      let i = splitNode.children.indexOf(refNode);\n\n      // Conditionally reuse a tab layout found in the wanted position.\n      if (merge) {\n        let j = i + (after ? 1 : -1);\n        let sibling = splitNode.children[j];\n        if (sibling instanceof Private.TabLayoutNode) {\n          this._insertTab(widget, null, sibling, true);\n          ++sibling.tabBar.currentIndex;\n          return;\n        }\n      }\n\n      // Normalize the split node.\n      splitNode.normalizeSizes();\n\n      // Consume half the space for the insert location.\n      let s = (splitNode.sizers[i].sizeHint /= 2);\n\n      // Insert the tab node sized to the other half.\n      let j = i + (after ? 1 : 0);\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(splitNode.children, j, tabNode);\n      ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n      ArrayExt.insert(splitNode.handles, j, this._createHandle());\n      tabNode.parent = splitNode;\n\n      // Finally, synchronize the visibility of the handles.\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Remove the ref node from the split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n    // Create a new normalized split node for the children.\n    let childNode = new Private.SplitLayoutNode(orientation);\n    childNode.normalized = true;\n\n    // Add the ref node sized to half the space.\n    childNode.children.push(refNode);\n    childNode.sizers.push(Private.createSizer(0.5));\n    childNode.handles.push(this._createHandle());\n    refNode.parent = childNode;\n\n    // Add the tab node sized to the other half.\n    let j = after ? 1 : 0;\n    let tabNode = this._createTabNode(widget);\n    ArrayExt.insert(childNode.children, j, tabNode);\n    ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n    ArrayExt.insert(childNode.handles, j, this._createHandle());\n    tabNode.parent = childNode;\n\n    // Synchronize the visibility of the handles.\n    childNode.syncHandles();\n\n    // Finally, add the new child node to the original split node.\n    ArrayExt.insert(splitNode.children, i, childNode);\n    childNode.parent = splitNode;\n  }\n\n  /**\n   * Ensure the root is a split node with the given orientation.\n   */\n  private _splitRoot(\n    orientation: Private.Orientation\n  ): Private.SplitLayoutNode {\n    // Bail early if the root already meets the requirements.\n    let oldRoot = this._root;\n    if (oldRoot instanceof Private.SplitLayoutNode) {\n      if (oldRoot.orientation === orientation) {\n        return oldRoot;\n      }\n    }\n\n    // Create a new root node with the specified orientation.\n    let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n    // Add the old root to the new root.\n    if (oldRoot) {\n      newRoot.children.push(oldRoot);\n      newRoot.sizers.push(Private.createSizer(0));\n      newRoot.handles.push(this._createHandle());\n      oldRoot.parent = newRoot;\n    }\n\n    // Return the new root as a convenience.\n    return newRoot;\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the size limits for the layout tree.\n    if (this._root) {\n      let limits = this._root.fit(this._spacing, this._items);\n      minW = limits.minWidth;\n      minH = limits.minHeight;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Bail early if there is no root layout node.\n    if (!this._root) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let x = this._box.paddingTop;\n    let y = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the geometry of the layout tree.\n    this._root.update(x, y, width, height, this._spacing, this._items);\n  }\n\n  /**\n   * Create a new tab bar for use by the dock layout.\n   *\n   * #### Notes\n   * The tab bar will be attached to the parent if it exists.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar using the renderer.\n    let tabBar = this.renderer.createTabBar(this._document);\n\n    // Enforce necessary tab bar behavior.\n    tabBar.orientation = 'horizontal';\n\n    // Attach the tab bar to the parent if possible.\n    if (this.parent) {\n      this.attachWidget(tabBar);\n    }\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for the dock layout.\n   *\n   * #### Notes\n   * The handle will be attached to the parent if it exists.\n   */\n  private _createHandle(): HTMLDivElement {\n    // Create the handle using the renderer.\n    let handle = this.renderer.createHandle();\n\n    // Initialize the handle layout behavior.\n    let style = handle.style;\n    style.position = 'absolute';\n    style.contain = 'strict';\n    style.top = '0';\n    style.left = '0';\n    style.width = '0';\n    style.height = '0';\n\n    // Attach the handle to the parent if it exists.\n    if (this.parent) {\n      this.parent.node.appendChild(handle);\n    }\n\n    // Return the initialized handle.\n    return handle;\n  }\n\n  private _spacing = 4;\n  private _dirty = false;\n  private _root: Private.LayoutNode | null = null;\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _document: Document | ShadowRoot;\n  private _hiddenMode: Widget.HiddenMode;\n  private _items: Private.ItemMap = new Map<Widget, LayoutItem>();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n  /**\n   * An options object for creating a dock layout.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * The renderer to use for the dock layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a dock layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new tab bar for use with a dock layout.\n     *\n     * @returns A new tab bar for a dock layout.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget>;\n\n    /**\n     * Create a new handle node for use with a dock layout.\n     *\n     * @returns A new handle node for a dock layout.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * A type alias for the supported insertion modes.\n   *\n   * An insert mode is used to specify how a widget should be added\n   * to the dock layout relative to a reference widget.\n   */\n  export type InsertMode =\n    | /**\n     * The area to the top of the reference widget.\n     *\n     * The widget will be inserted just above the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the top edge of the dock layout.\n     */\n    'split-top'\n\n    /**\n     * The area to the left of the reference widget.\n     *\n     * The widget will be inserted just left of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the left edge of the dock layout.\n     */\n    | 'split-left'\n\n    /**\n     * The area to the right of the reference widget.\n     *\n     * The widget will be inserted just right of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted  at the right edge of the dock layout.\n     */\n    | 'split-right'\n\n    /**\n     * The area to the bottom of the reference widget.\n     *\n     * The widget will be inserted just below the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the bottom edge of the dock layout.\n     */\n    | 'split-bottom'\n\n    /**\n     * Like `split-top` but if a tab layout exists above the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-top'\n\n    /**\n     * Like `split-left` but if a tab layout exists left of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-left'\n\n    /**\n     * Like `split-right` but if a tab layout exists right of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-right'\n\n    /**\n     * Like `split-bottom` but if a tab layout exists below the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-bottom'\n\n    /**\n     * The tab position before the reference widget.\n     *\n     * The widget will be added as a tab before the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-before'\n\n    /**\n     * The tab position after the reference widget.\n     *\n     * The widget will be added as a tab after the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-after';\n\n  /**\n   * An options object for adding a widget to the dock layout.\n   */\n  export interface IAddOptions {\n    /**\n     * The insertion mode for adding the widget.\n     *\n     * The default is `'tab-after'`.\n     */\n    mode?: InsertMode;\n\n    /**\n     * The reference widget for the insert location.\n     *\n     * The default is `null`.\n     */\n    ref?: Widget | null;\n  }\n\n  /**\n   * A layout config object for a tab area.\n   */\n  export interface ITabAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'tab-area';\n\n    /**\n     * The widgets contained in the tab area.\n     */\n    widgets: Widget[];\n\n    /**\n     * The index of the selected tab.\n     */\n    currentIndex: number;\n  }\n\n  /**\n   * A layout config object for a split area.\n   */\n  export interface ISplitAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'split-area';\n\n    /**\n     * The orientation of the split area.\n     */\n    orientation: 'horizontal' | 'vertical';\n\n    /**\n     * The children in the split area.\n     */\n    children: AreaConfig[];\n\n    /**\n     * The relative sizes of the children.\n     */\n    sizes: number[];\n  }\n\n  /**\n   * A type alias for a general area config.\n   */\n  export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n  /**\n   * A dock layout configuration object.\n   */\n  export interface ILayoutConfig {\n    /**\n     * The layout config for the main dock area.\n     */\n    main: AreaConfig | null;\n  }\n\n  /**\n   * An object which represents the geometry of a tab area.\n   */\n  export interface ITabAreaGeometry {\n    /**\n     * The tab bar for the tab area.\n     */\n    tabBar: TabBar<Widget>;\n\n    /**\n     * The local X position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the local X coordinate of the hit test query.\n     */\n    x: number;\n\n    /**\n     * The local Y position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the local Y coordinate of the hit test query.\n     */\n    y: number;\n\n    /**\n     * The local coordinate of the top edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the top edge of the tab area.\n     */\n    top: number;\n\n    /**\n     * The local coordinate of the left edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the left edge of the tab area.\n     */\n    left: number;\n\n    /**\n     * The local coordinate of the right edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the right edge of the layout parent\n     * widget, to the right edge of the tab area.\n     */\n    right: number;\n\n    /**\n     * The local coordinate of the bottom edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the bottom edge of the layout parent\n     * widget, to the bottom edge of the tab area.\n     */\n    bottom: number;\n\n    /**\n     * The width of the tab area.\n     *\n     * #### Notes\n     * This is total width allocated for the tab area.\n     */\n    width: number;\n\n    /**\n     * The height of the tab area.\n     *\n     * #### Notes\n     * This is total height allocated for the tab area.\n     */\n    height: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * A type alias for a dock layout node.\n   */\n  export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n  /**\n   * A type alias for the orientation of a split layout node.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a layout item map.\n   */\n  export type ItemMap = Map<Widget, LayoutItem>;\n\n  /**\n   * Create a box sizer with an initial size hint.\n   */\n  export function createSizer(hint: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = hint;\n    sizer.size = hint;\n    return sizer;\n  }\n\n  /**\n   * Normalize an area config object and collect the visited widgets.\n   */\n  export function normalizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    let result: DockLayout.AreaConfig | null;\n    if (config.type === 'tab-area') {\n      result = normalizeTabAreaConfig(config, widgetSet);\n    } else {\n      result = normalizeSplitAreaConfig(config, widgetSet);\n    }\n    return result;\n  }\n\n  /**\n   * Convert a normalized area config into a layout tree.\n   */\n  export function realizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): LayoutNode {\n    let node: LayoutNode;\n    if (config.type === 'tab-area') {\n      node = realizeTabAreaConfig(config, renderer, document);\n    } else {\n      node = realizeSplitAreaConfig(config, renderer, document);\n    }\n    return node;\n  }\n\n  /**\n   * A layout node which holds the data for a tabbed area.\n   */\n  export class TabLayoutNode {\n    /**\n     * Construct a new tab layout node.\n     *\n     * @param tabBar - The tab bar to use for the layout node.\n     */\n    constructor(tabBar: TabBar<Widget>) {\n      let tabSizer = new BoxSizer();\n      let widgetSizer = new BoxSizer();\n      tabSizer.stretch = 0;\n      widgetSizer.stretch = 1;\n      this.tabBar = tabBar;\n      this.sizers = [tabSizer, widgetSizer];\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * The tab bar for the layout node.\n     */\n    readonly tabBar: TabBar<Widget>;\n\n    /**\n     * The sizers for the layout node.\n     */\n    readonly sizers: [BoxSizer, BoxSizer];\n\n    /**\n     * The most recent value for the `top` edge of the layout box.\n     */\n    get top(): number {\n      return this._top;\n    }\n\n    /**\n     * The most recent value for the `left` edge of the layout box.\n     */\n    get left(): number {\n      return this._left;\n    }\n\n    /**\n     * The most recent value for the `width` of the layout box.\n     */\n    get width(): number {\n      return this._width;\n    }\n\n    /**\n     * The most recent value for the `height` of the layout box.\n     */\n    get height(): number {\n      return this._height;\n    }\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      yield this.tabBar;\n      yield* this.iterUserWidgets();\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const title of this.tabBar.titles) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      let title = this.tabBar.currentTitle;\n      if (title) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      yield this.tabBar;\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    // eslint-disable-next-line require-yield\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      return;\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      return this;\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      if (x < this._left || x >= this._left + this._width) {\n        return null;\n      }\n      if (y < this._top || y >= this._top + this._height) {\n        return null;\n      }\n      return this;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ITabAreaConfig {\n      let widgets = this.tabBar.titles.map(title => title.owner);\n      let currentIndex = this.tabBar.currentIndex;\n      return { type: 'tab-area', widgets, currentIndex };\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      return;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Set up the limit variables.\n      let minWidth = 0;\n      let minHeight = 0;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Lookup the tab bar and widget sizers.\n      let [tabBarSizer, widgetSizer] = this.sizers;\n\n      // Update the tab bar limits.\n      if (tabBarItem) {\n        tabBarItem.fit();\n      }\n\n      // Update the widget limits.\n      if (widgetItem) {\n        widgetItem.fit();\n      }\n\n      // Update the results and sizer for the tab bar.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        minWidth = Math.max(minWidth, tabBarItem.minWidth);\n        minHeight += tabBarItem.minHeight;\n        tabBarSizer.minSize = tabBarItem.minHeight;\n        tabBarSizer.maxSize = tabBarItem.maxHeight;\n      } else {\n        tabBarSizer.minSize = 0;\n        tabBarSizer.maxSize = 0;\n      }\n\n      // Update the results and sizer for the current widget.\n      if (widgetItem && !widgetItem.isHidden) {\n        minWidth = Math.max(minWidth, widgetItem.minWidth);\n        minHeight += widgetItem.minHeight;\n        widgetSizer.minSize = widgetItem.minHeight;\n        widgetSizer.maxSize = Infinity;\n      } else {\n        widgetSizer.minSize = 0;\n        widgetSizer.maxSize = Infinity;\n      }\n\n      // Return the computed size limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Update the layout box values.\n      this._top = top;\n      this._left = left;\n      this._width = width;\n      this._height = height;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, height);\n\n      // Update the tab bar item using the computed size.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        let size = this.sizers[0].size;\n        tabBarItem.update(left, top, width, size);\n        top += size;\n      }\n\n      // Layout the widget using the computed size.\n      if (widgetItem && !widgetItem.isHidden) {\n        let size = this.sizers[1].size;\n        widgetItem.update(left, top, width, size);\n      }\n    }\n\n    private _top = 0;\n    private _left = 0;\n    private _width = 0;\n    private _height = 0;\n  }\n\n  /**\n   * A layout node which holds the data for a split area.\n   */\n  export class SplitLayoutNode {\n    /**\n     * Construct a new split layout node.\n     *\n     * @param orientation - The orientation of the node.\n     */\n    constructor(orientation: Orientation) {\n      this.orientation = orientation;\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * Whether the sizers have been normalized.\n     */\n    normalized = false;\n\n    /**\n     * The orientation of the node.\n     */\n    readonly orientation: Orientation;\n\n    /**\n     * The child nodes for the split node.\n     */\n    readonly children: LayoutNode[] = [];\n\n    /**\n     * The box sizers for the layout children.\n     */\n    readonly sizers: BoxSizer[] = [];\n\n    /**\n     * The handles for the layout children.\n     */\n    readonly handles: HTMLDivElement[] = [];\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterAllWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterUserWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterSelectedWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      for (const child of this.children) {\n        yield* child.iterTabBars();\n      }\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      yield* this.handles;\n      for (const child of this.children) {\n        yield* child.iterHandles();\n      }\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findTabNode(widget);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      let index = this.handles.indexOf(handle);\n      if (index !== -1) {\n        return { index, node: this };\n      }\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findSplitNode(handle);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      if (this.children.length === 0) {\n        return null;\n      }\n      return this.children[0].findFirstTabNode();\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].hitTestTabNodes(x, y);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ISplitAreaConfig {\n      let orientation = this.orientation;\n      let sizes = this.createNormalizedSizes();\n      let children = this.children.map(child => child.createConfig());\n      return { type: 'split-area', orientation, children, sizes };\n    }\n\n    /**\n     * Sync the visibility and orientation of the handles.\n     */\n    syncHandles(): void {\n      this.handles.forEach((handle, i) => {\n        handle.setAttribute('data-orientation', this.orientation);\n        if (i === this.handles.length - 1) {\n          handle.classList.add('lm-mod-hidden');\n        } else {\n          handle.classList.remove('lm-mod-hidden');\n        }\n      });\n    }\n\n    /**\n     * Hold the current sizes of the box sizers.\n     *\n     * This sets the size hint of each sizer to its current size.\n     */\n    holdSizes(): void {\n      for (const sizer of this.sizers) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      for (const child of this.children) {\n        child.holdAllSizes();\n      }\n      this.holdSizes();\n    }\n\n    /**\n     * Normalize the sizes of the split layout node.\n     */\n    normalizeSizes(): void {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return;\n      }\n\n      // Hold the current sizes of the sizers.\n      this.holdSizes();\n\n      // Compute the sum of the sizes.\n      let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint = 1 / n;\n        }\n      } else {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint /= sum;\n        }\n      }\n\n      // Mark the sizes as normalized.\n      this.normalized = true;\n    }\n\n    /**\n     * Snap the normalized sizes of the split layout node.\n     */\n    createNormalizedSizes(): number[] {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return [];\n      }\n\n      // Grab the current sizes of the sizers.\n      let sizes = this.sizers.map(sizer => sizer.size);\n\n      // Compute the sum of the sizes.\n      let sum = sizes.reduce((v, size) => v + size, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] = 1 / n;\n        }\n      } else {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] /= sum;\n        }\n      }\n\n      // Return the normalized sizes.\n      return sizes;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Compute the required fixed space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n      // Set up the limit variables.\n      let minWidth = horizontal ? fixed : 0;\n      let minHeight = horizontal ? 0 : fixed;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Fit the children and update the limits.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let limits = this.children[i].fit(spacing, items);\n        if (horizontal) {\n          minHeight = Math.max(minHeight, limits.minHeight);\n          minWidth += limits.minWidth;\n          this.sizers[i].minSize = limits.minWidth;\n        } else {\n          minWidth = Math.max(minWidth, limits.minWidth);\n          minHeight += limits.minHeight;\n          this.sizers[i].minSize = limits.minHeight;\n        }\n      }\n\n      // Return the computed limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Compute the available layout space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n      let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n      // De-normalize the sizes if needed.\n      if (this.normalized) {\n        for (const sizer of this.sizers) {\n          sizer.sizeHint *= space;\n        }\n        this.normalized = false;\n      }\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, space);\n\n      // Update the geometry of the child nodes and handles.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let child = this.children[i];\n        let size = this.sizers[i].size;\n        let handleStyle = this.handles[i].style;\n        if (horizontal) {\n          child.update(left, top, size, height, spacing, items);\n          left += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${spacing}px`;\n          handleStyle.height = `${height}px`;\n          left += spacing;\n        } else {\n          child.update(left, top, width, size, spacing, items);\n          top += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${width}px`;\n          handleStyle.height = `${spacing}px`;\n          top += spacing;\n        }\n      }\n    }\n  }\n\n  export function addAria(widget: Widget, tabBar: TabBar<Widget>): void {\n    widget.node.setAttribute('role', 'tabpanel');\n    let renderer = tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  export function removeAria(widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n  }\n\n  /**\n   * Normalize a tab area config and collect the visited widgets.\n   */\n  function normalizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.ITabAreaConfig | null {\n    // Bail early if there is no content.\n    if (config.widgets.length === 0) {\n      return null;\n    }\n\n    // Setup the filtered widgets array.\n    let widgets: Widget[] = [];\n\n    // Filter the config for unique widgets.\n    for (const widget of config.widgets) {\n      if (!widgetSet.has(widget)) {\n        widgetSet.add(widget);\n        widgets.push(widget);\n      }\n    }\n\n    // Bail if there are no effective widgets.\n    if (widgets.length === 0) {\n      return null;\n    }\n\n    // Normalize the current index.\n    let index = config.currentIndex;\n    if (index !== -1 && (index < 0 || index >= widgets.length)) {\n      index = 0;\n    }\n\n    // Return a normalized config object.\n    return { type: 'tab-area', widgets, currentIndex: index };\n  }\n\n  /**\n   * Normalize a split area config and collect the visited widgets.\n   */\n  function normalizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    // Set up the result variables.\n    let orientation = config.orientation;\n    let children: DockLayout.AreaConfig[] = [];\n    let sizes: number[] = [];\n\n    // Normalize the config children.\n    for (let i = 0, n = config.children.length; i < n; ++i) {\n      // Normalize the child config.\n      let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n      // Ignore an empty child.\n      if (!child) {\n        continue;\n      }\n\n      // Add the child or hoist its content as appropriate.\n      if (child.type === 'tab-area' || child.orientation !== orientation) {\n        children.push(child);\n        sizes.push(Math.abs(config.sizes[i] || 0));\n      } else {\n        children.push(...child.children);\n        sizes.push(...child.sizes);\n      }\n    }\n\n    // Bail if there are no effective children.\n    if (children.length === 0) {\n      return null;\n    }\n\n    // If there is only one effective child, return that child.\n    if (children.length === 1) {\n      return children[0];\n    }\n\n    // Return a normalized config object.\n    return { type: 'split-area', orientation, children, sizes };\n  }\n\n  /**\n   * Convert a normalized tab area config into a layout tree.\n   */\n  function realizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): TabLayoutNode {\n    // Create the tab bar for the layout node.\n    let tabBar = renderer.createTabBar(document);\n\n    // Hide each widget and add it to the tab bar.\n    for (const widget of config.widgets) {\n      widget.hide();\n      tabBar.addTab(widget.title);\n      Private.addAria(widget, tabBar);\n    }\n\n    // Set the current index of the tab bar.\n    tabBar.currentIndex = config.currentIndex;\n\n    // Return the new tab layout node.\n    return new TabLayoutNode(tabBar);\n  }\n\n  /**\n   * Convert a normalized split area config into a layout tree.\n   */\n  function realizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): SplitLayoutNode {\n    // Create the split layout node.\n    let node = new SplitLayoutNode(config.orientation);\n\n    // Add each child to the layout node.\n    config.children.forEach((child, i) => {\n      // Create the child data for the layout node.\n      let childNode = realizeAreaConfig(child, renderer, document);\n      let sizer = createSizer(config.sizes[i]);\n      let handle = renderer.createHandle();\n\n      // Add the child data to the layout node.\n      node.children.push(childNode);\n      node.handles.push(handle);\n      node.sizers.push(sizer);\n\n      // Update the parent for the child node.\n      childNode.parent = node;\n    });\n\n    // Synchronize the handle state for the layout node.\n    node.syncHandles();\n\n    // Normalize the sizes for the layout node.\n    node.normalizeSizes();\n\n    // Return the new layout node.\n    return node;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n  /**\n   * Construct a new dock panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: DockPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-DockPanel');\n    this._document = options.document || document;\n    this._mode = options.mode || 'multiple-document';\n    this._renderer = options.renderer || DockPanel.defaultRenderer;\n    this._edges = options.edges || Private.DEFAULT_EDGES;\n    if (options.tabsMovable !== undefined) {\n      this._tabsMovable = options.tabsMovable;\n    }\n    if (options.tabsConstrained !== undefined) {\n      this._tabsConstrained = options.tabsConstrained;\n    }\n    if (options.addButtonEnabled !== undefined) {\n      this._addButtonEnabled = options.addButtonEnabled;\n    }\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = this._mode;\n\n    // Create the delegate renderer for the layout.\n    let renderer: DockPanel.IRenderer = {\n      createTabBar: () => this._createTabBar(),\n      createHandle: () => this._createHandle()\n    };\n\n    // Set up the dock layout for the panel.\n    this.layout = new DockLayout({\n      document: this._document,\n      renderer,\n      spacing: options.spacing,\n      hiddenMode: options.hiddenMode\n    });\n\n    // Set up the overlay drop indicator.\n    this.overlay = options.overlay || new DockPanel.Overlay();\n    this.node.appendChild(this.overlay.node);\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    // Ensure the mouse is released.\n    this._releaseMouse();\n\n    // Hide the overlay.\n    this.overlay.hide(0);\n\n    // Cancel a drag if one is in progress.\n    if (this._drag) {\n      this._drag.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The method for hiding widgets.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as DockLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as DockLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when the layout configuration is modified.\n   *\n   * #### Notes\n   * This signal is emitted whenever the current layout configuration\n   * may have changed.\n   *\n   * This signal is emitted asynchronously in a collapsed fashion, so\n   * that multiple synchronous modifications results in only a single\n   * emit of the signal.\n   */\n  get layoutModified(): ISignal<this, void> {\n    return this._layoutModified;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The overlay used by the dock panel.\n   */\n  readonly overlay: DockPanel.IOverlay;\n\n  /**\n   * The renderer used by the dock panel.\n   */\n  get renderer(): DockPanel.IRenderer {\n    return (this.layout as DockLayout).renderer;\n  }\n\n  /**\n   * Get the spacing between the widgets.\n   */\n  get spacing(): number {\n    return (this.layout as DockLayout).spacing;\n  }\n\n  /**\n   * Set the spacing between the widgets.\n   */\n  set spacing(value: number) {\n    (this.layout as DockLayout).spacing = value;\n  }\n\n  /**\n   * Get the mode for the dock panel.\n   */\n  get mode(): DockPanel.Mode {\n    return this._mode;\n  }\n\n  /**\n   * Set the mode for the dock panel.\n   *\n   * #### Notes\n   * Changing the mode is a destructive operation with respect to the\n   * panel's layout configuration. If layout state must be preserved,\n   * save the current layout config before changing the mode.\n   */\n  set mode(value: DockPanel.Mode) {\n    // Bail early if the mode does not change.\n    if (this._mode === value) {\n      return;\n    }\n\n    // Update the internal mode.\n    this._mode = value;\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = value;\n\n    // Get the layout for the panel.\n    let layout = this.layout as DockLayout;\n\n    // Configure the layout for the specified mode.\n    switch (value) {\n      case 'multiple-document':\n        for (const tabBar of layout.tabBars()) {\n          tabBar.show();\n        }\n        break;\n      case 'single-document':\n        layout.restoreLayout(Private.createSingleDocumentConfig(this));\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Whether the tabs can be dragged / moved at runtime.\n   */\n  get tabsMovable(): boolean {\n    return this._tabsMovable;\n  }\n\n  /**\n   * Enable / Disable draggable / movable tabs.\n   */\n  set tabsMovable(value: boolean) {\n    this._tabsMovable = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.tabsMovable = value;\n    }\n  }\n\n  /**\n   * Whether the tabs are constrained to their source dock panel\n   */\n  get tabsConstrained(): boolean {\n    return this._tabsConstrained;\n  }\n\n  /**\n   * Constrain/Allow tabs to be dragged outside of this dock panel\n   */\n  set tabsConstrained(value: boolean) {\n    this._tabsConstrained = value;\n  }\n\n  /**\n   * Whether the add buttons for each tab bar are enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add buttons for each tab bar are enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    this._addButtonEnabled = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.addButtonEnabled = value;\n    }\n  }\n\n  /**\n   * Whether the dock panel is empty.\n   */\n  get isEmpty(): boolean {\n    return (this.layout as DockLayout).isEmpty;\n  }\n\n  /**\n   * Create an iterator over the user widgets in the panel.\n   *\n   * @returns A new iterator over the user widgets in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  *widgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).widgets();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the panel.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the panel.\n   */\n  *selectedWidgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).selectedWidgets();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the panel.\n   *\n   * @returns A new iterator over the tab bars in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  *tabBars(): IterableIterator<TabBar<Widget>> {\n    yield* (this.layout as DockLayout).tabBars();\n  }\n\n  /**\n   * Create an iterator over the handles in the panel.\n   *\n   * @returns A new iterator over the handles in the panel.\n   */\n  *handles(): IterableIterator<HTMLDivElement> {\n    yield* (this.layout as DockLayout).handles();\n  }\n\n  /**\n   * Select a specific widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will make the widget the current widget in its tab area.\n   */\n  selectWidget(widget: Widget): void {\n    // Find the tab bar which contains the widget.\n    let tabBar = find(this.tabBars(), bar => {\n      return bar.titles.indexOf(widget.title) !== -1;\n    });\n\n    // Throw an error if no tab bar is found.\n    if (!tabBar) {\n      throw new Error('Widget is not contained in the dock panel.');\n    }\n\n    // Ensure the widget is the current widget.\n    tabBar.currentTitle = widget.title;\n  }\n\n  /**\n   * Activate a specified widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will select and activate the given widget.\n   */\n  activateWidget(widget: Widget): void {\n    this.selectWidget(widget);\n    widget.activate();\n  }\n\n  /**\n   * Save the current layout configuration of the dock panel.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockPanel.ILayoutConfig {\n    return (this.layout as DockLayout).saveLayout();\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   *\n   * The dock panel automatically reverts to `'multiple-document'`\n   * mode when a layout config is restored.\n   */\n  restoreLayout(config: DockPanel.ILayoutConfig): void {\n    // Reset the mode.\n    this._mode = 'multiple-document';\n\n    // Restore the layout.\n    (this.layout as DockLayout).restoreLayout(config);\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Add a widget to the dock panel.\n   *\n   * @param widget - The widget to add to the dock panel.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * If the panel is in single document mode, the options are ignored\n   * and the widget is always added as tab in the hidden tab bar.\n   */\n  addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n    // Add the widget to the layout.\n    if (this._mode === 'single-document') {\n      (this.layout as DockLayout).addWidget(widget);\n    } else {\n      (this.layout as DockLayout).addWidget(widget, options);\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   */\n  processMessage(msg: Message): void {\n    if (msg.type === 'layout-modified') {\n      this._layoutModified.emit(undefined);\n    } else {\n      super.processMessage(msg);\n    }\n  }\n\n  /**\n   * Handle the DOM events for the dock panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'lm-dragenter':\n        this._evtDragEnter(event as Drag.Event);\n        break;\n      case 'lm-dragleave':\n        this._evtDragLeave(event as Drag.Event);\n        break;\n      case 'lm-dragover':\n        this._evtDragOver(event as Drag.Event);\n        break;\n      case 'lm-drop':\n        this._evtDrop(event as Drag.Event);\n        break;\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('lm-dragenter', this);\n    this.node.addEventListener('lm-dragleave', this);\n    this.node.addEventListener('lm-dragover', this);\n    this.node.addEventListener('lm-drop', this);\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('lm-dragenter', this);\n    this.node.removeEventListener('lm-dragleave', this);\n    this.node.removeEventListener('lm-dragover', this);\n    this.node.removeEventListener('lm-drop', this);\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Add the widget class to the child.\n    msg.child.addClass('lm-DockPanel-widget');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Remove the widget class from the child.\n    msg.child.removeClass('lm-DockPanel-widget');\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `'lm-dragenter'` event for the dock panel.\n   */\n  private _evtDragEnter(event: Drag.Event): void {\n    // If the factory mime type is present, mark the event as\n    // handled in order to get the rest of the drag events.\n    if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n  }\n\n  /**\n   * Handle the `'lm-dragleave'` event for the dock panel.\n   */\n  private _evtDragLeave(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    if (this._tabsConstrained && event.source !== this) return;\n\n    event.stopPropagation();\n\n    // The new target might be a descendant, so we might still handle the drop.\n    // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n    // hide is cancelled by the lm-dragover handler's show overlay logic.\n    this.overlay.hide(1);\n  }\n\n  /**\n   * Handle the `'lm-dragover'` event for the dock panel.\n   */\n  private _evtDragOver(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Show the drop indicator overlay and update the drop\n    // action based on the drop target zone under the mouse.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      this._showOverlay(event.clientX, event.clientY) === 'invalid'\n    ) {\n      event.dropAction = 'none';\n    } else {\n      event.stopPropagation();\n      event.dropAction = event.proposedAction;\n    }\n  }\n\n  /**\n   * Handle the `'lm-drop'` event for the dock panel.\n   */\n  private _evtDrop(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Hide the drop indicator overlay.\n    this.overlay.hide(0);\n\n    // Bail if the proposed action is to do nothing.\n    if (event.proposedAction === 'none') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the drop target under the mouse.\n    let { clientX, clientY } = event;\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // Bail if the drop zone is invalid.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      zone === 'invalid'\n    ) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory mime type has invalid data.\n    let mimeData = event.mimeData;\n    let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n    if (typeof factory !== 'function') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory does not produce a widget.\n    let widget = factory();\n    if (!(widget instanceof Widget)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the widget is an ancestor of the dock panel.\n    if (widget.contains(this)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the reference widget for the drop target.\n    let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n    // Add the widget according to the indicated drop zone.\n    switch (zone) {\n      case 'root-all':\n        this.addWidget(widget);\n        break;\n      case 'root-top':\n        this.addWidget(widget, { mode: 'split-top' });\n        break;\n      case 'root-left':\n        this.addWidget(widget, { mode: 'split-left' });\n        break;\n      case 'root-right':\n        this.addWidget(widget, { mode: 'split-right' });\n        break;\n      case 'root-bottom':\n        this.addWidget(widget, { mode: 'split-bottom' });\n        break;\n      case 'widget-all':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      case 'widget-top':\n        this.addWidget(widget, { mode: 'split-top', ref });\n        break;\n      case 'widget-left':\n        this.addWidget(widget, { mode: 'split-left', ref });\n        break;\n      case 'widget-right':\n        this.addWidget(widget, { mode: 'split-right', ref });\n        break;\n      case 'widget-bottom':\n        this.addWidget(widget, { mode: 'split-bottom', ref });\n        break;\n      case 'widget-tab':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Accept the proposed drop action.\n    event.dropAction = event.proposedAction;\n\n    // Stop propagation if we have not bailed so far.\n    event.stopPropagation();\n\n    // Activate the dropped widget.\n    this.activateWidget(widget);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the dock panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      // Finalize the mouse release.\n      this._releaseMouse();\n\n      // Schedule an emit of the layout modified signal.\n      MessageLoop.postMessage(this, Private.LayoutModified);\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the dock panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the mouse target, if any.\n    let layout = this.layout as DockLayout;\n    let target = event.target as HTMLElement;\n    let handle = find(layout.handles(), handle => handle.contains(target));\n    if (!handle) {\n      return;\n    }\n\n    // Stop the event when a handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    this._document.addEventListener('keydown', this, true);\n    this._document.addEventListener('pointerup', this, true);\n    this._document.addEventListener('pointermove', this, true);\n    this._document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset deltas for the handle press.\n    let rect = handle.getBoundingClientRect();\n    let deltaX = event.clientX - rect.left;\n    let deltaY = event.clientY - rect.top;\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!, this._document);\n    this._pressData = { handle, deltaX, deltaY, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the dock panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event when dragging a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let rect = this.node.getBoundingClientRect();\n    let xPos = event.clientX - rect.left - this._pressData.deltaX;\n    let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n    // Set the handle as close to the desired position as possible.\n    let layout = this.layout as DockLayout;\n    layout.moveHandle(this._pressData.handle, xPos, yPos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the dock panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Release the mouse grab for the dock panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra document listeners.\n    this._document.removeEventListener('keydown', this, true);\n    this._document.removeEventListener('pointerup', this, true);\n    this._document.removeEventListener('pointermove', this, true);\n    this._document.removeEventListener('contextmenu', this, true);\n  }\n\n  /**\n   * Show the overlay indicator at the given client position.\n   *\n   * Returns the drop zone at the specified client position.\n   *\n   * #### Notes\n   * If the position is not over a valid zone, the overlay is hidden.\n   */\n  private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n    // Find the dock target for the given client position.\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // If the drop zone is invalid, hide the overlay and bail.\n    if (zone === 'invalid') {\n      this.overlay.hide(100);\n      return zone;\n    }\n\n    // Setup the variables needed to compute the overlay geometry.\n    let top: number;\n    let left: number;\n    let right: number;\n    let bottom: number;\n    let box = ElementExt.boxSizing(this.node); // TODO cache this?\n    let rect = this.node.getBoundingClientRect();\n\n    // Compute the overlay geometry based on the dock zone.\n    switch (zone) {\n      case 'root-all':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-top':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = rect.height * Private.GOLDEN_RATIO;\n        break;\n      case 'root-left':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = rect.width * Private.GOLDEN_RATIO;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-right':\n        top = box.paddingTop;\n        left = rect.width * Private.GOLDEN_RATIO;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-bottom':\n        top = rect.height * Private.GOLDEN_RATIO;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'widget-all':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-top':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height / 2;\n        break;\n      case 'widget-left':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right + target!.width / 2;\n        bottom = target!.bottom;\n        break;\n      case 'widget-right':\n        top = target!.top;\n        left = target!.left + target!.width / 2;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-bottom':\n        top = target!.top + target!.height / 2;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-tab': {\n        const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height - tabHeight;\n        break;\n      }\n      default:\n        throw 'unreachable';\n    }\n\n    // Show the overlay with the computed geometry.\n    this.overlay.show({ top, left, right, bottom });\n\n    // Finally, return the computed drop zone.\n    return zone;\n  }\n\n  /**\n   * Create a new tab bar for use by the panel.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar.\n    let tabBar = this._renderer.createTabBar(this._document);\n\n    // Set the generated tab bar property for the tab bar.\n    Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n    // Hide the tab bar when in single document mode.\n    if (this._mode === 'single-document') {\n      tabBar.hide();\n    }\n\n    // Enforce necessary tab bar behavior.\n    // TODO do we really want to enforce *all* of these?\n    tabBar.tabsMovable = this._tabsMovable;\n    tabBar.allowDeselect = false;\n    tabBar.addButtonEnabled = this._addButtonEnabled;\n    tabBar.removeBehavior = 'select-previous-tab';\n    tabBar.insertBehavior = 'select-tab-if-needed';\n\n    // Connect the signal handlers for the tab bar.\n    tabBar.tabMoved.connect(this._onTabMoved, this);\n    tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n    tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n    tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for use by the panel.\n   */\n  private _createHandle(): HTMLDivElement {\n    return this._renderer.createHandle();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from a tab bar.\n   */\n  private _onTabMoved(): void {\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `currentChanged` signal from a tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousTitle, currentTitle } = args;\n\n    // Hide the previous widget.\n    if (previousTitle) {\n      previousTitle.owner.hide();\n    }\n\n    // Show the current widget.\n    if (currentTitle) {\n      currentTitle.owner.show();\n    }\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `addRequested` signal from a tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from a tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from a tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabDetachRequested` signal from a tab bar.\n   */\n  private _onTabDetachRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabDetachRequestedArgs<Widget>\n  ): void {\n    // Do nothing if a drag is already in progress.\n    if (this._drag) {\n      return;\n    }\n\n    // Release the tab bar's hold on the mouse.\n    sender.releaseMouse();\n\n    // Extract the data from the args.\n    let { title, tab, clientX, clientY, offset } = args;\n\n    // Setup the mime data for the drag operation.\n    let mimeData = new MimeData();\n    let factory = () => title.owner;\n    mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n    // Create the drag image for the drag operation.\n    let dragImage = tab.cloneNode(true) as HTMLElement;\n    if (offset) {\n      dragImage.style.top = `-${offset.y}px`;\n      dragImage.style.left = `-${offset.x}px`;\n    }\n\n    // Create the drag object to manage the drag-drop operation.\n    this._drag = new Drag({\n      document: this._document,\n      mimeData,\n      dragImage,\n      proposedAction: 'move',\n      supportedActions: 'move',\n      source: this\n    });\n\n    // Hide the tab node in the original tab.\n    tab.classList.add('lm-mod-hidden');\n    let cleanup = () => {\n      this._drag = null;\n      tab.classList.remove('lm-mod-hidden');\n    };\n\n    // Start the drag operation and cleanup when done.\n    this._drag.start(clientX, clientY).then(cleanup);\n  }\n\n  private _edges: DockPanel.IEdges;\n  private _document: Document | ShadowRoot;\n  private _mode: DockPanel.Mode;\n  private _drag: Drag | null = null;\n  private _renderer: DockPanel.IRenderer;\n  private _tabsMovable: boolean = true;\n  private _tabsConstrained: boolean = false;\n  private _addButtonEnabled: boolean = false;\n  private _pressData: Private.IPressData | null = null;\n  private _layoutModified = new Signal<this, void>(this);\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n  /**\n   * An options object for creating a dock panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n    /**\n     * The overlay to use with the dock panel.\n     *\n     * The default is a new `Overlay` instance.\n     */\n    overlay?: IOverlay;\n\n    /**\n     * The renderer to use for the dock panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The spacing between the items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The mode for the dock panel.\n     *\n     * The default is `'multiple-document'`.\n     */\n    mode?: DockPanel.Mode;\n\n    /**\n     * The sizes of the edge drop zones, in pixels.\n     * If not given, default values will be used.\n     */\n    edges?: IEdges;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * Allow tabs to be draggable / movable by user.\n     *\n     * The default is `'true'`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Constrain tabs to this dock panel\n     *\n     * The default is `'false'`.\n     */\n    tabsConstrained?: boolean;\n\n    /**\n     * Enable add buttons in each of the dock panel's tab bars.\n     *\n     * The default is `'false'`.\n     */\n    addButtonEnabled?: boolean;\n  }\n\n  /**\n   * The sizes of the edge drop zones, in pixels.\n   */\n  export interface IEdges {\n    /**\n     * The size of the top edge drop zone.\n     */\n    top: number;\n\n    /**\n     * The size of the right edge drop zone.\n     */\n    right: number;\n\n    /**\n     * The size of the bottom edge drop zone.\n     */\n    bottom: number;\n\n    /**\n     * The size of the left edge drop zone.\n     */\n    left: number;\n  }\n\n  /**\n   * A type alias for the supported dock panel modes.\n   */\n  export type Mode =\n    | /**\n     * The single document mode.\n     *\n     * In this mode, only a single widget is visible at a time, and that\n     * widget fills the available layout space. No tab bars are visible.\n     */\n    'single-document'\n\n    /**\n     * The multiple document mode.\n     *\n     * In this mode, multiple documents are displayed in separate tab\n     * areas, and those areas can be individually resized by the user.\n     */\n    | 'multiple-document';\n\n  /**\n   * A type alias for a layout configuration object.\n   */\n  export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n  /**\n   * A type alias for the supported insertion modes.\n   */\n  export type InsertMode = DockLayout.InsertMode;\n\n  /**\n   * A type alias for the add widget options.\n   */\n  export type IAddOptions = DockLayout.IAddOptions;\n\n  /**\n   * An object which holds the geometry for overlay positioning.\n   */\n  export interface IOverlayGeometry {\n    /**\n     * The distance between the overlay and parent top edges.\n     */\n    top: number;\n\n    /**\n     * The distance between the overlay and parent left edges.\n     */\n    left: number;\n\n    /**\n     * The distance between the overlay and parent right edges.\n     */\n    right: number;\n\n    /**\n     * The distance between the overlay and parent bottom edges.\n     */\n    bottom: number;\n  }\n\n  /**\n   * An object which manages the overlay node for a dock panel.\n   */\n  export interface IOverlay {\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     *\n     * #### Notes\n     * The given geometry values assume the node will use absolute\n     * positioning.\n     *\n     * This is called on every mouse move event during a drag in order\n     * to update the position of the overlay. It should be efficient.\n     */\n    show(geo: IOverlayGeometry): void;\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 should hide the overlay immediately.\n     *\n     * #### Notes\n     * This is called whenever the overlay node should been hidden.\n     */\n    hide(delay: number): void;\n  }\n\n  /**\n   * A concrete implementation of `IOverlay`.\n   *\n   * This is the default overlay implementation for a dock panel.\n   */\n  export class Overlay implements IOverlay {\n    /**\n     * Construct a new overlay.\n     */\n    constructor() {\n      this.node = document.createElement('div');\n      this.node.classList.add('lm-DockPanel-overlay');\n      this.node.classList.add('lm-mod-hidden');\n      this.node.style.position = 'absolute';\n      this.node.style.contain = 'strict';\n    }\n\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     */\n    show(geo: IOverlayGeometry): void {\n      // Update the position of the overlay.\n      let style = this.node.style;\n      style.top = `${geo.top}px`;\n      style.left = `${geo.left}px`;\n      style.right = `${geo.right}px`;\n      style.bottom = `${geo.bottom}px`;\n\n      // Clear any pending hide timer.\n      clearTimeout(this._timer);\n      this._timer = -1;\n\n      // If the overlay is already visible, we're done.\n      if (!this._hidden) {\n        return;\n      }\n\n      // Clear the hidden flag.\n      this._hidden = false;\n\n      // Finally, show the overlay.\n      this.node.classList.remove('lm-mod-hidden');\n    }\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 will hide the overlay immediately.\n     */\n    hide(delay: number): void {\n      // Do nothing if the overlay is already hidden.\n      if (this._hidden) {\n        return;\n      }\n\n      // Hide immediately if the delay is <= 0.\n      if (delay <= 0) {\n        clearTimeout(this._timer);\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n        return;\n      }\n\n      // Do nothing if a hide is already pending.\n      if (this._timer !== -1) {\n        return;\n      }\n\n      // Otherwise setup the hide timer.\n      this._timer = window.setTimeout(() => {\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n      }, delay);\n    }\n\n    private _timer = -1;\n    private _hidden = true;\n  }\n\n  /**\n   * A type alias for a dock panel renderer;\n   */\n  export type IRenderer = DockLayout.IRenderer;\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new tab bar for use with a dock panel.\n     *\n     * @returns A new tab bar for a dock panel.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget> {\n      let bar = new TabBar<Widget>({ document });\n      bar.addClass('lm-DockPanel-tabBar');\n      return bar;\n    }\n\n    /**\n     * Create a new handle node for use with a dock panel.\n     *\n     * @returns A new handle node for a dock panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-DockPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * The default sizes for the edge drop zones, in pixels.\n   */\n  export const DEFAULT_EDGES = {\n    /**\n     * The size of the top edge dock zone for the root panel, in pixels.\n     * This is different from the others to distinguish between the top\n     * tab bar and the top root zone.\n     */\n    top: 12,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    right: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    bottom: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    left: 40\n  };\n\n  /**\n   * A singleton `'layout-modified'` conflatable message.\n   */\n  export const LayoutModified = new ConflatableMessage('layout-modified');\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The handle which was pressed.\n     */\n    handle: HTMLDivElement;\n\n    /**\n     * The X offset of the press in handle coordinates.\n     */\n    deltaX: number;\n\n    /**\n     * The Y offset of the press in handle coordinates.\n     */\n    deltaY: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * A type alias for a drop zone.\n   */\n  export type DropZone =\n    | /**\n     * An invalid drop zone.\n     */\n    'invalid'\n\n    /**\n     * The entirety of the root dock area.\n     */\n    | 'root-all'\n\n    /**\n     * The top portion of the root dock area.\n     */\n    | 'root-top'\n\n    /**\n     * The left portion of the root dock area.\n     */\n    | 'root-left'\n\n    /**\n     * The right portion of the root dock area.\n     */\n    | 'root-right'\n\n    /**\n     * The bottom portion of the root dock area.\n     */\n    | 'root-bottom'\n\n    /**\n     * The entirety of a tabbed widget area.\n     */\n    | 'widget-all'\n\n    /**\n     * The top portion of tabbed widget area.\n     */\n    | 'widget-top'\n\n    /**\n     * The left portion of tabbed widget area.\n     */\n    | 'widget-left'\n\n    /**\n     * The right portion of tabbed widget area.\n     */\n    | 'widget-right'\n\n    /**\n     * The bottom portion of tabbed widget area.\n     */\n    | 'widget-bottom'\n\n    /**\n     * The the bar of a tabbed widget area.\n     */\n    | 'widget-tab';\n\n  /**\n   * An object which holds the drop target zone and widget.\n   */\n  export interface IDropTarget {\n    /**\n     * The semantic zone for the mouse position.\n     */\n    zone: DropZone;\n\n    /**\n     * The tab area geometry for the drop zone, or `null`.\n     */\n    target: DockLayout.ITabAreaGeometry | null;\n  }\n\n  /**\n   * An attached property used to track generated tab bars.\n   */\n  export const isGeneratedTabBarProperty = new AttachedProperty<\n    Widget,\n    boolean\n  >({\n    name: 'isGeneratedTabBar',\n    create: () => false\n  });\n\n  /**\n   * Create a single document config for the widgets in a dock panel.\n   */\n  export function createSingleDocumentConfig(\n    panel: DockPanel\n  ): DockPanel.ILayoutConfig {\n    // Return an empty config if the panel is empty.\n    if (panel.isEmpty) {\n      return { main: null };\n    }\n\n    // Get a flat array of the widgets in the panel.\n    let widgets = Array.from(panel.widgets());\n\n    // Get the first selected widget in the panel.\n    let selected = panel.selectedWidgets().next().value;\n\n    // Compute the current index for the new config.\n    let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n    // Return the single document config.\n    return { main: { type: 'tab-area', widgets, currentIndex } };\n  }\n\n  /**\n   * Find the drop target at the given client position.\n   */\n  export function findDropTarget(\n    panel: DockPanel,\n    clientX: number,\n    clientY: number,\n    edges: DockPanel.IEdges\n  ): IDropTarget {\n    // Bail if the mouse is not over the dock panel.\n    if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Look up the layout for the panel.\n    let layout = panel.layout as DockLayout;\n\n    // If the layout is empty, indicate the entire root drop zone.\n    if (layout.isEmpty) {\n      return { zone: 'root-all', target: null };\n    }\n\n    // Test the edge zones when in multiple document mode.\n    if (panel.mode === 'multiple-document') {\n      // Get the client rect for the dock panel.\n      let panelRect = panel.node.getBoundingClientRect();\n\n      // Compute the distance to each edge of the panel.\n      let pl = clientX - panelRect.left + 1;\n      let pt = clientY - panelRect.top + 1;\n      let pr = panelRect.right - clientX;\n      let pb = panelRect.bottom - clientY;\n\n      // Find the minimum distance to an edge.\n      let pd = Math.min(pt, pr, pb, pl);\n\n      // Return a root zone if the mouse is within an edge.\n      switch (pd) {\n        case pt:\n          if (pt < edges.top) {\n            return { zone: 'root-top', target: null };\n          }\n          break;\n        case pr:\n          if (pr < edges.right) {\n            return { zone: 'root-right', target: null };\n          }\n          break;\n        case pb:\n          if (pb < edges.bottom) {\n            return { zone: 'root-bottom', target: null };\n          }\n          break;\n        case pl:\n          if (pl < edges.left) {\n            return { zone: 'root-left', target: null };\n          }\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Hit test the dock layout at the given client position.\n    let target = layout.hitTestTabAreas(clientX, clientY);\n\n    // Bail if no target area was found.\n    if (!target) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Return the whole tab area when in single document mode.\n    if (panel.mode === 'single-document') {\n      return { zone: 'widget-all', target };\n    }\n\n    // Compute the distance to each edge of the tab area.\n    let al = target.x - target.left + 1;\n    let at = target.y - target.top + 1;\n    let ar = target.left + target.width - target.x;\n    let ab = target.top + target.height - target.y;\n\n    const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n    if (at < tabHeight) {\n      return { zone: 'widget-tab', target };\n    }\n\n    // Get the X and Y edge sizes for the area.\n    let rx = Math.round(target.width / 3);\n    let ry = Math.round(target.height / 3);\n\n    // If the mouse is not within an edge, indicate the entire area.\n    if (al > rx && ar > rx && at > ry && ab > ry) {\n      return { zone: 'widget-all', target };\n    }\n\n    // Scale the distances by the slenderness ratio.\n    al /= rx;\n    at /= ry;\n    ar /= rx;\n    ab /= ry;\n\n    // Find the minimum distance to the area edge.\n    let ad = Math.min(al, at, ar, ab);\n\n    // Find the widget zone for the area edge.\n    let zone: DropZone;\n    switch (ad) {\n      case al:\n        zone = 'widget-left';\n        break;\n      case at:\n        zone = 'widget-top';\n        break;\n      case ar:\n        zone = 'widget-right';\n        break;\n      case ab:\n        zone = 'widget-bottom';\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Return the final drop target.\n    return { zone, target };\n  }\n\n  /**\n   * Get the drop reference widget for a tab bar.\n   */\n  export function getDropRef(tabBar: TabBar<Widget>): Widget | null {\n    if (tabBar.titles.length === 0) {\n      return null;\n    }\n    if (tabBar.currentTitle) {\n      return tabBar.currentTitle.owner;\n    }\n    return tabBar.titles[tabBar.titles.length - 1].owner;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker<T extends Widget> implements IDisposable {\n  /**\n   * Dispose of the resources held by the tracker.\n   */\n  dispose(): void {\n    // Do nothing if the tracker is already disposed.\n    if (this._counter < 0) {\n      return;\n    }\n\n    // Mark the tracker as disposed.\n    this._counter = -1;\n\n    // Clear the connections for the tracker.\n    Signal.clearData(this);\n\n    // Remove all event listeners.\n    for (const widget of this._widgets) {\n      widget.node.removeEventListener('focus', this, true);\n      widget.node.removeEventListener('blur', this, true);\n    }\n\n    // Clear the internal data structures.\n    this._activeWidget = null;\n    this._currentWidget = null;\n    this._nodes.clear();\n    this._numbers.clear();\n    this._widgets.length = 0;\n  }\n\n  /**\n   * A signal emitted when the current widget has changed.\n   */\n  get currentChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when the active widget has changed.\n   */\n  get activeChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._activeChanged;\n  }\n\n  /**\n   * A flag indicating whether the tracker is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._counter < 0;\n  }\n\n  /**\n   * The current widget in the tracker.\n   *\n   * #### Notes\n   * The current widget is the widget among the tracked widgets which\n   * has the *descendant node* which has most recently been focused.\n   *\n   * The current widget will not be updated if the node loses focus. It\n   * will only be updated when a different tracked widget gains focus.\n   *\n   * If the current widget is removed from the tracker, the previous\n   * current widget will be restored.\n   *\n   * This behavior is intended to follow a user's conceptual model of\n   * a semantically \"current\" widget, where the \"last thing of type X\"\n   * to be interacted with is the \"current instance of X\", regardless\n   * of whether that instance still has focus.\n   */\n  get currentWidget(): T | null {\n    return this._currentWidget;\n  }\n\n  /**\n   * The active widget in the tracker.\n   *\n   * #### Notes\n   * The active widget is the widget among the tracked widgets which\n   * has the *descendant node* which is currently focused.\n   */\n  get activeWidget(): T | null {\n    return this._activeWidget;\n  }\n\n  /**\n   * A read only array of the widgets being tracked.\n   */\n  get widgets(): ReadonlyArray<T> {\n    return this._widgets;\n  }\n\n  /**\n   * Get the focus number for a particular widget in the tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The focus number for the given widget, or `-1` if the\n   *   widget has not had focus since being added to the tracker, or\n   *   is not contained by the tracker.\n   *\n   * #### Notes\n   * The focus number indicates the relative order in which the widgets\n   * have gained focus. A widget with a larger number has gained focus\n   * more recently than a widget with a smaller number.\n   *\n   * The `currentWidget` will always have the largest focus number.\n   *\n   * All widgets start with a focus number of `-1`, which indicates that\n   * the widget has not been focused since being added to the tracker.\n   */\n  focusNumber(widget: T): number {\n    let n = this._numbers.get(widget);\n    return n === undefined ? -1 : n;\n  }\n\n  /**\n   * Test whether the focus tracker contains a given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns `true` if the widget is tracked, `false` otherwise.\n   */\n  has(widget: T): boolean {\n    return this._numbers.has(widget);\n  }\n\n  /**\n   * Add a widget to the focus tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is already tracked, this is a no-op.\n   */\n  add(widget: T): void {\n    // Do nothing if the widget is already tracked.\n    if (this._numbers.has(widget)) {\n      return;\n    }\n\n    // Test whether the widget has focus.\n    let focused = widget.node.contains(document.activeElement);\n\n    // Set up the initial focus number.\n    let n = focused ? this._counter++ : -1;\n\n    // Add the widget to the internal data structures.\n    this._widgets.push(widget);\n    this._numbers.set(widget, n);\n    this._nodes.set(widget.node, widget);\n\n    // Set up the event listeners. The capturing phase must be used\n    // since the 'focus' and 'blur' events don't bubble and Firefox\n    // doesn't support the 'focusin' or 'focusout' events.\n    widget.node.addEventListener('focus', this, true);\n    widget.node.addEventListener('blur', this, true);\n\n    // Connect the disposed signal handler.\n    widget.disposed.connect(this._onWidgetDisposed, this);\n\n    // Set the current and active widgets if needed.\n    if (focused) {\n      this._setWidgets(widget, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the focus tracker.\n   *\n   * #### Notes\n   * If the widget is the `currentWidget`, the previous current widget\n   * will become the new `currentWidget`.\n   *\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is not tracked, this is a no-op.\n   */\n  remove(widget: T): void {\n    // Bail early if the widget is not tracked.\n    if (!this._numbers.has(widget)) {\n      return;\n    }\n\n    // Disconnect the disposed signal handler.\n    widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n    // Remove the event listeners.\n    widget.node.removeEventListener('focus', this, true);\n    widget.node.removeEventListener('blur', this, true);\n\n    // Remove the widget from the internal data structures.\n    ArrayExt.removeFirstOf(this._widgets, widget);\n    this._nodes.delete(widget.node);\n    this._numbers.delete(widget);\n\n    // Bail early if the widget is not the current widget.\n    if (this._currentWidget !== widget) {\n      return;\n    }\n\n    // Filter the widgets for those which have had focus.\n    let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n    // Get the valid widget with the max focus number.\n    let previous =\n      max(valid, (first, second) => {\n        let a = this._numbers.get(first)!;\n        let b = this._numbers.get(second)!;\n        return a - b;\n      }) || null;\n\n    // Set the current and active widgets.\n    this._setWidgets(previous, null);\n  }\n\n  /**\n   * Handle the DOM events for the focus tracker.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tracked nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'focus':\n        this._evtFocus(event as FocusEvent);\n        break;\n      case 'blur':\n        this._evtBlur(event as FocusEvent);\n        break;\n    }\n  }\n\n  /**\n   * Set the current and active widgets for the tracker.\n   */\n  private _setWidgets(current: T | null, active: T | null): void {\n    // Swap the current widget.\n    let oldCurrent = this._currentWidget;\n    this._currentWidget = current;\n\n    // Swap the active widget.\n    let oldActive = this._activeWidget;\n    this._activeWidget = active;\n\n    // Emit the `currentChanged` signal if needed.\n    if (oldCurrent !== current) {\n      this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n    }\n\n    // Emit the `activeChanged` signal if needed.\n    if (oldActive !== active) {\n      this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n    }\n  }\n\n  /**\n   * Handle the `'focus'` event for a tracked widget.\n   */\n  private _evtFocus(event: FocusEvent): void {\n    // Find the widget which gained focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Update the focus number if necessary.\n    if (widget !== this._currentWidget) {\n      this._numbers.set(widget, this._counter++);\n    }\n\n    // Set the current and active widgets.\n    this._setWidgets(widget, widget);\n  }\n\n  /**\n   * Handle the `'blur'` event for a tracked widget.\n   */\n  private _evtBlur(event: FocusEvent): void {\n    // Find the widget which lost focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Get the node which being focused after this blur.\n    let focusTarget = event.relatedTarget as HTMLElement;\n\n    // If no other node is being focused, clear the active widget.\n    if (!focusTarget) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n\n    // Bail if the focus widget is not changing.\n    if (widget.node.contains(focusTarget)) {\n      return;\n    }\n\n    // If no tracked widget is being focused, clear the active widget.\n    if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n  }\n\n  /**\n   * Handle the `disposed` signal for a tracked widget.\n   */\n  private _onWidgetDisposed(sender: T): void {\n    this.remove(sender);\n  }\n\n  private _counter = 0;\n  private _widgets: T[] = [];\n  private _activeWidget: T | null = null;\n  private _currentWidget: T | null = null;\n  private _numbers = new Map<T, number>();\n  private _nodes = new Map<HTMLElement, T>();\n  private _activeChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(this);\n  private _currentChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(\n    this\n  );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n  /**\n   * An arguments object for the changed signals.\n   */\n  export interface IChangedArgs<T extends Widget> {\n    /**\n     * The old value for the widget.\n     */\n    oldValue: T | null;\n\n    /**\n     * The new value for the widget.\n     */\n    newValue: T | null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n  /**\n   * Construct a new grid layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: GridLayout.IOptions = {}) {\n    super(options);\n    if (options.rowCount !== undefined) {\n      Private.reallocSizers(this._rowSizers, options.rowCount);\n    }\n    if (options.columnCount !== undefined) {\n      Private.reallocSizers(this._columnSizers, options.columnCount);\n    }\n    if (options.rowSpacing !== undefined) {\n      this._rowSpacing = Private.clampValue(options.rowSpacing);\n    }\n    if (options.columnSpacing !== undefined) {\n      this._columnSpacing = Private.clampValue(options.columnSpacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the widgets and layout items.\n    for (const item of this._items) {\n      let widget = item.widget;\n      item.dispose();\n      widget.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._rowStarts.length = 0;\n    this._rowSizers.length = 0;\n    this._columnStarts.length = 0;\n    this._columnSizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the number of rows in the layout.\n   */\n  get rowCount(): number {\n    return this._rowSizers.length;\n  }\n\n  /**\n   * Set the number of rows in the layout.\n   *\n   * #### Notes\n   * The minimum row count is `1`.\n   */\n  set rowCount(value: number) {\n    // Do nothing if the row count does not change.\n    if (value === this.rowCount) {\n      return;\n    }\n\n    // Reallocate the row sizers.\n    Private.reallocSizers(this._rowSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the number of columns in the layout.\n   */\n  get columnCount(): number {\n    return this._columnSizers.length;\n  }\n\n  /**\n   * Set the number of columns in the layout.\n   *\n   * #### Notes\n   * The minimum column count is `1`.\n   */\n  set columnCount(value: number) {\n    // Do nothing if the column count does not change.\n    if (value === this.columnCount) {\n      return;\n    }\n\n    // Reallocate the column sizers.\n    Private.reallocSizers(this._columnSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the row spacing for the layout.\n   */\n  get rowSpacing(): number {\n    return this._rowSpacing;\n  }\n\n  /**\n   * Set the row spacing for the layout.\n   */\n  set rowSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._rowSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._rowSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the column spacing for the layout.\n   */\n  get columnSpacing(): number {\n    return this._columnSpacing;\n  }\n\n  /**\n   * Set the col spacing for the layout.\n   */\n  set columnSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._columnSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._columnSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @returns The stretch factor for the row.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  rowStretch(index: number): number {\n    let sizer = this._rowSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @param value - The stretch factor for the row.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setRowStretch(index: number, value: number): void {\n    // Look up the row sizer.\n    let sizer = this._rowSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @returns The stretch factor for the column.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  columnStretch(index: number): number {\n    let sizer = this._columnSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @param value - The stretch factor for the column.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setColumnStretch(index: number, value: number): void {\n    // Look up the column sizer.\n    let sizer = this._columnSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    for (const item of this._items) {\n      yield item.widget;\n    }\n  }\n\n  /**\n   * Add a widget to the grid layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, this is no-op.\n   */\n  addWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is already in the layout.\n    if (i !== -1) {\n      return;\n    }\n\n    // Add the widget to the layout.\n    this._items.push(new LayoutItem(widget));\n\n    // Attach the widget to the parent.\n    if (this.parent) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the grid layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is not in the layout.\n    if (i === -1) {\n      return;\n    }\n\n    // Remove the widget from the layout.\n    let item = ArrayExt.removeAt(this._items, i)!;\n\n    // Detach the widget from the parent.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n\n    // Dispose the layout item.\n    item.dispose();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Reset the min sizes of the sizers.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      this._rowSizers[i].minSize = 0;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      this._columnSizers[i].minSize = 0;\n    }\n\n    // Filter for the visible layout items.\n    let items = this._items.filter(it => !it.isHidden);\n\n    // Fit the layout items.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      items[i].fit();\n    }\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Sort the items by row span.\n    items.sort(Private.rowSpanCmp);\n\n    // Update the min sizes of the row sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the row bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n      // Distribute the minimum height to the sizers as needed.\n      Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n    }\n\n    // Sort the items by column span.\n    items.sort(Private.columnSpanCmp);\n\n    // Update the min sizes of the column sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the column bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let c1 = Math.min(config.column, maxCol);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Distribute the minimum width to the sizers as needed.\n      Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n    }\n\n    // If no size constraint is needed, just update the parent.\n    if (this.fitPolicy === 'set-no-constraint') {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n      return;\n    }\n\n    // Set up the computed min size.\n    let minH = maxRow * this._rowSpacing;\n    let minW = maxCol * this._columnSpacing;\n\n    // Add the sizer minimums to the computed min size.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      minH += this._rowSizers[i].minSize;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      minW += this._columnSizers[i].minSize;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Compute the total fixed row and column space.\n    let fixedRowSpace = maxRow * this._rowSpacing;\n    let fixedColSpace = maxCol * this._columnSpacing;\n\n    // Distribute the available space to the box sizers.\n    BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n    BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n    // Update the row start positions.\n    for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n      this._rowStarts[i] = pos;\n      pos += this._rowSizers[i].size + this._rowSpacing;\n    }\n\n    // Update the column start positions.\n    for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n      this._columnStarts[i] = pos;\n      pos += this._columnSizers[i].size + this._columnSpacing;\n    }\n\n    // Update the geometry of the layout items.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the cell bounds for the widget.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let c1 = Math.min(config.column, maxCol);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Compute the cell geometry.\n      let x = this._columnStarts[c1];\n      let y = this._rowStarts[r1];\n      let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n      let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n      // Update the geometry of the layout item.\n      item.update(x, y, w, h);\n    }\n  }\n\n  private _dirty = false;\n  private _rowSpacing = 4;\n  private _columnSpacing = 4;\n  private _items: LayoutItem[] = [];\n  private _rowStarts: number[] = [];\n  private _columnStarts: number[] = [];\n  private _rowSizers: BoxSizer[] = [new BoxSizer()];\n  private _columnSizers: BoxSizer[] = [new BoxSizer()];\n  private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n  /**\n   * An options object for initializing a grid layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The initial row count for the layout.\n     *\n     * The default is `1`.\n     */\n    rowCount?: number;\n\n    /**\n     * The initial column count for the layout.\n     *\n     * The default is `1`.\n     */\n    columnCount?: number;\n\n    /**\n     * The spacing between rows in the layout.\n     *\n     * The default is `4`.\n     */\n    rowSpacing?: number;\n\n    /**\n     * The spacing between columns in the layout.\n     *\n     * The default is `4`.\n     */\n    columnSpacing?: number;\n  }\n\n  /**\n   * An object which holds the cell configuration for a widget.\n   */\n  export interface ICellConfig {\n    /**\n     * The row index for the widget.\n     */\n    readonly row: number;\n\n    /**\n     * The column index for the widget.\n     */\n    readonly column: number;\n\n    /**\n     * The row span for the widget.\n     */\n    readonly rowSpan: number;\n\n    /**\n     * The column span for the widget.\n     */\n    readonly columnSpan: number;\n  }\n\n  /**\n   * Get the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The cell config for the widget.\n   */\n  export function getCellConfig(widget: Widget): ICellConfig {\n    return Private.cellConfigProperty.get(widget);\n  }\n\n  /**\n   * Set the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the cell config.\n   */\n  export function setCellConfig(\n    widget: Widget,\n    value: Partial<ICellConfig>\n  ): void {\n    Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for the widget cell config.\n   */\n  export const cellConfigProperty = new AttachedProperty<\n    Widget,\n    GridLayout.ICellConfig\n  >({\n    name: 'cellConfig',\n    create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n    changed: onChildCellConfigChanged\n  });\n\n  /**\n   * Normalize a partial cell config object.\n   */\n  export function normalizeConfig(\n    config: Partial<GridLayout.ICellConfig>\n  ): GridLayout.ICellConfig {\n    let row = Math.max(0, Math.floor(config.row || 0));\n    let column = Math.max(0, Math.floor(config.column || 0));\n    let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n    let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n    return { row, column, rowSpan, columnSpan };\n  }\n\n  /**\n   * Clamp a value to an integer >= 0.\n   */\n  export function clampValue(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * A sort comparison function for row spans.\n   */\n  export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.rowSpan - c2.rowSpan;\n  }\n\n  /**\n   * A sort comparison function for column spans.\n   */\n  export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.columnSpan - c2.columnSpan;\n  }\n\n  /**\n   * Reallocate the box sizers for the given grid dimensions.\n   */\n  export function reallocSizers(sizers: BoxSizer[], count: number): void {\n    // Coerce the count to the valid range.\n    count = Math.max(1, Math.floor(count));\n\n    // Add the missing sizers.\n    while (sizers.length < count) {\n      sizers.push(new BoxSizer());\n    }\n\n    // Remove the extra sizers.\n    if (sizers.length > count) {\n      sizers.length = count;\n    }\n  }\n\n  /**\n   * Distribute a min size constraint across a range of sizers.\n   */\n  export function distributeMin(\n    sizers: BoxSizer[],\n    i1: number,\n    i2: number,\n    minSize: number\n  ): void {\n    // Sanity check the indices.\n    if (i2 < i1) {\n      return;\n    }\n\n    // Handle the simple case of no cell span.\n    if (i1 === i2) {\n      let sizer = sizers[i1];\n      sizer.minSize = Math.max(sizer.minSize, minSize);\n      return;\n    }\n\n    // Compute the total current min size of the span.\n    let totalMin = 0;\n    for (let i = i1; i <= i2; ++i) {\n      totalMin += sizers[i].minSize;\n    }\n\n    // Do nothing if the total is greater than the required.\n    if (totalMin >= minSize) {\n      return;\n    }\n\n    // Compute the portion of the space to allocate to each sizer.\n    let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n    // Add the portion to each sizer.\n    for (let i = i1; i <= i2; ++i) {\n      sizers[i].minSize += portion;\n    }\n  }\n\n  /**\n   * The change handler for the child cell config property.\n   */\n  function onChildCellConfigChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof GridLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n  /**\n   * Construct a new menu bar.\n   *\n   * @param options - The options for initializing the menu bar.\n   */\n  constructor(options: MenuBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-MenuBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.renderer = options.renderer || MenuBar.defaultRenderer;\n    this._forceItemsPosition = options.forceItemsPosition || {\n      forceX: true,\n      forceY: true\n    };\n    this._overflowMenuOptions = options.overflowMenuOptions || {\n      isVisible: true\n    };\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._closeChildMenu();\n    this._menus.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the menu bar.\n   */\n  readonly renderer: MenuBar.IRenderer;\n\n  /**\n   * The child menu of the menu bar.\n   *\n   * #### Notes\n   * This will be `null` if the menu bar does not have an open menu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The overflow index of the menu bar.\n   */\n  get overflowIndex(): number {\n    return this._overflowIndex;\n  }\n\n  /**\n   * The overflow menu of the menu bar.\n   */\n  get overflowMenu(): Menu | null {\n    return this._overflowMenu;\n  }\n\n  /**\n   * Get the menu bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu title nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-MenuBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu.\n   */\n  get activeMenu(): Menu | null {\n    return this._menus[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu.\n   *\n   * #### Notes\n   * If the menu does not exist, the menu will be set to `null`.\n   */\n  set activeMenu(value: Menu | null) {\n    this.activeIndex = value ? this._menus.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu.\n   *\n   * #### Notes\n   * This will be `-1` if no menu is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu.\n   *\n   * #### Notes\n   * If the menu cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._menus.length) {\n      value = -1;\n    }\n\n    // An empty menu cannot be active\n    if (value > -1 && this._menus[value].items.length === 0) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menus in the menu bar.\n   */\n  get menus(): ReadonlyArray<Menu> {\n    return this._menus;\n  }\n\n  /**\n   * Open the active menu and activate its first menu item.\n   *\n   * #### Notes\n   * If there is no active menu, this is a no-op.\n   */\n  openActiveMenu(): void {\n    // Bail early if there is no active item.\n    if (this._activeIndex === -1) {\n      return;\n    }\n\n    // Open the child menu.\n    this._openChildMenu();\n\n    // Activate the first item in the child menu.\n    if (this._childMenu) {\n      this._childMenu.activeIndex = -1;\n      this._childMenu.activateNextItem();\n    }\n  }\n\n  /**\n   * Add a menu to the end of the menu bar.\n   *\n   * @param menu - The menu to add to the menu bar.\n   *\n   * #### Notes\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  addMenu(menu: Menu, update: boolean = true): void {\n    this.insertMenu(this._menus.length, menu, update);\n  }\n\n  /**\n   * Insert a menu into the menu bar at the specified index.\n   *\n   * @param index - The index at which to insert the menu.\n   *\n   * @param menu - The menu to insert into the menu bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the menus.\n   *\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  insertMenu(index: number, menu: Menu, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Look up the index of the menu.\n    let i = this._menus.indexOf(menu);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._menus.length));\n\n    // If the menu is not in the array, insert it.\n    if (i === -1) {\n      // Insert the menu into the array.\n      ArrayExt.insert(this._menus, j, menu);\n\n      // Add the styling class to the menu.\n      menu.addClass('lm-MenuBar-menu');\n\n      // Connect to the menu signals.\n      menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n      menu.menuRequested.connect(this._onMenuMenuRequested, this);\n      menu.title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the items.\n      if (update) {\n        this.update();\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the menu exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._menus.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the menu to the new locations.\n    ArrayExt.move(this._menus, i, j);\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove a menu from the menu bar.\n   *\n   * @param menu - The menu to remove from the menu bar.\n   *\n   * #### Notes\n   * This is a no-op if the menu is not in the menu bar.\n   */\n  removeMenu(menu: Menu, update: boolean = true): void {\n    this.removeMenuAt(this._menus.indexOf(menu), update);\n  }\n\n  /**\n   * Remove the menu at a given index from the menu bar.\n   *\n   * @param index - The index of the menu to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeMenuAt(index: number, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Remove the menu from the array.\n    let menu = ArrayExt.removeAt(this._menus, index);\n\n    // Bail if the index is out of range.\n    if (!menu) {\n      return;\n    }\n\n    // Disconnect from the menu signals.\n    menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n    menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n    menu.title.changed.disconnect(this._onTitleChanged, this);\n\n    // Remove the styling class from the menu.\n    menu.removeClass('lm-MenuBar-menu');\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove all menus from the menu bar.\n   */\n  clearMenus(): void {\n    // Bail if there is nothing to remove.\n    if (this._menus.length === 0) {\n      return;\n    }\n\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Disconnect from the menu signals and remove the styling class.\n    for (let menu of this._menus) {\n      menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n      menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n      menu.title.changed.disconnect(this._onTitleChanged, this);\n      menu.removeClass('lm-MenuBar-menu');\n    }\n\n    // Clear the menus array.\n    this._menus.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the menu bar.\n   *\n   * @param event - The DOM event sent to the menu bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu bar's DOM nodes. It\n   * should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n      case 'mouseleave':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'focusout':\n        this._evtFocusOut(event as FocusEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mousedown', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('focusout', this);\n    this.node.addEventListener('contextmenu', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mousedown', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('focusout', this);\n    this.node.removeEventListener('contextmenu', this);\n    this._closeChildMenu();\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this._focusItemAt(0);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    this.update();\n    super.onResize(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let menus = this._menus;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let tabFocusIndex =\n      this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n        ? this._tabFocusIndex\n        : 0;\n    let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n    let totalMenuSize = 0;\n    let isVisible = false;\n\n    // Check that the overflow menu doesn't count\n    length = this._overflowMenu !== null ? length - 1 : length;\n    let content = new Array<VirtualElement>(length);\n\n    // Render visible menus\n    for (let i = 0; i < length; ++i) {\n      content[i] = renderer.renderItem({\n        title: menus[i].title,\n        active: i === activeIndex,\n        tabbable: i === tabFocusIndex,\n        disabled: menus[i].items.length === 0,\n        onfocus: () => {\n          this._tabFocusIndex = i;\n          this.activeIndex = i;\n        }\n      });\n      // Calculate size of current menu\n      totalMenuSize += this._menuItemSizes[i];\n      // Check if overflow menu is already rendered\n      if (menus[i].title.label === this._overflowMenuOptions.title) {\n        isVisible = true;\n        length--;\n      }\n    }\n    // Render overflow menu if needed and active\n    if (this._overflowMenuOptions.isVisible) {\n      if (this._overflowIndex > -1 && !isVisible) {\n        // Create overflow menu\n        if (this._overflowMenu === null) {\n          const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n          this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n          this._overflowMenu.title.label = overflowMenuTitle;\n          this._overflowMenu.title.mnemonic = 0;\n          this.addMenu(this._overflowMenu, false);\n        }\n        // Move menus to overflow menu\n        for (let i = menus.length - 2; i >= length; i--) {\n          const submenu = this.menus[i];\n          submenu.title.mnemonic = 0;\n          this._overflowMenu.insertItem(0, {\n            type: 'submenu',\n            submenu: submenu\n          });\n          this.removeMenu(submenu, false);\n        }\n        content[length] = renderer.renderItem({\n          title: this._overflowMenu.title,\n          active: length === activeIndex && menus[length].items.length !== 0,\n          tabbable: length === tabFocusIndex,\n          disabled: menus[length].items.length === 0,\n          onfocus: () => {\n            this._tabFocusIndex = length;\n            this.activeIndex = length;\n          }\n        });\n        length++;\n      } else if (this._overflowMenu !== null) {\n        // Remove submenus from overflow menu\n        let overflowMenuItems = this._overflowMenu.items;\n        let screenSize = this.node.offsetWidth;\n        let n = this._overflowMenu.items.length;\n        for (let i = 0; i < n; ++i) {\n          let index = menus.length - 1 - i;\n          if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n            let menu = overflowMenuItems[0].submenu as Menu;\n            this._overflowMenu.removeItemAt(0);\n            this.insertMenu(length, menu, false);\n            content[length] = renderer.renderItem({\n              title: menu.title,\n              active: false,\n              tabbable: length === tabFocusIndex,\n              disabled: menus[length].items.length === 0,\n              onfocus: () => {\n                this._tabFocusIndex = length;\n                this.activeIndex = length;\n              }\n            });\n            length++;\n          }\n        }\n        if (this._overflowMenu.items.length === 0) {\n          this.removeMenu(this._overflowMenu, false);\n          content.pop();\n          this._overflowMenu = null;\n          this._overflowIndex = -1;\n        }\n      }\n    }\n    VirtualDOM.render(content, this.contentNode);\n    this._updateOverflowIndex();\n  }\n\n  /**\n   * Calculate and update the current overflow index.\n   */\n  private _updateOverflowIndex(): void {\n    if (!this._overflowMenuOptions.isVisible) {\n      return;\n    }\n\n    // Get elements visible in the main menu bar\n    const itemMenus = this.contentNode.childNodes;\n    let screenSize = this.node.offsetWidth;\n    let totalMenuSize = 0;\n    let index = -1;\n    let n = itemMenus.length;\n\n    if (this._menuItemSizes.length == 0) {\n      // Check if it is the first resize and get info about menu items sizes\n      for (let i = 0; i < n; i++) {\n        let item = itemMenus[i] as HTMLLIElement;\n        // Add sizes to array\n        totalMenuSize += item.offsetWidth;\n        this._menuItemSizes.push(item.offsetWidth);\n        if (totalMenuSize > screenSize && index === -1) {\n          index = i;\n        }\n      }\n    } else {\n      // Calculate current menu size\n      for (let i = 0; i < this._menuItemSizes.length; i++) {\n        totalMenuSize += this._menuItemSizes[i];\n        if (totalMenuSize > screenSize) {\n          index = i;\n          break;\n        }\n      }\n    }\n    this._overflowIndex = index;\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu bar.\n   *\n   * #### Notes\n   * All keys are trapped except the tab key that is ignored.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Reset the active index on tab, but do not trap the tab key.\n    if (kc === 9) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // A menu bar handles all other keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Enter, Space, Up Arrow, Down Arrow\n    if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n      // The active index may have changed (for example, user hovers over an\n      // item with the mouse), so be sure to use the focus index.\n      this.activeIndex = this._tabFocusIndex;\n      if (this.activeIndex !== this._tabFocusIndex) {\n        // Bail if the setter refused to set activeIndex to tabFocusIndex\n        // because it means that the item at tabFocusIndex cannot be opened (for\n        // example, it has an empty menu)\n        return;\n      }\n      this.openActiveMenu();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this._closeChildMenu();\n      this._focusItemAt(this.activeIndex);\n      return;\n    }\n\n    // Left or Right Arrow\n    if (kc === 37 || kc === 39) {\n      let direction = kc === 37 ? -1 : 1;\n      let start = this._tabFocusIndex + direction;\n      let n = this._menus.length;\n      for (let i = 0; i < n; i++) {\n        let index = (n + start + direction * i) % n;\n        if (this._menus[index].items.length) {\n          this._focusItemAt(index);\n          return;\n        }\n      }\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._menus, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that menu is opened.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.openActiveMenu();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n      this._focusItemAt(this.activeIndex);\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n      this._focusItemAt(this.activeIndex);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the mouse press was not on the menu bar. This can occur\n    // when the document listener is installed for an active menu bar.\n    if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n      return;\n    }\n\n    // Stop the propagation of the event. Immediate propagation is\n    // also stopped so that an open menu does not handle the event.\n    event.stopPropagation();\n    event.stopImmediatePropagation();\n\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // If the press was not on an item, close the child menu.\n    if (index === -1) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // If the press was not the left mouse button, do nothing further.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Otherwise, toggle the open state of the child menu.\n    if (this._childMenu) {\n      this._closeChildMenu();\n      this.activeIndex = index;\n    } else {\n      // If we don't call preventDefault() here, then the item in the menu\n      // bar will take focus over the menu that is being opened.\n      event.preventDefault();\n      const position = this._positionForMenu(index);\n      Menu.saveWindowData();\n      // Begin DOM modifications.\n      this.activeIndex = index;\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the active index will not change.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Bail early if a child menu is open and the mouse is not over\n    // an item. This allows the child menu to be kept open when the\n    // mouse is over the empty part of the menu bar.\n    if (index === -1 && this._childMenu) {\n      return;\n    }\n\n    // Get position for the new menu >before< updating active index.\n    const position =\n      index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n    // Before any modification, update window data.\n    Menu.saveWindowData();\n\n    // Begin DOM modifications.\n\n    // Update the active index to the hovered item.\n    this.activeIndex = index;\n\n    // Open the new menu if a menu is already open.\n    if (position) {\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Find initial position for the menu based on menubar item position.\n   *\n   * NOTE: this should be called before updating active index to avoid\n   * an additional layout and style invalidation as changing active\n   * index modifies DOM.\n   */\n  private _positionForMenu(index: number): Private.IPosition {\n    let itemNode = this.contentNode.children[index];\n    let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n    return {\n      top: bottom,\n      left\n    };\n  }\n\n  /**\n   * Handle the `'focusout'` event for the menu bar.\n   */\n  private _evtFocusOut(event: FocusEvent): void {\n    // Reset the active index if there is no open menu and the menubar is losing focus.\n    if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n      this.activeIndex = -1;\n    }\n  }\n\n  /**\n   * Focus an item in the menu bar.\n   *\n   * #### Notes\n   * Does not open the associated menu.\n   */\n  private _focusItemAt(index: number): void {\n    const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n    if (itemNode) {\n      itemNode.focus();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if there is no active menu.\n   */\n  private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n    // If there is no active menu, close the current menu.\n    let newMenu = this.activeMenu;\n    if (!newMenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Bail if there is no effective menu change.\n    let oldMenu = this._childMenu;\n    if (oldMenu === newMenu) {\n      return;\n    }\n\n    // Swap the internal menu reference.\n    this._childMenu = newMenu;\n\n    // Close the current menu, or setup for the new menu.\n    if (oldMenu) {\n      oldMenu.close();\n    } else {\n      document.addEventListener('mousedown', this, true);\n    }\n\n    // Update the tab focus index and ensure the menu bar is updated.\n    this._tabFocusIndex = this.activeIndex;\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n    // Get the positioning data for the new menu.\n    let { left, top } = options;\n    if (typeof left === 'undefined' || typeof top === 'undefined') {\n      ({ left, top } = this._positionForMenu(this._activeIndex));\n    }\n    // Begin DOM modifications\n\n    if (!oldMenu) {\n      // Continue setup for new menu\n      this.addClass('lm-mod-active');\n    }\n\n    // Open the new menu at the computed location.\n    if (newMenu.items.length > 0) {\n      newMenu.open(left, top, this._forceItemsPosition);\n    }\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    // Bail if no child menu is open.\n    if (!this._childMenu) {\n      return;\n    }\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    let menu = this._childMenu;\n    this._childMenu = null;\n\n    // Close the menu.\n    menu.close();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `aboutToClose` signal of a menu.\n   */\n  private _onMenuAboutToClose(sender: Menu): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    this._childMenu = null;\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `menuRequested` signal of a child menu.\n   */\n  private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Look up the active index and menu count.\n    let i = this._activeIndex;\n    let n = this._menus.length;\n\n    // Active the next requested index.\n    switch (args) {\n      case 'next':\n        this.activeIndex = i === n - 1 ? 0 : i + 1;\n        break;\n      case 'previous':\n        this.activeIndex = i === 0 ? n - 1 : i - 1;\n        break;\n    }\n\n    // Open the active menu.\n    this.openActiveMenu();\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(): void {\n    this.update();\n  }\n\n  // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n  private _activeIndex = -1;\n  // Track which item can be focused using the TAB key. Unlike _activeIndex will\n  // always point to a menuitem. Whenever you update this value, it's important\n  // to follow it with an \"update-request\" message so that the `tabindex`\n  // attribute on each menubar item gets properly updated.\n  private _tabFocusIndex = 0;\n  private _forceItemsPosition: Menu.IOpenOptions;\n  private _overflowMenuOptions: IOverflowMenuOptions;\n  private _menus: Menu[] = [];\n  private _childMenu: Menu | null = null;\n  private _overflowMenu: Menu | null = null;\n  private _menuItemSizes: number[] = [];\n  private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n  /**\n   * An options object for creating a menu bar.\n   */\n  export interface IOptions {\n    /**\n     * A custom renderer for creating menu bar content.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n    /**\n     * Whether to force the position of the menu. The MenuBar forces the\n     * coordinates of its menus by default. With this option you can disable it.\n     *\n     * Setting to `false` will enable the logic which repositions the\n     * coordinates of the menu if it will not fit entirely on screen.\n     *\n     * The default is `true`.\n     */\n    forceItemsPosition?: Menu.IOpenOptions;\n    /**\n     * Whether to add a overflow menu if there's overflow.\n     *\n     * Setting to `true` will enable the logic that creates an overflow menu\n     * to show the menu items that don't fit entirely on the screen.\n     *\n     * The default is `true`.\n     */\n    overflowMenuOptions?: IOverflowMenuOptions;\n  }\n\n  /**\n   * An object which holds the data to render a menu bar item.\n   */\n  export interface IRenderData {\n    /**\n     * The title to be rendered.\n     */\n    readonly title: Title<Widget>;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the user can tab to the item.\n     */\n    readonly tabbable: boolean;\n\n    /**\n     * Whether the item is disabled.\n     *\n     * #### Notes\n     * A disabled item cannot be active.\n     * A disabled item cannot be focussed.\n     */\n    readonly disabled?: boolean;\n\n    readonly onfocus?: (event: FocusEvent) => void;\n  }\n\n  /**\n   * A renderer for use with a menu bar.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.title.icon is undefined, it will be ignored.\n      return h.div({ className }, data.title.icon!, data.title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n    }\n\n    /**\n     * Create the class name for the menu bar item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-item';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.active && !data.disabled) {\n        name += ' lm-mod-active';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a menu bar item.\n     *\n     * @param data - The data to use for the item.\n     *\n     * @returns The dataset for the menu bar item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the aria attributes for menu bar item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      return {\n        role: 'menuitem',\n        'aria-haspopup': 'true',\n        'aria-disabled': data.disabled ? 'true' : 'false'\n      };\n    }\n\n    /**\n     * Create the class name for the menu bar item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-itemIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.title;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n  /**\n   * Determines if a overflow menu appears when the menu items overflow.\n   *\n   * Defaults to `true`.\n   */\n  isVisible: boolean;\n  /**\n   * Determines the title of the overflow menu.\n   *\n   * Default: `...`.\n   */\n  title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a menu bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-MenuBar-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menubar');\n    return node;\n  }\n\n  /**\n   * Position for the menu relative to top-left screen corner.\n   */\n  export interface IPosition {\n    /**\n     * Pixels right from screen origin.\n     */\n    left: number;\n    /**\n     * Pixels down from screen origin.\n     */\n    top: number;\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    menus: ReadonlyArray<Menu>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = menus.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Look up the menu title.\n      let title = menus[k].title;\n\n      // Ignore titles with an empty label.\n      if (title.label.length === 0) {\n        continue;\n      }\n\n      // Look up the mnemonic index for the label.\n      let mn = title.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < title.label.length) {\n        if (title.label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n  /**\n   * Construct a new scroll bar.\n   *\n   * @param options - The options for initializing the scroll bar.\n   */\n  constructor(options: ScrollBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-ScrollBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n\n    // Set the orientation.\n    this._orientation = options.orientation || 'vertical';\n    this.dataset['orientation'] = this._orientation;\n\n    // Parse the rest of the options.\n    if (options.maximum !== undefined) {\n      this._maximum = Math.max(0, options.maximum);\n    }\n    if (options.page !== undefined) {\n      this._page = Math.max(0, options.page);\n    }\n    if (options.value !== undefined) {\n      this._value = Math.max(0, Math.min(options.value, this._maximum));\n    }\n  }\n\n  /**\n   * A signal emitted when the user moves the scroll thumb.\n   *\n   * #### Notes\n   * The payload is the current value of the scroll bar.\n   */\n  get thumbMoved(): ISignal<this, number> {\n    return this._thumbMoved;\n  }\n\n  /**\n   * A signal emitted when the user clicks a step button.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get stepRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._stepRequested;\n  }\n\n  /**\n   * A signal emitted when the user clicks the scroll track.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get pageRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._pageRequested;\n  }\n\n  /**\n   * Get the orientation of the scroll bar.\n   */\n  get orientation(): ScrollBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the scroll bar.\n   */\n  set orientation(value: ScrollBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making changes.\n    this._releaseMouse();\n\n    // Update the internal orientation.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the current value of the scroll bar.\n   */\n  get value(): number {\n    return this._value;\n  }\n\n  /**\n   * Set the current value of the scroll bar.\n   *\n   * #### Notes\n   * The value will be clamped to the range `[0, maximum]`.\n   */\n  set value(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Do nothing if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size is the amount of visible content in the scrolled\n   * region, expressed in data units. It determines the size of the\n   * scroll bar thumb.\n   */\n  get page(): number {\n    return this._page;\n  }\n\n  /**\n   * Set the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size will be clamped to the range `[0, Infinity]`.\n   */\n  set page(value: number) {\n    // Clamp the page size to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._page === value) {\n      return;\n    }\n\n    // Update the internal page size.\n    this._page = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the maximum value of the scroll bar.\n   */\n  get maximum(): number {\n    return this._maximum;\n  }\n\n  /**\n   * Set the maximum value of the scroll bar.\n   *\n   * #### Notes\n   * The max size will be clamped to the range `[0, Infinity]`.\n   */\n  set maximum(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._maximum === value) {\n      return;\n    }\n\n    // Update the internal values.\n    this._maximum = value;\n\n    // Clamp the current value to the new range.\n    this._value = Math.min(this._value, value);\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * The scroll bar decrement button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get decrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar increment button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get incrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[1] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar track node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get trackNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-track'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar thumb node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get thumbNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-thumb'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Handle the DOM events for the scroll bar.\n   *\n   * @param event - The DOM event sent to the scroll bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the scroll bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A method invoked on a 'before-attach' message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('mousedown', this);\n    this.update();\n  }\n\n  /**\n   * A method invoked on an 'after-detach' message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('mousedown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A method invoked on an 'update-request' message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    // Convert the value and page into percentages.\n    let value = (this._value * 100) / this._maximum;\n    let page = (this._page * 100) / (this._page + this._maximum);\n\n    // Clamp the value and page to the relevant range.\n    value = Math.max(0, Math.min(value, 100));\n    page = Math.max(0, Math.min(page, 100));\n\n    // Fetch the thumb style.\n    let thumbStyle = this.thumbNode.style;\n\n    // Update the thumb style for the current orientation.\n    if (this._orientation === 'horizontal') {\n      thumbStyle.top = '';\n      thumbStyle.height = '';\n      thumbStyle.left = `${value}%`;\n      thumbStyle.width = `${page}%`;\n      thumbStyle.transform = `translate(${-value}%, 0%)`;\n    } else {\n      thumbStyle.left = '';\n      thumbStyle.width = '';\n      thumbStyle.top = `${value}%`;\n      thumbStyle.height = `${page}%`;\n      thumbStyle.transform = `translate(0%, ${-value}%)`;\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the scroll bar.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Ignore anything except the `Escape` key.\n    if (event.keyCode !== 27) {\n      return;\n    }\n\n    // Fetch the previous scroll value.\n    let value = this._pressData ? this._pressData.value : -1;\n\n    // Release the mouse.\n    this._releaseMouse();\n\n    // Restore the old scroll value if possible.\n    if (value !== -1) {\n      this._moveThumb(value);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the scroll bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse press.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Send an activate request to the scroll bar. This can be\n    // used by message hooks to activate something relevant.\n    this.activate();\n\n    // Do nothing if the mouse is already captured.\n    if (this._pressData) {\n      return;\n    }\n\n    // Find the pressed scroll bar part.\n    let part = Private.findPart(this, event.target as HTMLElement);\n\n    // Do nothing if the part is not of interest.\n    if (!part) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Override the mouse cursor.\n    let override = Drag.overrideCursor('default');\n\n    // Set up the press data.\n    this._pressData = {\n      part,\n      override,\n      delta: -1,\n      value: -1,\n      mouseX: event.clientX,\n      mouseY: event.clientY\n    };\n\n    // Add the extra event listeners.\n    document.addEventListener('mousemove', this, true);\n    document.addEventListener('mouseup', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Handle a thumb press.\n    if (part === 'thumb') {\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Update the press data delta for the current orientation.\n      if (this._orientation === 'horizontal') {\n        this._pressData.delta = event.clientX - thumbRect.left;\n      } else {\n        this._pressData.delta = event.clientY - thumbRect.top;\n      }\n\n      // Add the active class to the thumb node.\n      thumbNode.classList.add('lm-mod-active');\n\n      // Store the current value in the press data.\n      this._pressData.value = this._value;\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track press.\n    if (part === 'track') {\n      // Fetch the client rect for the thumb.\n      let thumbRect = this.thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n\n    // Handle a decrement button press.\n    if (part === 'decrement') {\n      // Add the active class to the decrement node.\n      this.decrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button press.\n    if (part === 'increment') {\n      // Add the active class to the increment node.\n      this.incrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the scroll bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Update the mouse position.\n    this._pressData.mouseX = event.clientX;\n    this._pressData.mouseY = event.clientY;\n\n    // Bail if the thumb is not being dragged.\n    if (this._pressData.part !== 'thumb') {\n      return;\n    }\n\n    // Get the client rect for the thumb and track.\n    let thumbRect = this.thumbNode.getBoundingClientRect();\n    let trackRect = this.trackNode.getBoundingClientRect();\n\n    // Fetch the scroll geometry based on the orientation.\n    let trackPos: number;\n    let trackSpan: number;\n    if (this._orientation === 'horizontal') {\n      trackPos = event.clientX - trackRect.left - this._pressData.delta;\n      trackSpan = trackRect.width - thumbRect.width;\n    } else {\n      trackPos = event.clientY - trackRect.top - this._pressData.delta;\n      trackSpan = trackRect.height - thumbRect.height;\n    }\n\n    // Compute the desired value from the scroll geometry.\n    let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n    // Move the thumb to the computed value.\n    this._moveThumb(value);\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the scroll bar.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse release.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse and restore the node states.\n   */\n  private _releaseMouse(): void {\n    // Bail if there is no press data.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the repeat timer.\n    clearTimeout(this._repeatTimer);\n    this._repeatTimer = -1;\n\n    // Clear the press data.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra event listeners.\n    document.removeEventListener('mousemove', this, true);\n    document.removeEventListener('mouseup', this, true);\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('contextmenu', this, true);\n\n    // Remove the active classes from the nodes.\n    this.thumbNode.classList.remove('lm-mod-active');\n    this.decrementNode.classList.remove('lm-mod-active');\n    this.incrementNode.classList.remove('lm-mod-active');\n  }\n\n  /**\n   * Move the thumb to the specified position.\n   */\n  private _moveThumb(value: number): void {\n    // Clamp the value to the allowed range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Bail if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update of the scroll bar.\n    this.update();\n\n    // Emit the thumb moved signal.\n    this._thumbMoved.emit(value);\n  }\n\n  /**\n   * A timeout callback for repeating the mouse press.\n   */\n  private _onRepeat = () => {\n    // Clear the repeat timer id.\n    this._repeatTimer = -1;\n\n    // Bail if the mouse has been released.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Look up the part that was pressed.\n    let part = this._pressData.part;\n\n    // Bail if the thumb was pressed.\n    if (part === 'thumb') {\n      return;\n    }\n\n    // Schedule the timer for another repeat.\n    this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n    // Get the current mouse position.\n    let mouseX = this._pressData.mouseX;\n    let mouseY = this._pressData.mouseY;\n\n    // Handle a decrement button repeat.\n    if (part === 'decrement') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button repeat.\n    if (part === 'increment') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track repeat.\n    if (part === 'track') {\n      // Bail if the mouse is not over the track.\n      if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Bail if the mouse is over the thumb.\n      if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n  };\n\n  private _value = 0;\n  private _page = 10;\n  private _maximum = 100;\n  private _repeatTimer = -1;\n  private _orientation: ScrollBar.Orientation;\n  private _pressData: Private.IPressData | null = null;\n  private _thumbMoved = new Signal<this, number>(this);\n  private _stepRequested = new Signal<this, 'decrement' | 'increment'>(this);\n  private _pageRequested = new Signal<this, 'decrement' | 'increment'>(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n  /**\n   * A type alias for a scroll bar orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * An options object for creating a scroll bar.\n   */\n  export interface IOptions {\n    /**\n     * The orientation of the scroll bar.\n     *\n     * The default is `'vertical'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The value for the scroll bar.\n     *\n     * The default is `0`.\n     */\n    value?: number;\n\n    /**\n     * The page size for the scroll bar.\n     *\n     * The default is `10`.\n     */\n    page?: number;\n\n    /**\n     * The maximum value for the scroll bar.\n     *\n     * The default is `100`.\n     */\n    maximum?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A type alias for the parts of a scroll bar.\n   */\n  export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The scroll bar part which was pressed.\n     */\n    part: ScrollBarPart;\n\n    /**\n     * The offset of the press in thumb coordinates, or -1.\n     */\n    delta: number;\n\n    /**\n     * The scroll value at the time the thumb was pressed, or -1.\n     */\n    value: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n\n    /**\n     * The current X position of the mouse.\n     */\n    mouseX: number;\n\n    /**\n     * The current Y position of the mouse.\n     */\n    mouseY: number;\n  }\n\n  /**\n   * Create the DOM node for a scroll bar.\n   */\n  export function createNode(): HTMLElement {\n    let node = document.createElement('div');\n    let decrement = document.createElement('div');\n    let increment = document.createElement('div');\n    let track = document.createElement('div');\n    let thumb = document.createElement('div');\n    decrement.className = 'lm-ScrollBar-button';\n    increment.className = 'lm-ScrollBar-button';\n    decrement.dataset['action'] = 'decrement';\n    increment.dataset['action'] = 'increment';\n    track.className = 'lm-ScrollBar-track';\n    thumb.className = 'lm-ScrollBar-thumb';\n    track.appendChild(thumb);\n    node.appendChild(decrement);\n    node.appendChild(track);\n    node.appendChild(increment);\n    return node;\n  }\n\n  /**\n   * Find the scroll bar part which contains the given target.\n   */\n  export function findPart(\n    scrollBar: ScrollBar,\n    target: HTMLElement\n  ): ScrollBarPart | null {\n    // Test the thumb.\n    if (scrollBar.thumbNode.contains(target)) {\n      return 'thumb';\n    }\n\n    // Test the track.\n    if (scrollBar.trackNode.contains(target)) {\n      return 'track';\n    }\n\n    // Test the decrement button.\n    if (scrollBar.decrementNode.contains(target)) {\n      return 'decrement';\n    }\n\n    // Test the increment button.\n    if (scrollBar.incrementNode.contains(target)) {\n      return 'increment';\n    }\n\n    // Indicate no match.\n    return null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this._widget) {\n      let widget = this._widget;\n      this._widget = null;\n      widget.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * Get the child widget for the layout.\n   */\n  get widget(): Widget | null {\n    return this._widget;\n  }\n\n  /**\n   * Set the child widget for the layout.\n   *\n   * #### Notes\n   * Setting the child widget will cause the old child widget to be\n   * automatically disposed. If that is not desired, set the parent\n   * of the old child to `null` before assigning a new child.\n   */\n  set widget(widget: Widget | null) {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    if (widget) {\n      widget.parent = this.parent;\n    }\n\n    // Bail early if the widget does not change.\n    if (this._widget === widget) {\n      return;\n    }\n\n    // Dispose of the old child widget.\n    if (this._widget) {\n      this._widget.dispose();\n    }\n\n    // Update the internal widget.\n    this._widget = widget;\n\n    // Attach the new child widget if needed.\n    if (this.parent && widget) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    if (this._widget) {\n      yield this._widget;\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Bail early if the widget does not exist in the layout.\n    if (this._widget !== widget) {\n      return;\n    }\n\n    // Clear the internal widget.\n    this._widget = null;\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n  constructor(options: StackedLayout.IOptions = {}) {\n    super(options);\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    if (this.widgets.length > 1) {\n      this.widgets.forEach(w => {\n        w.hiddenMode = this._hiddenMode;\n      });\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (\n      this._hiddenMode === Widget.HiddenMode.Scale &&\n      this._items.length > 0\n    ) {\n      if (this._items.length === 1) {\n        this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n      }\n      widget.hiddenMode = Widget.HiddenMode.Scale;\n    } else {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n    }\n\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Reset the z-index for the widget.\n    item!.widget.node.style.zIndex = '';\n\n    // Reset the hidden mode for the widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n\n      // Reset the hidden mode for the first widget if necessary.\n      if (this._items.length === 1) {\n        this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n      }\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the computed minimum size.\n      minW = Math.max(minW, item.minWidth);\n      minH = Math.max(minH, item.minHeight);\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the widget stacking order and layout geometry.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Set the z-index for the widget.\n      item.widget.node.style.zIndex = `${i}`;\n\n      // Update the item geometry.\n      item.update(left, top, width, height);\n    }\n  }\n\n  private _dirty = false;\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n  /**\n   * An options object for initializing a stacked layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n  /**\n   * Construct a new stacked panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: StackedPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-StackedPanel');\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as StackedLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as StackedLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when a widget is removed from a stacked panel.\n   */\n  get widgetRemoved(): ISignal<this, Widget> {\n    return this._widgetRemoved;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-StackedPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-StackedPanel-child');\n    this._widgetRemoved.emit(msg.child);\n  }\n\n  private _widgetRemoved = new Signal<this, Widget>(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n  /**\n   * An options object for creating a stacked panel.\n   */\n  export interface IOptions {\n    /**\n     * The stacked layout to use for the stacked panel.\n     *\n     * The default is a new `StackedLayout`.\n     */\n    layout?: StackedLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a stacked layout for the given panel options.\n   */\n  export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n    return options.layout || new StackedLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n  /**\n   * Construct a new tab panel.\n   *\n   * @param options - The options for initializing the tab panel.\n   */\n  constructor(options: TabPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-TabPanel');\n\n    // Create the tab bar and stacked panel.\n    this.tabBar = new TabBar<Widget>(options);\n    this.tabBar.addClass('lm-TabPanel-tabBar');\n    this.stackedPanel = new StackedPanel();\n    this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n    // Connect the tab bar signal handlers.\n    this.tabBar.tabMoved.connect(this._onTabMoved, this);\n    this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    this.tabBar.tabActivateRequested.connect(\n      this._onTabActivateRequested,\n      this\n    );\n    this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Connect the stacked panel signal handlers.\n    this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n    // Get the data related to the placement.\n    this._tabPlacement = options.tabPlacement || 'top';\n    let direction = Private.directionFromPlacement(this._tabPlacement);\n    let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = this._tabPlacement;\n\n    // Create the box layout.\n    let layout = new BoxLayout({ direction, spacing: 0 });\n\n    // Set the stretch factors for the child widgets.\n    BoxLayout.setStretch(this.tabBar, 0);\n    BoxLayout.setStretch(this.stackedPanel, 1);\n\n    // Add the child widgets to the layout.\n    layout.addWidget(this.tabBar);\n    layout.addWidget(this.stackedPanel);\n\n    // Install the layout on the tab panel.\n    this.layout = layout;\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabPanel.ICurrentChangedArgs> {\n    return this._currentChanged;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this.tabBar.currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the index is out of range, it will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    this.tabBar.currentIndex = value;\n  }\n\n  /**\n   * Get the currently selected widget.\n   *\n   * #### Notes\n   * This will be `null` if there is no selected tab.\n   */\n  get currentWidget(): Widget | null {\n    let title = this.tabBar.currentTitle;\n    return title ? title.owner : null;\n  }\n\n  /**\n   * Set the currently selected widget.\n   *\n   * #### Notes\n   * If the widget is not in the panel, it will be set to `null`.\n   */\n  set currentWidget(value: Widget | null) {\n    this.tabBar.currentTitle = value ? value.title : null;\n  }\n\n  /**\n   * Get the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  get tabsMovable(): boolean {\n    return this.tabBar.tabsMovable;\n  }\n\n  /**\n   * Set the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  set tabsMovable(value: boolean) {\n    this.tabBar.tabsMovable = value;\n  }\n\n  /**\n   * Get the whether the add button is enabled.\n   *\n   */\n  get addButtonEnabled(): boolean {\n    return this.tabBar.addButtonEnabled;\n  }\n\n  /**\n   * Set the whether the add button is enabled.\n   *\n   */\n  set addButtonEnabled(value: boolean) {\n    this.tabBar.addButtonEnabled = value;\n  }\n\n  /**\n   * Get the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  get tabPlacement(): TabPanel.TabPlacement {\n    return this._tabPlacement;\n  }\n\n  /**\n   * Set the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  set tabPlacement(value: TabPanel.TabPlacement) {\n    // Bail if the placement does not change.\n    if (this._tabPlacement === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._tabPlacement = value;\n\n    // Get the values related to the placement.\n    let direction = Private.directionFromPlacement(value);\n    let orientation = Private.orientationFromPlacement(value);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = value;\n\n    // Update the layout direction.\n    (this.layout as BoxLayout).direction = direction;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The tab bar used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the tab bar directly can lead to undefined behavior.\n   */\n  readonly tabBar: TabBar<Widget>;\n\n  /**\n   * The stacked panel used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the panel directly can lead to undefined behavior.\n   */\n  readonly stackedPanel: StackedPanel;\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this.stackedPanel.widgets;\n  }\n\n  /**\n   * Add a widget to the end of the tab panel.\n   *\n   * @param widget - The widget to add to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this.widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the tab panel at a specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (widget !== this.currentWidget) {\n      widget.hide();\n    }\n    this.stackedPanel.insertWidget(index, widget);\n    this.tabBar.insertTab(index, widget.title);\n\n    widget.node.setAttribute('role', 'tabpanel');\n\n    let renderer = this.tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  /**\n   * Handle the `currentChanged` signal from the tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n    // Extract the widgets from the titles.\n    let previousWidget = previousTitle ? previousTitle.owner : null;\n    let currentWidget = currentTitle ? currentTitle.owner : null;\n\n    // Hide the previous widget.\n    if (previousWidget) {\n      previousWidget.hide();\n    }\n\n    // Show the current widget.\n    if (currentWidget) {\n      currentWidget.show();\n    }\n\n    // Emit the `currentChanged` signal for the tab panel.\n    this._currentChanged.emit({\n      previousIndex,\n      previousWidget,\n      currentIndex,\n      currentWidget\n    });\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n  }\n\n  /**\n   * Handle the `tabAddRequested` signal from the tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>, args: void): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from the tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from the tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from the tab bar.\n   */\n  private _onTabMoved(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabMovedArgs<Widget>\n  ): void {\n    this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n  }\n\n  /**\n   * Handle the `widgetRemoved` signal from the stacked panel.\n   */\n  private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n    this.tabBar.removeTab(widget.title);\n  }\n\n  private _tabPlacement: TabPanel.TabPlacement;\n  private _currentChanged = new Signal<this, TabPanel.ICurrentChangedArgs>(\n    this\n  );\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n  /**\n   * A type alias for tab placement in a tab bar.\n   */\n  export type TabPlacement =\n    | /**\n     * The tabs are placed as a row above the content.\n     */\n    'top'\n\n    /**\n     * The tabs are placed as a column to the left of the content.\n     */\n    | 'left'\n\n    /**\n     * The tabs are placed as a column to the right of the content.\n     */\n    | 'right'\n\n    /**\n     * The tabs are placed as a row below the content.\n     */\n    | 'bottom';\n\n  /**\n   * An options object for initializing a tab panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the tab panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether the button to add new tabs is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The placement of the tab bar relative to the content.\n     *\n     * The default is `'top'`.\n     */\n    tabPlacement?: TabPlacement;\n\n    /**\n     * The renderer for the panel's tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: TabBar.IRenderer<Widget>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs {\n    /**\n     * The previously selected index.\n     */\n    previousIndex: number;\n\n    /**\n     * The previously selected widget.\n     */\n    previousWidget: Widget | null;\n\n    /**\n     * The currently selected index.\n     */\n    currentIndex: number;\n\n    /**\n     * The currently selected widget.\n     */\n    currentWidget: Widget | null;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Convert a tab placement to tab bar orientation.\n   */\n  export function orientationFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): TabBar.Orientation {\n    return placementToOrientationMap[plc];\n  }\n\n  /**\n   * Convert a tab placement to a box layout direction.\n   */\n  export function directionFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): BoxLayout.Direction {\n    return placementToDirectionMap[plc];\n  }\n\n  /**\n   * A mapping of tab placement to tab bar orientation.\n   */\n  const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n    top: 'horizontal',\n    left: 'vertical',\n    right: 'vertical',\n    bottom: 'horizontal'\n  };\n\n  /**\n   * A mapping of tab placement to box layout direction.\n   */\n  const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n    top: 'top-to-bottom',\n    left: 'left-to-right',\n    right: 'right-to-left',\n    bottom: 'bottom-to-top'\n  };\n}\n"],"names":["BoxEngine","Signal","Private","MessageLoop","AttachedProperty","Message","ConflatableMessage","ElementExt","ArrayExt","Utils","UUID","Drag","VirtualDOM","h","StringExt","CommandRegistry","JSONExt","getKeyboardLayout","DisposableDelegate","Selector","empty","find","Platform","MimeData","max"],"mappings":";;;;;;IAAA;IACA;IACA;;;;;;IAM+E;IAE/E;;;;;;;;;IASG;UACU,QAAQ,CAAA;IAArB,IAAA,WAAA,GAAA;IACE;;;;;;;;;;;;IAYG;YACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;IAEb;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;IAEnB;;;;;;;;;;;;;;;IAeG;YACH,IAAO,CAAA,OAAA,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G;IACH,IAAU,OAAO,CAsChB;IAtCD,CAAA,UAAU,OAAO,EAAA;IACf;;IAEG;QACH,SAAgB,wBAAwB,CACtC,GAA0B,EAAA;IAE1B,QAAA,OAAO,yBAAyB,CAAC,GAAG,CAAC,CAAC;SACvC;IAJe,IAAA,OAAA,CAAA,wBAAwB,2BAIvC,CAAA;IAED;;IAEG;QACH,SAAgB,sBAAsB,CACpC,GAA0B,EAAA;IAE1B,QAAA,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;SACrC;IAJe,IAAA,OAAA,CAAA,sBAAsB,yBAIrC,CAAA;IAED;;IAEG;IACH,IAAA,MAAM,yBAAyB,GAA0C;IACvE,QAAA,GAAG,EAAE,YAAY;IACjB,QAAA,IAAI,EAAE,UAAU;IAChB,QAAA,KAAK,EAAE,UAAU;IACjB,QAAA,MAAM,EAAE,YAAY;SACrB,CAAC;IAEF;;IAEG;IACH,IAAA,MAAM,uBAAuB,GAA2C;IACtE,QAAA,GAAG,EAAE,eAAe;IACpB,QAAA,IAAI,EAAE,eAAe;IACrB,QAAA,KAAK,EAAE,eAAe;IACtB,QAAA,MAAM,EAAE,eAAe;SACxB,CAAC;IACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/node_modules/@lumino/widgets/dist/index.min.js b/node_modules/@lumino/widgets/dist/index.min.js
index d4c625f..94ead69 100644
--- a/node_modules/@lumino/widgets/dist/index.min.js
+++ b/node_modules/@lumino/widgets/dist/index.min.js
@@ -1,2 +1,2 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lumino/algorithm"),require("@lumino/coreutils"),require("@lumino/domutils"),require("@lumino/messaging"),require("@lumino/properties"),require("@lumino/signaling"),require("@lumino/dragdrop"),require("@lumino/commands"),require("@lumino/virtualdom"),require("@lumino/disposable"),require("@lumino/keyboard")):"function"==typeof define&&define.amd?define(["exports","@lumino/algorithm","@lumino/coreutils","@lumino/domutils","@lumino/messaging","@lumino/properties","@lumino/signaling","@lumino/dragdrop","@lumino/commands","@lumino/virtualdom","@lumino/disposable","@lumino/keyboard"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lumino_widgets={},e.lumino_algorithm,e.lumino_coreutils,e.lumino_domutils,e.lumino_messaging,e.lumino_properties,e.lumino_signaling,e.lumino_dragdrop,e.lumino_commands,e.lumino_virtualdom,e.lumino_disposable,e.lumino_keyboard)}(this,(function(e,t,i,s,n,a,r,o,h,d,l,c){"use strict";class u{constructor(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}}var m,g,p,_;e.BoxEngine=void 0,(m=e.BoxEngine||(e.BoxEngine={})).calc=function(e,t){let i=e.length;if(0===i)return t;let s=0,n=0,a=0,r=0,o=0;for(let t=0;t<i;++t){let i=e[t],h=i.minSize,d=i.maxSize,l=i.sizeHint;i.done=!1,i.size=Math.max(h,Math.min(l,d)),a+=i.size,s+=h,n+=d,i.stretch>0&&(r+=i.stretch,o++)}if(t===a)return 0;if(t<=s){for(let t=0;t<i;++t){let i=e[t];i.size=i.minSize}return t-s}if(t>=n){for(let t=0;t<i;++t){let i=e[t];i.size=i.maxSize}return t-n}let h=.01,d=i;if(t<a){let s=a-t;for(;o>0&&s>h;){let t=s,n=r;for(let a=0;a<i;++a){let i=e[a];if(i.done||0===i.stretch)continue;let h=i.stretch*t/n;i.size-h<=i.minSize?(s-=i.size-i.minSize,r-=i.stretch,i.size=i.minSize,i.done=!0,d--,o--):(s-=h,i.size-=h)}}for(;d>0&&s>h;){let t=s/d;for(let n=0;n<i;++n){let i=e[n];i.done||(i.size-t<=i.minSize?(s-=i.size-i.minSize,i.size=i.minSize,i.done=!0,d--):(s-=t,i.size-=t))}}}else{let s=t-a;for(;o>0&&s>h;){let t=s,n=r;for(let a=0;a<i;++a){let i=e[a];if(i.done||0===i.stretch)continue;let h=i.stretch*t/n;i.size+h>=i.maxSize?(s-=i.maxSize-i.size,r-=i.stretch,i.size=i.maxSize,i.done=!0,d--,o--):(s-=h,i.size+=h)}}for(;d>0&&s>h;){let t=s/d;for(let n=0;n<i;++n){let i=e[n];i.done||(i.size+t>=i.maxSize?(s-=i.maxSize-i.size,i.size=i.maxSize,i.done=!0,d--):(s-=t,i.size+=t))}}}return 0},m.adjust=function(e,t,i){0!==e.length&&0!==i&&(i>0?function(e,t,i){let s=0;for(let i=0;i<=t;++i){let t=e[i];s+=t.maxSize-t.size}let n=0;for(let i=t+1,s=e.length;i<s;++i){let t=e[i];n+=t.size-t.minSize}let a=i=Math.min(i,s,n);for(let i=t;i>=0&&a>0;--i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t+1,s=e.length;i<s&&r>0;++i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,i):function(e,t,i){let s=0;for(let i=t+1,n=e.length;i<n;++i){let t=e[i];s+=t.maxSize-t.size}let n=0;for(let i=0;i<=t;++i){let t=e[i];n+=t.size-t.minSize}let a=i=Math.min(i,s,n);for(let i=t+1,s=e.length;i<s&&a>0;++i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t;i>=0&&r>0;--i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,-i))};class f{constructor(e){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new r.Signal(this),this._isDisposed=!1,this.owner=e.owner,void 0!==e.label&&(this._label=e.label),void 0!==e.mnemonic&&(this._mnemonic=e.mnemonic),void 0!==e.icon&&(this._icon=e.icon),void 0!==e.iconClass&&(this._iconClass=e.iconClass),void 0!==e.iconLabel&&(this._iconLabel=e.iconLabel),void 0!==e.caption&&(this._caption=e.caption),void 0!==e.className&&(this._className=e.className),void 0!==e.closable&&(this._closable=e.closable),this._dataset=e.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))}get caption(){return this._caption}set caption(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))}get className(){return this._className}set className(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))}get closable(){return this._closable}set closable(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,r.Signal.clearData(this))}}class b{constructor(e={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new r.Signal(this),this._hiddenMode=b.HiddenMode.Display,this.node=g.createNode(e),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(b.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&b.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),r.Signal.clearData(this),n.MessageLoop.clearData(this),a.AttachedProperty.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(b.Flag.IsDisposed)}get isAttached(){return this.testFlag(b.Flag.IsAttached)}get isHidden(){return this.testFlag(b.Flag.IsHidden)}get isVisible(){let e=this;do{if(e.isHidden||!e.isAttached)return!1;e=e.parent}while(null!=e);return!0}get title(){return g.titleProperty.get(this)}get id(){return this.node.id}set id(e){this.node.id=e}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==b.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-removed",this);n.MessageLoop.sendMessage(this._parent,e)}if(this._parent=e,this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-added",this);n.MessageLoop.sendMessage(this._parent,e)}this.isDisposed||n.MessageLoop.sendMessage(this,b.Msg.ParentChanged)}}get layout(){return this._layout}set layout(e){if(this._layout!==e){if(this.testFlag(b.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(e){for(let t=e;t;t=t._parent)if(t===this)return!0;return!1}hasClass(e){return this.node.classList.contains(e)}addClass(e){this.node.classList.add(e)}removeClass(e){this.node.classList.remove(e)}toggleClass(e,t){return!0===t?(this.node.classList.add(e),!0):!1===t?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)}update(){n.MessageLoop.postMessage(this,b.Msg.UpdateRequest)}fit(){n.MessageLoop.postMessage(this,b.Msg.FitRequest)}activate(){n.MessageLoop.postMessage(this,b.Msg.ActivateRequest)}close(){n.MessageLoop.sendMessage(this,b.Msg.CloseRequest)}show(){if(this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeShow),this.clearFlag(b.Flag.IsHidden),this._toggleHidden(!1),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterShow),this.parent)){let e=new b.ChildMessage("child-shown",this);n.MessageLoop.sendMessage(this.parent,e)}}hide(){if(!this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeHide),this.setFlag(b.Flag.IsHidden),this._toggleHidden(!0),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterHide),this.parent)){let e=new b.ChildMessage("child-hidden",this);n.MessageLoop.sendMessage(this.parent,e)}}setHidden(e){e?this.hide():this.show()}testFlag(e){return 0!=(this._flags&e)}setFlag(e){this._flags|=e}clearFlag(e){this._flags&=~e}processMessage(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(b.Flag.IsVisible),this.setFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(b.Flag.IsVisible),this.clearFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}}notifyLayout(e){this._layout&&this._layout.processParentMessage(e)}onCloseRequest(e){this.parent?this.parent=null:this.isAttached&&b.detach(this)}onResize(e){}onUpdateRequest(e){}onFitRequest(e){}onActivateRequest(e){}onBeforeShow(e){}onAfterShow(e){}onBeforeHide(e){}onAfterHide(e){}onBeforeAttach(e){}onAfterAttach(e){}onBeforeDetach(e){}onAfterDetach(e){}onChildAdded(e){}onChildRemoved(e){}_toggleHidden(e){if(e)switch(this._hiddenMode){case b.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1"}else switch(this._hiddenMode){case b.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex=""}}}!function(e){var t,i,s;(t=e.HiddenMode||(e.HiddenMode={}))[t.Display=0]="Display",t[t.Scale=1]="Scale",t[t.ContentVisibility=2]="ContentVisibility",(i=e.Flag||(e.Flag={}))[i.IsDisposed=1]="IsDisposed",i[i.IsAttached=2]="IsAttached",i[i.IsHidden=4]="IsHidden",i[i.IsVisible=8]="IsVisible",i[i.DisallowLayout=16]="DisallowLayout",(s=e.Msg||(e.Msg={})).BeforeShow=new n.Message("before-show"),s.AfterShow=new n.Message("after-show"),s.BeforeHide=new n.Message("before-hide"),s.AfterHide=new n.Message("after-hide"),s.BeforeAttach=new n.Message("before-attach"),s.AfterAttach=new n.Message("after-attach"),s.BeforeDetach=new n.Message("before-detach"),s.AfterDetach=new n.Message("after-detach"),s.ParentChanged=new n.Message("parent-changed"),s.UpdateRequest=new n.ConflatableMessage("update-request"),s.FitRequest=new n.ConflatableMessage("fit-request"),s.ActivateRequest=new n.ConflatableMessage("activate-request"),s.CloseRequest=new n.ConflatableMessage("close-request");class a extends n.Message{constructor(e,t){super(e),this.child=t}}e.ChildMessage=a;class r extends n.Message{constructor(e,t){super("resize"),this.width=e,this.height=t}}e.ResizeMessage=r,function(e){e.UnknownSize=new e(-1,-1)}(r=e.ResizeMessage||(e.ResizeMessage={})),e.attach=function(t,i,s=null){if(t.parent)throw new Error("Cannot attach a child widget.");if(t.isAttached||t.node.isConnected)throw new Error("Widget is already attached.");if(!i.isConnected)throw new Error("Host is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeAttach),i.insertBefore(t.node,s),n.MessageLoop.sendMessage(t,e.Msg.AfterAttach)},e.detach=function(t){if(t.parent)throw new Error("Cannot detach a child widget.");if(!t.isAttached||!t.node.isConnected)throw new Error("Widget is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeDetach),t.node.parentNode.removeChild(t.node),n.MessageLoop.sendMessage(t,e.Msg.AfterDetach)}}(b||(b={})),function(e){e.titleProperty=new a.AttachedProperty({name:"title",create:e=>new f({owner:e})}),e.createNode=function(e){return e.node||document.createElement(e.tag||"div")}}(g||(g={}));class v{constructor(e={}){this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,r.Signal.clearData(this),a.AttachedProperty.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){let e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}}processParentMessage(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e)}}init(){for(const e of this)e.parent=this.parent}onResize(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onUpdateRequest(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onBeforeAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onBeforeHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onChildRemoved(e){this.removeWidget(e.child)}onFitRequest(e){}onChildShown(e){}onChildHidden(e){}}!function(e){e.getHorizontalAlignment=function(e){return p.horizontalAlignmentProperty.get(e)},e.setHorizontalAlignment=function(e,t){p.horizontalAlignmentProperty.set(e,t)},e.getVerticalAlignment=function(e){return p.verticalAlignmentProperty.get(e)},e.setVerticalAlignment=function(e,t){p.verticalAlignmentProperty.set(e,t)}}(v||(v={}));class x{constructor(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height="",e.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let e=s.ElementExt.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight}update(e,t,i,s){let a=Math.max(this._minWidth,Math.min(i,this._maxWidth)),r=Math.max(this._minHeight,Math.min(s,this._maxHeight));if(a<i)switch(v.getHorizontalAlignment(this.widget)){case"left":break;case"center":e+=(i-a)/2;break;case"right":e+=i-a;break;default:throw"unreachable"}if(r<s)switch(v.getVerticalAlignment(this.widget)){case"top":break;case"center":t+=(s-r)/2;break;case"bottom":t+=s-r;break;default:throw"unreachable"}let o=!1,h=this.widget.node.style;if(this._top!==t&&(this._top=t,h.top=`${t}px`),this._left!==e&&(this._left=e,h.left=`${e}px`),this._width!==a&&(o=!0,this._width=a,h.width=`${a}px`),this._height!==r&&(o=!0,this._height=r,h.height=`${r}px`),o){let e=new b.ResizeMessage(a,r);n.MessageLoop.sendMessage(this.widget,e)}}}!function(e){function t(e){e.parent&&e.parent.layout&&e.parent.update()}e.horizontalAlignmentProperty=new a.AttachedProperty({name:"horizontalAlignment",create:()=>"center",changed:t}),e.verticalAlignmentProperty=new a.AttachedProperty({name:"verticalAlignment",create:()=>"top",changed:t})}(p||(p={}));class M extends v{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(e){this.insertWidget(this._widgets.length,e)}insertWidget(e,i){i.parent=this.parent;let s=this._widgets.indexOf(i),n=Math.max(0,Math.min(e,this._widgets.length));if(-1===s)return t.ArrayExt.insert(this._widgets,n,i),void(this.parent&&this.attachWidget(n,i));n===this._widgets.length&&n--,s!==n&&(t.ArrayExt.move(this._widgets,s,n),this.parent&&this.moveWidget(s,n,i))}removeWidget(e){this.removeWidgetAt(this._widgets.indexOf(e))}removeWidgetAt(e){let i=t.ArrayExt.removeAt(this._widgets,e);i&&this.parent&&this.detachWidget(e,i)}init(){super.init();let e=0;for(const t of this)this.attachWidget(e++,t)}attachWidget(e,t){let i=this.parent.node.children[e];this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeAttach),this.parent.node.insertBefore(t.node,i),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterAttach)}moveWidget(e,t,i){this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach);let s=this.parent.node.children[t];this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,s),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach)}detachWidget(e,t){this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterDetach)}}!function(e){e.clampDimension=function(e){return Math.max(0,Math.floor(e))}}(_||(_={}));var y,w,A,E,C,S,I,z,L,T,D=_;class B extends M{constructor(e){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=e.renderer,void 0!==e.orientation&&(this._orientation=e.orientation),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=_.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.parent&&(this.parent.dataset.orientation=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=_.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map((e=>e.size))}relativeSizes(){return y.normalize(this._sizers.map((e=>e.size)))}setRelativeSizes(e,t=!0){let i=this._sizers.length,s=e.slice(0,i);for(;s.length<i;)s.push(0);let n=y.normalize(s);for(let e=0;e<i;++e){let t=this._sizers[e];t.sizeHint=n[e],t.size=n[e]}this._hasNormedSizes=!0,t&&this.parent&&this.parent.update()}moveHandle(t,i){let s,n=this._handles[t];if(n&&!n.classList.contains("lm-mod-hidden")&&(s="horizontal"===this._orientation?i-n.offsetLeft:i-n.offsetTop,0!==s)){for(let e of this._sizers)e.size>0&&(e.sizeHint=e.size);e.BoxEngine.adjust(this._sizers,t,s),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){let s=new x(i),a=y.createHandle(this.renderer),r=y.averageSize(this._sizers),o=y.createSizer(r);t.ArrayExt.insert(this._items,e,s),t.ArrayExt.insert(this._sizers,e,o),t.ArrayExt.insert(this._handles,e,a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.node.appendChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),t.ArrayExt.move(this._handles,e,i),this.parent.fit()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e),a=t.ArrayExt.removeAt(this._handles,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.node.removeChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}updateItemPosition(e,t,i,s,n,a,r){const o=this._items[e];if(o.isHidden)return;let h=this._handles[e].style;t?(i+=this.widgetOffset,o.update(i,s,r,n),i+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${this._spacing}px`,h.height=`${n}px`):(s+=this.widgetOffset,o.update(i,s,a,r),s+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${a}px`,h.height=`${this._spacing}px`)}_fit(){let e=0,t=-1;for(let i=0,s=this._items.length;i<s;++i)this._items[i].isHidden?this._handles[i].classList.add("lm-mod-hidden"):(this._handles[i].classList.remove("lm-mod-hidden"),t=i,e++);-1!==t&&this._handles[t].classList.add("lm-mod-hidden"),this._fixed=this._spacing*Math.max(0,e-1)+this.widgetOffset*this._items.length;let i="horizontal"===this._orientation,a=i?this._fixed:0,r=i?0:this._fixed;for(let e=0,t=this._items.length;e<t;++e){let t=this._items[e],s=this._sizers[e];s.size>0&&(s.sizeHint=s.size),t.isHidden?(s.minSize=0,s.maxSize=0):(t.fit(),s.stretch=B.getStretch(t.widget),i?(s.minSize=t.minWidth,s.maxSize=t.maxWidth,a+=t.minWidth,r=Math.max(r,t.minHeight)):(s.minSize=t.minHeight,s.maxSize=t.maxHeight,r+=t.minHeight,a=Math.max(a,t.minWidth)))}let o=this._box=s.ElementExt.boxSizing(this.parent.node);a+=o.horizontalSum,r+=o.verticalSum;let h=this.parent.node.style;h.minWidth=`${a}px`,h.minHeight=`${r}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e<t;++e)n+=+!this._items[e].isHidden;if(0===n&&0===this.widgetOffset)return;t<0&&(t=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let a=this._box.paddingTop,r=this._box.paddingLeft,o=t-this._box.horizontalSum,h=i-this._box.verticalSum,d=0,l=0,c="horizontal"===this._orientation;if(n>0){let t;if(t=c?Math.max(0,o-this._fixed):Math.max(0,h-this._fixed),this._hasNormedSizes){for(let e of this._sizers)e.sizeHint*=t;this._hasNormedSizes=!1}let i=e.BoxEngine.calc(this._sizers,t);if(i>0)switch(this._alignment){case"start":break;case"center":d=0,l=i/2;break;case"end":d=0,l=i;break;case"justify":d=i/n,l=0;break;default:throw"unreachable"}}for(let e=0,t=this._items.length;e<t;++e){const t=this._items[e].isHidden?0:this._sizers[e].size+d;this.updateItemPosition(e,c,c?r+l:r,c?a:a+l,h,o,t);const i=this.widgetOffset+(this._handles[e].classList.contains("lm-mod-hidden")?0:this._spacing);c?r+=t+i:a+=t+i}}}!function(e){e.getStretch=function(e){return y.stretchProperty.get(e)},e.setStretch=function(e,t){y.stretchProperty.set(e,t)}}(B||(B={})),function(e){e.stretchProperty=new a.AttachedProperty({name:"stretch",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:function(e){e.parent&&e.parent.layout instanceof B&&e.parent.fit()}}),e.createSizer=function(e){let t=new u;return t.sizeHint=Math.floor(e),t},e.createHandle=function(e){let t=e.createHandle();return t.style.position="absolute",t.style.contain="style",t},e.averageSize=function(e){return e.reduce(((e,t)=>e+t.size),0)/e.length||0},e.normalize=function(e){let t=e.length;if(0===t)return[];let i=e.reduce(((e,t)=>e+Math.abs(t)),0);return 0===i?e.map((e=>1/t)):e.map((e=>e/i))}}(y||(y={}));class k extends B{constructor(e){super({...e,orientation:e.orientation||"vertical"}),this._titles=[],this.titleSpace=e.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(e){e=D.clampDimension(e),this.widgetOffset!==e&&(this.widgetOffset=e,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(e,t){const i=this._titles[e],s=i.classList.contains("lm-mod-expanded"),n=w.createTitle(this.renderer,t.title,s);this._titles[e]=n,this.parent.node.replaceChild(n,i)}insertWidget(e,t){t.id||(t.id=`id-${i.UUID.uuid4()}`),super.insertWidget(e,t)}attachWidget(e,i){const s=w.createTitle(this.renderer,i.title);t.ArrayExt.insert(this._titles,e,s),this.parent.node.appendChild(s),i.node.setAttribute("role","region"),i.node.setAttribute("aria-labelledby",s.id),super.attachWidget(e,i)}moveWidget(e,i,s){t.ArrayExt.move(this._titles,e,i),super.moveWidget(e,i,s)}detachWidget(e,i){const s=t.ArrayExt.removeAt(this._titles,e);this.parent.node.removeChild(s),super.detachWidget(e,i)}updateItemPosition(e,t,i,s,n,a,r){const o=this._titles[e].style;o.top=`${s}px`,o.left=`${i}px`,o.height=`${this.widgetOffset}px`,o.width=t?`${n}px`:`${a}px`,super.updateItemPosition(e,t,i,s,n,a,r)}}!function(e){e.createTitle=function(e,t,i=!0){const s=e.createSectionTitle(t);return s.style.position="absolute",s.style.contain="strict",s.setAttribute("aria-label",`${t.label} Section`),s.setAttribute("aria-expanded",i?"true":"false"),s.setAttribute("aria-controls",t.owner.id),i&&s.classList.add("lm-mod-expanded"),s}}(w||(w={}));class R extends b{constructor(e={}){super(),this.addClass("lm-Panel"),this.layout=A.createLayout(e)}get widgets(){return this.layout.widgets}addWidget(e){this.layout.addWidget(e)}insertWidget(e,t){this.layout.insertWidget(e,t)}}!function(e){e.createLayout=function(e){return e.layout||new M}}(A||(A={}));class N extends R{constructor(e={}){super({layout:E.createLayout(e)}),this._handleMoved=new r.Signal(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(e){this.layout.orientation=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(e,t=!0){this.layout.setRelativeSizes(e,t)}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){e.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(e){e.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(e){this._pressData&&(e.preventDefault(),e.stopPropagation()),27===e.keyCode&&this._releaseMouse()}_evtPointerDown(e){if(0!==e.button)return;let i,s=this.layout,n=t.ArrayExt.findFirstIndex(s.handles,(t=>t.contains(e.target)));if(-1===n)return;e.preventDefault(),e.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let a=s.handles[n],r=a.getBoundingClientRect();i="horizontal"===s.orientation?e.clientX-r.left:e.clientY-r.top;let h=window.getComputedStyle(a),d=o.Drag.overrideCursor(h.cursor);this._pressData={index:n,delta:i,override:d}}_evtPointerMove(e){let t;e.preventDefault(),e.stopPropagation();let i=this.layout,s=this.node.getBoundingClientRect();t="horizontal"===i.orientation?e.clientX-s.left-this._pressData.delta:e.clientY-s.top-this._pressData.delta,i.moveHandle(this._pressData.index,t)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}}!function(e){class t{createHandle(){let e=document.createElement("div");return e.className="lm-SplitPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t,e.getStretch=function(e){return B.getStretch(e)},e.setStretch=function(e,t){B.setStretch(e,t)}}(N||(N={})),function(e){e.createLayout=function(e){return e.layout||new B({renderer:e.renderer||N.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing})}}(E||(E={}));class H extends N{constructor(e={}){super({...e,layout:C.createLayout(e)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new r.Signal(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(e){this.layout.titleSpace=e}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(e){super.addWidget(e),e.title.changed.connect(this._onTitleChanged,this)}collapse(e){const t=this.layout.widgets[e];t&&!t.isHidden&&this._toggleExpansion(e)}expand(e){const t=this.layout.widgets[e];t&&t.isHidden&&this._toggleExpansion(e)}insertWidget(e,t){super.insertWidget(e,t),t.title.changed.connect(this._onTitleChanged,this)}handleEvent(e){switch(super.handleEvent(e),e.type){case"click":this._evtClick(e);break;case"keydown":this._eventKeyDown(e)}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(e)}onAfterDetach(e){super.onAfterDetach(e),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(e){const i=t.ArrayExt.findFirstIndex(this.widgets,(t=>t.contains(e.owner)));i>=0&&(this.layout.updateTitle(i,e.owner),this.update())}_computeWidgetSize(e){const t=this.layout,i=t.widgets[e];if(!i)return;const s=i.isHidden,n=t.absoluteSizes(),a=(s?-1:1)*this.spacing,r=n.reduce(((e,t)=>e+t));let o=[...n];if(s){const t=this._widgetSizesCache.get(i);if(!t)return;o[e]+=t;const s=o.map((e=>e-t>0)).lastIndexOf(!0);-1===s?o.forEach(((i,s)=>{s!==e&&(o[s]-=n[s]/r*(t-a))})):o[s]-=t-a}else{const t=n[e];this._widgetSizesCache.set(i,t),o[e]=0;const s=o.map((e=>e>0)).lastIndexOf(!0);if(-1===s)return;o[s]=n[s]+t+a}return o.map((e=>e/(r+a)))}_evtClick(e){const i=e.target;if(i){const s=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this._toggleExpansion(s))}}_eventKeyDown(e){if(e.defaultPrevented)return;const i=e.target;let s=!1;if(i){const n=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));if(n>=0){const t=e.keyCode.toString();if(e.key.match(/Space|Enter/)||t.match(/13|32/))i.click(),s=!0;else if("horizontal"===this.orientation?e.key.match(/ArrowLeft|ArrowRight/)||t.match(/37|39/):e.key.match(/ArrowUp|ArrowDown/)||t.match(/38|40/)){const i=e.key.match(/ArrowLeft|ArrowUp/)||t.match(/37|38/)?-1:1,a=this.titles.length,r=(n+a+i)%a;this.titles[r].focus(),s=!0}else"End"===e.key||"35"===t?(this.titles[this.titles.length-1].focus(),s=!0):"Home"!==e.key&&"36"!==t||(this.titles[0].focus(),s=!0)}s&&e.preventDefault()}}_toggleExpansion(e){const t=this.titles[e],i=this.layout.widgets[e],s=this._computeWidgetSize(e);s&&this.setRelativeSizes(s,!1),i.isHidden?(t.classList.add("lm-mod-expanded"),t.setAttribute("aria-expanded","true"),i.show()):(t.classList.remove("lm-mod-expanded"),t.setAttribute("aria-expanded","false"),i.hide()),this._expansionToggled.emit(e)}}!function(e){class t extends N.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++t._nInstance}createCollapseIcon(e){return document.createElement("span")}createSectionTitle(e){const t=document.createElement("h3");t.setAttribute("tabindex","0"),t.id=this.createTitleKey(e),t.className=this.titleClassName;for(const i in e.dataset)t.dataset[i]=e.dataset[i];t.appendChild(this.createCollapseIcon(e)).className="lm-AccordionPanel-titleCollapser";const i=t.appendChild(document.createElement("span"));return i.className="lm-AccordionPanel-titleLabel",i.textContent=e.label,i.title=e.caption||e.label,t}createTitleKey(e){let t=this._titleKeys.get(e);return void 0===t&&(t=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(e,t)),t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t}(H||(H={})),function(e){e.createLayout=function(e){return e.layout||new k({renderer:e.renderer||H.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing,titleSpace:e.titleSpace})}}(C||(C={}));class P extends M{constructor(e={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==e.direction&&(this._direction=e.direction),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this.parent&&(this.parent.dataset.direction=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){t.ArrayExt.insert(this._items,e,new x(i)),t.ArrayExt.insert(this._sizers,e,new u),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0;for(let t=0,i=this._items.length;t<i;++t)e+=+!this._items[t].isHidden;this._fixed=this._spacing*Math.max(0,e-1);let t=S.isHorizontal(this._direction),i=t?this._fixed:0,a=t?0:this._fixed;for(let e=0,s=this._items.length;e<s;++e){let s=this._items[e],n=this._sizers[e];s.isHidden?(n.minSize=0,n.maxSize=0):(s.fit(),n.sizeHint=P.getSizeBasis(s.widget),n.stretch=P.getStretch(s.widget),t?(n.minSize=s.minWidth,n.maxSize=s.maxWidth,i+=s.minWidth,a=Math.max(a,s.minHeight)):(n.minSize=s.minHeight,n.maxSize=s.maxHeight,a+=s.minHeight,i=Math.max(i,s.minWidth)))}let r=this._box=s.ElementExt.boxSizing(this.parent.node);i+=r.horizontalSum,a+=r.verticalSum;let o=this.parent.node.style;o.minWidth=`${i}px`,o.minHeight=`${a}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e<t;++e)n+=+!this._items[e].isHidden;if(0===n)return;t<0&&(t=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let a,r=this._box.paddingTop,o=this._box.paddingLeft,h=t-this._box.horizontalSum,d=i-this._box.verticalSum;switch(this._direction){case"left-to-right":a=e.BoxEngine.calc(this._sizers,Math.max(0,h-this._fixed));break;case"top-to-bottom":a=e.BoxEngine.calc(this._sizers,Math.max(0,d-this._fixed));break;case"right-to-left":a=e.BoxEngine.calc(this._sizers,Math.max(0,h-this._fixed)),o+=h;break;case"bottom-to-top":a=e.BoxEngine.calc(this._sizers,Math.max(0,d-this._fixed)),r+=d;break;default:throw"unreachable"}let l=0,c=0;if(a>0)switch(this._alignment){case"start":break;case"center":l=0,c=a/2;break;case"end":l=0,c=a;break;case"justify":l=a/n,c=0;break;default:throw"unreachable"}for(let e=0,t=this._items.length;e<t;++e){let t=this._items[e];if(t.isHidden)continue;let i=this._sizers[e].size;switch(this._direction){case"left-to-right":t.update(o+c,r,i+l,d),o+=i+l+this._spacing;break;case"top-to-bottom":t.update(o,r+c,h,i+l),r+=i+l+this._spacing;break;case"right-to-left":t.update(o-c-i-l,r,i+l,d),o-=i+l+this._spacing;break;case"bottom-to-top":t.update(o,r-c-i-l,h,i+l),r-=i+l+this._spacing;break;default:throw"unreachable"}}}}!function(e){e.getStretch=function(e){return S.stretchProperty.get(e)},e.setStretch=function(e,t){S.stretchProperty.set(e,t)},e.getSizeBasis=function(e){return S.sizeBasisProperty.get(e)},e.setSizeBasis=function(e,t){S.sizeBasisProperty.set(e,t)}}(P||(P={})),function(e){function t(e){e.parent&&e.parent.layout instanceof P&&e.parent.fit()}e.stretchProperty=new a.AttachedProperty({name:"stretch",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.sizeBasisProperty=new a.AttachedProperty({name:"sizeBasis",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.isHorizontal=function(e){return"left-to-right"===e||"right-to-left"===e},e.clampSpacing=function(e){return Math.max(0,Math.floor(e))}}(S||(S={}));class W extends R{constructor(e={}){super({layout:I.createLayout(e)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(e){this.layout.direction=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}onChildAdded(e){e.child.addClass("lm-BoxPanel-child")}onChildRemoved(e){e.child.removeClass("lm-BoxPanel-child")}}!function(e){e.getStretch=function(e){return P.getStretch(e)},e.setStretch=function(e,t){P.setStretch(e,t)},e.getSizeBasis=function(e){return P.getSizeBasis(e)},e.setSizeBasis=function(e,t){P.setSizeBasis(e,t)}}(W||(W={})),function(e){e.createLayout=function(e){return e.layout||new P(e)}}(I||(I={}));class q extends b{constructor(e){super({node:z.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||q.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(e){let t=z.createItem(this.commands,e);return this._items.push(t),this.refresh(),t}addItems(e){const t=e.map((e=>z.createItem(this.commands,e)));return t.forEach((e=>this._items.push(e))),this.refresh(),t}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){t.ArrayExt.removeAt(this._items,e)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){if(this._results=null,""!==this.inputNode.value){this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit"}else{this.node.getElementsByClassName("lm-close-icon")[0].style.display="none"}this.update()}handleEvent(e){switch(e.type){case"click":this._evtClick(e);break;case"keydown":this._evtKeyDown(e);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(e){this.update(),super.onAfterShow(e)}onActivateRequest(e){if(this.isAttached){let e=this.inputNode;e.focus(),e.select()}}onUpdateRequest(e){if(!this.isVisible)return void d.VirtualDOM.render(null,this.contentNode);let i=this.inputNode.value,n=this.contentNode,a=this._results;if(a||(a=this._results=z.search(this._items,i),this._activeIndex=i?t.ArrayExt.findFirstIndex(a,z.canActivate):-1),!i&&0===a.length)return void d.VirtualDOM.render(null,n);if(i&&0===a.length){let e=this.renderer.renderEmptyMessage({query:i});return void d.VirtualDOM.render(e,n)}let r=this.renderer,o=this._activeIndex,h=new Array(a.length);for(let e=0,t=a.length;e<t;++e){let t=a[e];if("header"===t.type){let i=t.indices,s=t.category;h[e]=r.renderHeader({category:s,indices:i})}else{let i=t.item,s=t.indices,n=e===o;h[e]=r.renderItem({item:i,indices:s,active:n})}}if(d.VirtualDOM.render(h,n),o<0||o>=a.length)n.scrollTop=0;else{let e=n.children[o];s.ElementExt.scrollIntoViewIfNeeded(n,e)}}_evtClick(e){if(0!==e.button)return;if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>t.contains(e.target)));-1!==i&&(e.preventDefault(),e.stopPropagation(),this._execute(i))}_evtKeyDown(e){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.keyCode){case 13:e.preventDefault(),e.stopPropagation(),this._execute(this._activeIndex);break;case 38:e.preventDefault(),e.stopPropagation(),this._activatePreviousItem();break;case 40:e.preventDefault(),e.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,i=this._results.length,s=e<i-1?e+1:0,n=0===s?i-1:s-1;this._activeIndex=t.ArrayExt.findFirstIndex(this._results,z.canActivate,s,n),this.update()}_activatePreviousItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,i=this._results.length,s=e<=0?i-1:e-1,n=s===i-1?0:s+1;this._activeIndex=t.ArrayExt.findLastIndex(this._results,z.canActivate,s,n),this.update()}_execute(e){if(!this._results)return;let t=this._results[e];if(t){if("header"===t.type){let e=this.inputNode;return e.value=`${t.category.toLowerCase()} `,e.focus(),void this.refresh()}t.item.isEnabled&&(this.commands.execute(t.item.command,t.item.args),this.inputNode.value="",this.refresh())}}_toggleFocused(){let e=document.activeElement===this.inputNode;this.toggleClass("lm-mod-focused",e)}_onGenericChange(){this.refresh()}}!function(e){class i{renderHeader(e){let t=this.formatHeader(e);return d.h.li({className:"lm-CommandPalette-header"},t)}renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e);return e.item.isToggleable?d.h.li({className:t,dataset:i,role:"menuitemcheckbox","aria-checked":`${e.item.isToggled}`},this.renderItemIcon(e),this.renderItemContent(e),this.renderItemShortcut(e)):d.h.li({className:t,dataset:i,role:"menuitem"},this.renderItemIcon(e),this.renderItemContent(e),this.renderItemShortcut(e))}renderEmptyMessage(e){let t=this.formatEmptyMessage(e);return d.h.li({className:"lm-CommandPalette-emptyMessage"},t)}renderItemIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.item.icon,e.item.iconLabel)}renderItemContent(e){return d.h.div({className:"lm-CommandPalette-itemContent"},this.renderItemLabel(e),this.renderItemCaption(e))}renderItemLabel(e){let t=this.formatItemLabel(e);return d.h.div({className:"lm-CommandPalette-itemLabel"},t)}renderItemCaption(e){let t=this.formatItemCaption(e);return d.h.div({className:"lm-CommandPalette-itemCaption"},t)}renderItemShortcut(e){let t=this.formatItemShortcut(e);return d.h.div({className:"lm-CommandPalette-itemShortcut"},t)}createItemClass(e){let t="lm-CommandPalette-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.active&&(t+=" lm-mod-active");let i=e.item.className;return i&&(t+=` ${i}`),t}createItemDataset(e){return{...e.item.dataset,command:e.item.command}}createIconClass(e){let t="lm-CommandPalette-itemIcon",i=e.item.iconClass;return i?`${t} ${i}`:t}formatHeader(e){return e.indices&&0!==e.indices.length?t.StringExt.highlight(e.category,e.indices,d.h.mark):e.category}formatEmptyMessage(e){return`No commands found that match '${e.query}'`}formatItemShortcut(e){let t=e.item.keyBinding;return t?h.CommandRegistry.formatKeystroke(t.keys):null}formatItemLabel(e){return e.indices&&0!==e.indices.length?t.StringExt.highlight(e.item.label,e.indices,d.h.mark):e.item.label}formatItemCaption(e){return e.item.caption}}e.Renderer=i,e.defaultRenderer=new i}(q||(q={})),function(e){function s(e,i){let s=e.category.toLowerCase(),n=`${s} ${e.label.toLowerCase()}`,a=1/0,r=null,o=/\b\w/g;for(;;){let e=o.exec(n);if(!e)break;let s=t.StringExt.matchSumOfDeltas(n,i,e.index);if(!s)break;s.score<=a&&(a=s.score,r=s.indices)}if(!r||a===1/0)return null;let h=s.length+1,d=t.ArrayExt.lowerBound(r,h,((e,t)=>e-t)),l=r.slice(0,d),c=r.slice(d);for(let e=0,t=c.length;e<t;++e)c[e]-=h;return 0===l.length?{matchType:0,categoryIndices:null,labelIndices:c,score:a,item:e}:0===c.length?{matchType:1,categoryIndices:l,labelIndices:null,score:a,item:e}:{matchType:2,categoryIndices:l,labelIndices:c,score:a,item:e}}function n(e,t){let i=e.matchType-t.matchType;if(0!==i)return i;let s=e.score-t.score;if(0!==s)return s;let n=0,a=0;switch(e.matchType){case 0:n=e.labelIndices[0],a=t.labelIndices[0];break;case 1:case 2:n=e.categoryIndices[0],a=t.categoryIndices[0]}if(n!==a)return n-a;let r=e.item.category.localeCompare(t.item.category);if(0!==r)return r;let o=e.item.rank,h=t.item.rank;return o!==h?o<h?-1:1:e.item.label.localeCompare(t.item.label)}e.createNode=function(){let e=document.createElement("div"),t=document.createElement("div"),i=document.createElement("div"),s=document.createElement("input"),n=document.createElement("ul"),a=document.createElement("button");return t.className="lm-CommandPalette-search",i.className="lm-CommandPalette-wrapper",s.className="lm-CommandPalette-input",a.className="lm-close-icon",n.className="lm-CommandPalette-content",n.setAttribute("role","menu"),s.spellcheck=!1,i.appendChild(s),i.appendChild(a),t.appendChild(i),e.appendChild(t),e.appendChild(n),e},e.createItem=function(e,t){return new a(e,t)},e.search=function(e,t){let i=function(e,t){i=t,t=i.replace(/\s+/g,"").toLowerCase();var i;let n=[];for(let i=0,a=e.length;i<a;++i){let a=e[i];if(!a.isVisible)continue;if(!t){n.push({matchType:3,categoryIndices:null,labelIndices:null,score:0,item:a});continue}let r=s(a,t);r&&(a.isEnabled||(r.score+=1e3),n.push(r))}return n}(e,t);return i.sort(n),function(e){let t=[];for(let i=0,s=e.length;i<s;++i){let{item:s,categoryIndices:n,labelIndices:a}=e[i],r=s.category;0!==i&&r===e[i-1].item.category||t.push({type:"header",category:r,indices:n}),t.push({type:"item",item:s,indices:a})}return t}(i)},e.canActivate=function(e){return"item"===e.type&&e.item.isEnabled};class a{constructor(e,t){this._commands=e,this.category=t.category.trim().replace(/\s+/g," "),this.command=t.command,this.args=t.args||i.JSONExt.emptyObject,this.rank=void 0!==t.rank?t.rank:1/0}get label(){return this._commands.label(this.command,this.args)}get icon(){return this._commands.icon(this.command,this.args)}get iconClass(){return this._commands.iconClass(this.command,this.args)}get iconLabel(){return this._commands.iconLabel(this.command,this.args)}get caption(){return this._commands.caption(this.command,this.args)}get className(){return this._commands.className(this.command,this.args)}get dataset(){return this._commands.dataset(this.command,this.args)}get isEnabled(){return this._commands.isEnabled(this.command,this.args)}get isToggled(){return this._commands.isToggled(this.command,this.args)}get isToggleable(){return this._commands.isToggleable(this.command,this.args)}get isVisible(){return this._commands.isVisible(this.command,this.args)}get keyBinding(){let{command:e,args:s}=this;return t.ArrayExt.findLastValue(this._commands.keyBindings,(t=>t.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}}}(z||(z={}));class F extends b{constructor(e){super({node:L.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new r.Signal(this),this._menuRequested=new r.Signal(this),this.addClass("lm-Menu"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||F.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let e=this;for(;e._parentMenu;)e=e._parentMenu;return e}get leafMenu(){let e=this;for(;e._childMenu;)e=e._childMenu;return e}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(e){this.activeIndex=e?this._items.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._items.length)&&(e=-1),-1===e||L.canActivate(this._items[e])||(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let e=this._items.length,i=this._activeIndex,s=i<e-1?i+1:0,n=0===s?e-1:s-1;this.activeIndex=t.ArrayExt.findFirstIndex(this._items,L.canActivate,s,n)}activatePreviousItem(){let e=this._items.length,i=this._activeIndex,s=i<=0?e-1:i-1,n=s===e-1?0:s+1;this.activeIndex=t.ArrayExt.findLastIndex(this._items,L.canActivate,s,n)}triggerActiveItem(){if(!this.isAttached)return;let e=this.activeItem;if(!e)return;if(this._cancelOpenTimer(),this._cancelCloseTimer(),"submenu"===e.type)return void this._openChildMenu(!0);this.rootMenu.close();let{command:t,args:i}=e;this.commands.isEnabled(t,i)?this.commands.execute(t,i):console.log(`Command '${t}' is disabled.`)}addItem(e){return this.insertItem(this._items.length,e)}insertItem(e,i){this.isAttached&&this.close(),this.activeIndex=-1;let s=Math.max(0,Math.min(e,this._items.length)),n=L.createItem(this,i);return t.ArrayExt.insert(this._items,s,n),this.update(),n}removeItem(e){let t=this._items.indexOf(e);-1!==t&&this.removeItemAt(t)}removeItemAt(e){this.isAttached&&this.close(),this.activeIndex=-1,t.ArrayExt.removeAt(this._items,e)&&this.update()}clearItems(){this.isAttached&&this.close(),this.activeIndex=-1,0!==this._items.length&&(this._items.length=0,this.update())}open(e,t,i={}){var s,n,a;if(this.isAttached)return;let r=i.forceX||!1,o=i.forceY||!1;const h=null!==(s=i.host)&&void 0!==s?s:null,d=null!==(n=i.ref)&&void 0!==n?n:null,l=null!==(a=i.horizontalAlignment)&&void 0!==a?a:"rtl"===document.documentElement.dir?"right":"left";L.openRootMenu(this,e,t,r,o,l,h,d),this.activate()}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mouseup":this._evtMouseUp(e);break;case"mousemove":this._evtMouseMove(e);break;case"mouseenter":this._evtMouseEnter(e);break;case"mouseleave":this._evtMouseLeave(e);break;case"mousedown":this._evtMouseDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mouseup",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseenter",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("contextmenu",this),document.addEventListener("mousedown",this,!0)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mouseup",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseenter",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("contextmenu",this),document.removeEventListener("mousedown",this,!0)}onActivateRequest(e){this.isAttached&&this.node.focus()}onUpdateRequest(e){let t=this._items,i=this.renderer,s=this._activeIndex,n=L.computeCollapsed(t),a=new Array(t.length);for(let e=0,r=t.length;e<r;++e){let r=t[e],o=e===s,h=n[e];a[e]=i.renderItem({item:r,active:o,collapsed:h,onfocus:()=>{this.activeIndex=e}})}d.VirtualDOM.render(a,this.contentNode)}onCloseRequest(e){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let t=this._childMenu;t&&(this._childIndex=-1,this._childMenu=null,t._parentMenu=null,t.close());let i=this._parentMenu;i&&(this._parentMenu=null,i._childIndex=-1,i._childMenu=null,i.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(e)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation();let t=e.keyCode;if(13===t)return void this.triggerActiveItem();if(27===t)return void this.close();if(37===t)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===t)return void this.activatePreviousItem();if(39===t){let e=this.activeItem;return void(e&&"submenu"===e.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next"))}if(40===t)return void this.activateNextItem();let i=c.getKeyboardLayout().keyForKeydownEvent(e);if(!i)return;let s=this._activeIndex+1,n=L.findMnemonic(this._items,i,s);-1===n.index||n.multiple?-1!==n.index?this.activeIndex=n.index:-1!==n.auto&&(this.activeIndex=n.auto):(this.activeIndex=n.index,this.triggerActiveItem())}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this.triggerActiveItem())}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(this.activeIndex=i,i=this.activeIndex,i===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let n=this.activeItem;n&&"submenu"===n.type&&n.submenu&&this._startOpenTimer()}_evtMouseEnter(e){for(let e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex}_evtMouseLeave(e){if(this._cancelOpenTimer(),!this._childMenu)return void(this.activeIndex=-1);let{clientX:t,clientY:i}=e;s.ElementExt.hitTest(this._childMenu.node,t,i)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtMouseDown(e){this._parentMenu||(L.hitTestMenus(this,e.clientX,e.clientY)?(e.preventDefault(),e.stopPropagation()):this.close())}_openChildMenu(e=!1){let t=this.activeItem;if(!t||"submenu"!==t.type||!t.submenu)return void this._closeChildMenu();let i=t.submenu;if(i===this._childMenu)return;F.saveWindowData(),this._closeChildMenu(),this._childMenu=i,this._childIndex=this._activeIndex,i._parentMenu=this,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let s=this.contentNode.children[this._activeIndex];L.openSubmenu(i,s),e&&(i.activeIndex=-1,i.activateNextItem()),i.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout((()=>{this._openTimerID=0,this._openChildMenu()}),L.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((()=>{this._closeTimerID=0,this._closeChildMenu()}),L.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){L.saveWindowData()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,tabindex:"0",onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e),this.renderShortcut(e),this.renderSubmenu(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.item.icon,e.item.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-Menu-itemLabel"},t)}renderShortcut(e){let t=this.formatShortcut(e);return d.h.div({className:"lm-Menu-itemShortcut"},t)}renderSubmenu(e){return d.h.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(e){let t="lm-Menu-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.item.isVisible||(t+=" lm-mod-hidden"),e.active&&(t+=" lm-mod-active"),e.collapsed&&(t+=" lm-mod-collapsed");let i=e.item.className;return i&&(t+=` ${i}`),t}createItemDataset(e){let t,{type:i,command:s,dataset:n}=e.item;return t="command"===i?{...n,type:i,command:s}:{...n,type:i},t}createIconClass(e){let t="lm-Menu-itemIcon",i=e.item.iconClass;return i?`${t} ${i}`:t}createItemARIA(e){let t={};switch(e.item.type){case"separator":t.role="presentation";break;case"submenu":t["aria-haspopup"]="true",e.item.isEnabled||(t["aria-disabled"]="true");break;default:e.item.isEnabled||(t["aria-disabled"]="true"),e.item.isToggled?(t.role="menuitemcheckbox",t["aria-checked"]="true"):t.role="menuitem"}return t}formatLabel(e){let{label:t,mnemonic:i}=e.item;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-Menu-itemMnemonic"},a),n]}formatShortcut(e){let t=e.item.keyBinding;return t?h.CommandRegistry.formatKeystroke(t.keys):null}}e.Renderer=t,e.defaultRenderer=new t}(F||(F={})),function(e){e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3;let a=null,r=0;function o(){return r>0?(r--,a):d()}function h(e){return"separator"!==e.type&&e.isEnabled&&e.isVisible}function d(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}e.saveWindowData=function(){a=d(),r++},e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-Menu-content",e.appendChild(t),t.setAttribute("role","menu"),e.tabIndex=0,e},e.canActivate=h,e.createItem=function(e,t){return new l(e.commands,t)},e.hitTestMenus=function(e,t,i){for(let n=e;n;n=n.childMenu)if(s.ElementExt.hitTest(n.node,t,i))return!0;return!1},e.computeCollapsed=function(e){let i=new Array(e.length);t.ArrayExt.fill(i,!1);let s=0,n=e.length;for(;s<n;++s){let t=e[s];if(t.isVisible){if("separator"!==t.type)break;i[s]=!0}}let a=n-1;for(;a>=0;--a){let t=e[a];if(t.isVisible){if("separator"!==t.type)break;i[a]=!0}}let r=!1;for(;++s<a;){let t=e[s];t.isVisible&&("separator"!==t.type?r=!1:r?i[s]=!0:r=!0)}return i},e.openRootMenu=function(e,t,i,s,a,r,h,d){const l=o();let c=l.pageXOffset,u=l.pageYOffset,m=l.clientWidth,g=l.clientHeight;n.MessageLoop.sendMessage(e,b.Msg.UpdateRequest);let p=g-(a?i:0),_=e.node,f=_.style;f.opacity="0",f.maxHeight=`${p}px`,b.attach(e,h||document.body,d);let{width:v,height:x}=_.getBoundingClientRect();"right"===r&&(t-=v),!s&&t+v>c+m&&(t=c+m-v),!a&&i+x>u+g&&(i>u+g?i=u+g-x:i-=x),f.transform=`translate(${Math.max(0,t)}px, ${Math.max(0,i)}px`,f.opacity="1"},e.openSubmenu=function(t,i){const a=o();let r=a.pageXOffset,h=a.pageYOffset,d=a.clientWidth,l=a.clientHeight;n.MessageLoop.sendMessage(t,b.Msg.UpdateRequest);let c=l,u=t.node,m=u.style;m.opacity="0",m.maxHeight=`${c}px`,b.attach(t,document.body);let{width:g,height:p}=u.getBoundingClientRect(),_=s.ElementExt.boxSizing(t.node),f=i.getBoundingClientRect(),v=f.right-e.SUBMENU_OVERLAP;v+g>r+d&&(v=f.left+e.SUBMENU_OVERLAP-g);let x=f.top-_.borderTop-_.paddingTop;x+p>h+l&&(x=f.bottom+_.borderBottom+_.paddingBottom-p),m.transform=`translate(${Math.max(0,v)}px, ${Math.max(0,x)}px`,m.opacity="1"},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t<o;++t){let d=(t+i)%o,l=e[d];if(!h(l))continue;let c=l.label;if(0===c.length)continue;let u=l.mnemonic;u>=0&&u<c.length?c[u].toUpperCase()===r&&(-1===s?s=d:a=!0):-1===n&&c[0].toUpperCase()===r&&(n=d)}return{index:s,multiple:a,auto:n}};class l{constructor(e,t){this._commands=e,this.type=t.type||"command",this.command=t.command||"",this.args=t.args||i.JSONExt.emptyObject,this.submenu=t.submenu||null}get label(){return"command"===this.type?this._commands.label(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.label:""}get mnemonic(){return"command"===this.type?this._commands.mnemonic(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.mnemonic:-1}get icon(){return"command"===this.type?this._commands.icon(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.icon:void 0}get iconClass(){return"command"===this.type?this._commands.iconClass(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.iconClass:""}get iconLabel(){return"command"===this.type?this._commands.iconLabel(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.iconLabel:""}get caption(){return"command"===this.type?this._commands.caption(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.caption:""}get className(){return"command"===this.type?this._commands.className(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.className:""}get dataset(){return"command"===this.type?this._commands.dataset(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.dataset:{}}get isEnabled(){return"command"===this.type?this._commands.isEnabled(this.command,this.args):"submenu"!==this.type||null!==this.submenu}get isToggled(){return"command"===this.type&&this._commands.isToggled(this.command,this.args)}get isVisible(){return"command"===this.type?this._commands.isVisible(this.command,this.args):"submenu"!==this.type||null!==this.submenu}get keyBinding(){if("command"===this.type){let{command:e,args:s}=this;return t.ArrayExt.findLastValue(this._commands.keyBindings,(t=>t.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}return null}}}(L||(L={}));!function(e){function t(e,t){let i=e.rank,s=t.rank;return i!==s?i<s?-1:1:e.id-t.id}function i(e,i){let n=s.Selector.calculateSpecificity(e.selector),a=s.Selector.calculateSpecificity(i.selector);return n!==a?a-n:t(e,i)}e.createItem=function(e,t){let i=function(e){if(-1!==e.indexOf(","))throw new Error(`Selector cannot contain commas: ${e}`);if(!s.Selector.isValid(e))throw new Error(`Invalid selector: ${e}`);return e}(e.selector),n=void 0!==e.rank?e.rank:1/0;return{...e,selector:i,rank:n,id:t}},e.matchItems=function(e,n,a,r){let o=n.target;if(!o)return null;let h=n.currentTarget;if(!h)return null;if(!h.contains(o)&&(o=document.elementFromPoint(n.clientX,n.clientY),!o||!h.contains(o)))return null;let d=[],l=e.slice();for(;null!==o;){let e=[];for(let t=0,i=l.length;t<i;++t){let i=l[t];i&&(s.Selector.matches(o,i.selector)&&(e.push(i),l[t]=null))}if(0!==e.length&&(a&&e.sort(r?i:t),d.push(...e)),o===h)break;o=o.parentElement}return a||d.sort(r?i:t),d}}(T||(T={}));const O=["ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Home","End"];class $ extends b{constructor(e={}){super({node:V.createNode()}),this._currentIndex=-1,this._titles=[],this._titlesEditable=!1,this._previousTitle=null,this._dragData=null,this._addButtonEnabled=!1,this._tabMoved=new r.Signal(this),this._currentChanged=new r.Signal(this),this._addRequested=new r.Signal(this),this._tabCloseRequested=new r.Signal(this),this._tabDetachRequested=new r.Signal(this),this._tabActivateRequested=new r.Signal(this),this.addClass("lm-TabBar"),this.contentNode.setAttribute("role","tablist"),this.setFlag(b.Flag.DisallowLayout),this._document=e.document||document,this.tabsMovable=e.tabsMovable||!1,this.titlesEditable=e.titlesEditable||!1,this.allowDeselect=e.allowDeselect||!1,this.addButtonEnabled=e.addButtonEnabled||!1,this.insertBehavior=e.insertBehavior||"select-tab-if-needed",this.name=e.name||"",this.orientation=e.orientation||"horizontal",this.removeBehavior=e.removeBehavior||"select-tab-after",this.renderer=e.renderer||$.defaultRenderer}dispose(){this._releaseMouse(),this._titles.length=0,this._previousTitle=null,super.dispose()}get currentChanged(){return this._currentChanged}get tabMoved(){return this._tabMoved}get tabActivateRequested(){return this._tabActivateRequested}get addRequested(){return this._addRequested}get tabCloseRequested(){return this._tabCloseRequested}get tabDetachRequested(){return this._tabDetachRequested}get document(){return this._document}get titlesEditable(){return this._titlesEditable}set titlesEditable(e){this._titlesEditable=e}get currentTitle(){return this._titles[this._currentIndex]||null}set currentTitle(e){this.currentIndex=e?this._titles.indexOf(e):-1}get currentIndex(){return this._currentIndex}set currentIndex(e){if((e<0||e>=this._titles.length)&&(e=-1),this._currentIndex===e)return;let t=this._currentIndex,i=this._titles[t]||null,s=e,n=this._titles[s]||null;this._currentIndex=s,this._previousTitle=i,this.update(),this._currentChanged.emit({previousIndex:t,previousTitle:i,currentIndex:s,currentTitle:n})}get name(){return this._name}set name(e){this._name=e,e?this.contentNode.setAttribute("aria-label",e):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.contentNode.setAttribute("aria-orientation",e))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled!==e&&(this._addButtonEnabled=e,e?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(e){return this.insertTab(this._titles.length,e)}insertTab(e,i){this._releaseMouse();let s=V.asTitle(i),n=this._titles.indexOf(s),a=Math.max(0,Math.min(e,this._titles.length));return-1===n?(t.ArrayExt.insert(this._titles,a,s),s.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(a,s),s):(a===this._titles.length&&a--,n===a||(t.ArrayExt.move(this._titles,n,a),this.update(),this._adjustCurrentForMove(n,a)),s)}removeTab(e){this.removeTabAt(this._titles.indexOf(e))}removeTabAt(e){this._releaseMouse();let i=t.ArrayExt.removeAt(this._titles,e);i&&(i.changed.disconnect(this._onTitleChanged,this),i===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,i))}clearTabs(){if(0===this._titles.length)return;this._releaseMouse();for(let e of this._titles)e.changed.disconnect(this._onTitleChanged,this);let e=this.currentIndex,t=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==e&&this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}releaseMouse(){this._releaseMouse()}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"dblclick":this._evtDblClick(e);break;case"keydown":e.eventPhase===Event.CAPTURING_PHASE?this._evtKeyDownCapturing(e):this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this),this.node.addEventListener("keydown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this.node.removeEventListener("keydown",this),this._releaseMouse()}onUpdateRequest(e){var t;let i=this._titles,s=this.renderer,n=this.currentTitle,a=new Array(i.length);const r=null!==(t=this._getCurrentTabindex())&&void 0!==t?t:this._currentIndex>-1?this._currentIndex:0;for(let e=0,t=i.length;e<t;++e){let o=i[e],h=o===n,d=h?t:t-e-1,l=r===e?0:-1;a[e]=s.renderTab({title:o,current:h,zIndex:d,tabIndex:l})}d.VirtualDOM.render(a,this.contentNode)}_getCurrentTabindex(){let e=null;const t=this.contentNode.querySelector('li[tabindex="0"]');return t?e=[...this.contentNode.children].indexOf(t):this._addButtonEnabled&&"0"===this.addButtonNode.getAttribute("tabindex")&&(e=-1),e}_evtDblClick(e){if(!this.titlesEditable)return;let i=this.contentNode.children,n=t.ArrayExt.findFirstIndex(i,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===n)return;let a=this.titles[n],r=i[n].querySelector(".lm-TabBar-tabLabel");if(r&&r.contains(e.target)){let e=a.label||"",t=r.innerHTML;r.innerHTML="";let i=document.createElement("input");i.classList.add("lm-TabBar-tabInput"),i.value=e,r.appendChild(i);let s=()=>{i.removeEventListener("blur",s),r.innerHTML=t,this.node.addEventListener("keydown",this)};i.addEventListener("dblclick",(e=>e.stopPropagation())),i.addEventListener("blur",s),i.addEventListener("keydown",(e=>{"Enter"===e.key?(""!==i.value&&(a.label=a.caption=i.value),s()):"Escape"===e.key&&s()})),this.node.removeEventListener("keydown",this),i.select(),i.focus(),r.children.length>0&&r.children[0].focus()}}_evtKeyDownCapturing(e){e.eventPhase===Event.CAPTURING_PHASE&&(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&this._releaseMouse())}_evtKeyDown(e){var i,s,n;if("Tab"!==e.key&&e.eventPhase!==Event.CAPTURING_PHASE)if("Enter"===e.key||"Spacebar"===e.key||" "===e.key){const i=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(i))e.preventDefault(),e.stopPropagation(),this._addRequested.emit();else{const s=t.ArrayExt.findFirstIndex(this.contentNode.children,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this.currentIndex=s)}}else if(O.includes(e.key)){const t=[...this.contentNode.children];if(this.addButtonEnabled&&t.push(this.addButtonNode),t.length<=1)return;e.preventDefault(),e.stopPropagation();let a,r=t.indexOf(document.activeElement);-1===r&&(r=this._currentIndex),"ArrowRight"===e.key&&"horizontal"===this._orientation||"ArrowDown"===e.key&&"vertical"===this._orientation?a=null!==(i=t[r+1])&&void 0!==i?i:t[0]:"ArrowLeft"===e.key&&"horizontal"===this._orientation||"ArrowUp"===e.key&&"vertical"===this._orientation?a=null!==(s=t[r-1])&&void 0!==s?s:t[t.length-1]:"Home"===e.key?a=t[0]:"End"===e.key&&(a=t[t.length-1]),a&&(null===(n=t[r])||void 0===n||n.setAttribute("tabindex","-1"),null==a||a.setAttribute("tabindex","0"),a.focus())}}_evtPointerDown(e){if(0!==e.button&&1!==e.button)return;if(this._dragData)return;if(e.target.classList.contains("lm-TabBar-tabInput"))return;let i=this.addButtonEnabled&&this.addButtonNode.contains(e.target),n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===a&&!i)return;if(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[a],index:a,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===e.button||i)return;let r=n[a].querySelector(this.renderer.closeIconSelector);r&&r.contains(e.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===a?this.currentIndex=-1:this.currentIndex=a,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(e){let t=this._dragData;if(!t)return;e.preventDefault(),e.stopPropagation();let i=this.contentNode.children;if(t.dragActive||V.dragExceeded(t,e)){if(!t.dragActive){let e=t.tab.getBoundingClientRect();"horizontal"===this._orientation?(t.tabPos=t.tab.offsetLeft,t.tabSize=e.width,t.tabPressPos=t.pressX-e.left):(t.tabPos=t.tab.offsetTop,t.tabSize=e.height,t.tabPressPos=t.pressY-e.top),t.tabPressOffset={x:t.pressX-e.left,y:t.pressY-e.top},t.tabLayout=V.snapTabLayout(i,this._orientation),t.contentRect=this.contentNode.getBoundingClientRect(),t.override=o.Drag.overrideCursor("default"),t.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),t.dragActive=!0}if(!t.detachRequested&&V.detachExceeded(t,e)){t.detachRequested=!0;let s=t.index,n=e.clientX,a=e.clientY,r=i[s],o=this._titles[s];if(this._tabDetachRequested.emit({index:s,title:o,tab:r,clientX:n,clientY:a,offset:t.tabPressOffset}),t.dragAborted)return}V.layoutTabs(i,t,e,this._orientation)}}_evtPointerUp(e){if(0!==e.button&&1!==e.button)return;const i=this._dragData;if(!i)return;if(e.preventDefault(),e.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!i.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(e.target))return void this._addRequested.emit(void 0);let n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(a!==i.index)return;let r=this._titles[a];if(!r.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:a,title:r});let o=n[a].querySelector(this.renderer.closeIconSelector);return o&&o.contains(e.target)?void this._tabCloseRequested.emit({index:a,title:r}):void 0}if(0!==e.button)return;V.finalizeTabPosition(i,this._orientation),i.tab.classList.remove("lm-mod-dragging");let a=V.parseTransitionDuration(i.tab);setTimeout((()=>{if(i.dragAborted)return;this._dragData=null,V.resetTabPositions(this.contentNode.children,this._orientation),i.override.dispose(),this.removeClass("lm-mod-dragging");let e=i.index,s=i.targetIndex;-1!==s&&e!==s&&(t.ArrayExt.move(this._titles,e,s),this._adjustCurrentForMove(e,s),this._tabMoved.emit({fromIndex:e,toIndex:s,title:this._titles[s]}),n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest))}),a)}_releaseMouse(){let e=this._dragData;e&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),e.dragAborted=!0,e.dragActive&&(V.resetTabPositions(this.contentNode.children,this._orientation),e.override.dispose(),e.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(e,t){let i=this.currentTitle,s=this._currentIndex,n=this.insertBehavior;if("select-tab"===n||"select-tab-if-needed"===n&&-1===s)return this._currentIndex=e,this._previousTitle=i,void this._currentChanged.emit({previousIndex:s,previousTitle:i,currentIndex:e,currentTitle:t});s>=e&&this._currentIndex++}_adjustCurrentForMove(e,t){this._currentIndex===e?this._currentIndex=t:this._currentIndex<e&&this._currentIndex>=t?this._currentIndex++:this._currentIndex>e&&this._currentIndex<=t&&this._currentIndex--}_adjustCurrentForRemove(e,t){let i=this._currentIndex,s=this.removeBehavior;if(i===e){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null});if("select-tab-after"===s)return this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===s)return this._currentIndex=Math.max(0,e-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===s)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}else i>e&&this._currentIndex--}_onTitleChanged(e){this.update()}}var V,U,Y,X,K,G,j,J;!function(e){class t{constructor(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++t._nInstance}renderTab(e){let t=e.title.caption,i=this.createTabKey(e),s=i,n=this.createTabStyle(e),a=this.createTabClass(e),r=this.createTabDataset(e),o=this.createTabARIA(e);return e.title.closable?d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e),this.renderCloseIcon(e)):d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){const{title:t}=e;let i=this.createIconClass(e);return d.h.div({className:i},t.icon,t.iconLabel)}renderLabel(e){return d.h.div({className:"lm-TabBar-tabLabel"},e.title.label)}renderCloseIcon(e){return d.h.div({className:"lm-TabBar-tabCloseIcon"})}createTabKey(e){let t=this._tabKeys.get(e.title);return void 0===t&&(t=`tab-key-${this._uuid}-${this._tabID++}`,this._tabKeys.set(e.title,t)),t}createTabStyle(e){return{zIndex:`${e.zIndex}`}}createTabClass(e){let t="lm-TabBar-tab";return e.title.className&&(t+=` ${e.title.className}`),e.title.closable&&(t+=" lm-mod-closable"),e.current&&(t+=" lm-mod-current"),t}createTabDataset(e){return e.title.dataset}createTabARIA(e){var t;return{role:"tab","aria-selected":e.current.toString(),tabindex:`${null!==(t=e.tabIndex)&&void 0!==t?t:"-1"}`}}createIconClass(e){let t="lm-TabBar-tabIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t,e.addButtonSelector=".lm-TabBar-addButton"}($||($={})),function(e){e.DRAG_THRESHOLD=5,e.DETACH_THRESHOLD=20,e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");t.setAttribute("role","tablist"),t.className="lm-TabBar-content",e.appendChild(t);let i=document.createElement("div");return i.className="lm-TabBar-addButton lm-mod-hidden",i.setAttribute("tabindex","-1"),i.setAttribute("role","button"),e.appendChild(i),e},e.asTitle=function(e){return e instanceof f?e:new f(e)},e.parseTransitionDuration=function(e){let t=window.getComputedStyle(e);return 1e3*(parseFloat(t.transitionDuration)||0)},e.snapTabLayout=function(e,t){let i=new Array(e.length);for(let s=0,n=e.length;s<n;++s){let n=e[s],a=window.getComputedStyle(n);i[s]="horizontal"===t?{pos:n.offsetLeft,size:n.offsetWidth,margin:parseFloat(a.marginLeft)||0}:{pos:n.offsetTop,size:n.offsetHeight,margin:parseFloat(a.marginTop)||0}}return i},e.dragExceeded=function(t,i){let s=Math.abs(i.clientX-t.pressX),n=Math.abs(i.clientY-t.pressY);return s>=e.DRAG_THRESHOLD||n>=e.DRAG_THRESHOLD},e.detachExceeded=function(t,i){let s=t.contentRect;return i.clientX<s.left-e.DETACH_THRESHOLD||i.clientX>=s.right+e.DETACH_THRESHOLD||i.clientY<s.top-e.DETACH_THRESHOLD||i.clientY>=s.bottom+e.DETACH_THRESHOLD},e.layoutTabs=function(e,t,i,s){let n,a,r,o;"horizontal"===s?(n=t.pressX,a=i.clientX-t.contentRect.left,r=i.clientX,o=t.contentRect.width):(n=t.pressY,a=i.clientY-t.contentRect.top,r=i.clientY,o=t.contentRect.height);let h=t.index,d=a-t.tabPressPos,l=d+t.tabSize;for(let i=0,a=e.length;i<a;++i){let a,c=t.tabLayout[i],u=c.pos+(c.size>>1);if(i<t.index&&d<u)a=`${t.tabSize+t.tabLayout[i+1].margin}px`,h=Math.min(h,i);else if(i>t.index&&l>u)a=-t.tabSize-c.margin+"px",h=Math.max(h,i);else if(i===t.index){let e=r-n,i=o-(t.tabPos+t.tabSize);a=`${Math.max(-t.tabPos,Math.min(e,i))}px`}else a="";"horizontal"===s?e[i].style.left=a:e[i].style.top=a}t.targetIndex=h},e.finalizeTabPosition=function(e,t){let i,s;if(i="horizontal"===t?e.contentRect.width:e.contentRect.height,e.targetIndex===e.index)s=0;else if(e.targetIndex>e.index){let t=e.tabLayout[e.targetIndex];s=t.pos+t.size-e.tabSize-e.tabPos}else{s=e.tabLayout[e.targetIndex].pos-e.tabPos}let n=i-(e.tabPos+e.tabSize),a=Math.max(-e.tabPos,Math.min(s,n));"horizontal"===t?e.tab.style.left=`${a}px`:e.tab.style.top=`${a}px`},e.resetTabPositions=function(e,t){for(const i of e)"horizontal"===t?i.style.left="":i.style.top=""}}(V||(V={}));class Q extends v{constructor(e){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=e.renderer,void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing)),this._document=e.document||document,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:b.HiddenMode.Display}dispose(){let e=this[Symbol.iterator]();this._items.forEach((e=>{e.dispose()})),this._box=null,this._root=null,this._items.clear();for(const t of e)t.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){if(this._hiddenMode!==e){this._hiddenMode=e;for(const e of this.tabBars())if(e.titles.length>1)for(const t of e.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():t.empty()}widgets(){return this._root?this._root.iterUserWidgets():t.empty()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():t.empty()}tabBars(){return this._root?this._root.iterTabBars():t.empty()}handles(){return this._root?this._root.iterHandles():t.empty()}moveHandle(t,i,s){let n=t.classList.contains("lm-mod-hidden");if(!this._root||n)return;let a,r=this._root.findSplitNode(t);r&&(a="horizontal"===r.node.orientation?i-t.offsetLeft:s-t.offsetTop,0!==a&&(r.node.holdSizes(),e.BoxEngine.adjust(r.node.sizers,r.index,a),this.parent&&this.parent.update()))}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(e){let t,i=new Set;t=e.main?U.normalizeAreaConfig(e.main,i):null;let s=this.widgets(),n=this.tabBars(),a=this.handles();this._root=null;for(const e of s)i.has(e)||(e.parent=null);for(const e of n)e.dispose();for(const e of a)e.parentNode&&e.parentNode.removeChild(e);for(const e of i)e.parent=this.parent;this._root=t?U.realizeAreaConfig(t,{createTabBar:e=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):null,this.parent&&(i.forEach((e=>{this.attachWidget(e)})),this.parent.fit())}addWidget(e,t={}){let i=t.ref||null,s=t.mode||"tab-after",n=null;if(this._root&&i&&(n=this._root.findTabNode(i)),i&&!n)throw new Error("Reference widget is not in the layout.");switch(e.parent=this.parent,s){case"tab-after":this._insertTab(e,i,n,!0);break;case"tab-before":this._insertTab(e,i,n,!1);break;case"split-top":this._insertSplit(e,i,n,"vertical",!1);break;case"split-left":this._insertSplit(e,i,n,"horizontal",!1);break;case"split-right":this._insertSplit(e,i,n,"horizontal",!0);break;case"split-bottom":this._insertSplit(e,i,n,"vertical",!0);break;case"merge-top":this._insertSplit(e,i,n,"vertical",!1,!0);break;case"merge-left":this._insertSplit(e,i,n,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(e,i,n,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(e,i,n,"vertical",!0,!0)}this.parent&&(this.attachWidget(e),this.parent.fit())}removeWidget(e){this._removeWidget(e),this.parent&&(this.detachWidget(e),this.parent.fit())}hitTestTabAreas(e,t){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let i=this.parent.node.getBoundingClientRect(),n=e-i.left-this._box.borderLeft,a=t-i.top-this._box.borderTop,r=this._root.hitTestTabNodes(n,a);if(!r)return null;let{tabBar:o,top:h,left:d,width:l,height:c}=r,u=this._box.borderLeft+this._box.borderRight,m=this._box.borderTop+this._box.borderBottom;return{tabBar:o,x:n,y:a,top:h,left:d,right:i.width-u-(d+l),bottom:i.height-m-(h+c),width:l,height:c}}init(){super.init();for(const e of this)this.attachWidget(e);for(const e of this.handles())this.parent.node.appendChild(e);this.parent.fit()}attachWidget(e){this.parent.node!==e.node.parentNode&&(this._items.set(e,new x(e)),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach))}detachWidget(e){if(this.parent.node!==e.node.parentNode)return;this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach);let t=this._items.get(e);t&&(this._items.delete(e),t.dispose())}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_removeWidget(e){if(!this._root)return;let i=this._root.findTabNode(e);if(!i)return;if(U.removeAria(e),i.tabBar.titles.length>1){if(i.tabBar.removeTab(e.title),this._hiddenMode===b.HiddenMode.Scale&&1==i.tabBar.titles.length){i.tabBar.titles[0].owner.hiddenMode=b.HiddenMode.Display}return}if(i.tabBar.dispose(),this._root===i)return void(this._root=null);this._root.holdAllSizes();let s=i.parent;i.parent=null;let n=t.ArrayExt.removeFirstOf(s.children,i),a=t.ArrayExt.removeAt(s.handles,n);if(t.ArrayExt.removeAt(s.sizers,n),a.parentNode&&a.parentNode.removeChild(a),s.children.length>1)return void s.syncHandles();let r=s.parent;s.parent=null;let o=s.children[0],h=s.handles[0];if(s.children.length=0,s.handles.length=0,s.sizers.length=0,h.parentNode&&h.parentNode.removeChild(h),this._root===s)return o.parent=null,void(this._root=o);let d=r,l=d.children.indexOf(s);if(o instanceof U.TabLayoutNode)return o.parent=d,void(d.children[l]=o);let c=t.ArrayExt.removeAt(d.handles,l);t.ArrayExt.removeAt(d.children,l),t.ArrayExt.removeAt(d.sizers,l),c.parentNode&&c.parentNode.removeChild(c);for(let e=0,i=o.children.length;e<i;++e){let i=o.children[e],s=o.handles[e],n=o.sizers[e];t.ArrayExt.insert(d.children,l+e,i),t.ArrayExt.insert(d.handles,l+e,s),t.ArrayExt.insert(d.sizers,l+e,n),i.parent=d}o.children.length=0,o.handles.length=0,o.sizers.length=0,o.parent=null,d.syncHandles()}_createTabNode(e){let t=new U.TabLayoutNode(this._createTabBar());return t.tabBar.addTab(e.title),U.addAria(e,t.tabBar),t}_insertTab(e,t,i,s){if(e===t)return;if(!this._root){let t=new U.TabLayoutNode(this._createTabBar());return t.tabBar.addTab(e.title),this._root=t,void U.addAria(e,t.tabBar)}let n;if(i||(i=this._root.findFirstTabNode()),-1===i.tabBar.titles.indexOf(e.title)&&(this._removeWidget(e),e.hide()),n=t?i.tabBar.titles.indexOf(t.title):i.tabBar.currentIndex,this._hiddenMode===b.HiddenMode.Scale)if(0===i.tabBar.titles.length)e.hiddenMode=b.HiddenMode.Display;else if(1==i.tabBar.titles.length){i.tabBar.titles[0].owner.hiddenMode=b.HiddenMode.Scale}else e.hiddenMode=b.HiddenMode.Scale;else e.hiddenMode=this._hiddenMode;i.tabBar.insertTab(n+(s?1:0),e.title),U.addAria(e,i.tabBar)}_insertSplit(e,i,s,n,a,r=!1){if(e===i&&s&&1===s.tabBar.titles.length)return;if(this._removeWidget(e),!this._root)return void(this._root=this._createTabNode(e));if(!s||!s.parent){let i=this._splitRoot(n),r=a?i.children.length:0;i.normalizeSizes();let o=U.createSizer(s?1:U.GOLDEN_RATIO),h=this._createTabNode(e);return t.ArrayExt.insert(i.children,r,h),t.ArrayExt.insert(i.sizers,r,o),t.ArrayExt.insert(i.handles,r,this._createHandle()),h.parent=i,i.normalizeSizes(),void i.syncHandles()}let o=s.parent;if(o.orientation===n){let i=o.children.indexOf(s);if(r){let t=i+(a?1:-1),s=o.children[t];if(s instanceof U.TabLayoutNode)return this._insertTab(e,null,s,!0),void++s.tabBar.currentIndex}o.normalizeSizes();let n=o.sizers[i].sizeHint/=2,h=i+(a?1:0),d=this._createTabNode(e);return t.ArrayExt.insert(o.children,h,d),t.ArrayExt.insert(o.sizers,h,U.createSizer(n)),t.ArrayExt.insert(o.handles,h,this._createHandle()),d.parent=o,void o.syncHandles()}let h=t.ArrayExt.removeFirstOf(o.children,s),d=new U.SplitLayoutNode(n);d.normalized=!0,d.children.push(s),d.sizers.push(U.createSizer(.5)),d.handles.push(this._createHandle()),s.parent=d;let l=a?1:0,c=this._createTabNode(e);t.ArrayExt.insert(d.children,l,c),t.ArrayExt.insert(d.sizers,l,U.createSizer(.5)),t.ArrayExt.insert(d.handles,l,this._createHandle()),c.parent=d,d.syncHandles(),t.ArrayExt.insert(o.children,h,d),d.parent=o}_splitRoot(e){let t=this._root;if(t instanceof U.SplitLayoutNode&&t.orientation===e)return t;let i=this._root=new U.SplitLayoutNode(e);return t&&(i.children.push(t),i.sizers.push(U.createSizer(0)),i.handles.push(this._createHandle()),t.parent=i),i}_fit(){let e=0,t=0;if(this._root){let i=this._root.fit(this._spacing,this._items);e=i.minWidth,t=i.minHeight}let i=this._box=s.ElementExt.boxSizing(this.parent.node);e+=i.horizontalSum,t+=i.verticalSum;let a=this.parent.node.style;a.minWidth=`${e}px`,a.minHeight=`${t}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(e,t){if(this._dirty=!1,!this._root)return;e<0&&(e=this.parent.node.offsetWidth),t<0&&(t=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let i=this._box.paddingTop,n=this._box.paddingLeft,a=e-this._box.horizontalSum,r=t-this._box.verticalSum;this._root.update(i,n,a,r,this._spacing,this._items)}_createTabBar(){let e=this.renderer.createTabBar(this._document);return e.orientation="horizontal",this.parent&&this.attachWidget(e),e}_createHandle(){let e=this.renderer.createHandle(),t=e.style;return t.position="absolute",t.contain="strict",t.top="0",t.left="0",t.width="0",t.height="0",this.parent&&this.parent.node.appendChild(e),e}}!function(t){function i(e){let t=new u;return t.sizeHint=e,t.size=e,t}function s(e,t){let i;return i="tab-area"===e.type?function(e,t){if(0===e.widgets.length)return null;let i=[];for(const s of e.widgets)t.has(s)||(t.add(s),i.push(s));if(0===i.length)return null;let s=e.currentIndex;-1!==s&&(s<0||s>=i.length)&&(s=0);return{type:"tab-area",widgets:i,currentIndex:s}}(e,t):function(e,t){let i=e.orientation,n=[],a=[];for(let r=0,o=e.children.length;r<o;++r){let o=s(e.children[r],t);o&&("tab-area"===o.type||o.orientation!==i?(n.push(o),a.push(Math.abs(e.sizes[r]||0))):(n.push(...o.children),a.push(...o.sizes)))}if(0===n.length)return null;if(1===n.length)return n[0];return{type:"split-area",orientation:i,children:n,sizes:a}}(e,t),i}function n(e,s,o){let h;return h="tab-area"===e.type?function(e,i,s){let n=i.createTabBar(s);for(const i of e.widgets)i.hide(),n.addTab(i.title),t.addAria(i,n);return n.currentIndex=e.currentIndex,new a(n)}(e,s,o):function(e,t,s){let a=new r(e.orientation);return e.children.forEach(((r,o)=>{let h=n(r,t,s),d=i(e.sizes[o]),l=t.createHandle();a.children.push(h),a.handles.push(l),a.sizers.push(d),h.parent=a})),a.syncHandles(),a.normalizeSizes(),a}(e,s,o),h}t.GOLDEN_RATIO=.618,t.createSizer=i,t.normalizeAreaConfig=s,t.realizeAreaConfig=n;class a{constructor(e){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let t=new u,i=new u;t.stretch=0,i.stretch=1,this.tabBar=e,this.sizers=[t,i]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(const e of this.tabBar.titles)yield e.owner}*iterSelectedWidgets(){let e=this.tabBar.currentTitle;e&&(yield e.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(e){return-1!==this.tabBar.titles.indexOf(e.title)?this:null}findSplitNode(e){return null}findFirstTabNode(){return this}hitTestTabNodes(e,t){return e<this._left||e>=this._left+this._width||t<this._top||t>=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map((e=>e.owner)),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(e,t){let i=0,s=0,n=t.get(this.tabBar),a=this.tabBar.currentTitle,r=a?t.get(a.owner):void 0,[o,h]=this.sizers;return n&&n.fit(),r&&r.fit(),n&&!n.isHidden?(i=Math.max(i,n.minWidth),s+=n.minHeight,o.minSize=n.minHeight,o.maxSize=n.maxHeight):(o.minSize=0,o.maxSize=0),r&&!r.isHidden?(i=Math.max(i,r.minWidth),s+=r.minHeight,h.minSize=r.minHeight,h.maxSize=1/0):(h.minSize=0,h.maxSize=1/0),{minWidth:i,minHeight:s,maxWidth:Infinity,maxHeight:Infinity}}update(t,i,s,n,a,r){this._top=i,this._left=t,this._width=s,this._height=n;let o=r.get(this.tabBar),h=this.tabBar.currentTitle,d=h?r.get(h.owner):void 0;if(e.BoxEngine.calc(this.sizers,n),o&&!o.isHidden){let e=this.sizers[0].size;o.update(t,i,s,e),i+=e}if(d&&!d.isHidden){let e=this.sizers[1].size;d.update(t,i,s,e)}}}t.TabLayoutNode=a;class r{constructor(e){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=e}*iterAllWidgets(){for(const e of this.children)yield*e.iterAllWidgets()}*iterUserWidgets(){for(const e of this.children)yield*e.iterUserWidgets()}*iterSelectedWidgets(){for(const e of this.children)yield*e.iterSelectedWidgets()}*iterTabBars(){for(const e of this.children)yield*e.iterTabBars()}*iterHandles(){yield*this.handles;for(const e of this.children)yield*e.iterHandles()}findTabNode(e){for(let t=0,i=this.children.length;t<i;++t){let i=this.children[t].findTabNode(e);if(i)return i}return null}findSplitNode(e){let t=this.handles.indexOf(e);if(-1!==t)return{index:t,node:this};for(let t=0,i=this.children.length;t<i;++t){let i=this.children[t].findSplitNode(e);if(i)return i}return null}findFirstTabNode(){return 0===this.children.length?null:this.children[0].findFirstTabNode()}hitTestTabNodes(e,t){for(let i=0,s=this.children.length;i<s;++i){let s=this.children[i].hitTestTabNodes(e,t);if(s)return s}return null}createConfig(){let e=this.orientation,t=this.createNormalizedSizes();return{type:"split-area",orientation:e,children:this.children.map((e=>e.createConfig())),sizes:t}}syncHandles(){this.handles.forEach(((e,t)=>{e.setAttribute("data-orientation",this.orientation),t===this.handles.length-1?e.classList.add("lm-mod-hidden"):e.classList.remove("lm-mod-hidden")}))}holdSizes(){for(const e of this.sizers)e.sizeHint=e.size}holdAllSizes(){for(const e of this.children)e.holdAllSizes();this.holdSizes()}normalizeSizes(){let e=this.sizers.length;if(0===e)return;this.holdSizes();let t=this.sizers.reduce(((e,t)=>e+t.sizeHint),0);if(0===t)for(const t of this.sizers)t.size=t.sizeHint=1/e;else for(const e of this.sizers)e.size=e.sizeHint/=t;this.normalized=!0}createNormalizedSizes(){let e=this.sizers.length;if(0===e)return[];let t=this.sizers.map((e=>e.size)),i=t.reduce(((e,t)=>e+t),0);if(0===i)for(let i=t.length-1;i>-1;i--)t[i]=1/e;else for(let e=t.length-1;e>-1;e--)t[e]/=i;return t}fit(e,t){let i="horizontal"===this.orientation,s=Math.max(0,this.children.length-1)*e,n=i?s:0,a=i?0:s;for(let s=0,r=this.children.length;s<r;++s){let r=this.children[s].fit(e,t);i?(a=Math.max(a,r.minHeight),n+=r.minWidth,this.sizers[s].minSize=r.minWidth):(n=Math.max(n,r.minWidth),a+=r.minHeight,this.sizers[s].minSize=r.minHeight)}return{minWidth:n,minHeight:a,maxWidth:Infinity,maxHeight:Infinity}}update(t,i,s,n,a,r){let o="horizontal"===this.orientation,h=Math.max(0,this.children.length-1)*a,d=Math.max(0,(o?s:n)-h);if(this.normalized){for(const e of this.sizers)e.sizeHint*=d;this.normalized=!1}e.BoxEngine.calc(this.sizers,d);for(let e=0,h=this.children.length;e<h;++e){let h=this.children[e],d=this.sizers[e].size,l=this.handles[e].style;o?(h.update(t,i,d,n,a,r),t+=d,l.top=`${i}px`,l.left=`${t}px`,l.width=`${a}px`,l.height=`${n}px`,t+=a):(h.update(t,i,s,d,a,r),i+=d,l.top=`${i}px`,l.left=`${t}px`,l.width=`${s}px`,l.height=`${a}px`,i+=a)}}}t.SplitLayoutNode=r,t.addAria=function(e,t){e.node.setAttribute("role","tabpanel");let i=t.renderer;if(i instanceof $.Renderer){let t=i.createTabKey({title:e.title,current:!1,zIndex:0});e.node.setAttribute("aria-labelledby",t)}},t.removeAria=function(e){e.node.removeAttribute("role"),e.node.removeAttribute("aria-labelledby")}}(U||(U={}));class Z extends b{constructor(e={}){super(),this._drag=null,this._tabsMovable=!0,this._tabsConstrained=!1,this._addButtonEnabled=!1,this._pressData=null,this._layoutModified=new r.Signal(this),this._addRequested=new r.Signal(this),this.addClass("lm-DockPanel"),this._document=e.document||document,this._mode=e.mode||"multiple-document",this._renderer=e.renderer||Z.defaultRenderer,this._edges=e.edges||Y.DEFAULT_EDGES,void 0!==e.tabsMovable&&(this._tabsMovable=e.tabsMovable),void 0!==e.tabsConstrained&&(this._tabsConstrained=e.tabsConstrained),void 0!==e.addButtonEnabled&&(this._addButtonEnabled=e.addButtonEnabled),this.dataset.mode=this._mode;let t={createTabBar:()=>this._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new Q({document:this._document,renderer:t,spacing:e.spacing,hiddenMode:e.hiddenMode}),this.overlay=e.overlay||new Z.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get mode(){return this._mode}set mode(e){if(this._mode===e)return;this._mode=e,this.dataset.mode=e;let t=this.layout;switch(e){case"multiple-document":for(const e of t.tabBars())e.show();break;case"single-document":t.restoreLayout(Y.createSingleDocumentConfig(this));break;default:throw"unreachable"}n.MessageLoop.postMessage(this,Y.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(e){this._tabsMovable=e;for(const t of this.tabBars())t.tabsMovable=e}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(e){this._tabsConstrained=e}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled=e;for(const t of this.tabBars())t.addButtonEnabled=e}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(e){let i=t.find(this.tabBars(),(t=>-1!==t.titles.indexOf(e.title)));if(!i)throw new Error("Widget is not contained in the dock panel.");i.currentTitle=e.title}activateWidget(e){this.selectWidget(e),e.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(e){this._mode="multiple-document",this.layout.restoreLayout(e),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}addWidget(e,t={}){"single-document"===this._mode?this.layout.addWidget(e):this.layout.addWidget(e,t),n.MessageLoop.postMessage(this,Y.LayoutModified)}processMessage(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):super.processMessage(e)}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){Y.isGeneratedTabBarProperty.get(e.child)||e.child.addClass("lm-DockPanel-widget")}onChildRemoved(e){Y.isGeneratedTabBarProperty.get(e.child)||(e.child.removeClass("lm-DockPanel-widget"),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtDragEnter(e){e.mimeData.hasData("application/vnd.lumino.widget-factory")&&(e.preventDefault(),e.stopPropagation())}_evtDragLeave(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||(e.stopPropagation(),this.overlay.hide(1))}_evtDragOver(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||"invalid"===this._showOverlay(e.clientX,e.clientY)?e.dropAction="none":(e.stopPropagation(),e.dropAction=e.proposedAction)}_evtDrop(e){if(e.preventDefault(),this.overlay.hide(0),"none"===e.proposedAction)return void(e.dropAction="none");let{clientX:t,clientY:i}=e,{zone:s,target:n}=Y.findDropTarget(this,t,i,this._edges);if(this._tabsConstrained&&e.source!==this||"invalid"===s)return void(e.dropAction="none");let a=e.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof a)return void(e.dropAction="none");let r=a();if(!(r instanceof b))return void(e.dropAction="none");if(r.contains(this))return void(e.dropAction="none");let o=n?Y.getDropRef(n.tabBar):null;switch(s){case"root-all":this.addWidget(r);break;case"root-top":this.addWidget(r,{mode:"split-top"});break;case"root-left":this.addWidget(r,{mode:"split-left"});break;case"root-right":this.addWidget(r,{mode:"split-right"});break;case"root-bottom":this.addWidget(r,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(r,{mode:"tab-after",ref:o});break;case"widget-top":this.addWidget(r,{mode:"split-top",ref:o});break;case"widget-left":this.addWidget(r,{mode:"split-left",ref:o});break;case"widget-right":this.addWidget(r,{mode:"split-right",ref:o});break;case"widget-bottom":this.addWidget(r,{mode:"split-bottom",ref:o});break;default:throw"unreachable"}e.dropAction=e.proposedAction,e.stopPropagation(),this.activateWidget(r)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation(),27===e.keyCode&&(this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtPointerDown(e){if(0!==e.button)return;let i=this.layout,s=e.target,n=t.find(i.handles(),(e=>e.contains(s)));if(!n)return;e.preventDefault(),e.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let a=n.getBoundingClientRect(),r=e.clientX-a.left,h=e.clientY-a.top,d=window.getComputedStyle(n),l=o.Drag.overrideCursor(d.cursor,this._document);this._pressData={handle:n,deltaX:r,deltaY:h,override:l}}_evtPointerMove(e){if(!this._pressData)return;e.preventDefault(),e.stopPropagation();let t=this.node.getBoundingClientRect(),i=e.clientX-t.left-this._pressData.deltaX,s=e.clientY-t.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,i,s)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(e,t){let i,n,a,r,{zone:o,target:h}=Y.findDropTarget(this,e,t,this._edges);if("invalid"===o)return this.overlay.hide(100),o;let d=s.ElementExt.boxSizing(this.node),l=this.node.getBoundingClientRect();switch(o){case"root-all":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"root-top":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=l.height*Y.GOLDEN_RATIO;break;case"root-left":i=d.paddingTop,n=d.paddingLeft,a=l.width*Y.GOLDEN_RATIO,r=d.paddingBottom;break;case"root-right":i=d.paddingTop,n=l.width*Y.GOLDEN_RATIO,a=d.paddingRight,r=d.paddingBottom;break;case"root-bottom":i=l.height*Y.GOLDEN_RATIO,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"widget-all":i=h.top,n=h.left,a=h.right,r=h.bottom;break;case"widget-top":i=h.top,n=h.left,a=h.right,r=h.bottom+h.height/2;break;case"widget-left":i=h.top,n=h.left,a=h.right+h.width/2,r=h.bottom;break;case"widget-right":i=h.top,n=h.left+h.width/2,a=h.right,r=h.bottom;break;case"widget-bottom":i=h.top+h.height/2,n=h.left,a=h.right,r=h.bottom;break;case"widget-tab":{const e=h.tabBar.node.getBoundingClientRect().height;i=h.top,n=h.left,a=h.right,r=h.bottom+h.height-e;break}default:throw"unreachable"}return this.overlay.show({top:i,left:n,right:a,bottom:r}),o}_createTabBar(){let e=this._renderer.createTabBar(this._document);return Y.isGeneratedTabBarProperty.set(e,!0),"single-document"===this._mode&&e.hide(),e.tabsMovable=this._tabsMovable,e.allowDeselect=!1,e.addButtonEnabled=this._addButtonEnabled,e.removeBehavior="select-previous-tab",e.insertBehavior="select-tab-if-needed",e.tabMoved.connect(this._onTabMoved,this),e.currentChanged.connect(this._onCurrentChanged,this),e.tabCloseRequested.connect(this._onTabCloseRequested,this),e.tabDetachRequested.connect(this._onTabDetachRequested,this),e.tabActivateRequested.connect(this._onTabActivateRequested,this),e.addRequested.connect(this._onTabAddRequested,this),e}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){n.MessageLoop.postMessage(this,Y.LayoutModified)}_onCurrentChanged(e,t){let{previousTitle:i,currentTitle:a}=t;i&&i.owner.hide(),a&&a.owner.show(),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}_onTabAddRequested(e){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabDetachRequested(e,t){if(this._drag)return;e.releaseMouse();let{title:s,tab:n,clientX:a,clientY:r,offset:h}=t,d=new i.MimeData;d.setData("application/vnd.lumino.widget-factory",(()=>s.owner));let l=n.cloneNode(!0);h&&(l.style.top=`-${h.y}px`,l.style.left=`-${h.x}px`),this._drag=new o.Drag({document:this._document,mimeData:d,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),n.classList.add("lm-mod-hidden");this._drag.start(a,r).then((()=>{this._drag=null,n.classList.remove("lm-mod-hidden")}))}}!function(e){e.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(e){let t=this.node.style;t.top=`${e.top}px`,t.left=`${e.left}px`,t.right=`${e.right}px`,t.bottom=`${e.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(e){if(!this._hidden)return e<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,void this.node.classList.add("lm-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")}),e)))}};class t{createTabBar(e){let t=new $({document:e});return t.addClass("lm-DockPanel-tabBar"),t}createHandle(){let e=document.createElement("div");return e.className="lm-DockPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t}(Z||(Z={})),function(e){e.GOLDEN_RATIO=.618,e.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},e.LayoutModified=new n.ConflatableMessage("layout-modified"),e.isGeneratedTabBarProperty=new a.AttachedProperty({name:"isGeneratedTabBar",create:()=>!1}),e.createSingleDocumentConfig=function(e){if(e.isEmpty)return{main:null};let t=Array.from(e.widgets()),i=e.selectedWidgets().next().value,s=i?t.indexOf(i):-1;return{main:{type:"tab-area",widgets:t,currentIndex:s}}},e.findDropTarget=function(e,t,i,n){if(!s.ElementExt.hitTest(e.node,t,i))return{zone:"invalid",target:null};let a=e.layout;if(a.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===e.mode){let s=e.node.getBoundingClientRect(),a=t-s.left+1,r=i-s.top+1,o=s.right-t,h=s.bottom-i;switch(Math.min(r,o,h,a)){case r:if(r<n.top)return{zone:"root-top",target:null};break;case o:if(o<n.right)return{zone:"root-right",target:null};break;case h:if(h<n.bottom)return{zone:"root-bottom",target:null};break;case a:if(a<n.left)return{zone:"root-left",target:null};break;default:throw"unreachable"}}let r=a.hitTestTabAreas(t,i);if(!r)return{zone:"invalid",target:null};if("single-document"===e.mode)return{zone:"widget-all",target:r};let o=r.x-r.left+1,h=r.y-r.top+1,d=r.left+r.width-r.x,l=r.top+r.height-r.y;if(h<r.tabBar.node.getBoundingClientRect().height)return{zone:"widget-tab",target:r};let c,u=Math.round(r.width/3),m=Math.round(r.height/3);if(o>u&&d>u&&h>m&&l>m)return{zone:"widget-all",target:r};switch(o/=u,h/=m,d/=u,l/=m,Math.min(o,h,d,l)){case o:c="widget-left";break;case h:c="widget-top";break;case d:c="widget-right";break;case l:c="widget-bottom";break;default:throw"unreachable"}return{zone:c,target:r}},e.getDropRef=function(e){return 0===e.titles.length?null:e.currentTitle?e.currentTitle.owner:e.titles[e.titles.length-1].owner}}(Y||(Y={}));class ee extends v{constructor(e={}){super(e),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new u],this._columnSizers=[new u],this._box=null,void 0!==e.rowCount&&X.reallocSizers(this._rowSizers,e.rowCount),void 0!==e.columnCount&&X.reallocSizers(this._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(this._rowSpacing=X.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(this._columnSpacing=X.clampValue(e.columnSpacing))}dispose(){for(const e of this._items){let t=e.widget;e.dispose(),t.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(e){e!==this.rowCount&&(X.reallocSizers(this._rowSizers,e),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(e){e!==this.columnCount&&(X.reallocSizers(this._columnSizers,e),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){e=X.clampValue(e),this._rowSpacing!==e&&(this._rowSpacing=e,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){e=X.clampValue(e),this._columnSpacing!==e&&(this._columnSpacing=e,this.parent&&this.parent.fit())}rowStretch(e){let t=this._rowSizers[e];return t?t.stretch:-1}setRowStretch(e,t){let i=this._rowSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}columnStretch(e){let t=this._columnSizers[e];return t?t.stretch:-1}setColumnStretch(e,t){let i=this._columnSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(const e of this._items)yield e.widget}addWidget(e){-1===t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e))&&(this._items.push(new x(e)),this.parent&&this.attachWidget(e))}removeWidget(e){let i=t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e));if(-1===i)return;let s=t.ArrayExt.removeAt(this._items,i);this.parent&&this.detachWidget(e),s.dispose()}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach),this.parent.fit()}detachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){for(let e=0,t=this.rowCount;e<t;++e)this._rowSizers[e].minSize=0;for(let e=0,t=this.columnCount;e<t;++e)this._columnSizers[e].minSize=0;let e=this._items.filter((e=>!e.isHidden));for(let t=0,i=e.length;t<i;++t)e[t].fit();let t=this.rowCount-1,i=this.columnCount-1;e.sort(X.rowSpanCmp);for(let i=0,s=e.length;i<s;++i){let s=e[i],n=ee.getCellConfig(s.widget),a=Math.min(n.row,t),r=Math.min(n.row+n.rowSpan-1,t);X.distributeMin(this._rowSizers,a,r,s.minHeight)}e.sort(X.columnSpanCmp);for(let t=0,s=e.length;t<s;++t){let s=e[t],n=ee.getCellConfig(s.widget),a=Math.min(n.column,i),r=Math.min(n.column+n.columnSpan-1,i);X.distributeMin(this._columnSizers,a,r,s.minWidth)}if("set-no-constraint"===this.fitPolicy)return void n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest);let a=t*this._rowSpacing,r=i*this._columnSpacing;for(let e=0,t=this.rowCount;e<t;++e)a+=this._rowSizers[e].minSize;for(let e=0,t=this.columnCount;e<t;++e)r+=this._columnSizers[e].minSize;let o=this._box=s.ElementExt.boxSizing(this.parent.node);r+=o.horizontalSum,a+=o.verticalSum;let h=this.parent.node.style;h.minWidth=`${r}px`,h.minHeight=`${a}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1,t<0&&(t=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let n=this._box.paddingTop,a=this._box.paddingLeft,r=t-this._box.horizontalSum,o=i-this._box.verticalSum,h=this.rowCount-1,d=this.columnCount-1,l=h*this._rowSpacing,c=d*this._columnSpacing;e.BoxEngine.calc(this._rowSizers,Math.max(0,o-l)),e.BoxEngine.calc(this._columnSizers,Math.max(0,r-c));for(let e=0,t=n,i=this.rowCount;e<i;++e)this._rowStarts[e]=t,t+=this._rowSizers[e].size+this._rowSpacing;for(let e=0,t=a,i=this.columnCount;e<i;++e)this._columnStarts[e]=t,t+=this._columnSizers[e].size+this._columnSpacing;for(let e=0,t=this._items.length;e<t;++e){let t=this._items[e];if(t.isHidden)continue;let i=ee.getCellConfig(t.widget),s=Math.min(i.row,h),n=Math.min(i.column,d),a=Math.min(i.row+i.rowSpan-1,h),r=Math.min(i.column+i.columnSpan-1,d),o=this._columnStarts[n],l=this._rowStarts[s],c=this._columnStarts[r]+this._columnSizers[r].size-o,u=this._rowStarts[a]+this._rowSizers[a].size-l;t.update(o,l,c,u)}}}!function(e){e.getCellConfig=function(e){return X.cellConfigProperty.get(e)},e.setCellConfig=function(e,t){X.cellConfigProperty.set(e,X.normalizeConfig(t))}}(ee||(ee={})),function(e){e.cellConfigProperty=new a.AttachedProperty({name:"cellConfig",create:()=>({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(e){e.parent&&e.parent.layout instanceof ee&&e.parent.fit()}}),e.normalizeConfig=function(e){return{row:Math.max(0,Math.floor(e.row||0)),column:Math.max(0,Math.floor(e.column||0)),rowSpan:Math.max(1,Math.floor(e.rowSpan||0)),columnSpan:Math.max(1,Math.floor(e.columnSpan||0))}},e.clampValue=function(e){return Math.max(0,Math.floor(e))},e.rowSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.rowSpan-n.rowSpan},e.columnSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.columnSpan-n.columnSpan},e.reallocSizers=function(e,t){for(t=Math.max(1,Math.floor(t));e.length<t;)e.push(new u);e.length>t&&(e.length=t)},e.distributeMin=function(e,t,i,s){if(i<t)return;if(t===i){let i=e[t];return void(i.minSize=Math.max(i.minSize,s))}let n=0;for(let s=t;s<=i;++s)n+=e[s].minSize;if(n>=s)return;let a=(s-n)/(i-t+1);for(let s=t;s<=i;++s)e[s].minSize+=a}}(X||(X={}));class te extends b{constructor(e={}){super({node:K.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(b.Flag.DisallowLayout),this.renderer=e.renderer||te.defaultRenderer,this._forceItemsPosition=e.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=e.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(e){this.activeIndex=e?this._menus.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._menus.length)&&(e=-1),e>-1&&0===this._menus[e].items.length&&(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(e,t=!0){this.insertMenu(this._menus.length,e,t)}insertMenu(e,i,s=!0){this._closeChildMenu();let n=this._menus.indexOf(i),a=Math.max(0,Math.min(e,this._menus.length));if(-1===n)return t.ArrayExt.insert(this._menus,a,i),i.addClass("lm-MenuBar-menu"),i.aboutToClose.connect(this._onMenuAboutToClose,this),i.menuRequested.connect(this._onMenuMenuRequested,this),i.title.changed.connect(this._onTitleChanged,this),void(s&&this.update());a===this._menus.length&&a--,n!==a&&(t.ArrayExt.move(this._menus,n,a),s&&this.update())}removeMenu(e,t=!0){this.removeMenuAt(this._menus.indexOf(e),t)}removeMenuAt(e,i=!0){this._closeChildMenu();let s=t.ArrayExt.removeAt(this._menus,e);s&&(s.aboutToClose.disconnect(this._onMenuAboutToClose,this),s.menuRequested.disconnect(this._onMenuMenuRequested,this),s.title.changed.disconnect(this._onTitleChanged,this),s.removeClass("lm-MenuBar-menu"),i&&this.update())}clearMenus(){if(0!==this._menus.length){this._closeChildMenu();for(let e of this._menus)e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":case"mouseleave":this._evtMouseMove(e);break;case"focusout":this._evtFocusOut(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(e){this.isAttached&&this._focusItemAt(0)}onResize(e){this.update(),super.onResize(e)}onUpdateRequest(e){var t;let i=this._menus,s=this.renderer,n=this._activeIndex,a=this._tabFocusIndex>=0&&this._tabFocusIndex<i.length?this._tabFocusIndex:0,r=this._overflowIndex>-1?this._overflowIndex:i.length,o=0,l=!1;r=null!==this._overflowMenu?r-1:r;let c=new Array(r);for(let e=0;e<r;++e)c[e]=s.renderItem({title:i[e].title,active:e===n,tabbable:e===a,disabled:0===i[e].items.length,onfocus:()=>{this._tabFocusIndex=e,this.activeIndex=e}}),o+=this._menuItemSizes[e],i[e].title.label===this._overflowMenuOptions.title&&(l=!0,r--);if(this._overflowMenuOptions.isVisible)if(this._overflowIndex>-1&&!l){if(null===this._overflowMenu){const e=null!==(t=this._overflowMenuOptions.title)&&void 0!==t?t:"...";this._overflowMenu=new F({commands:new h.CommandRegistry}),this._overflowMenu.title.label=e,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let e=i.length-2;e>=r;e--){const t=this.menus[e];t.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:t}),this.removeMenu(t,!1)}c[r]=s.renderItem({title:this._overflowMenu.title,active:r===n&&0!==i[r].items.length,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}else if(null!==this._overflowMenu){let e=this._overflowMenu.items,t=this.node.offsetWidth,n=this._overflowMenu.items.length;for(let h=0;h<n;++h){let n=i.length-1-h;if(t-o>this._menuItemSizes[n]){let t=e[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(r,t,!1),c[r]=s.renderItem({title:t.title,active:!1,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),c.pop(),this._overflowMenu=null,this._overflowIndex=-1)}d.VirtualDOM.render(c,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;const e=this.contentNode.childNodes;let t=this.node.offsetWidth,i=0,s=-1,n=e.length;if(0==this._menuItemSizes.length)for(let a=0;a<n;a++){let n=e[a];i+=n.offsetWidth,this._menuItemSizes.push(n.offsetWidth),i>t&&-1===s&&(s=a)}else for(let e=0;e<this._menuItemSizes.length;e++)if(i+=this._menuItemSizes[e],i>t){s=e;break}this._overflowIndex=s}_evtKeyDown(e){let t=e.keyCode;if(9===t)return void(this.activeIndex=-1);if(e.preventDefault(),e.stopPropagation(),13===t||32===t||38===t||40===t){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;return void this.openActiveMenu()}if(27===t)return this._closeChildMenu(),void this._focusItemAt(this.activeIndex);if(37===t||39===t){let e=37===t?-1:1,i=this._tabFocusIndex+e,s=this._menus.length;for(let t=0;t<s;t++){let n=(s+i+e*t)%s;if(this._menus[n].items.length)return void this._focusItemAt(n)}return}let i=c.getKeyboardLayout().keyForKeydownEvent(e);if(!i)return;let s=this._activeIndex+1,n=K.findMnemonic(this._menus,i,s);-1===n.index||n.multiple?-1!==n.index?(this.activeIndex=n.index,this._focusItemAt(this.activeIndex)):-1!==n.auto&&(this.activeIndex=n.auto,this._focusItemAt(this.activeIndex)):(this.activeIndex=n.index,this.openActiveMenu())}_evtMouseDown(e){if(!s.ElementExt.hitTest(this.node,e.clientX,e.clientY))return;e.stopPropagation(),e.stopImmediatePropagation();let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1!==i){if(0===e.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=i;else{e.preventDefault();const t=this._positionForMenu(i);F.saveWindowData(),this.activeIndex=i,this._openChildMenu(t)}}else this._closeChildMenu()}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(-1===i&&this._childMenu)return;const n=i>=0&&this._childMenu?this._positionForMenu(i):null;F.saveWindowData(),this.activeIndex=i,n&&this._openChildMenu(n)}_positionForMenu(e){let t=this.contentNode.children[e],{left:i,bottom:s}=t.getBoundingClientRect();return{top:s,left:i}}_evtFocusOut(e){this._childMenu||this.node.contains(e.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(e){const t=this.contentNode.childNodes[e];t&&t.focus()}_openChildMenu(e={}){let t=this.activeMenu;if(!t)return void this._closeChildMenu();let i=this._childMenu;if(i===t)return;this._childMenu=t,i?i.close():document.addEventListener("mousedown",this,!0),this._tabFocusIndex=this.activeIndex,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let{left:s,top:a}=e;void 0!==s&&void 0!==a||({left:s,top:a}=this._positionForMenu(this._activeIndex)),i||this.addClass("lm-mod-active"),t.items.length>0&&t.open(s,a,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0);let e=this._childMenu;this._childMenu=null,e.close(),this.activeIndex=-1}_onMenuAboutToClose(e){e===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(e,t){if(e!==this._childMenu)return;let i=this._activeIndex,s=this._menus.length;switch(t){case"next":this.activeIndex=i===s-1?0:i+1;break;case"previous":this.activeIndex=0===i?s-1:i-1}this.openActiveMenu()}_onTitleChanged(){this.update()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,...e.disabled?{}:{tabindex:e.tabbable?"0":"-1"},onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.title.icon,e.title.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-MenuBar-itemLabel"},t)}createItemClass(e){let t="lm-MenuBar-item";return e.title.className&&(t+=` ${e.title.className}`),e.active&&!e.disabled&&(t+=" lm-mod-active"),t}createItemDataset(e){return e.title.dataset}createItemARIA(e){return{role:"menuitem","aria-haspopup":"true","aria-disabled":e.disabled?"true":"false"}}createIconClass(e){let t="lm-MenuBar-itemIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}formatLabel(e){let{label:t,mnemonic:i}=e.title;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-MenuBar-itemMnemonic"},a),n]}}e.Renderer=t,e.defaultRenderer=new t}(te||(te={})),function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-MenuBar-content",e.appendChild(t),t.setAttribute("role","menubar"),e},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t<o;++t){let h=(t+i)%o,d=e[h].title;if(0===d.label.length)continue;let l=d.mnemonic;l>=0&&l<d.label.length?d.label[l].toUpperCase()===r&&(-1===s?s=h:a=!0):-1===n&&d.label[0].toUpperCase()===r&&(n=h)}return{index:s,multiple:a,auto:n}}}(K||(K={}));!function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("div"),i=document.createElement("div"),s=document.createElement("div"),n=document.createElement("div");return t.className="lm-ScrollBar-button",i.className="lm-ScrollBar-button",t.dataset.action="decrement",i.dataset.action="increment",s.className="lm-ScrollBar-track",n.className="lm-ScrollBar-thumb",s.appendChild(n),e.appendChild(t),e.appendChild(s),e.appendChild(i),e},e.findPart=function(e,t){return e.thumbNode.contains(t)?"thumb":e.trackNode.contains(t)?"track":e.decrementNode.contains(t)?"decrement":e.incrementNode.contains(t)?"increment":null}}(G||(G={}));class ie extends v{constructor(){super(...arguments),this._widget=null}dispose(){if(this._widget){let e=this._widget;this._widget=null,e.dispose()}super.dispose()}get widget(){return this._widget}set widget(e){e&&(e.parent=this.parent),this._widget!==e&&(this._widget&&this._widget.dispose(),this._widget=e,this.parent&&e&&this.attachWidget(e))}*[Symbol.iterator](){this._widget&&(yield this._widget)}removeWidget(e){this._widget===e&&(this._widget=null,this.parent&&this.detachWidget(e))}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach)}detachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach)}}class se extends M{constructor(e={}){super(e),this._dirty=!1,this._items=[],this._box=null,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:b.HiddenMode.Display}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this._hiddenMode=e,this.widgets.length>1&&this.widgets.forEach((e=>{e.hiddenMode=this._hiddenMode})))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(e,i){this._hiddenMode===b.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=b.HiddenMode.Scale),i.hiddenMode=b.HiddenMode.Scale):i.hiddenMode=b.HiddenMode.Display,t.ArrayExt.insert(this._items,e,new x(i)),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.widget.node.style.zIndex="",this._hiddenMode===b.HiddenMode.Scale&&(i.hiddenMode=b.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=b.HiddenMode.Display)),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0,t=0;for(let i=0,s=this._items.length;i<s;++i){let s=this._items[i];s.isHidden||(s.fit(),e=Math.max(e,s.minWidth),t=Math.max(t,s.minHeight))}let i=this._box=s.ElementExt.boxSizing(this.parent.node);e+=i.horizontalSum,t+=i.verticalSum;let a=this.parent.node.style;a.minWidth=`${e}px`,a.minHeight=`${t}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(e,t){this._dirty=!1;let i=0;for(let e=0,t=this._items.length;e<t;++e)i+=+!this._items[e].isHidden;if(0===i)return;e<0&&(e=this.parent.node.offsetWidth),t<0&&(t=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let n=this._box.paddingTop,a=this._box.paddingLeft,r=e-this._box.horizontalSum,o=t-this._box.verticalSum;for(let e=0,t=this._items.length;e<t;++e){let t=this._items[e];t.isHidden||(t.widget.node.style.zIndex=`${e}`,t.update(a,n,r,o))}}}class ne extends R{constructor(e={}){super({layout:j.createLayout(e)}),this._widgetRemoved=new r.Signal(this),this.addClass("lm-StackedPanel")}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get widgetRemoved(){return this._widgetRemoved}onChildAdded(e){e.child.addClass("lm-StackedPanel-child")}onChildRemoved(e){e.child.removeClass("lm-StackedPanel-child"),this._widgetRemoved.emit(e.child)}}!function(e){e.createLayout=function(e){return e.layout||new se}}(j||(j={}));!function(e){e.orientationFromPlacement=function(e){return t[e]},e.directionFromPlacement=function(e){return i[e]};const t={top:"horizontal",left:"vertical",right:"vertical",bottom:"horizontal"},i={top:"top-to-bottom",left:"left-to-right",right:"right-to-left",bottom:"bottom-to-top"}}(J||(J={})),e.AccordionLayout=k,e.AccordionPanel=H,e.BoxLayout=P,e.BoxPanel=W,e.BoxSizer=u,e.CommandPalette=q,e.ContextMenu=class{constructor(e){this._groupByTarget=!0,this._idTick=0,this._items=[],this._sortBySelector=!0;const{groupByTarget:t,sortBySelector:i,...s}=e;this.menu=new F(s),this._groupByTarget=!1!==t,this._sortBySelector=!1!==i}addItem(e){let i=T.createItem(e,this._idTick++);return this._items.push(i),new l.DisposableDelegate((()=>{t.ArrayExt.removeFirstOf(this._items,i)}))}open(e){if(F.saveWindowData(),this.menu.clearItems(),0===this._items.length)return!1;let t=T.matchItems(this._items,e,this._groupByTarget,this._sortBySelector);if(!t||0===t.length)return!1;for(const e of t)this.menu.addItem(e);return this.menu.open(e.clientX,e.clientY),!0}},e.DockLayout=Q,e.DockPanel=Z,e.FocusTracker=class{constructor(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new r.Signal(this),this._currentChanged=new r.Signal(this)}dispose(){if(!(this._counter<0)){this._counter=-1,r.Signal.clearData(this);for(const e of this._widgets)e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0);this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0}}get currentChanged(){return this._currentChanged}get activeChanged(){return this._activeChanged}get isDisposed(){return this._counter<0}get currentWidget(){return this._currentWidget}get activeWidget(){return this._activeWidget}get widgets(){return this._widgets}focusNumber(e){let t=this._numbers.get(e);return void 0===t?-1:t}has(e){return this._numbers.has(e)}add(e){if(this._numbers.has(e))return;let t=e.node.contains(document.activeElement),i=t?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,i),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),t&&this._setWidgets(e,e)}remove(e){if(!this._numbers.has(e))return;if(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),t.ArrayExt.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget!==e)return;let i=this._widgets.filter((e=>-1!==this._numbers.get(e))),s=t.max(i,((e,t)=>this._numbers.get(e)-this._numbers.get(t)))||null;this._setWidgets(s,null)}handleEvent(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e)}}_setWidgets(e,t){let i=this._currentWidget;this._currentWidget=e;let s=this._activeWidget;this._activeWidget=t,i!==e&&this._currentChanged.emit({oldValue:i,newValue:e}),s!==t&&this._activeChanged.emit({oldValue:s,newValue:t})}_evtFocus(e){let t=this._nodes.get(e.currentTarget);t!==this._currentWidget&&this._numbers.set(t,this._counter++),this._setWidgets(t,t)}_evtBlur(e){let i=this._nodes.get(e.currentTarget),s=e.relatedTarget;s&&(i.node.contains(s)||t.find(this._widgets,(e=>e.node.contains(s))))||this._setWidgets(this._currentWidget,null)}_onWidgetDisposed(e){this.remove(e)}},e.GridLayout=ee,e.Layout=v,e.LayoutItem=x,e.Menu=F,e.MenuBar=te,e.Panel=R,e.PanelLayout=M,e.ScrollBar=class extends b{constructor(e={}){super({node:G.createNode()}),this._onRepeat=()=>{if(this._repeatTimer=-1,!this._pressData)return;let e=this._pressData.part;if("thumb"===e)return;this._repeatTimer=window.setTimeout(this._onRepeat,20);let t=this._pressData.mouseX,i=this._pressData.mouseY;if("decrement"!==e)if("increment"!==e){if("track"===e){if(!s.ElementExt.hitTest(this.trackNode,t,i))return;let e=this.thumbNode;if(s.ElementExt.hitTest(e,t,i))return;let n,a=e.getBoundingClientRect();return n="horizontal"===this._orientation?t<a.left?"decrement":"increment":i<a.top?"decrement":"increment",void this._pageRequested.emit(n)}}else{if(!s.ElementExt.hitTest(this.incrementNode,t,i))return;this._stepRequested.emit("increment")}else{if(!s.ElementExt.hitTest(this.decrementNode,t,i))return;this._stepRequested.emit("decrement")}},this._value=0,this._page=10,this._maximum=100,this._repeatTimer=-1,this._pressData=null,this._thumbMoved=new r.Signal(this),this._stepRequested=new r.Signal(this),this._pageRequested=new r.Signal(this),this.addClass("lm-ScrollBar"),this.setFlag(b.Flag.DisallowLayout),this._orientation=e.orientation||"vertical",this.dataset.orientation=this._orientation,void 0!==e.maximum&&(this._maximum=Math.max(0,e.maximum)),void 0!==e.page&&(this._page=Math.max(0,e.page)),void 0!==e.value&&(this._value=Math.max(0,Math.min(e.value,this._maximum)))}get thumbMoved(){return this._thumbMoved}get stepRequested(){return this._stepRequested}get pageRequested(){return this._pageRequested}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.update())}get value(){return this._value}set value(e){e=Math.max(0,Math.min(e,this._maximum)),this._value!==e&&(this._value=e,this.update())}get page(){return this._page}set page(e){e=Math.max(0,e),this._page!==e&&(this._page=e,this.update())}get maximum(){return this._maximum}set maximum(e){e=Math.max(0,e),this._maximum!==e&&(this._maximum=e,this._value=Math.min(this._value,e),this.update())}get decrementNode(){return this.node.getElementsByClassName("lm-ScrollBar-button")[0]}get incrementNode(){return this.node.getElementsByClassName("lm-ScrollBar-button")[1]}get trackNode(){return this.node.getElementsByClassName("lm-ScrollBar-track")[0]}get thumbNode(){return this.node.getElementsByClassName("lm-ScrollBar-thumb")[0]}handleEvent(e){switch(e.type){case"mousedown":this._evtMouseDown(e);break;case"mousemove":this._evtMouseMove(e);break;case"mouseup":this._evtMouseUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("mousedown",this),this.update()}onAfterDetach(e){this.node.removeEventListener("mousedown",this),this._releaseMouse()}onUpdateRequest(e){let t=100*this._value/this._maximum,i=100*this._page/(this._page+this._maximum);t=Math.max(0,Math.min(t,100)),i=Math.max(0,Math.min(i,100));let s=this.thumbNode.style;"horizontal"===this._orientation?(s.top="",s.height="",s.left=`${t}%`,s.width=`${i}%`,s.transform=`translate(${-t}%, 0%)`):(s.left="",s.width="",s.top=`${t}%`,s.height=`${i}%`,s.transform=`translate(0%, ${-t}%)`)}_evtKeyDown(e){if(e.preventDefault(),e.stopPropagation(),27!==e.keyCode)return;let t=this._pressData?this._pressData.value:-1;this._releaseMouse(),-1!==t&&this._moveThumb(t)}_evtMouseDown(e){if(0!==e.button)return;if(this.activate(),this._pressData)return;let t=G.findPart(this,e.target);if(!t)return;e.preventDefault(),e.stopPropagation();let i=o.Drag.overrideCursor("default");if(this._pressData={part:t,override:i,delta:-1,value:-1,mouseX:e.clientX,mouseY:e.clientY},document.addEventListener("mousemove",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0),"thumb"===t){let t=this.thumbNode,i=t.getBoundingClientRect();return"horizontal"===this._orientation?this._pressData.delta=e.clientX-i.left:this._pressData.delta=e.clientY-i.top,t.classList.add("lm-mod-active"),void(this._pressData.value=this._value)}if("track"===t){let t,i=this.thumbNode.getBoundingClientRect();return t="horizontal"===this._orientation?e.clientX<i.left?"decrement":"increment":e.clientY<i.top?"decrement":"increment",this._repeatTimer=window.setTimeout(this._onRepeat,350),void this._pageRequested.emit(t)}return"decrement"===t?(this.decrementNode.classList.add("lm-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),void this._stepRequested.emit("decrement")):"increment"===t?(this.incrementNode.classList.add("lm-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),void this._stepRequested.emit("increment")):void 0}_evtMouseMove(e){if(!this._pressData)return;if(e.preventDefault(),e.stopPropagation(),this._pressData.mouseX=e.clientX,this._pressData.mouseY=e.clientY,"thumb"!==this._pressData.part)return;let t,i,s=this.thumbNode.getBoundingClientRect(),n=this.trackNode.getBoundingClientRect();"horizontal"===this._orientation?(t=e.clientX-n.left-this._pressData.delta,i=n.width-s.width):(t=e.clientY-n.top-this._pressData.delta,i=n.height-s.height);let a=0===i?0:t*this._maximum/i;this._moveThumb(a)}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(clearTimeout(this._repeatTimer),this._repeatTimer=-1,this._pressData.override.dispose(),this._pressData=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0),this.thumbNode.classList.remove("lm-mod-active"),this.decrementNode.classList.remove("lm-mod-active"),this.incrementNode.classList.remove("lm-mod-active"))}_moveThumb(e){e=Math.max(0,Math.min(e,this._maximum)),this._value!==e&&(this._value=e,this.update(),this._thumbMoved.emit(e))}},e.SingletonLayout=ie,e.SplitLayout=B,e.SplitPanel=N,e.StackedLayout=se,e.StackedPanel=ne,e.TabBar=$,e.TabPanel=class extends b{constructor(e={}){super(),this._currentChanged=new r.Signal(this),this._addRequested=new r.Signal(this),this.addClass("lm-TabPanel"),this.tabBar=new $(e),this.tabBar.addClass("lm-TabPanel-tabBar"),this.stackedPanel=new ne,this.stackedPanel.addClass("lm-TabPanel-stackedPanel"),this.tabBar.tabMoved.connect(this._onTabMoved,this),this.tabBar.currentChanged.connect(this._onCurrentChanged,this),this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested,this),this.tabBar.tabActivateRequested.connect(this._onTabActivateRequested,this),this.tabBar.addRequested.connect(this._onTabAddRequested,this),this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved,this),this._tabPlacement=e.tabPlacement||"top";let t=J.directionFromPlacement(this._tabPlacement),i=J.orientationFromPlacement(this._tabPlacement);this.tabBar.orientation=i,this.tabBar.dataset.placement=this._tabPlacement;let s=new P({direction:t,spacing:0});P.setStretch(this.tabBar,0),P.setStretch(this.stackedPanel,1),s.addWidget(this.tabBar),s.addWidget(this.stackedPanel),this.layout=s}get currentChanged(){return this._currentChanged}get currentIndex(){return this.tabBar.currentIndex}set currentIndex(e){this.tabBar.currentIndex=e}get currentWidget(){let e=this.tabBar.currentTitle;return e?e.owner:null}set currentWidget(e){this.tabBar.currentTitle=e?e.title:null}get tabsMovable(){return this.tabBar.tabsMovable}set tabsMovable(e){this.tabBar.tabsMovable=e}get addButtonEnabled(){return this.tabBar.addButtonEnabled}set addButtonEnabled(e){this.tabBar.addButtonEnabled=e}get tabPlacement(){return this._tabPlacement}set tabPlacement(e){if(this._tabPlacement===e)return;this._tabPlacement=e;let t=J.directionFromPlacement(e),i=J.orientationFromPlacement(e);this.tabBar.orientation=i,this.tabBar.dataset.placement=e,this.layout.direction=t}get addRequested(){return this._addRequested}get widgets(){return this.stackedPanel.widgets}addWidget(e){this.insertWidget(this.widgets.length,e)}insertWidget(e,t){t!==this.currentWidget&&t.hide(),this.stackedPanel.insertWidget(e,t),this.tabBar.insertTab(e,t.title),t.node.setAttribute("role","tabpanel");let i=this.tabBar.renderer;if(i instanceof $.Renderer){let e=i.createTabKey({title:t.title,current:!1,zIndex:0});t.node.setAttribute("aria-labelledby",e)}}_onCurrentChanged(e,t){let{previousIndex:i,previousTitle:a,currentIndex:r,currentTitle:o}=t,h=a?a.owner:null,d=o?o.owner:null;h&&h.hide(),d&&d.show(),this._currentChanged.emit({previousIndex:i,previousWidget:h,currentIndex:r,currentWidget:d}),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush()}_onTabAddRequested(e,t){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabMoved(e,t){this.stackedPanel.insertWidget(t.toIndex,t.title.owner)}_onWidgetRemoved(e,t){t.node.removeAttribute("role"),t.node.removeAttribute("aria-labelledby"),this.tabBar.removeTab(t.title)}},e.Title=f,e.Widget=b}));
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lumino/algorithm"),require("@lumino/coreutils"),require("@lumino/domutils"),require("@lumino/messaging"),require("@lumino/properties"),require("@lumino/signaling"),require("@lumino/dragdrop"),require("@lumino/commands"),require("@lumino/virtualdom"),require("@lumino/disposable"),require("@lumino/keyboard")):"function"==typeof define&&define.amd?define(["exports","@lumino/algorithm","@lumino/coreutils","@lumino/domutils","@lumino/messaging","@lumino/properties","@lumino/signaling","@lumino/dragdrop","@lumino/commands","@lumino/virtualdom","@lumino/disposable","@lumino/keyboard"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lumino_widgets={},e.lumino_algorithm,e.lumino_coreutils,e.lumino_domutils,e.lumino_messaging,e.lumino_properties,e.lumino_signaling,e.lumino_dragdrop,e.lumino_commands,e.lumino_virtualdom,e.lumino_disposable,e.lumino_keyboard)}(this,(function(e,t,i,s,n,a,r,o,h,d,l,c){"use strict";class u{constructor(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}}var m,g,p,_;e.BoxEngine=void 0,(m=e.BoxEngine||(e.BoxEngine={})).calc=function(e,t){let i=e.length;if(0===i)return t;let s=0,n=0,a=0,r=0,o=0;for(let t=0;t<i;++t){let i=e[t],h=i.minSize,d=i.maxSize,l=i.sizeHint;i.done=!1,i.size=Math.max(h,Math.min(l,d)),a+=i.size,s+=h,n+=d,i.stretch>0&&(r+=i.stretch,o++)}if(t===a)return 0;if(t<=s){for(let t=0;t<i;++t){let i=e[t];i.size=i.minSize}return t-s}if(t>=n){for(let t=0;t<i;++t){let i=e[t];i.size=i.maxSize}return t-n}let h=.01,d=i;if(t<a){let s=a-t;for(;o>0&&s>h;){let t=s,n=r;for(let a=0;a<i;++a){let i=e[a];if(i.done||0===i.stretch)continue;let h=i.stretch*t/n;i.size-h<=i.minSize?(s-=i.size-i.minSize,r-=i.stretch,i.size=i.minSize,i.done=!0,d--,o--):(s-=h,i.size-=h)}}for(;d>0&&s>h;){let t=s/d;for(let n=0;n<i;++n){let i=e[n];i.done||(i.size-t<=i.minSize?(s-=i.size-i.minSize,i.size=i.minSize,i.done=!0,d--):(s-=t,i.size-=t))}}}else{let s=t-a;for(;o>0&&s>h;){let t=s,n=r;for(let a=0;a<i;++a){let i=e[a];if(i.done||0===i.stretch)continue;let h=i.stretch*t/n;i.size+h>=i.maxSize?(s-=i.maxSize-i.size,r-=i.stretch,i.size=i.maxSize,i.done=!0,d--,o--):(s-=h,i.size+=h)}}for(;d>0&&s>h;){let t=s/d;for(let n=0;n<i;++n){let i=e[n];i.done||(i.size+t>=i.maxSize?(s-=i.maxSize-i.size,i.size=i.maxSize,i.done=!0,d--):(s-=t,i.size+=t))}}}return 0},m.adjust=function(e,t,i){0!==e.length&&0!==i&&(i>0?function(e,t,i){let s=0;for(let i=0;i<=t;++i){let t=e[i];s+=t.maxSize-t.size}let n=0;for(let i=t+1,s=e.length;i<s;++i){let t=e[i];n+=t.size-t.minSize}let a=i=Math.min(i,s,n);for(let i=t;i>=0&&a>0;--i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t+1,s=e.length;i<s&&r>0;++i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,i):function(e,t,i){let s=0;for(let i=t+1,n=e.length;i<n;++i){let t=e[i];s+=t.maxSize-t.size}let n=0;for(let i=0;i<=t;++i){let t=e[i];n+=t.size-t.minSize}let a=i=Math.min(i,s,n);for(let i=t+1,s=e.length;i<s&&a>0;++i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t;i>=0&&r>0;--i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,-i))};class f{constructor(e){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new r.Signal(this),this._isDisposed=!1,this.owner=e.owner,void 0!==e.label&&(this._label=e.label),void 0!==e.mnemonic&&(this._mnemonic=e.mnemonic),void 0!==e.icon&&(this._icon=e.icon),void 0!==e.iconClass&&(this._iconClass=e.iconClass),void 0!==e.iconLabel&&(this._iconLabel=e.iconLabel),void 0!==e.caption&&(this._caption=e.caption),void 0!==e.className&&(this._className=e.className),void 0!==e.closable&&(this._closable=e.closable),this._dataset=e.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))}get caption(){return this._caption}set caption(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))}get className(){return this._className}set className(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))}get closable(){return this._closable}set closable(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,r.Signal.clearData(this))}}class b{constructor(e={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new r.Signal(this),this._hiddenMode=b.HiddenMode.Display,this.node=g.createNode(e),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(b.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&b.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),r.Signal.clearData(this),n.MessageLoop.clearData(this),a.AttachedProperty.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(b.Flag.IsDisposed)}get isAttached(){return this.testFlag(b.Flag.IsAttached)}get isHidden(){return this.testFlag(b.Flag.IsHidden)}get isVisible(){let e=this;do{if(e.isHidden||!e.isAttached)return!1;e=e.parent}while(null!=e);return!0}get title(){return g.titleProperty.get(this)}get id(){return this.node.id}set id(e){this.node.id=e}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==b.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-removed",this);n.MessageLoop.sendMessage(this._parent,e)}if(this._parent=e,this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-added",this);n.MessageLoop.sendMessage(this._parent,e)}this.isDisposed||n.MessageLoop.sendMessage(this,b.Msg.ParentChanged)}}get layout(){return this._layout}set layout(e){if(this._layout!==e){if(this.testFlag(b.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(e){for(let t=e;t;t=t._parent)if(t===this)return!0;return!1}hasClass(e){return this.node.classList.contains(e)}addClass(e){this.node.classList.add(e)}removeClass(e){this.node.classList.remove(e)}toggleClass(e,t){return!0===t?(this.node.classList.add(e),!0):!1===t?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)}update(){n.MessageLoop.postMessage(this,b.Msg.UpdateRequest)}fit(){n.MessageLoop.postMessage(this,b.Msg.FitRequest)}activate(){n.MessageLoop.postMessage(this,b.Msg.ActivateRequest)}close(){n.MessageLoop.sendMessage(this,b.Msg.CloseRequest)}show(){if(this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeShow),this.clearFlag(b.Flag.IsHidden),this._toggleHidden(!1),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterShow),this.parent)){let e=new b.ChildMessage("child-shown",this);n.MessageLoop.sendMessage(this.parent,e)}}hide(){if(!this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeHide),this.setFlag(b.Flag.IsHidden),this._toggleHidden(!0),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterHide),this.parent)){let e=new b.ChildMessage("child-hidden",this);n.MessageLoop.sendMessage(this.parent,e)}}setHidden(e){e?this.hide():this.show()}testFlag(e){return 0!=(this._flags&e)}setFlag(e){this._flags|=e}clearFlag(e){this._flags&=~e}processMessage(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(b.Flag.IsVisible),this.setFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(b.Flag.IsVisible),this.clearFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}}notifyLayout(e){this._layout&&this._layout.processParentMessage(e)}onCloseRequest(e){this.parent?this.parent=null:this.isAttached&&b.detach(this)}onResize(e){}onUpdateRequest(e){}onFitRequest(e){}onActivateRequest(e){}onBeforeShow(e){}onAfterShow(e){}onBeforeHide(e){}onAfterHide(e){}onBeforeAttach(e){}onAfterAttach(e){}onBeforeDetach(e){}onAfterDetach(e){}onChildAdded(e){}onChildRemoved(e){}_toggleHidden(e){if(e)switch(this._hiddenMode){case b.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1"}else switch(this._hiddenMode){case b.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex=""}}}!function(e){var t,i,s;(t=e.HiddenMode||(e.HiddenMode={}))[t.Display=0]="Display",t[t.Scale=1]="Scale",t[t.ContentVisibility=2]="ContentVisibility",(i=e.Flag||(e.Flag={}))[i.IsDisposed=1]="IsDisposed",i[i.IsAttached=2]="IsAttached",i[i.IsHidden=4]="IsHidden",i[i.IsVisible=8]="IsVisible",i[i.DisallowLayout=16]="DisallowLayout",(s=e.Msg||(e.Msg={})).BeforeShow=new n.Message("before-show"),s.AfterShow=new n.Message("after-show"),s.BeforeHide=new n.Message("before-hide"),s.AfterHide=new n.Message("after-hide"),s.BeforeAttach=new n.Message("before-attach"),s.AfterAttach=new n.Message("after-attach"),s.BeforeDetach=new n.Message("before-detach"),s.AfterDetach=new n.Message("after-detach"),s.ParentChanged=new n.Message("parent-changed"),s.UpdateRequest=new n.ConflatableMessage("update-request"),s.FitRequest=new n.ConflatableMessage("fit-request"),s.ActivateRequest=new n.ConflatableMessage("activate-request"),s.CloseRequest=new n.ConflatableMessage("close-request");class a extends n.Message{constructor(e,t){super(e),this.child=t}}e.ChildMessage=a;class r extends n.Message{constructor(e,t){super("resize"),this.width=e,this.height=t}}e.ResizeMessage=r,function(e){e.UnknownSize=new e(-1,-1)}(r=e.ResizeMessage||(e.ResizeMessage={})),e.attach=function(t,i,s=null){if(t.parent)throw new Error("Cannot attach a child widget.");if(t.isAttached||t.node.isConnected)throw new Error("Widget is already attached.");if(!i.isConnected)throw new Error("Host is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeAttach),i.insertBefore(t.node,s),n.MessageLoop.sendMessage(t,e.Msg.AfterAttach)},e.detach=function(t){if(t.parent)throw new Error("Cannot detach a child widget.");if(!t.isAttached||!t.node.isConnected)throw new Error("Widget is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeDetach),t.node.parentNode.removeChild(t.node),n.MessageLoop.sendMessage(t,e.Msg.AfterDetach)}}(b||(b={})),function(e){e.titleProperty=new a.AttachedProperty({name:"title",create:e=>new f({owner:e})}),e.createNode=function(e){return e.node||document.createElement(e.tag||"div")}}(g||(g={}));class v{constructor(e={}){this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,r.Signal.clearData(this),a.AttachedProperty.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){let e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}}processParentMessage(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e)}}init(){for(const e of this)e.parent=this.parent}onResize(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onUpdateRequest(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onBeforeAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onBeforeHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onChildRemoved(e){this.removeWidget(e.child)}onFitRequest(e){}onChildShown(e){}onChildHidden(e){}}!function(e){e.getHorizontalAlignment=function(e){return p.horizontalAlignmentProperty.get(e)},e.setHorizontalAlignment=function(e,t){p.horizontalAlignmentProperty.set(e,t)},e.getVerticalAlignment=function(e){return p.verticalAlignmentProperty.get(e)},e.setVerticalAlignment=function(e,t){p.verticalAlignmentProperty.set(e,t)}}(v||(v={}));class x{constructor(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height="",e.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let e=s.ElementExt.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight}update(e,t,i,s){let a=Math.max(this._minWidth,Math.min(i,this._maxWidth)),r=Math.max(this._minHeight,Math.min(s,this._maxHeight));if(a<i)switch(v.getHorizontalAlignment(this.widget)){case"left":break;case"center":e+=(i-a)/2;break;case"right":e+=i-a;break;default:throw"unreachable"}if(r<s)switch(v.getVerticalAlignment(this.widget)){case"top":break;case"center":t+=(s-r)/2;break;case"bottom":t+=s-r;break;default:throw"unreachable"}let o=!1,h=this.widget.node.style;if(this._top!==t&&(this._top=t,h.top=`${t}px`),this._left!==e&&(this._left=e,h.left=`${e}px`),this._width!==a&&(o=!0,this._width=a,h.width=`${a}px`),this._height!==r&&(o=!0,this._height=r,h.height=`${r}px`),o){let e=new b.ResizeMessage(a,r);n.MessageLoop.sendMessage(this.widget,e)}}}!function(e){function t(e){e.parent&&e.parent.layout&&e.parent.update()}e.horizontalAlignmentProperty=new a.AttachedProperty({name:"horizontalAlignment",create:()=>"center",changed:t}),e.verticalAlignmentProperty=new a.AttachedProperty({name:"verticalAlignment",create:()=>"top",changed:t})}(p||(p={}));class M extends v{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(e){this.insertWidget(this._widgets.length,e)}insertWidget(e,i){i.parent=this.parent;let s=this._widgets.indexOf(i),n=Math.max(0,Math.min(e,this._widgets.length));if(-1===s)return t.ArrayExt.insert(this._widgets,n,i),void(this.parent&&this.attachWidget(n,i));n===this._widgets.length&&n--,s!==n&&(t.ArrayExt.move(this._widgets,s,n),this.parent&&this.moveWidget(s,n,i))}removeWidget(e){this.removeWidgetAt(this._widgets.indexOf(e))}removeWidgetAt(e){let i=t.ArrayExt.removeAt(this._widgets,e);i&&this.parent&&this.detachWidget(e,i)}init(){super.init();let e=0;for(const t of this)this.attachWidget(e++,t)}attachWidget(e,t){let i=this.parent.node.children[e];this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeAttach),this.parent.node.insertBefore(t.node,i),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterAttach)}moveWidget(e,t,i){this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach);let s=this.parent.node.children[t];this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,s),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach)}detachWidget(e,t){this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterDetach)}}!function(e){e.clampDimension=function(e){return Math.max(0,Math.floor(e))}}(_||(_={}));var y,w,A,E,C,S,I,z,L,T,D=_;class B extends M{constructor(e){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=e.renderer,void 0!==e.orientation&&(this._orientation=e.orientation),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=_.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.parent&&(this.parent.dataset.orientation=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=_.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map((e=>e.size))}relativeSizes(){return y.normalize(this._sizers.map((e=>e.size)))}setRelativeSizes(e,t=!0){let i=this._sizers.length,s=e.slice(0,i);for(;s.length<i;)s.push(0);let n=y.normalize(s);for(let e=0;e<i;++e){let t=this._sizers[e];t.sizeHint=n[e],t.size=n[e]}this._hasNormedSizes=!0,t&&this.parent&&this.parent.update()}moveHandle(t,i){let s,n=this._handles[t];if(n&&!n.classList.contains("lm-mod-hidden")&&(s="horizontal"===this._orientation?i-n.offsetLeft:i-n.offsetTop,0!==s)){for(let e of this._sizers)e.size>0&&(e.sizeHint=e.size);e.BoxEngine.adjust(this._sizers,t,s),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){let s=new x(i),a=y.createHandle(this.renderer),r=y.averageSize(this._sizers),o=y.createSizer(r);t.ArrayExt.insert(this._items,e,s),t.ArrayExt.insert(this._sizers,e,o),t.ArrayExt.insert(this._handles,e,a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.node.appendChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),t.ArrayExt.move(this._handles,e,i),this.parent.fit()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e),a=t.ArrayExt.removeAt(this._handles,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.node.removeChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}updateItemPosition(e,t,i,s,n,a,r){const o=this._items[e];if(o.isHidden)return;let h=this._handles[e].style;t?(i+=this.widgetOffset,o.update(i,s,r,n),i+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${this._spacing}px`,h.height=`${n}px`):(s+=this.widgetOffset,o.update(i,s,a,r),s+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${a}px`,h.height=`${this._spacing}px`)}_fit(){let e=0,t=-1;for(let i=0,s=this._items.length;i<s;++i)this._items[i].isHidden?this._handles[i].classList.add("lm-mod-hidden"):(this._handles[i].classList.remove("lm-mod-hidden"),t=i,e++);-1!==t&&this._handles[t].classList.add("lm-mod-hidden"),this._fixed=this._spacing*Math.max(0,e-1)+this.widgetOffset*this._items.length;let i="horizontal"===this._orientation,a=i?this._fixed:0,r=i?0:this._fixed;for(let e=0,t=this._items.length;e<t;++e){let t=this._items[e],s=this._sizers[e];s.size>0&&(s.sizeHint=s.size),t.isHidden?(s.minSize=0,s.maxSize=0):(t.fit(),s.stretch=B.getStretch(t.widget),i?(s.minSize=t.minWidth,s.maxSize=t.maxWidth,a+=t.minWidth,r=Math.max(r,t.minHeight)):(s.minSize=t.minHeight,s.maxSize=t.maxHeight,r+=t.minHeight,a=Math.max(a,t.minWidth)))}let o=this._box=s.ElementExt.boxSizing(this.parent.node);a+=o.horizontalSum,r+=o.verticalSum;let h=this.parent.node.style;h.minWidth=`${a}px`,h.minHeight=`${r}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e<t;++e)n+=+!this._items[e].isHidden;if(0===n&&0===this.widgetOffset)return;t<0&&(t=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let a=this._box.paddingTop,r=this._box.paddingLeft,o=t-this._box.horizontalSum,h=i-this._box.verticalSum,d=0,l=0,c="horizontal"===this._orientation;if(n>0){let t;if(t=c?Math.max(0,o-this._fixed):Math.max(0,h-this._fixed),this._hasNormedSizes){for(let e of this._sizers)e.sizeHint*=t;this._hasNormedSizes=!1}let i=e.BoxEngine.calc(this._sizers,t);if(i>0)switch(this._alignment){case"start":break;case"center":d=0,l=i/2;break;case"end":d=0,l=i;break;case"justify":d=i/n,l=0;break;default:throw"unreachable"}}for(let e=0,t=this._items.length;e<t;++e){const t=this._items[e].isHidden?0:this._sizers[e].size+d;this.updateItemPosition(e,c,c?r+l:r,c?a:a+l,h,o,t);const i=this.widgetOffset+(this._handles[e].classList.contains("lm-mod-hidden")?0:this._spacing);c?r+=t+i:a+=t+i}}}!function(e){e.getStretch=function(e){return y.stretchProperty.get(e)},e.setStretch=function(e,t){y.stretchProperty.set(e,t)}}(B||(B={})),function(e){e.stretchProperty=new a.AttachedProperty({name:"stretch",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:function(e){e.parent&&e.parent.layout instanceof B&&e.parent.fit()}}),e.createSizer=function(e){let t=new u;return t.sizeHint=Math.floor(e),t},e.createHandle=function(e){let t=e.createHandle();return t.style.position="absolute",t.style.contain="style",t},e.averageSize=function(e){return e.reduce(((e,t)=>e+t.size),0)/e.length||0},e.normalize=function(e){let t=e.length;if(0===t)return[];let i=e.reduce(((e,t)=>e+Math.abs(t)),0);return 0===i?e.map((e=>1/t)):e.map((e=>e/i))}}(y||(y={}));class k extends B{constructor(e){super({...e,orientation:e.orientation||"vertical"}),this._titles=[],this.titleSpace=e.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(e){e=D.clampDimension(e),this.widgetOffset!==e&&(this.widgetOffset=e,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(e,t){const i=this._titles[e],s=i.classList.contains("lm-mod-expanded"),n=w.createTitle(this.renderer,t.title,s);this._titles[e]=n,this.parent.node.replaceChild(n,i)}insertWidget(e,t){t.id||(t.id=`id-${i.UUID.uuid4()}`),super.insertWidget(e,t)}attachWidget(e,i){const s=w.createTitle(this.renderer,i.title);t.ArrayExt.insert(this._titles,e,s),this.parent.node.appendChild(s),i.node.setAttribute("role","region"),i.node.setAttribute("aria-labelledby",s.id),super.attachWidget(e,i)}moveWidget(e,i,s){t.ArrayExt.move(this._titles,e,i),super.moveWidget(e,i,s)}detachWidget(e,i){const s=t.ArrayExt.removeAt(this._titles,e);this.parent.node.removeChild(s),super.detachWidget(e,i)}updateItemPosition(e,t,i,s,n,a,r){const o=this._titles[e].style;o.top=`${s}px`,o.left=`${i}px`,o.height=`${this.widgetOffset}px`,o.width=t?`${n}px`:`${a}px`,super.updateItemPosition(e,t,i,s,n,a,r)}}!function(e){e.createTitle=function(e,t,i=!0){const s=e.createSectionTitle(t);return s.style.position="absolute",s.style.contain="strict",s.setAttribute("aria-label",`${t.label} Section`),s.setAttribute("aria-expanded",i?"true":"false"),s.setAttribute("aria-controls",t.owner.id),i&&s.classList.add("lm-mod-expanded"),s}}(w||(w={}));class R extends b{constructor(e={}){super(),this.addClass("lm-Panel"),this.layout=A.createLayout(e)}get widgets(){return this.layout.widgets}addWidget(e){this.layout.addWidget(e)}insertWidget(e,t){this.layout.insertWidget(e,t)}}!function(e){e.createLayout=function(e){return e.layout||new M}}(A||(A={}));class N extends R{constructor(e={}){super({layout:E.createLayout(e)}),this._handleMoved=new r.Signal(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(e){this.layout.orientation=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(e,t=!0){this.layout.setRelativeSizes(e,t)}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){e.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(e){e.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(e){this._pressData&&(e.preventDefault(),e.stopPropagation()),27===e.keyCode&&this._releaseMouse()}_evtPointerDown(e){if(0!==e.button)return;let i,s=this.layout,n=t.ArrayExt.findFirstIndex(s.handles,(t=>t.contains(e.target)));if(-1===n)return;e.preventDefault(),e.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let a=s.handles[n],r=a.getBoundingClientRect();i="horizontal"===s.orientation?e.clientX-r.left:e.clientY-r.top;let h=window.getComputedStyle(a),d=o.Drag.overrideCursor(h.cursor);this._pressData={index:n,delta:i,override:d}}_evtPointerMove(e){let t;e.preventDefault(),e.stopPropagation();let i=this.layout,s=this.node.getBoundingClientRect();t="horizontal"===i.orientation?e.clientX-s.left-this._pressData.delta:e.clientY-s.top-this._pressData.delta,i.moveHandle(this._pressData.index,t)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}}!function(e){class t{createHandle(){let e=document.createElement("div");return e.className="lm-SplitPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t,e.getStretch=function(e){return B.getStretch(e)},e.setStretch=function(e,t){B.setStretch(e,t)}}(N||(N={})),function(e){e.createLayout=function(e){return e.layout||new B({renderer:e.renderer||N.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing})}}(E||(E={}));class H extends N{constructor(e={}){super({...e,layout:C.createLayout(e)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new r.Signal(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(e){this.layout.titleSpace=e}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(e){super.addWidget(e),e.title.changed.connect(this._onTitleChanged,this)}collapse(e){const t=this.layout.widgets[e];t&&!t.isHidden&&this._toggleExpansion(e)}expand(e){const t=this.layout.widgets[e];t&&t.isHidden&&this._toggleExpansion(e)}insertWidget(e,t){super.insertWidget(e,t),t.title.changed.connect(this._onTitleChanged,this)}handleEvent(e){switch(super.handleEvent(e),e.type){case"click":this._evtClick(e);break;case"keydown":this._eventKeyDown(e)}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(e)}onAfterDetach(e){super.onAfterDetach(e),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(e){const i=t.ArrayExt.findFirstIndex(this.widgets,(t=>t.contains(e.owner)));i>=0&&(this.layout.updateTitle(i,e.owner),this.update())}_computeWidgetSize(e){const t=this.layout,i=t.widgets[e];if(!i)return;const s=i.isHidden,n=t.absoluteSizes(),a=(s?-1:1)*this.spacing,r=n.reduce(((e,t)=>e+t));let o=[...n];if(s){const t=this._widgetSizesCache.get(i);if(!t)return;o[e]+=t;const s=o.map((e=>e-t>0)).lastIndexOf(!0);-1===s?o.forEach(((i,s)=>{s!==e&&(o[s]-=n[s]/r*(t-a))})):o[s]-=t-a}else{const t=n[e];this._widgetSizesCache.set(i,t),o[e]=0;const s=o.map((e=>e>0)).lastIndexOf(!0);if(-1===s)return;o[s]=n[s]+t+a}return o.map((e=>e/(r+a)))}_evtClick(e){const i=e.target;if(i){const s=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this._toggleExpansion(s))}}_eventKeyDown(e){if(e.defaultPrevented)return;const i=e.target;let s=!1;if(i){const n=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));if(n>=0){const t=e.keyCode.toString();if(e.key.match(/Space|Enter/)||t.match(/13|32/))i.click(),s=!0;else if("horizontal"===this.orientation?e.key.match(/ArrowLeft|ArrowRight/)||t.match(/37|39/):e.key.match(/ArrowUp|ArrowDown/)||t.match(/38|40/)){const i=e.key.match(/ArrowLeft|ArrowUp/)||t.match(/37|38/)?-1:1,a=this.titles.length,r=(n+a+i)%a;this.titles[r].focus(),s=!0}else"End"===e.key||"35"===t?(this.titles[this.titles.length-1].focus(),s=!0):"Home"!==e.key&&"36"!==t||(this.titles[0].focus(),s=!0)}s&&e.preventDefault()}}_toggleExpansion(e){const t=this.titles[e],i=this.layout.widgets[e],s=this._computeWidgetSize(e);s&&this.setRelativeSizes(s,!1),i.isHidden?(t.classList.add("lm-mod-expanded"),t.setAttribute("aria-expanded","true"),i.show()):(t.classList.remove("lm-mod-expanded"),t.setAttribute("aria-expanded","false"),i.hide()),this._expansionToggled.emit(e)}}!function(e){class t extends N.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++t._nInstance}createCollapseIcon(e){return document.createElement("span")}createSectionTitle(e){const t=document.createElement("h3");t.setAttribute("tabindex","0"),t.id=this.createTitleKey(e),t.className=this.titleClassName;for(const i in e.dataset)t.dataset[i]=e.dataset[i];t.appendChild(this.createCollapseIcon(e)).className="lm-AccordionPanel-titleCollapser";const i=t.appendChild(document.createElement("span"));return i.className="lm-AccordionPanel-titleLabel",i.textContent=e.label,i.title=e.caption||e.label,t}createTitleKey(e){let t=this._titleKeys.get(e);return void 0===t&&(t=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(e,t)),t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t}(H||(H={})),function(e){e.createLayout=function(e){return e.layout||new k({renderer:e.renderer||H.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing,titleSpace:e.titleSpace})}}(C||(C={}));class P extends M{constructor(e={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==e.direction&&(this._direction=e.direction),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this.parent&&(this.parent.dataset.direction=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){t.ArrayExt.insert(this._items,e,new x(i)),t.ArrayExt.insert(this._sizers,e,new u),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0;for(let t=0,i=this._items.length;t<i;++t)e+=+!this._items[t].isHidden;this._fixed=this._spacing*Math.max(0,e-1);let t=S.isHorizontal(this._direction),i=t?this._fixed:0,a=t?0:this._fixed;for(let e=0,s=this._items.length;e<s;++e){let s=this._items[e],n=this._sizers[e];s.isHidden?(n.minSize=0,n.maxSize=0):(s.fit(),n.sizeHint=P.getSizeBasis(s.widget),n.stretch=P.getStretch(s.widget),t?(n.minSize=s.minWidth,n.maxSize=s.maxWidth,i+=s.minWidth,a=Math.max(a,s.minHeight)):(n.minSize=s.minHeight,n.maxSize=s.maxHeight,a+=s.minHeight,i=Math.max(i,s.minWidth)))}let r=this._box=s.ElementExt.boxSizing(this.parent.node);i+=r.horizontalSum,a+=r.verticalSum;let o=this.parent.node.style;o.minWidth=`${i}px`,o.minHeight=`${a}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e<t;++e)n+=+!this._items[e].isHidden;if(0===n)return;t<0&&(t=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let a,r=this._box.paddingTop,o=this._box.paddingLeft,h=t-this._box.horizontalSum,d=i-this._box.verticalSum;switch(this._direction){case"left-to-right":a=e.BoxEngine.calc(this._sizers,Math.max(0,h-this._fixed));break;case"top-to-bottom":a=e.BoxEngine.calc(this._sizers,Math.max(0,d-this._fixed));break;case"right-to-left":a=e.BoxEngine.calc(this._sizers,Math.max(0,h-this._fixed)),o+=h;break;case"bottom-to-top":a=e.BoxEngine.calc(this._sizers,Math.max(0,d-this._fixed)),r+=d;break;default:throw"unreachable"}let l=0,c=0;if(a>0)switch(this._alignment){case"start":break;case"center":l=0,c=a/2;break;case"end":l=0,c=a;break;case"justify":l=a/n,c=0;break;default:throw"unreachable"}for(let e=0,t=this._items.length;e<t;++e){let t=this._items[e];if(t.isHidden)continue;let i=this._sizers[e].size;switch(this._direction){case"left-to-right":t.update(o+c,r,i+l,d),o+=i+l+this._spacing;break;case"top-to-bottom":t.update(o,r+c,h,i+l),r+=i+l+this._spacing;break;case"right-to-left":t.update(o-c-i-l,r,i+l,d),o-=i+l+this._spacing;break;case"bottom-to-top":t.update(o,r-c-i-l,h,i+l),r-=i+l+this._spacing;break;default:throw"unreachable"}}}}!function(e){e.getStretch=function(e){return S.stretchProperty.get(e)},e.setStretch=function(e,t){S.stretchProperty.set(e,t)},e.getSizeBasis=function(e){return S.sizeBasisProperty.get(e)},e.setSizeBasis=function(e,t){S.sizeBasisProperty.set(e,t)}}(P||(P={})),function(e){function t(e){e.parent&&e.parent.layout instanceof P&&e.parent.fit()}e.stretchProperty=new a.AttachedProperty({name:"stretch",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.sizeBasisProperty=new a.AttachedProperty({name:"sizeBasis",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.isHorizontal=function(e){return"left-to-right"===e||"right-to-left"===e},e.clampSpacing=function(e){return Math.max(0,Math.floor(e))}}(S||(S={}));class W extends R{constructor(e={}){super({layout:I.createLayout(e)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(e){this.layout.direction=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}onChildAdded(e){e.child.addClass("lm-BoxPanel-child")}onChildRemoved(e){e.child.removeClass("lm-BoxPanel-child")}}!function(e){e.getStretch=function(e){return P.getStretch(e)},e.setStretch=function(e,t){P.setStretch(e,t)},e.getSizeBasis=function(e){return P.getSizeBasis(e)},e.setSizeBasis=function(e,t){P.setSizeBasis(e,t)}}(W||(W={})),function(e){e.createLayout=function(e){return e.layout||new P(e)}}(I||(I={}));class q extends b{constructor(e){super({node:z.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||q.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(e){let t=z.createItem(this.commands,e);return this._items.push(t),this.refresh(),t}addItems(e){const t=e.map((e=>z.createItem(this.commands,e)));return t.forEach((e=>this._items.push(e))),this.refresh(),t}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){t.ArrayExt.removeAt(this._items,e)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){if(this._results=null,""!==this.inputNode.value){this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit"}else{this.node.getElementsByClassName("lm-close-icon")[0].style.display="none"}this.update()}handleEvent(e){switch(e.type){case"click":this._evtClick(e);break;case"keydown":this._evtKeyDown(e);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(e){this.update(),super.onAfterShow(e)}onActivateRequest(e){if(this.isAttached){let e=this.inputNode;e.focus(),e.select()}}onUpdateRequest(e){if(!this.isVisible)return void d.VirtualDOM.render(null,this.contentNode);let i=this.inputNode.value,n=this.contentNode,a=this._results;if(a||(a=this._results=z.search(this._items,i),this._activeIndex=i?t.ArrayExt.findFirstIndex(a,z.canActivate):-1),!i&&0===a.length)return void d.VirtualDOM.render(null,n);if(i&&0===a.length){let e=this.renderer.renderEmptyMessage({query:i});return void d.VirtualDOM.render(e,n)}let r=this.renderer,o=this._activeIndex,h=new Array(a.length);for(let e=0,t=a.length;e<t;++e){let t=a[e];if("header"===t.type){let i=t.indices,s=t.category;h[e]=r.renderHeader({category:s,indices:i})}else{let i=t.item,s=t.indices,n=e===o;h[e]=r.renderItem({item:i,indices:s,active:n})}}if(d.VirtualDOM.render(h,n),o<0||o>=a.length)n.scrollTop=0;else{let e=n.children[o];s.ElementExt.scrollIntoViewIfNeeded(n,e)}}_evtClick(e){if(0!==e.button)return;if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>t.contains(e.target)));-1!==i&&(e.preventDefault(),e.stopPropagation(),this._execute(i))}_evtKeyDown(e){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.keyCode){case 13:e.preventDefault(),e.stopPropagation(),this._execute(this._activeIndex);break;case 38:e.preventDefault(),e.stopPropagation(),this._activatePreviousItem();break;case 40:e.preventDefault(),e.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,i=this._results.length,s=e<i-1?e+1:0,n=0===s?i-1:s-1;this._activeIndex=t.ArrayExt.findFirstIndex(this._results,z.canActivate,s,n),this.update()}_activatePreviousItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,i=this._results.length,s=e<=0?i-1:e-1,n=s===i-1?0:s+1;this._activeIndex=t.ArrayExt.findLastIndex(this._results,z.canActivate,s,n),this.update()}_execute(e){if(!this._results)return;let t=this._results[e];if(t){if("header"===t.type){let e=this.inputNode;return e.value=`${t.category.toLowerCase()} `,e.focus(),void this.refresh()}t.item.isEnabled&&(this.commands.execute(t.item.command,t.item.args),this.inputNode.value="",this.refresh())}}_toggleFocused(){let e=document.activeElement===this.inputNode;this.toggleClass("lm-mod-focused",e)}_onGenericChange(){this.refresh()}}!function(e){class i{renderHeader(e){let t=this.formatHeader(e);return d.h.li({className:"lm-CommandPalette-header"},t)}renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e);return e.item.isToggleable?d.h.li({className:t,dataset:i,role:"menuitemcheckbox","aria-checked":`${e.item.isToggled}`},this.renderItemIcon(e),this.renderItemContent(e),this.renderItemShortcut(e)):d.h.li({className:t,dataset:i,role:"menuitem"},this.renderItemIcon(e),this.renderItemContent(e),this.renderItemShortcut(e))}renderEmptyMessage(e){let t=this.formatEmptyMessage(e);return d.h.li({className:"lm-CommandPalette-emptyMessage"},t)}renderItemIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.item.icon,e.item.iconLabel)}renderItemContent(e){return d.h.div({className:"lm-CommandPalette-itemContent"},this.renderItemLabel(e),this.renderItemCaption(e))}renderItemLabel(e){let t=this.formatItemLabel(e);return d.h.div({className:"lm-CommandPalette-itemLabel"},t)}renderItemCaption(e){let t=this.formatItemCaption(e);return d.h.div({className:"lm-CommandPalette-itemCaption"},t)}renderItemShortcut(e){let t=this.formatItemShortcut(e);return d.h.div({className:"lm-CommandPalette-itemShortcut"},t)}createItemClass(e){let t="lm-CommandPalette-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.active&&(t+=" lm-mod-active");let i=e.item.className;return i&&(t+=` ${i}`),t}createItemDataset(e){return{...e.item.dataset,command:e.item.command}}createIconClass(e){let t="lm-CommandPalette-itemIcon",i=e.item.iconClass;return i?`${t} ${i}`:t}formatHeader(e){return e.indices&&0!==e.indices.length?t.StringExt.highlight(e.category,e.indices,d.h.mark):e.category}formatEmptyMessage(e){return`No commands found that match '${e.query}'`}formatItemShortcut(e){let t=e.item.keyBinding;return t?h.CommandRegistry.formatKeystroke(t.keys):null}formatItemLabel(e){return e.indices&&0!==e.indices.length?t.StringExt.highlight(e.item.label,e.indices,d.h.mark):e.item.label}formatItemCaption(e){return e.item.caption}}e.Renderer=i,e.defaultRenderer=new i}(q||(q={})),function(e){function s(e,i){let s=e.category.toLowerCase(),n=`${s} ${e.label.toLowerCase()}`,a=1/0,r=null,o=/\b\w/g;for(;;){let e=o.exec(n);if(!e)break;let s=t.StringExt.matchSumOfDeltas(n,i,e.index);if(!s)break;s.score<=a&&(a=s.score,r=s.indices)}if(!r||a===1/0)return null;let h=s.length+1,d=t.ArrayExt.lowerBound(r,h,((e,t)=>e-t)),l=r.slice(0,d),c=r.slice(d);for(let e=0,t=c.length;e<t;++e)c[e]-=h;return 0===l.length?{matchType:0,categoryIndices:null,labelIndices:c,score:a,item:e}:0===c.length?{matchType:1,categoryIndices:l,labelIndices:null,score:a,item:e}:{matchType:2,categoryIndices:l,labelIndices:c,score:a,item:e}}function n(e,t){let i=e.matchType-t.matchType;if(0!==i)return i;let s=e.score-t.score;if(0!==s)return s;let n=0,a=0;switch(e.matchType){case 0:n=e.labelIndices[0],a=t.labelIndices[0];break;case 1:case 2:n=e.categoryIndices[0],a=t.categoryIndices[0]}if(n!==a)return n-a;let r=e.item.category.localeCompare(t.item.category);if(0!==r)return r;let o=e.item.rank,h=t.item.rank;return o!==h?o<h?-1:1:e.item.label.localeCompare(t.item.label)}e.createNode=function(){let e=document.createElement("div"),t=document.createElement("div"),i=document.createElement("div"),s=document.createElement("input"),n=document.createElement("ul"),a=document.createElement("button");return t.className="lm-CommandPalette-search",i.className="lm-CommandPalette-wrapper",s.className="lm-CommandPalette-input",a.className="lm-close-icon",n.className="lm-CommandPalette-content",n.setAttribute("role","menu"),s.spellcheck=!1,i.appendChild(s),i.appendChild(a),t.appendChild(i),e.appendChild(t),e.appendChild(n),e},e.createItem=function(e,t){return new a(e,t)},e.search=function(e,t){let i=function(e,t){i=t,t=i.replace(/\s+/g,"").toLowerCase();var i;let n=[];for(let i=0,a=e.length;i<a;++i){let a=e[i];if(!a.isVisible)continue;if(!t){n.push({matchType:3,categoryIndices:null,labelIndices:null,score:0,item:a});continue}let r=s(a,t);r&&(a.isEnabled||(r.score+=1e3),n.push(r))}return n}(e,t);return i.sort(n),function(e){let t=[];for(let i=0,s=e.length;i<s;++i){let{item:s,categoryIndices:n,labelIndices:a}=e[i],r=s.category;0!==i&&r===e[i-1].item.category||t.push({type:"header",category:r,indices:n}),t.push({type:"item",item:s,indices:a})}return t}(i)},e.canActivate=function(e){return"item"===e.type&&e.item.isEnabled};class a{constructor(e,t){this._commands=e,this.category=t.category.trim().replace(/\s+/g," "),this.command=t.command,this.args=t.args||i.JSONExt.emptyObject,this.rank=void 0!==t.rank?t.rank:1/0}get label(){return this._commands.label(this.command,this.args)}get icon(){return this._commands.icon(this.command,this.args)}get iconClass(){return this._commands.iconClass(this.command,this.args)}get iconLabel(){return this._commands.iconLabel(this.command,this.args)}get caption(){return this._commands.caption(this.command,this.args)}get className(){return this._commands.className(this.command,this.args)}get dataset(){return this._commands.dataset(this.command,this.args)}get isEnabled(){return this._commands.isEnabled(this.command,this.args)}get isToggled(){return this._commands.isToggled(this.command,this.args)}get isToggleable(){return this._commands.isToggleable(this.command,this.args)}get isVisible(){return this._commands.isVisible(this.command,this.args)}get keyBinding(){let{command:e,args:s}=this;return t.ArrayExt.findLastValue(this._commands.keyBindings,(t=>t.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}}}(z||(z={}));class F extends b{constructor(e){super({node:L.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new r.Signal(this),this._menuRequested=new r.Signal(this),this.addClass("lm-Menu"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||F.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let e=this;for(;e._parentMenu;)e=e._parentMenu;return e}get leafMenu(){let e=this;for(;e._childMenu;)e=e._childMenu;return e}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(e){this.activeIndex=e?this._items.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._items.length)&&(e=-1),-1===e||L.canActivate(this._items[e])||(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let e=this._items.length,i=this._activeIndex,s=i<e-1?i+1:0,n=0===s?e-1:s-1;this.activeIndex=t.ArrayExt.findFirstIndex(this._items,L.canActivate,s,n)}activatePreviousItem(){let e=this._items.length,i=this._activeIndex,s=i<=0?e-1:i-1,n=s===e-1?0:s+1;this.activeIndex=t.ArrayExt.findLastIndex(this._items,L.canActivate,s,n)}triggerActiveItem(){if(!this.isAttached)return;let e=this.activeItem;if(!e)return;if(this._cancelOpenTimer(),this._cancelCloseTimer(),"submenu"===e.type)return void this._openChildMenu(!0);this.rootMenu.close();let{command:t,args:i}=e;this.commands.isEnabled(t,i)?this.commands.execute(t,i):console.log(`Command '${t}' is disabled.`)}addItem(e){return this.insertItem(this._items.length,e)}insertItem(e,i){this.isAttached&&this.close(),this.activeIndex=-1;let s=Math.max(0,Math.min(e,this._items.length)),n=L.createItem(this,i);return t.ArrayExt.insert(this._items,s,n),this.update(),n}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){this.isAttached&&this.close(),this.activeIndex=-1,t.ArrayExt.removeAt(this._items,e)&&this.update()}clearItems(){this.isAttached&&this.close(),this.activeIndex=-1,0!==this._items.length&&(this._items.length=0,this.update())}open(e,t,i={}){var s,n,a;if(this.isAttached)return;let r=i.forceX||!1,o=i.forceY||!1;const h=null!==(s=i.host)&&void 0!==s?s:null,d=null!==(n=i.ref)&&void 0!==n?n:null,l=null!==(a=i.horizontalAlignment)&&void 0!==a?a:"rtl"===document.documentElement.dir?"right":"left";L.openRootMenu(this,e,t,r,o,l,h,d),this.activate()}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mouseup":this._evtMouseUp(e);break;case"mousemove":this._evtMouseMove(e);break;case"mouseenter":this._evtMouseEnter(e);break;case"mouseleave":this._evtMouseLeave(e);break;case"mousedown":this._evtMouseDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onAfterAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mouseup",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseenter",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("contextmenu",this),this.node.ownerDocument.addEventListener("mousedown",this,!0)}onBeforeDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mouseup",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseenter",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("contextmenu",this),this.node.ownerDocument.removeEventListener("mousedown",this,!0)}onActivateRequest(e){this.isAttached&&this.node.focus()}onUpdateRequest(e){let t=this._items,i=this.renderer,s=this._activeIndex,n=L.computeCollapsed(t),a=new Array(t.length);for(let e=0,r=t.length;e<r;++e){let r=t[e],o=e===s,h=n[e];a[e]=i.renderItem({item:r,active:o,collapsed:h,onfocus:()=>{this.activeIndex=e}})}d.VirtualDOM.render(a,this.contentNode)}onCloseRequest(e){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let t=this._childMenu;t&&(this._childIndex=-1,this._childMenu=null,t._parentMenu=null,t.close());let i=this._parentMenu;i&&(this._parentMenu=null,i._childIndex=-1,i._childMenu=null,i.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(e)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation();let t=e.keyCode;if(13===t)return void this.triggerActiveItem();if(27===t)return void this.close();if(37===t)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===t)return void this.activatePreviousItem();if(39===t){let e=this.activeItem;return void(e&&"submenu"===e.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next"))}if(40===t)return void this.activateNextItem();let i=c.getKeyboardLayout().keyForKeydownEvent(e);if(!i)return;let s=this._activeIndex+1,n=L.findMnemonic(this._items,i,s);-1===n.index||n.multiple?-1!==n.index?this.activeIndex=n.index:-1!==n.auto&&(this.activeIndex=n.auto):(this.activeIndex=n.index,this.triggerActiveItem())}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this.triggerActiveItem())}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(this.activeIndex=i,i=this.activeIndex,i===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let n=this.activeItem;n&&"submenu"===n.type&&n.submenu&&this._startOpenTimer()}_evtMouseEnter(e){for(let e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex}_evtMouseLeave(e){if(this._cancelOpenTimer(),!this._childMenu)return void(this.activeIndex=-1);let{clientX:t,clientY:i}=e;s.ElementExt.hitTest(this._childMenu.node,t,i)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtMouseDown(e){this._parentMenu||(L.hitTestMenus(this,e.clientX,e.clientY)?(e.preventDefault(),e.stopPropagation()):this.close())}_openChildMenu(e=!1){let t=this.activeItem;if(!t||"submenu"!==t.type||!t.submenu)return void this._closeChildMenu();let i=t.submenu;if(i===this._childMenu)return;F.saveWindowData(),this._closeChildMenu(),this._childMenu=i,this._childIndex=this._activeIndex,i._parentMenu=this,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let s=this.contentNode.children[this._activeIndex];L.openSubmenu(i,s),e&&(i.activeIndex=-1,i.activateNextItem()),i.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout((()=>{this._openTimerID=0,this._openChildMenu()}),L.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((()=>{this._closeTimerID=0,this._closeChildMenu()}),L.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){L.saveWindowData()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,tabindex:"0",onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e),this.renderShortcut(e),this.renderSubmenu(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.item.icon,e.item.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-Menu-itemLabel"},t)}renderShortcut(e){let t=this.formatShortcut(e);return d.h.div({className:"lm-Menu-itemShortcut"},t)}renderSubmenu(e){return d.h.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(e){let t="lm-Menu-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.item.isVisible||(t+=" lm-mod-hidden"),e.active&&(t+=" lm-mod-active"),e.collapsed&&(t+=" lm-mod-collapsed");let i=e.item.className;return i&&(t+=` ${i}`),t}createItemDataset(e){let t,{type:i,command:s,dataset:n}=e.item;return t="command"===i?{...n,type:i,command:s}:{...n,type:i},t}createIconClass(e){let t="lm-Menu-itemIcon",i=e.item.iconClass;return i?`${t} ${i}`:t}createItemARIA(e){let t={};switch(e.item.type){case"separator":t.role="presentation";break;case"submenu":t["aria-haspopup"]="true",e.item.isEnabled||(t["aria-disabled"]="true");break;default:e.item.isEnabled||(t["aria-disabled"]="true"),e.item.isToggled?(t.role="menuitemcheckbox",t["aria-checked"]="true"):t.role="menuitem"}return t}formatLabel(e){let{label:t,mnemonic:i}=e.item;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-Menu-itemMnemonic"},a),n]}formatShortcut(e){let t=e.item.keyBinding;return t?h.CommandRegistry.formatKeystroke(t.keys):null}}e.Renderer=t,e.defaultRenderer=new t}(F||(F={})),function(e){function a(e){return function(e){var t,i;return{pageXOffset:(null===(t=e.ownerDocument.defaultView)||void 0===t?void 0:t.window.scrollX)||0,pageYOffset:(null===(i=e.ownerDocument.defaultView)||void 0===i?void 0:i.window.scrollY)||0,clientWidth:e.ownerDocument.documentElement.clientWidth,clientHeight:e.ownerDocument.documentElement.clientHeight}}(e)}function r(e){return"separator"!==e.type&&e.isEnabled&&e.isVisible}e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3,e.saveWindowData=function(){},e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-Menu-content",e.appendChild(t),t.setAttribute("role","menu"),e.tabIndex=0,e},e.canActivate=r,e.createItem=function(e,t){return new o(e.commands,t)},e.hitTestMenus=function(e,t,i){for(let n=e;n;n=n.childMenu)if(s.ElementExt.hitTest(n.node,t,i))return!0;return!1},e.computeCollapsed=function(e){let i=new Array(e.length);t.ArrayExt.fill(i,!1);let s=0,n=e.length;for(;s<n;++s){let t=e[s];if(t.isVisible){if("separator"!==t.type)break;i[s]=!0}}let a=n-1;for(;a>=0;--a){let t=e[a];if(t.isVisible){if("separator"!==t.type)break;i[a]=!0}}let r=!1;for(;++s<a;){let t=e[s];t.isVisible&&("separator"!==t.type?r=!1:r?i[s]=!0:r=!0)}return i},e.openRootMenu=function(e,t,i,s,r,o,h,d){const l=a(h||e.node);let c=l.pageXOffset,u=l.pageYOffset,m=l.clientWidth,g=l.clientHeight;n.MessageLoop.sendMessage(e,b.Msg.UpdateRequest);let p=g-(r?i:0),_=e.node,f=_.style;f.top="0",f.left="0",f.opacity="0",f.maxHeight=`${p}px`,b.attach(e,h||document.body,d);let{width:v,height:x}=_.getBoundingClientRect();"right"===o&&(t-=v),!s&&t+v>c+m&&(t=c+m-v),!r&&i+x>u+g&&(i>u+g?i=u+g-x:i-=x),f.transform=`translate(${Math.max(0,t)}px, ${Math.max(0,i)}px`,f.opacity="1"},e.openSubmenu=function(t,i){const r=a(i);let o=r.pageXOffset,h=r.pageYOffset,d=r.clientWidth,l=r.clientHeight;n.MessageLoop.sendMessage(t,b.Msg.UpdateRequest);let c=l,u=t.node,m=u.style;m.opacity="0",m.maxHeight=`${c}px`,b.attach(t,i.ownerDocument.body);let{width:g,height:p}=u.getBoundingClientRect(),_=s.ElementExt.boxSizing(t.node),f=i.getBoundingClientRect(),v=f.right-e.SUBMENU_OVERLAP;v+g>o+d&&(v=f.left+e.SUBMENU_OVERLAP-g);let x=f.top-_.borderTop-_.paddingTop;x+p>h+l&&(x=f.bottom+_.borderBottom+_.paddingBottom-p),m.top="0",m.left="0",m.transform=`translate(${Math.max(0,v)}px, ${Math.max(0,x)}px`,m.opacity="1"},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,o=t.toUpperCase();for(let t=0,h=e.length;t<h;++t){let d=(t+i)%h,l=e[d];if(!r(l))continue;let c=l.label;if(0===c.length)continue;let u=l.mnemonic;u>=0&&u<c.length?c[u].toUpperCase()===o&&(-1===s?s=d:a=!0):-1===n&&c[0].toUpperCase()===o&&(n=d)}return{index:s,multiple:a,auto:n}};class o{constructor(e,t){this._commands=e,this.type=t.type||"command",this.command=t.command||"",this.args=t.args||i.JSONExt.emptyObject,this.submenu=t.submenu||null}get label(){return"command"===this.type?this._commands.label(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.label:""}get mnemonic(){return"command"===this.type?this._commands.mnemonic(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.mnemonic:-1}get icon(){return"command"===this.type?this._commands.icon(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.icon:void 0}get iconClass(){return"command"===this.type?this._commands.iconClass(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.iconClass:""}get iconLabel(){return"command"===this.type?this._commands.iconLabel(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.iconLabel:""}get caption(){return"command"===this.type?this._commands.caption(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.caption:""}get className(){return"command"===this.type?this._commands.className(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.className:""}get dataset(){return"command"===this.type?this._commands.dataset(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.dataset:{}}get isEnabled(){return"command"===this.type?this._commands.isEnabled(this.command,this.args):"submenu"!==this.type||null!==this.submenu}get isToggled(){return"command"===this.type&&this._commands.isToggled(this.command,this.args)}get isVisible(){return"command"===this.type?this._commands.isVisible(this.command,this.args):"submenu"!==this.type||null!==this.submenu}get keyBinding(){if("command"===this.type){let{command:e,args:s}=this;return t.ArrayExt.findLastValue(this._commands.keyBindings,(t=>t.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}return null}}}(L||(L={}));!function(e){function t(e,t){let i=e.rank,s=t.rank;return i!==s?i<s?-1:1:e.id-t.id}function i(e,i){let n=s.Selector.calculateSpecificity(e.selector),a=s.Selector.calculateSpecificity(i.selector);return n!==a?a-n:t(e,i)}e.createItem=function(e,t){let i=function(e){if(-1!==e.indexOf(","))throw new Error(`Selector cannot contain commas: ${e}`);if(!s.Selector.isValid(e))throw new Error(`Invalid selector: ${e}`);return e}(e.selector),n=void 0!==e.rank?e.rank:1/0;return{...e,selector:i,rank:n,id:t}},e.matchItems=function(e,n,a,r){let o=n.target;if(!o)return null;let h=n.currentTarget;if(!h)return null;if(!h.contains(o)&&(o=document.elementFromPoint(n.clientX,n.clientY),!o||!h.contains(o)))return null;let d=[],l=e.slice();for(;null!==o;){let e=[];for(let t=0,i=l.length;t<i;++t){let i=l[t];i&&(s.Selector.matches(o,i.selector)&&(e.push(i),l[t]=null))}if(0!==e.length&&(a&&e.sort(r?i:t),d.push(...e)),o===h)break;o=o.parentElement}return a||d.sort(r?i:t),d}}(T||(T={}));const O=["ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Home","End"];class $ extends b{constructor(e={}){super({node:V.createNode()}),this._currentIndex=-1,this._titles=[],this._titlesEditable=!1,this._previousTitle=null,this._dragData=null,this._addButtonEnabled=!1,this._tabMoved=new r.Signal(this),this._currentChanged=new r.Signal(this),this._addRequested=new r.Signal(this),this._tabCloseRequested=new r.Signal(this),this._tabDetachRequested=new r.Signal(this),this._tabActivateRequested=new r.Signal(this),this.addClass("lm-TabBar"),this.contentNode.setAttribute("role","tablist"),this.setFlag(b.Flag.DisallowLayout),this._document=e.document||document,this.tabsMovable=e.tabsMovable||!1,this.titlesEditable=e.titlesEditable||!1,this.allowDeselect=e.allowDeselect||!1,this.addButtonEnabled=e.addButtonEnabled||!1,this.insertBehavior=e.insertBehavior||"select-tab-if-needed",this.name=e.name||"",this.orientation=e.orientation||"horizontal",this.removeBehavior=e.removeBehavior||"select-tab-after",this.renderer=e.renderer||$.defaultRenderer}dispose(){this._releaseMouse(),this._titles.length=0,this._previousTitle=null,super.dispose()}get currentChanged(){return this._currentChanged}get tabMoved(){return this._tabMoved}get tabActivateRequested(){return this._tabActivateRequested}get addRequested(){return this._addRequested}get tabCloseRequested(){return this._tabCloseRequested}get tabDetachRequested(){return this._tabDetachRequested}get document(){return this._document}get titlesEditable(){return this._titlesEditable}set titlesEditable(e){this._titlesEditable=e}get currentTitle(){return this._titles[this._currentIndex]||null}set currentTitle(e){this.currentIndex=e?this._titles.indexOf(e):-1}get currentIndex(){return this._currentIndex}set currentIndex(e){if((e<0||e>=this._titles.length)&&(e=-1),this._currentIndex===e)return;let t=this._currentIndex,i=this._titles[t]||null,s=e,n=this._titles[s]||null;this._currentIndex=s,this._previousTitle=i,this.update(),this._currentChanged.emit({previousIndex:t,previousTitle:i,currentIndex:s,currentTitle:n})}get name(){return this._name}set name(e){this._name=e,e?this.contentNode.setAttribute("aria-label",e):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.contentNode.setAttribute("aria-orientation",e))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled!==e&&(this._addButtonEnabled=e,e?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(e){return this.insertTab(this._titles.length,e)}insertTab(e,i){this._releaseMouse();let s=V.asTitle(i),n=this._titles.indexOf(s),a=Math.max(0,Math.min(e,this._titles.length));return-1===n?(t.ArrayExt.insert(this._titles,a,s),s.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(a,s),s):(a===this._titles.length&&a--,n===a||(t.ArrayExt.move(this._titles,n,a),this.update(),this._adjustCurrentForMove(n,a)),s)}removeTab(e){this.removeTabAt(this._titles.indexOf(e))}removeTabAt(e){this._releaseMouse();let i=t.ArrayExt.removeAt(this._titles,e);i&&(i.changed.disconnect(this._onTitleChanged,this),i===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,i))}clearTabs(){if(0===this._titles.length)return;this._releaseMouse();for(let e of this._titles)e.changed.disconnect(this._onTitleChanged,this);let e=this.currentIndex,t=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==e&&this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}releaseMouse(){this._releaseMouse()}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"dblclick":this._evtDblClick(e);break;case"keydown":e.eventPhase===Event.CAPTURING_PHASE?this._evtKeyDownCapturing(e):this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this),this.node.addEventListener("keydown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this.node.removeEventListener("keydown",this),this._releaseMouse()}onUpdateRequest(e){var t;let i=this._titles,s=this.renderer,n=this.currentTitle,a=new Array(i.length);const r=null!==(t=this._getCurrentTabindex())&&void 0!==t?t:this._currentIndex>-1?this._currentIndex:0;for(let e=0,t=i.length;e<t;++e){let o=i[e],h=o===n,d=h?t:t-e-1,l=r===e?0:-1;a[e]=s.renderTab({title:o,current:h,zIndex:d,tabIndex:l})}d.VirtualDOM.render(a,this.contentNode)}_getCurrentTabindex(){let e=null;const t=this.contentNode.querySelector('li[tabindex="0"]');return t?e=[...this.contentNode.children].indexOf(t):this._addButtonEnabled&&"0"===this.addButtonNode.getAttribute("tabindex")&&(e=-1),e}_evtDblClick(e){if(!this.titlesEditable)return;let i=this.contentNode.children,n=t.ArrayExt.findFirstIndex(i,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===n)return;let a=this.titles[n],r=i[n].querySelector(".lm-TabBar-tabLabel");if(r&&r.contains(e.target)){let e=a.label||"",t=r.innerHTML;r.innerHTML="";let i=document.createElement("input");i.classList.add("lm-TabBar-tabInput"),i.value=e,r.appendChild(i);let s=()=>{i.removeEventListener("blur",s),r.innerHTML=t,this.node.addEventListener("keydown",this)};i.addEventListener("dblclick",(e=>e.stopPropagation())),i.addEventListener("blur",s),i.addEventListener("keydown",(e=>{"Enter"===e.key?(""!==i.value&&(a.label=a.caption=i.value),s()):"Escape"===e.key&&s()})),this.node.removeEventListener("keydown",this),i.select(),i.focus(),r.children.length>0&&r.children[0].focus()}}_evtKeyDownCapturing(e){e.eventPhase===Event.CAPTURING_PHASE&&(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&this._releaseMouse())}_evtKeyDown(e){var i,s,n;if("Tab"!==e.key&&e.eventPhase!==Event.CAPTURING_PHASE)if("Enter"===e.key||"Spacebar"===e.key||" "===e.key){const i=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(i))e.preventDefault(),e.stopPropagation(),this._addRequested.emit();else{const s=t.ArrayExt.findFirstIndex(this.contentNode.children,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this.currentIndex=s)}}else if(O.includes(e.key)){const t=[...this.contentNode.children];if(this.addButtonEnabled&&t.push(this.addButtonNode),t.length<=1)return;e.preventDefault(),e.stopPropagation();let a,r=t.indexOf(document.activeElement);-1===r&&(r=this._currentIndex),"ArrowRight"===e.key&&"horizontal"===this._orientation||"ArrowDown"===e.key&&"vertical"===this._orientation?a=null!==(i=t[r+1])&&void 0!==i?i:t[0]:"ArrowLeft"===e.key&&"horizontal"===this._orientation||"ArrowUp"===e.key&&"vertical"===this._orientation?a=null!==(s=t[r-1])&&void 0!==s?s:t[t.length-1]:"Home"===e.key?a=t[0]:"End"===e.key&&(a=t[t.length-1]),a&&(null===(n=t[r])||void 0===n||n.setAttribute("tabindex","-1"),null==a||a.setAttribute("tabindex","0"),a.focus())}}_evtPointerDown(e){if(0!==e.button&&1!==e.button)return;if(this._dragData)return;if(e.target.classList.contains("lm-TabBar-tabInput"))return;let i=this.addButtonEnabled&&this.addButtonNode.contains(e.target),n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===a&&!i)return;if(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[a],index:a,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===e.button||i)return;let r=n[a].querySelector(this.renderer.closeIconSelector);r&&r.contains(e.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===a?this.currentIndex=-1:this.currentIndex=a,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(e){let t=this._dragData;if(!t)return;e.preventDefault(),e.stopPropagation();let i=this.contentNode.children;if(t.dragActive||V.dragExceeded(t,e)){if(!t.dragActive){let e=t.tab.getBoundingClientRect();"horizontal"===this._orientation?(t.tabPos=t.tab.offsetLeft,t.tabSize=e.width,t.tabPressPos=t.pressX-e.left):(t.tabPos=t.tab.offsetTop,t.tabSize=e.height,t.tabPressPos=t.pressY-e.top),t.tabPressOffset={x:t.pressX-e.left,y:t.pressY-e.top},t.tabLayout=V.snapTabLayout(i,this._orientation),t.contentRect=this.contentNode.getBoundingClientRect(),t.override=o.Drag.overrideCursor("default"),t.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),t.dragActive=!0}if(!t.detachRequested&&V.detachExceeded(t,e)){t.detachRequested=!0;let s=t.index,n=e.clientX,a=e.clientY,r=i[s],o=this._titles[s];if(this._tabDetachRequested.emit({index:s,title:o,tab:r,clientX:n,clientY:a,offset:t.tabPressOffset}),t.dragAborted)return}V.layoutTabs(i,t,e,this._orientation)}}_evtPointerUp(e){if(0!==e.button&&1!==e.button)return;const i=this._dragData;if(!i)return;if(e.preventDefault(),e.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!i.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(e.target))return void this._addRequested.emit(void 0);let n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(a!==i.index)return;let r=this._titles[a];if(!r.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:a,title:r});let o=n[a].querySelector(this.renderer.closeIconSelector);return o&&o.contains(e.target)?void this._tabCloseRequested.emit({index:a,title:r}):void 0}if(0!==e.button)return;V.finalizeTabPosition(i,this._orientation),i.tab.classList.remove("lm-mod-dragging");let a=V.parseTransitionDuration(i.tab);setTimeout((()=>{if(i.dragAborted)return;this._dragData=null,V.resetTabPositions(this.contentNode.children,this._orientation),i.override.dispose(),this.removeClass("lm-mod-dragging");let e=i.index,s=i.targetIndex;-1!==s&&e!==s&&(t.ArrayExt.move(this._titles,e,s),this._adjustCurrentForMove(e,s),this._tabMoved.emit({fromIndex:e,toIndex:s,title:this._titles[s]}),n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest))}),a)}_releaseMouse(){let e=this._dragData;e&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),e.dragAborted=!0,e.dragActive&&(V.resetTabPositions(this.contentNode.children,this._orientation),e.override.dispose(),e.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(e,t){let i=this.currentTitle,s=this._currentIndex,n=this.insertBehavior;if("select-tab"===n||"select-tab-if-needed"===n&&-1===s)return this._currentIndex=e,this._previousTitle=i,void this._currentChanged.emit({previousIndex:s,previousTitle:i,currentIndex:e,currentTitle:t});s>=e&&this._currentIndex++}_adjustCurrentForMove(e,t){this._currentIndex===e?this._currentIndex=t:this._currentIndex<e&&this._currentIndex>=t?this._currentIndex++:this._currentIndex>e&&this._currentIndex<=t&&this._currentIndex--}_adjustCurrentForRemove(e,t){let i=this._currentIndex,s=this.removeBehavior;if(i===e){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null});if("select-tab-after"===s)return this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===s)return this._currentIndex=Math.max(0,e-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===s)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}else i>e&&this._currentIndex--}_onTitleChanged(e){this.update()}}var V,U,Y,X,K,G,j,J;!function(e){class t{constructor(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++t._nInstance}renderTab(e){let t=e.title.caption,i=this.createTabKey(e),s=i,n=this.createTabStyle(e),a=this.createTabClass(e),r=this.createTabDataset(e),o=this.createTabARIA(e);return e.title.closable?d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e),this.renderCloseIcon(e)):d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){const{title:t}=e;let i=this.createIconClass(e);return d.h.div({className:i},t.icon,t.iconLabel)}renderLabel(e){return d.h.div({className:"lm-TabBar-tabLabel"},e.title.label)}renderCloseIcon(e){return d.h.div({className:"lm-TabBar-tabCloseIcon"})}createTabKey(e){let t=this._tabKeys.get(e.title);return void 0===t&&(t=`tab-key-${this._uuid}-${this._tabID++}`,this._tabKeys.set(e.title,t)),t}createTabStyle(e){return{zIndex:`${e.zIndex}`}}createTabClass(e){let t="lm-TabBar-tab";return e.title.className&&(t+=` ${e.title.className}`),e.title.closable&&(t+=" lm-mod-closable"),e.current&&(t+=" lm-mod-current"),t}createTabDataset(e){return e.title.dataset}createTabARIA(e){var t;return{role:"tab","aria-selected":e.current.toString(),tabindex:`${null!==(t=e.tabIndex)&&void 0!==t?t:"-1"}`}}createIconClass(e){let t="lm-TabBar-tabIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t,e.addButtonSelector=".lm-TabBar-addButton"}($||($={})),function(e){e.DRAG_THRESHOLD=5,e.DETACH_THRESHOLD=20,e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");t.setAttribute("role","tablist"),t.className="lm-TabBar-content",e.appendChild(t);let i=document.createElement("div");return i.className="lm-TabBar-addButton lm-mod-hidden",i.setAttribute("tabindex","-1"),i.setAttribute("role","button"),e.appendChild(i),e},e.asTitle=function(e){return e instanceof f?e:new f(e)},e.parseTransitionDuration=function(e){let t=window.getComputedStyle(e);return 1e3*(parseFloat(t.transitionDuration)||0)},e.snapTabLayout=function(e,t){let i=new Array(e.length);for(let s=0,n=e.length;s<n;++s){let n=e[s],a=window.getComputedStyle(n);i[s]="horizontal"===t?{pos:n.offsetLeft,size:n.offsetWidth,margin:parseFloat(a.marginLeft)||0}:{pos:n.offsetTop,size:n.offsetHeight,margin:parseFloat(a.marginTop)||0}}return i},e.dragExceeded=function(t,i){let s=Math.abs(i.clientX-t.pressX),n=Math.abs(i.clientY-t.pressY);return s>=e.DRAG_THRESHOLD||n>=e.DRAG_THRESHOLD},e.detachExceeded=function(t,i){let s=t.contentRect;return i.clientX<s.left-e.DETACH_THRESHOLD||i.clientX>=s.right+e.DETACH_THRESHOLD||i.clientY<s.top-e.DETACH_THRESHOLD||i.clientY>=s.bottom+e.DETACH_THRESHOLD},e.layoutTabs=function(e,t,i,s){let n,a,r,o;"horizontal"===s?(n=t.pressX,a=i.clientX-t.contentRect.left,r=i.clientX,o=t.contentRect.width):(n=t.pressY,a=i.clientY-t.contentRect.top,r=i.clientY,o=t.contentRect.height);let h=t.index,d=a-t.tabPressPos,l=d+t.tabSize;for(let i=0,a=e.length;i<a;++i){let a,c=t.tabLayout[i],u=c.pos+(c.size>>1);if(i<t.index&&d<u)a=`${t.tabSize+t.tabLayout[i+1].margin}px`,h=Math.min(h,i);else if(i>t.index&&l>u)a=-t.tabSize-c.margin+"px",h=Math.max(h,i);else if(i===t.index){let e=r-n,i=o-(t.tabPos+t.tabSize);a=`${Math.max(-t.tabPos,Math.min(e,i))}px`}else a="";"horizontal"===s?e[i].style.left=a:e[i].style.top=a}t.targetIndex=h},e.finalizeTabPosition=function(e,t){let i,s;if(i="horizontal"===t?e.contentRect.width:e.contentRect.height,e.targetIndex===e.index)s=0;else if(e.targetIndex>e.index){let t=e.tabLayout[e.targetIndex];s=t.pos+t.size-e.tabSize-e.tabPos}else{s=e.tabLayout[e.targetIndex].pos-e.tabPos}let n=i-(e.tabPos+e.tabSize),a=Math.max(-e.tabPos,Math.min(s,n));"horizontal"===t?e.tab.style.left=`${a}px`:e.tab.style.top=`${a}px`},e.resetTabPositions=function(e,t){for(const i of e)"horizontal"===t?i.style.left="":i.style.top=""}}(V||(V={}));class Q extends v{constructor(e){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=e.renderer,void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing)),this._document=e.document||document,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:b.HiddenMode.Display}dispose(){let e=this[Symbol.iterator]();this._items.forEach((e=>{e.dispose()})),this._box=null,this._root=null,this._items.clear();for(const t of e)t.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){if(this._hiddenMode!==e){this._hiddenMode=e;for(const e of this.tabBars())if(e.titles.length>1)for(const t of e.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():t.empty()}widgets(){return this._root?this._root.iterUserWidgets():t.empty()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():t.empty()}tabBars(){return this._root?this._root.iterTabBars():t.empty()}handles(){return this._root?this._root.iterHandles():t.empty()}moveHandle(t,i,s){let n=t.classList.contains("lm-mod-hidden");if(!this._root||n)return;let a,r=this._root.findSplitNode(t);r&&(a="horizontal"===r.node.orientation?i-t.offsetLeft:s-t.offsetTop,0!==a&&(r.node.holdSizes(),e.BoxEngine.adjust(r.node.sizers,r.index,a),this.parent&&this.parent.update()))}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(e){let t,i=new Set;t=e.main?U.normalizeAreaConfig(e.main,i):null;let s=this.widgets(),n=this.tabBars(),a=this.handles();this._root=null;for(const e of s)i.has(e)||(e.parent=null);for(const e of n)e.dispose();for(const e of a)e.parentNode&&e.parentNode.removeChild(e);for(const e of i)e.parent=this.parent;this._root=t?U.realizeAreaConfig(t,{createTabBar:e=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):null,this.parent&&(i.forEach((e=>{this.attachWidget(e)})),this.parent.fit())}addWidget(e,t={}){let i=t.ref||null,s=t.mode||"tab-after",n=null;if(this._root&&i&&(n=this._root.findTabNode(i)),i&&!n)throw new Error("Reference widget is not in the layout.");switch(e.parent=this.parent,s){case"tab-after":this._insertTab(e,i,n,!0);break;case"tab-before":this._insertTab(e,i,n,!1);break;case"split-top":this._insertSplit(e,i,n,"vertical",!1);break;case"split-left":this._insertSplit(e,i,n,"horizontal",!1);break;case"split-right":this._insertSplit(e,i,n,"horizontal",!0);break;case"split-bottom":this._insertSplit(e,i,n,"vertical",!0);break;case"merge-top":this._insertSplit(e,i,n,"vertical",!1,!0);break;case"merge-left":this._insertSplit(e,i,n,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(e,i,n,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(e,i,n,"vertical",!0,!0)}this.parent&&(this.attachWidget(e),this.parent.fit())}removeWidget(e){this._removeWidget(e),this.parent&&(this.detachWidget(e),this.parent.fit())}hitTestTabAreas(e,t){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let i=this.parent.node.getBoundingClientRect(),n=e-i.left-this._box.borderLeft,a=t-i.top-this._box.borderTop,r=this._root.hitTestTabNodes(n,a);if(!r)return null;let{tabBar:o,top:h,left:d,width:l,height:c}=r,u=this._box.borderLeft+this._box.borderRight,m=this._box.borderTop+this._box.borderBottom;return{tabBar:o,x:n,y:a,top:h,left:d,right:i.width-u-(d+l),bottom:i.height-m-(h+c),width:l,height:c}}init(){super.init();for(const e of this)this.attachWidget(e);for(const e of this.handles())this.parent.node.appendChild(e);this.parent.fit()}attachWidget(e){this.parent.node!==e.node.parentNode&&(this._items.set(e,new x(e)),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach))}detachWidget(e){if(this.parent.node!==e.node.parentNode)return;this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach);let t=this._items.get(e);t&&(this._items.delete(e),t.dispose())}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_removeWidget(e){if(!this._root)return;let i=this._root.findTabNode(e);if(!i)return;if(U.removeAria(e),i.tabBar.titles.length>1){if(i.tabBar.removeTab(e.title),this._hiddenMode===b.HiddenMode.Scale&&1==i.tabBar.titles.length){i.tabBar.titles[0].owner.hiddenMode=b.HiddenMode.Display}return}if(i.tabBar.dispose(),this._root===i)return void(this._root=null);this._root.holdAllSizes();let s=i.parent;i.parent=null;let n=t.ArrayExt.removeFirstOf(s.children,i),a=t.ArrayExt.removeAt(s.handles,n);if(t.ArrayExt.removeAt(s.sizers,n),a.parentNode&&a.parentNode.removeChild(a),s.children.length>1)return void s.syncHandles();let r=s.parent;s.parent=null;let o=s.children[0],h=s.handles[0];if(s.children.length=0,s.handles.length=0,s.sizers.length=0,h.parentNode&&h.parentNode.removeChild(h),this._root===s)return o.parent=null,void(this._root=o);let d=r,l=d.children.indexOf(s);if(o instanceof U.TabLayoutNode)return o.parent=d,void(d.children[l]=o);let c=t.ArrayExt.removeAt(d.handles,l);t.ArrayExt.removeAt(d.children,l),t.ArrayExt.removeAt(d.sizers,l),c.parentNode&&c.parentNode.removeChild(c);for(let e=0,i=o.children.length;e<i;++e){let i=o.children[e],s=o.handles[e],n=o.sizers[e];t.ArrayExt.insert(d.children,l+e,i),t.ArrayExt.insert(d.handles,l+e,s),t.ArrayExt.insert(d.sizers,l+e,n),i.parent=d}o.children.length=0,o.handles.length=0,o.sizers.length=0,o.parent=null,d.syncHandles()}_createTabNode(e){let t=new U.TabLayoutNode(this._createTabBar());return t.tabBar.addTab(e.title),U.addAria(e,t.tabBar),t}_insertTab(e,t,i,s){if(e===t)return;if(!this._root){let t=new U.TabLayoutNode(this._createTabBar());return t.tabBar.addTab(e.title),this._root=t,void U.addAria(e,t.tabBar)}let n;if(i||(i=this._root.findFirstTabNode()),-1===i.tabBar.titles.indexOf(e.title)&&(this._removeWidget(e),e.hide()),n=t?i.tabBar.titles.indexOf(t.title):i.tabBar.currentIndex,this._hiddenMode===b.HiddenMode.Scale)if(0===i.tabBar.titles.length)e.hiddenMode=b.HiddenMode.Display;else if(1==i.tabBar.titles.length){i.tabBar.titles[0].owner.hiddenMode=b.HiddenMode.Scale}else e.hiddenMode=b.HiddenMode.Scale;else e.hiddenMode=this._hiddenMode;i.tabBar.insertTab(n+(s?1:0),e.title),U.addAria(e,i.tabBar)}_insertSplit(e,i,s,n,a,r=!1){if(e===i&&s&&1===s.tabBar.titles.length)return;if(this._removeWidget(e),!this._root)return void(this._root=this._createTabNode(e));if(!s||!s.parent){let i=this._splitRoot(n),r=a?i.children.length:0;i.normalizeSizes();let o=U.createSizer(s?1:U.GOLDEN_RATIO),h=this._createTabNode(e);return t.ArrayExt.insert(i.children,r,h),t.ArrayExt.insert(i.sizers,r,o),t.ArrayExt.insert(i.handles,r,this._createHandle()),h.parent=i,i.normalizeSizes(),void i.syncHandles()}let o=s.parent;if(o.orientation===n){let i=o.children.indexOf(s);if(r){let t=i+(a?1:-1),s=o.children[t];if(s instanceof U.TabLayoutNode)return this._insertTab(e,null,s,!0),void++s.tabBar.currentIndex}o.normalizeSizes();let n=o.sizers[i].sizeHint/=2,h=i+(a?1:0),d=this._createTabNode(e);return t.ArrayExt.insert(o.children,h,d),t.ArrayExt.insert(o.sizers,h,U.createSizer(n)),t.ArrayExt.insert(o.handles,h,this._createHandle()),d.parent=o,void o.syncHandles()}let h=t.ArrayExt.removeFirstOf(o.children,s),d=new U.SplitLayoutNode(n);d.normalized=!0,d.children.push(s),d.sizers.push(U.createSizer(.5)),d.handles.push(this._createHandle()),s.parent=d;let l=a?1:0,c=this._createTabNode(e);t.ArrayExt.insert(d.children,l,c),t.ArrayExt.insert(d.sizers,l,U.createSizer(.5)),t.ArrayExt.insert(d.handles,l,this._createHandle()),c.parent=d,d.syncHandles(),t.ArrayExt.insert(o.children,h,d),d.parent=o}_splitRoot(e){let t=this._root;if(t instanceof U.SplitLayoutNode&&t.orientation===e)return t;let i=this._root=new U.SplitLayoutNode(e);return t&&(i.children.push(t),i.sizers.push(U.createSizer(0)),i.handles.push(this._createHandle()),t.parent=i),i}_fit(){let e=0,t=0;if(this._root){let i=this._root.fit(this._spacing,this._items);e=i.minWidth,t=i.minHeight}let i=this._box=s.ElementExt.boxSizing(this.parent.node);e+=i.horizontalSum,t+=i.verticalSum;let a=this.parent.node.style;a.minWidth=`${e}px`,a.minHeight=`${t}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(e,t){if(this._dirty=!1,!this._root)return;e<0&&(e=this.parent.node.offsetWidth),t<0&&(t=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let i=this._box.paddingTop,n=this._box.paddingLeft,a=e-this._box.horizontalSum,r=t-this._box.verticalSum;this._root.update(i,n,a,r,this._spacing,this._items)}_createTabBar(){let e=this.renderer.createTabBar(this._document);return e.orientation="horizontal",this.parent&&this.attachWidget(e),e}_createHandle(){let e=this.renderer.createHandle(),t=e.style;return t.position="absolute",t.contain="strict",t.top="0",t.left="0",t.width="0",t.height="0",this.parent&&this.parent.node.appendChild(e),e}}!function(t){function i(e){let t=new u;return t.sizeHint=e,t.size=e,t}function s(e,t){let i;return i="tab-area"===e.type?function(e,t){if(0===e.widgets.length)return null;let i=[];for(const s of e.widgets)t.has(s)||(t.add(s),i.push(s));if(0===i.length)return null;let s=e.currentIndex;-1!==s&&(s<0||s>=i.length)&&(s=0);return{type:"tab-area",widgets:i,currentIndex:s}}(e,t):function(e,t){let i=e.orientation,n=[],a=[];for(let r=0,o=e.children.length;r<o;++r){let o=s(e.children[r],t);o&&("tab-area"===o.type||o.orientation!==i?(n.push(o),a.push(Math.abs(e.sizes[r]||0))):(n.push(...o.children),a.push(...o.sizes)))}if(0===n.length)return null;if(1===n.length)return n[0];return{type:"split-area",orientation:i,children:n,sizes:a}}(e,t),i}function n(e,s,o){let h;return h="tab-area"===e.type?function(e,i,s){let n=i.createTabBar(s);for(const i of e.widgets)i.hide(),n.addTab(i.title),t.addAria(i,n);return n.currentIndex=e.currentIndex,new a(n)}(e,s,o):function(e,t,s){let a=new r(e.orientation);return e.children.forEach(((r,o)=>{let h=n(r,t,s),d=i(e.sizes[o]),l=t.createHandle();a.children.push(h),a.handles.push(l),a.sizers.push(d),h.parent=a})),a.syncHandles(),a.normalizeSizes(),a}(e,s,o),h}t.GOLDEN_RATIO=.618,t.createSizer=i,t.normalizeAreaConfig=s,t.realizeAreaConfig=n;class a{constructor(e){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let t=new u,i=new u;t.stretch=0,i.stretch=1,this.tabBar=e,this.sizers=[t,i]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(const e of this.tabBar.titles)yield e.owner}*iterSelectedWidgets(){let e=this.tabBar.currentTitle;e&&(yield e.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(e){return-1!==this.tabBar.titles.indexOf(e.title)?this:null}findSplitNode(e){return null}findFirstTabNode(){return this}hitTestTabNodes(e,t){return e<this._left||e>=this._left+this._width||t<this._top||t>=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map((e=>e.owner)),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(e,t){let i=0,s=0,n=t.get(this.tabBar),a=this.tabBar.currentTitle,r=a?t.get(a.owner):void 0,[o,h]=this.sizers;return n&&n.fit(),r&&r.fit(),n&&!n.isHidden?(i=Math.max(i,n.minWidth),s+=n.minHeight,o.minSize=n.minHeight,o.maxSize=n.maxHeight):(o.minSize=0,o.maxSize=0),r&&!r.isHidden?(i=Math.max(i,r.minWidth),s+=r.minHeight,h.minSize=r.minHeight,h.maxSize=1/0):(h.minSize=0,h.maxSize=1/0),{minWidth:i,minHeight:s,maxWidth:Infinity,maxHeight:Infinity}}update(t,i,s,n,a,r){this._top=i,this._left=t,this._width=s,this._height=n;let o=r.get(this.tabBar),h=this.tabBar.currentTitle,d=h?r.get(h.owner):void 0;if(e.BoxEngine.calc(this.sizers,n),o&&!o.isHidden){let e=this.sizers[0].size;o.update(t,i,s,e),i+=e}if(d&&!d.isHidden){let e=this.sizers[1].size;d.update(t,i,s,e)}}}t.TabLayoutNode=a;class r{constructor(e){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=e}*iterAllWidgets(){for(const e of this.children)yield*e.iterAllWidgets()}*iterUserWidgets(){for(const e of this.children)yield*e.iterUserWidgets()}*iterSelectedWidgets(){for(const e of this.children)yield*e.iterSelectedWidgets()}*iterTabBars(){for(const e of this.children)yield*e.iterTabBars()}*iterHandles(){yield*this.handles;for(const e of this.children)yield*e.iterHandles()}findTabNode(e){for(let t=0,i=this.children.length;t<i;++t){let i=this.children[t].findTabNode(e);if(i)return i}return null}findSplitNode(e){let t=this.handles.indexOf(e);if(-1!==t)return{index:t,node:this};for(let t=0,i=this.children.length;t<i;++t){let i=this.children[t].findSplitNode(e);if(i)return i}return null}findFirstTabNode(){return 0===this.children.length?null:this.children[0].findFirstTabNode()}hitTestTabNodes(e,t){for(let i=0,s=this.children.length;i<s;++i){let s=this.children[i].hitTestTabNodes(e,t);if(s)return s}return null}createConfig(){let e=this.orientation,t=this.createNormalizedSizes();return{type:"split-area",orientation:e,children:this.children.map((e=>e.createConfig())),sizes:t}}syncHandles(){this.handles.forEach(((e,t)=>{e.setAttribute("data-orientation",this.orientation),t===this.handles.length-1?e.classList.add("lm-mod-hidden"):e.classList.remove("lm-mod-hidden")}))}holdSizes(){for(const e of this.sizers)e.sizeHint=e.size}holdAllSizes(){for(const e of this.children)e.holdAllSizes();this.holdSizes()}normalizeSizes(){let e=this.sizers.length;if(0===e)return;this.holdSizes();let t=this.sizers.reduce(((e,t)=>e+t.sizeHint),0);if(0===t)for(const t of this.sizers)t.size=t.sizeHint=1/e;else for(const e of this.sizers)e.size=e.sizeHint/=t;this.normalized=!0}createNormalizedSizes(){let e=this.sizers.length;if(0===e)return[];let t=this.sizers.map((e=>e.size)),i=t.reduce(((e,t)=>e+t),0);if(0===i)for(let i=t.length-1;i>-1;i--)t[i]=1/e;else for(let e=t.length-1;e>-1;e--)t[e]/=i;return t}fit(e,t){let i="horizontal"===this.orientation,s=Math.max(0,this.children.length-1)*e,n=i?s:0,a=i?0:s;for(let s=0,r=this.children.length;s<r;++s){let r=this.children[s].fit(e,t);i?(a=Math.max(a,r.minHeight),n+=r.minWidth,this.sizers[s].minSize=r.minWidth):(n=Math.max(n,r.minWidth),a+=r.minHeight,this.sizers[s].minSize=r.minHeight)}return{minWidth:n,minHeight:a,maxWidth:Infinity,maxHeight:Infinity}}update(t,i,s,n,a,r){let o="horizontal"===this.orientation,h=Math.max(0,this.children.length-1)*a,d=Math.max(0,(o?s:n)-h);if(this.normalized){for(const e of this.sizers)e.sizeHint*=d;this.normalized=!1}e.BoxEngine.calc(this.sizers,d);for(let e=0,h=this.children.length;e<h;++e){let h=this.children[e],d=this.sizers[e].size,l=this.handles[e].style;o?(h.update(t,i,d,n,a,r),t+=d,l.top=`${i}px`,l.left=`${t}px`,l.width=`${a}px`,l.height=`${n}px`,t+=a):(h.update(t,i,s,d,a,r),i+=d,l.top=`${i}px`,l.left=`${t}px`,l.width=`${s}px`,l.height=`${a}px`,i+=a)}}}t.SplitLayoutNode=r,t.addAria=function(e,t){e.node.setAttribute("role","tabpanel");let i=t.renderer;if(i instanceof $.Renderer){let t=i.createTabKey({title:e.title,current:!1,zIndex:0});e.node.setAttribute("aria-labelledby",t)}},t.removeAria=function(e){e.node.removeAttribute("role"),e.node.removeAttribute("aria-labelledby")}}(U||(U={}));class Z extends b{constructor(e={}){super(),this._drag=null,this._tabsMovable=!0,this._tabsConstrained=!1,this._addButtonEnabled=!1,this._pressData=null,this._layoutModified=new r.Signal(this),this._addRequested=new r.Signal(this),this.addClass("lm-DockPanel"),this._document=e.document||document,this._mode=e.mode||"multiple-document",this._renderer=e.renderer||Z.defaultRenderer,this._edges=e.edges||Y.DEFAULT_EDGES,void 0!==e.tabsMovable&&(this._tabsMovable=e.tabsMovable),void 0!==e.tabsConstrained&&(this._tabsConstrained=e.tabsConstrained),void 0!==e.addButtonEnabled&&(this._addButtonEnabled=e.addButtonEnabled),this.dataset.mode=this._mode;let t={createTabBar:()=>this._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new Q({document:this._document,renderer:t,spacing:e.spacing,hiddenMode:e.hiddenMode}),this.overlay=e.overlay||new Z.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get mode(){return this._mode}set mode(e){if(this._mode===e)return;this._mode=e,this.dataset.mode=e;let t=this.layout;switch(e){case"multiple-document":for(const e of t.tabBars())e.show();break;case"single-document":t.restoreLayout(Y.createSingleDocumentConfig(this));break;default:throw"unreachable"}n.MessageLoop.postMessage(this,Y.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(e){this._tabsMovable=e;for(const t of this.tabBars())t.tabsMovable=e}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(e){this._tabsConstrained=e}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled=e;for(const t of this.tabBars())t.addButtonEnabled=e}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(e){let i=t.find(this.tabBars(),(t=>-1!==t.titles.indexOf(e.title)));if(!i)throw new Error("Widget is not contained in the dock panel.");i.currentTitle=e.title}activateWidget(e){this.selectWidget(e),e.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(e){this._mode="multiple-document",this.layout.restoreLayout(e),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}addWidget(e,t={}){"single-document"===this._mode?this.layout.addWidget(e):this.layout.addWidget(e,t),n.MessageLoop.postMessage(this,Y.LayoutModified)}processMessage(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):super.processMessage(e)}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){Y.isGeneratedTabBarProperty.get(e.child)||e.child.addClass("lm-DockPanel-widget")}onChildRemoved(e){Y.isGeneratedTabBarProperty.get(e.child)||(e.child.removeClass("lm-DockPanel-widget"),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtDragEnter(e){e.mimeData.hasData("application/vnd.lumino.widget-factory")&&(e.preventDefault(),e.stopPropagation())}_evtDragLeave(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||(e.stopPropagation(),this.overlay.hide(1))}_evtDragOver(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||"invalid"===this._showOverlay(e.clientX,e.clientY)?e.dropAction="none":(e.stopPropagation(),e.dropAction=e.proposedAction)}_evtDrop(e){if(e.preventDefault(),this.overlay.hide(0),"none"===e.proposedAction)return void(e.dropAction="none");let{clientX:t,clientY:i}=e,{zone:s,target:n}=Y.findDropTarget(this,t,i,this._edges);if(this._tabsConstrained&&e.source!==this||"invalid"===s)return void(e.dropAction="none");let a=e.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof a)return void(e.dropAction="none");let r=a();if(!(r instanceof b))return void(e.dropAction="none");if(r.contains(this))return void(e.dropAction="none");let o=n?Y.getDropRef(n.tabBar):null;switch(s){case"root-all":this.addWidget(r);break;case"root-top":this.addWidget(r,{mode:"split-top"});break;case"root-left":this.addWidget(r,{mode:"split-left"});break;case"root-right":this.addWidget(r,{mode:"split-right"});break;case"root-bottom":this.addWidget(r,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(r,{mode:"tab-after",ref:o});break;case"widget-top":this.addWidget(r,{mode:"split-top",ref:o});break;case"widget-left":this.addWidget(r,{mode:"split-left",ref:o});break;case"widget-right":this.addWidget(r,{mode:"split-right",ref:o});break;case"widget-bottom":this.addWidget(r,{mode:"split-bottom",ref:o});break;default:throw"unreachable"}e.dropAction=e.proposedAction,e.stopPropagation(),this.activateWidget(r)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation(),27===e.keyCode&&(this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtPointerDown(e){if(0!==e.button)return;let i=this.layout,s=e.target,n=t.find(i.handles(),(e=>e.contains(s)));if(!n)return;e.preventDefault(),e.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let a=n.getBoundingClientRect(),r=e.clientX-a.left,h=e.clientY-a.top,d=window.getComputedStyle(n),l=o.Drag.overrideCursor(d.cursor,this._document);this._pressData={handle:n,deltaX:r,deltaY:h,override:l}}_evtPointerMove(e){if(!this._pressData)return;e.preventDefault(),e.stopPropagation();let t=this.node.getBoundingClientRect(),i=e.clientX-t.left-this._pressData.deltaX,s=e.clientY-t.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,i,s)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(e,t){let i,n,a,r,{zone:o,target:h}=Y.findDropTarget(this,e,t,this._edges);if("invalid"===o)return this.overlay.hide(100),o;let d=s.ElementExt.boxSizing(this.node),l=this.node.getBoundingClientRect();switch(o){case"root-all":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"root-top":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=l.height*Y.GOLDEN_RATIO;break;case"root-left":i=d.paddingTop,n=d.paddingLeft,a=l.width*Y.GOLDEN_RATIO,r=d.paddingBottom;break;case"root-right":i=d.paddingTop,n=l.width*Y.GOLDEN_RATIO,a=d.paddingRight,r=d.paddingBottom;break;case"root-bottom":i=l.height*Y.GOLDEN_RATIO,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"widget-all":i=h.top,n=h.left,a=h.right,r=h.bottom;break;case"widget-top":i=h.top,n=h.left,a=h.right,r=h.bottom+h.height/2;break;case"widget-left":i=h.top,n=h.left,a=h.right+h.width/2,r=h.bottom;break;case"widget-right":i=h.top,n=h.left+h.width/2,a=h.right,r=h.bottom;break;case"widget-bottom":i=h.top+h.height/2,n=h.left,a=h.right,r=h.bottom;break;case"widget-tab":{const e=h.tabBar.node.getBoundingClientRect().height;i=h.top,n=h.left,a=h.right,r=h.bottom+h.height-e;break}default:throw"unreachable"}return this.overlay.show({top:i,left:n,right:a,bottom:r}),o}_createTabBar(){let e=this._renderer.createTabBar(this._document);return Y.isGeneratedTabBarProperty.set(e,!0),"single-document"===this._mode&&e.hide(),e.tabsMovable=this._tabsMovable,e.allowDeselect=!1,e.addButtonEnabled=this._addButtonEnabled,e.removeBehavior="select-previous-tab",e.insertBehavior="select-tab-if-needed",e.tabMoved.connect(this._onTabMoved,this),e.currentChanged.connect(this._onCurrentChanged,this),e.tabCloseRequested.connect(this._onTabCloseRequested,this),e.tabDetachRequested.connect(this._onTabDetachRequested,this),e.tabActivateRequested.connect(this._onTabActivateRequested,this),e.addRequested.connect(this._onTabAddRequested,this),e}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){n.MessageLoop.postMessage(this,Y.LayoutModified)}_onCurrentChanged(e,t){let{previousTitle:i,currentTitle:a}=t;i&&i.owner.hide(),a&&a.owner.show(),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}_onTabAddRequested(e){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabDetachRequested(e,t){if(this._drag)return;e.releaseMouse();let{title:s,tab:n,clientX:a,clientY:r,offset:h}=t,d=new i.MimeData;d.setData("application/vnd.lumino.widget-factory",(()=>s.owner));let l=n.cloneNode(!0);h&&(l.style.top=`-${h.y}px`,l.style.left=`-${h.x}px`),this._drag=new o.Drag({document:this._document,mimeData:d,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),n.classList.add("lm-mod-hidden");this._drag.start(a,r).then((()=>{this._drag=null,n.classList.remove("lm-mod-hidden")}))}}!function(e){e.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(e){let t=this.node.style;t.top=`${e.top}px`,t.left=`${e.left}px`,t.right=`${e.right}px`,t.bottom=`${e.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(e){if(!this._hidden)return e<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,void this.node.classList.add("lm-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")}),e)))}};class t{createTabBar(e){let t=new $({document:e});return t.addClass("lm-DockPanel-tabBar"),t}createHandle(){let e=document.createElement("div");return e.className="lm-DockPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t}(Z||(Z={})),function(e){e.GOLDEN_RATIO=.618,e.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},e.LayoutModified=new n.ConflatableMessage("layout-modified"),e.isGeneratedTabBarProperty=new a.AttachedProperty({name:"isGeneratedTabBar",create:()=>!1}),e.createSingleDocumentConfig=function(e){if(e.isEmpty)return{main:null};let t=Array.from(e.widgets()),i=e.selectedWidgets().next().value,s=i?t.indexOf(i):-1;return{main:{type:"tab-area",widgets:t,currentIndex:s}}},e.findDropTarget=function(e,t,i,n){if(!s.ElementExt.hitTest(e.node,t,i))return{zone:"invalid",target:null};let a=e.layout;if(a.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===e.mode){let s=e.node.getBoundingClientRect(),a=t-s.left+1,r=i-s.top+1,o=s.right-t,h=s.bottom-i;switch(Math.min(r,o,h,a)){case r:if(r<n.top)return{zone:"root-top",target:null};break;case o:if(o<n.right)return{zone:"root-right",target:null};break;case h:if(h<n.bottom)return{zone:"root-bottom",target:null};break;case a:if(a<n.left)return{zone:"root-left",target:null};break;default:throw"unreachable"}}let r=a.hitTestTabAreas(t,i);if(!r)return{zone:"invalid",target:null};if("single-document"===e.mode)return{zone:"widget-all",target:r};let o=r.x-r.left+1,h=r.y-r.top+1,d=r.left+r.width-r.x,l=r.top+r.height-r.y;if(h<r.tabBar.node.getBoundingClientRect().height)return{zone:"widget-tab",target:r};let c,u=Math.round(r.width/3),m=Math.round(r.height/3);if(o>u&&d>u&&h>m&&l>m)return{zone:"widget-all",target:r};switch(o/=u,h/=m,d/=u,l/=m,Math.min(o,h,d,l)){case o:c="widget-left";break;case h:c="widget-top";break;case d:c="widget-right";break;case l:c="widget-bottom";break;default:throw"unreachable"}return{zone:c,target:r}},e.getDropRef=function(e){return 0===e.titles.length?null:e.currentTitle?e.currentTitle.owner:e.titles[e.titles.length-1].owner}}(Y||(Y={}));class ee extends v{constructor(e={}){super(e),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new u],this._columnSizers=[new u],this._box=null,void 0!==e.rowCount&&X.reallocSizers(this._rowSizers,e.rowCount),void 0!==e.columnCount&&X.reallocSizers(this._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(this._rowSpacing=X.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(this._columnSpacing=X.clampValue(e.columnSpacing))}dispose(){for(const e of this._items){let t=e.widget;e.dispose(),t.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(e){e!==this.rowCount&&(X.reallocSizers(this._rowSizers,e),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(e){e!==this.columnCount&&(X.reallocSizers(this._columnSizers,e),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){e=X.clampValue(e),this._rowSpacing!==e&&(this._rowSpacing=e,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){e=X.clampValue(e),this._columnSpacing!==e&&(this._columnSpacing=e,this.parent&&this.parent.fit())}rowStretch(e){let t=this._rowSizers[e];return t?t.stretch:-1}setRowStretch(e,t){let i=this._rowSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}columnStretch(e){let t=this._columnSizers[e];return t?t.stretch:-1}setColumnStretch(e,t){let i=this._columnSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(const e of this._items)yield e.widget}addWidget(e){-1===t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e))&&(this._items.push(new x(e)),this.parent&&this.attachWidget(e))}removeWidget(e){let i=t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e));if(-1===i)return;let s=t.ArrayExt.removeAt(this._items,i);this.parent&&this.detachWidget(e),s.dispose()}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach),this.parent.fit()}detachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){for(let e=0,t=this.rowCount;e<t;++e)this._rowSizers[e].minSize=0;for(let e=0,t=this.columnCount;e<t;++e)this._columnSizers[e].minSize=0;let e=this._items.filter((e=>!e.isHidden));for(let t=0,i=e.length;t<i;++t)e[t].fit();let t=this.rowCount-1,i=this.columnCount-1;e.sort(X.rowSpanCmp);for(let i=0,s=e.length;i<s;++i){let s=e[i],n=ee.getCellConfig(s.widget),a=Math.min(n.row,t),r=Math.min(n.row+n.rowSpan-1,t);X.distributeMin(this._rowSizers,a,r,s.minHeight)}e.sort(X.columnSpanCmp);for(let t=0,s=e.length;t<s;++t){let s=e[t],n=ee.getCellConfig(s.widget),a=Math.min(n.column,i),r=Math.min(n.column+n.columnSpan-1,i);X.distributeMin(this._columnSizers,a,r,s.minWidth)}if("set-no-constraint"===this.fitPolicy)return void n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest);let a=t*this._rowSpacing,r=i*this._columnSpacing;for(let e=0,t=this.rowCount;e<t;++e)a+=this._rowSizers[e].minSize;for(let e=0,t=this.columnCount;e<t;++e)r+=this._columnSizers[e].minSize;let o=this._box=s.ElementExt.boxSizing(this.parent.node);r+=o.horizontalSum,a+=o.verticalSum;let h=this.parent.node.style;h.minWidth=`${r}px`,h.minHeight=`${a}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1,t<0&&(t=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let n=this._box.paddingTop,a=this._box.paddingLeft,r=t-this._box.horizontalSum,o=i-this._box.verticalSum,h=this.rowCount-1,d=this.columnCount-1,l=h*this._rowSpacing,c=d*this._columnSpacing;e.BoxEngine.calc(this._rowSizers,Math.max(0,o-l)),e.BoxEngine.calc(this._columnSizers,Math.max(0,r-c));for(let e=0,t=n,i=this.rowCount;e<i;++e)this._rowStarts[e]=t,t+=this._rowSizers[e].size+this._rowSpacing;for(let e=0,t=a,i=this.columnCount;e<i;++e)this._columnStarts[e]=t,t+=this._columnSizers[e].size+this._columnSpacing;for(let e=0,t=this._items.length;e<t;++e){let t=this._items[e];if(t.isHidden)continue;let i=ee.getCellConfig(t.widget),s=Math.min(i.row,h),n=Math.min(i.column,d),a=Math.min(i.row+i.rowSpan-1,h),r=Math.min(i.column+i.columnSpan-1,d),o=this._columnStarts[n],l=this._rowStarts[s],c=this._columnStarts[r]+this._columnSizers[r].size-o,u=this._rowStarts[a]+this._rowSizers[a].size-l;t.update(o,l,c,u)}}}!function(e){e.getCellConfig=function(e){return X.cellConfigProperty.get(e)},e.setCellConfig=function(e,t){X.cellConfigProperty.set(e,X.normalizeConfig(t))}}(ee||(ee={})),function(e){e.cellConfigProperty=new a.AttachedProperty({name:"cellConfig",create:()=>({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(e){e.parent&&e.parent.layout instanceof ee&&e.parent.fit()}}),e.normalizeConfig=function(e){return{row:Math.max(0,Math.floor(e.row||0)),column:Math.max(0,Math.floor(e.column||0)),rowSpan:Math.max(1,Math.floor(e.rowSpan||0)),columnSpan:Math.max(1,Math.floor(e.columnSpan||0))}},e.clampValue=function(e){return Math.max(0,Math.floor(e))},e.rowSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.rowSpan-n.rowSpan},e.columnSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.columnSpan-n.columnSpan},e.reallocSizers=function(e,t){for(t=Math.max(1,Math.floor(t));e.length<t;)e.push(new u);e.length>t&&(e.length=t)},e.distributeMin=function(e,t,i,s){if(i<t)return;if(t===i){let i=e[t];return void(i.minSize=Math.max(i.minSize,s))}let n=0;for(let s=t;s<=i;++s)n+=e[s].minSize;if(n>=s)return;let a=(s-n)/(i-t+1);for(let s=t;s<=i;++s)e[s].minSize+=a}}(X||(X={}));class te extends b{constructor(e={}){super({node:K.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(b.Flag.DisallowLayout),this.renderer=e.renderer||te.defaultRenderer,this._forceItemsPosition=e.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=e.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(e){this.activeIndex=e?this._menus.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._menus.length)&&(e=-1),e>-1&&0===this._menus[e].items.length&&(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(e,t=!0){this.insertMenu(this._menus.length,e,t)}insertMenu(e,i,s=!0){this._closeChildMenu();let n=this._menus.indexOf(i),a=Math.max(0,Math.min(e,this._menus.length));if(-1===n)return t.ArrayExt.insert(this._menus,a,i),i.addClass("lm-MenuBar-menu"),i.aboutToClose.connect(this._onMenuAboutToClose,this),i.menuRequested.connect(this._onMenuMenuRequested,this),i.title.changed.connect(this._onTitleChanged,this),void(s&&this.update());a===this._menus.length&&a--,n!==a&&(t.ArrayExt.move(this._menus,n,a),s&&this.update())}removeMenu(e,t=!0){this.removeMenuAt(this._menus.indexOf(e),t)}removeMenuAt(e,i=!0){this._closeChildMenu();let s=t.ArrayExt.removeAt(this._menus,e);s&&(s.aboutToClose.disconnect(this._onMenuAboutToClose,this),s.menuRequested.disconnect(this._onMenuMenuRequested,this),s.title.changed.disconnect(this._onTitleChanged,this),s.removeClass("lm-MenuBar-menu"),i&&this.update())}clearMenus(){if(0!==this._menus.length){this._closeChildMenu();for(let e of this._menus)e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":case"mouseleave":this._evtMouseMove(e);break;case"focusout":this._evtFocusOut(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(e){this.isAttached&&this._focusItemAt(0)}onResize(e){this.update(),super.onResize(e)}onUpdateRequest(e){var t;let i=this._menus,s=this.renderer,n=this._activeIndex,a=this._tabFocusIndex>=0&&this._tabFocusIndex<i.length?this._tabFocusIndex:0,r=this._overflowIndex>-1?this._overflowIndex:i.length,o=0,l=!1;r=null!==this._overflowMenu?r-1:r;let c=new Array(r);for(let e=0;e<r;++e)c[e]=s.renderItem({title:i[e].title,active:e===n,tabbable:e===a,disabled:0===i[e].items.length,onfocus:()=>{this._tabFocusIndex=e,this.activeIndex=e}}),o+=this._menuItemSizes[e],i[e].title.label===this._overflowMenuOptions.title&&(l=!0,r--);if(this._overflowMenuOptions.isVisible)if(this._overflowIndex>-1&&!l){if(null===this._overflowMenu){const e=null!==(t=this._overflowMenuOptions.title)&&void 0!==t?t:"...";this._overflowMenu=new F({commands:new h.CommandRegistry}),this._overflowMenu.title.label=e,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let e=i.length-2;e>=r;e--){const t=this.menus[e];t.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:t}),this.removeMenu(t,!1)}c[r]=s.renderItem({title:this._overflowMenu.title,active:r===n&&0!==i[r].items.length,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}else if(null!==this._overflowMenu){let e=this._overflowMenu.items,t=this.node.offsetWidth,n=this._overflowMenu.items.length;for(let h=0;h<n;++h){let n=i.length-1-h;if(t-o>this._menuItemSizes[n]){let t=e[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(r,t,!1),c[r]=s.renderItem({title:t.title,active:!1,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),c.pop(),this._overflowMenu=null,this._overflowIndex=-1)}d.VirtualDOM.render(c,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;const e=this.contentNode.childNodes;let t=this.node.offsetWidth,i=0,s=-1,n=e.length;if(0==this._menuItemSizes.length)for(let a=0;a<n;a++){let n=e[a];i+=n.offsetWidth,this._menuItemSizes.push(n.offsetWidth),i>t&&-1===s&&(s=a)}else for(let e=0;e<this._menuItemSizes.length;e++)if(i+=this._menuItemSizes[e],i>t){s=e;break}this._overflowIndex=s}_evtKeyDown(e){let t=e.keyCode;if(9===t)return void(this.activeIndex=-1);if(e.preventDefault(),e.stopPropagation(),13===t||32===t||38===t||40===t){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;return void this.openActiveMenu()}if(27===t)return this._closeChildMenu(),void this._focusItemAt(this.activeIndex);if(37===t||39===t){let e=37===t?-1:1,i=this._tabFocusIndex+e,s=this._menus.length;for(let t=0;t<s;t++){let n=(s+i+e*t)%s;if(this._menus[n].items.length)return void this._focusItemAt(n)}return}let i=c.getKeyboardLayout().keyForKeydownEvent(e);if(!i)return;let s=this._activeIndex+1,n=K.findMnemonic(this._menus,i,s);-1===n.index||n.multiple?-1!==n.index?(this.activeIndex=n.index,this._focusItemAt(this.activeIndex)):-1!==n.auto&&(this.activeIndex=n.auto,this._focusItemAt(this.activeIndex)):(this.activeIndex=n.index,this.openActiveMenu())}_evtMouseDown(e){if(!s.ElementExt.hitTest(this.node,e.clientX,e.clientY))return;e.stopPropagation(),e.stopImmediatePropagation();let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1!==i){if(0===e.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=i;else{e.preventDefault();const t=this._positionForMenu(i);F.saveWindowData(),this.activeIndex=i,this._openChildMenu(t)}}else this._closeChildMenu()}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(-1===i&&this._childMenu)return;const n=i>=0&&this._childMenu?this._positionForMenu(i):null;F.saveWindowData(),this.activeIndex=i,n&&this._openChildMenu(n)}_positionForMenu(e){let t=this.contentNode.children[e],{left:i,bottom:s}=t.getBoundingClientRect();return{top:s,left:i}}_evtFocusOut(e){this._childMenu||this.node.contains(e.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(e){const t=this.contentNode.childNodes[e];t&&t.focus()}_openChildMenu(e={}){let t=this.activeMenu;if(!t)return void this._closeChildMenu();let i=this._childMenu;if(i===t)return;this._childMenu=t,i?i.close():document.addEventListener("mousedown",this,!0),this._tabFocusIndex=this.activeIndex,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let{left:s,top:a}=e;void 0!==s&&void 0!==a||({left:s,top:a}=this._positionForMenu(this._activeIndex)),i||this.addClass("lm-mod-active"),t.items.length>0&&t.open(s,a,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0);let e=this._childMenu;this._childMenu=null,e.close(),this.activeIndex=-1}_onMenuAboutToClose(e){e===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(e,t){if(e!==this._childMenu)return;let i=this._activeIndex,s=this._menus.length;switch(t){case"next":this.activeIndex=i===s-1?0:i+1;break;case"previous":this.activeIndex=0===i?s-1:i-1}this.openActiveMenu()}_onTitleChanged(){this.update()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,...e.disabled?{}:{tabindex:e.tabbable?"0":"-1"},onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.title.icon,e.title.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-MenuBar-itemLabel"},t)}createItemClass(e){let t="lm-MenuBar-item";return e.title.className&&(t+=` ${e.title.className}`),e.active&&!e.disabled&&(t+=" lm-mod-active"),t}createItemDataset(e){return e.title.dataset}createItemARIA(e){return{role:"menuitem","aria-haspopup":"true","aria-disabled":e.disabled?"true":"false"}}createIconClass(e){let t="lm-MenuBar-itemIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}formatLabel(e){let{label:t,mnemonic:i}=e.title;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-MenuBar-itemMnemonic"},a),n]}}e.Renderer=t,e.defaultRenderer=new t}(te||(te={})),function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-MenuBar-content",e.appendChild(t),t.setAttribute("role","menubar"),e},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t<o;++t){let h=(t+i)%o,d=e[h].title;if(0===d.label.length)continue;let l=d.mnemonic;l>=0&&l<d.label.length?d.label[l].toUpperCase()===r&&(-1===s?s=h:a=!0):-1===n&&d.label[0].toUpperCase()===r&&(n=h)}return{index:s,multiple:a,auto:n}}}(K||(K={}));!function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("div"),i=document.createElement("div"),s=document.createElement("div"),n=document.createElement("div");return t.className="lm-ScrollBar-button",i.className="lm-ScrollBar-button",t.dataset.action="decrement",i.dataset.action="increment",s.className="lm-ScrollBar-track",n.className="lm-ScrollBar-thumb",s.appendChild(n),e.appendChild(t),e.appendChild(s),e.appendChild(i),e},e.findPart=function(e,t){return e.thumbNode.contains(t)?"thumb":e.trackNode.contains(t)?"track":e.decrementNode.contains(t)?"decrement":e.incrementNode.contains(t)?"increment":null}}(G||(G={}));class ie extends v{constructor(){super(...arguments),this._widget=null}dispose(){if(this._widget){let e=this._widget;this._widget=null,e.dispose()}super.dispose()}get widget(){return this._widget}set widget(e){e&&(e.parent=this.parent),this._widget!==e&&(this._widget&&this._widget.dispose(),this._widget=e,this.parent&&e&&this.attachWidget(e))}*[Symbol.iterator](){this._widget&&(yield this._widget)}removeWidget(e){this._widget===e&&(this._widget=null,this.parent&&this.detachWidget(e))}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach)}detachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach)}}class se extends M{constructor(e={}){super(e),this._dirty=!1,this._items=[],this._box=null,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:b.HiddenMode.Display}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this._hiddenMode=e,this.widgets.length>1&&this.widgets.forEach((e=>{e.hiddenMode=this._hiddenMode})))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(e,i){this._hiddenMode===b.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=b.HiddenMode.Scale),i.hiddenMode=b.HiddenMode.Scale):i.hiddenMode=b.HiddenMode.Display,t.ArrayExt.insert(this._items,e,new x(i)),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.widget.node.style.zIndex="",this._hiddenMode===b.HiddenMode.Scale&&(i.hiddenMode=b.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=b.HiddenMode.Display)),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0,t=0;for(let i=0,s=this._items.length;i<s;++i){let s=this._items[i];s.isHidden||(s.fit(),e=Math.max(e,s.minWidth),t=Math.max(t,s.minHeight))}let i=this._box=s.ElementExt.boxSizing(this.parent.node);e+=i.horizontalSum,t+=i.verticalSum;let a=this.parent.node.style;a.minWidth=`${e}px`,a.minHeight=`${t}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(e,t){this._dirty=!1;let i=0;for(let e=0,t=this._items.length;e<t;++e)i+=+!this._items[e].isHidden;if(0===i)return;e<0&&(e=this.parent.node.offsetWidth),t<0&&(t=this.parent.node.offsetHeight),this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let n=this._box.paddingTop,a=this._box.paddingLeft,r=e-this._box.horizontalSum,o=t-this._box.verticalSum;for(let e=0,t=this._items.length;e<t;++e){let t=this._items[e];t.isHidden||(t.widget.node.style.zIndex=`${e}`,t.update(a,n,r,o))}}}class ne extends R{constructor(e={}){super({layout:j.createLayout(e)}),this._widgetRemoved=new r.Signal(this),this.addClass("lm-StackedPanel")}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get widgetRemoved(){return this._widgetRemoved}onChildAdded(e){e.child.addClass("lm-StackedPanel-child")}onChildRemoved(e){e.child.removeClass("lm-StackedPanel-child"),this._widgetRemoved.emit(e.child)}}!function(e){e.createLayout=function(e){return e.layout||new se}}(j||(j={}));!function(e){e.orientationFromPlacement=function(e){return t[e]},e.directionFromPlacement=function(e){return i[e]};const t={top:"horizontal",left:"vertical",right:"vertical",bottom:"horizontal"},i={top:"top-to-bottom",left:"left-to-right",right:"right-to-left",bottom:"bottom-to-top"}}(J||(J={})),e.AccordionLayout=k,e.AccordionPanel=H,e.BoxLayout=P,e.BoxPanel=W,e.BoxSizer=u,e.CommandPalette=q,e.ContextMenu=class{constructor(e){this._groupByTarget=!0,this._idTick=0,this._items=[],this._sortBySelector=!0;const{groupByTarget:t,sortBySelector:i,...s}=e;this.menu=new F(s),this._groupByTarget=!1!==t,this._sortBySelector=!1!==i}addItem(e){let i=T.createItem(e,this._idTick++);return this._items.push(i),new l.DisposableDelegate((()=>{t.ArrayExt.removeFirstOf(this._items,i)}))}open(e){if(F.saveWindowData(),this.menu.clearItems(),0===this._items.length)return!1;let t=T.matchItems(this._items,e,this._groupByTarget,this._sortBySelector);if(!t||0===t.length)return!1;for(const e of t)this.menu.addItem(e);return this.menu.open(e.clientX,e.clientY),!0}},e.DockLayout=Q,e.DockPanel=Z,e.FocusTracker=class{constructor(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new r.Signal(this),this._currentChanged=new r.Signal(this)}dispose(){if(!(this._counter<0)){this._counter=-1,r.Signal.clearData(this);for(const e of this._widgets)e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0);this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0}}get currentChanged(){return this._currentChanged}get activeChanged(){return this._activeChanged}get isDisposed(){return this._counter<0}get currentWidget(){return this._currentWidget}get activeWidget(){return this._activeWidget}get widgets(){return this._widgets}focusNumber(e){let t=this._numbers.get(e);return void 0===t?-1:t}has(e){return this._numbers.has(e)}add(e){if(this._numbers.has(e))return;let t=e.node.contains(document.activeElement),i=t?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,i),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),t&&this._setWidgets(e,e)}remove(e){if(!this._numbers.has(e))return;if(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),t.ArrayExt.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget!==e)return;let i=this._widgets.filter((e=>-1!==this._numbers.get(e))),s=t.max(i,((e,t)=>this._numbers.get(e)-this._numbers.get(t)))||null;this._setWidgets(s,null)}handleEvent(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e)}}_setWidgets(e,t){let i=this._currentWidget;this._currentWidget=e;let s=this._activeWidget;this._activeWidget=t,i!==e&&this._currentChanged.emit({oldValue:i,newValue:e}),s!==t&&this._activeChanged.emit({oldValue:s,newValue:t})}_evtFocus(e){let t=this._nodes.get(e.currentTarget);t!==this._currentWidget&&this._numbers.set(t,this._counter++),this._setWidgets(t,t)}_evtBlur(e){let i=this._nodes.get(e.currentTarget),s=e.relatedTarget;s&&(i.node.contains(s)||t.find(this._widgets,(e=>e.node.contains(s))))||this._setWidgets(this._currentWidget,null)}_onWidgetDisposed(e){this.remove(e)}},e.GridLayout=ee,e.Layout=v,e.LayoutItem=x,e.Menu=F,e.MenuBar=te,e.Panel=R,e.PanelLayout=M,e.ScrollBar=class extends b{constructor(e={}){super({node:G.createNode()}),this._onRepeat=()=>{if(this._repeatTimer=-1,!this._pressData)return;let e=this._pressData.part;if("thumb"===e)return;this._repeatTimer=window.setTimeout(this._onRepeat,20);let t=this._pressData.mouseX,i=this._pressData.mouseY;if("decrement"!==e)if("increment"!==e){if("track"===e){if(!s.ElementExt.hitTest(this.trackNode,t,i))return;let e=this.thumbNode;if(s.ElementExt.hitTest(e,t,i))return;let n,a=e.getBoundingClientRect();return n="horizontal"===this._orientation?t<a.left?"decrement":"increment":i<a.top?"decrement":"increment",void this._pageRequested.emit(n)}}else{if(!s.ElementExt.hitTest(this.incrementNode,t,i))return;this._stepRequested.emit("increment")}else{if(!s.ElementExt.hitTest(this.decrementNode,t,i))return;this._stepRequested.emit("decrement")}},this._value=0,this._page=10,this._maximum=100,this._repeatTimer=-1,this._pressData=null,this._thumbMoved=new r.Signal(this),this._stepRequested=new r.Signal(this),this._pageRequested=new r.Signal(this),this.addClass("lm-ScrollBar"),this.setFlag(b.Flag.DisallowLayout),this._orientation=e.orientation||"vertical",this.dataset.orientation=this._orientation,void 0!==e.maximum&&(this._maximum=Math.max(0,e.maximum)),void 0!==e.page&&(this._page=Math.max(0,e.page)),void 0!==e.value&&(this._value=Math.max(0,Math.min(e.value,this._maximum)))}get thumbMoved(){return this._thumbMoved}get stepRequested(){return this._stepRequested}get pageRequested(){return this._pageRequested}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.update())}get value(){return this._value}set value(e){e=Math.max(0,Math.min(e,this._maximum)),this._value!==e&&(this._value=e,this.update())}get page(){return this._page}set page(e){e=Math.max(0,e),this._page!==e&&(this._page=e,this.update())}get maximum(){return this._maximum}set maximum(e){e=Math.max(0,e),this._maximum!==e&&(this._maximum=e,this._value=Math.min(this._value,e),this.update())}get decrementNode(){return this.node.getElementsByClassName("lm-ScrollBar-button")[0]}get incrementNode(){return this.node.getElementsByClassName("lm-ScrollBar-button")[1]}get trackNode(){return this.node.getElementsByClassName("lm-ScrollBar-track")[0]}get thumbNode(){return this.node.getElementsByClassName("lm-ScrollBar-thumb")[0]}handleEvent(e){switch(e.type){case"mousedown":this._evtMouseDown(e);break;case"mousemove":this._evtMouseMove(e);break;case"mouseup":this._evtMouseUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("mousedown",this),this.update()}onAfterDetach(e){this.node.removeEventListener("mousedown",this),this._releaseMouse()}onUpdateRequest(e){let t=100*this._value/this._maximum,i=100*this._page/(this._page+this._maximum);t=Math.max(0,Math.min(t,100)),i=Math.max(0,Math.min(i,100));let s=this.thumbNode.style;"horizontal"===this._orientation?(s.top="",s.height="",s.left=`${t}%`,s.width=`${i}%`,s.transform=`translate(${-t}%, 0%)`):(s.left="",s.width="",s.top=`${t}%`,s.height=`${i}%`,s.transform=`translate(0%, ${-t}%)`)}_evtKeyDown(e){if(e.preventDefault(),e.stopPropagation(),27!==e.keyCode)return;let t=this._pressData?this._pressData.value:-1;this._releaseMouse(),-1!==t&&this._moveThumb(t)}_evtMouseDown(e){if(0!==e.button)return;if(this.activate(),this._pressData)return;let t=G.findPart(this,e.target);if(!t)return;e.preventDefault(),e.stopPropagation();let i=o.Drag.overrideCursor("default");if(this._pressData={part:t,override:i,delta:-1,value:-1,mouseX:e.clientX,mouseY:e.clientY},document.addEventListener("mousemove",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0),"thumb"===t){let t=this.thumbNode,i=t.getBoundingClientRect();return"horizontal"===this._orientation?this._pressData.delta=e.clientX-i.left:this._pressData.delta=e.clientY-i.top,t.classList.add("lm-mod-active"),void(this._pressData.value=this._value)}if("track"===t){let t,i=this.thumbNode.getBoundingClientRect();return t="horizontal"===this._orientation?e.clientX<i.left?"decrement":"increment":e.clientY<i.top?"decrement":"increment",this._repeatTimer=window.setTimeout(this._onRepeat,350),void this._pageRequested.emit(t)}return"decrement"===t?(this.decrementNode.classList.add("lm-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),void this._stepRequested.emit("decrement")):"increment"===t?(this.incrementNode.classList.add("lm-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),void this._stepRequested.emit("increment")):void 0}_evtMouseMove(e){if(!this._pressData)return;if(e.preventDefault(),e.stopPropagation(),this._pressData.mouseX=e.clientX,this._pressData.mouseY=e.clientY,"thumb"!==this._pressData.part)return;let t,i,s=this.thumbNode.getBoundingClientRect(),n=this.trackNode.getBoundingClientRect();"horizontal"===this._orientation?(t=e.clientX-n.left-this._pressData.delta,i=n.width-s.width):(t=e.clientY-n.top-this._pressData.delta,i=n.height-s.height);let a=0===i?0:t*this._maximum/i;this._moveThumb(a)}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(clearTimeout(this._repeatTimer),this._repeatTimer=-1,this._pressData.override.dispose(),this._pressData=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0),this.thumbNode.classList.remove("lm-mod-active"),this.decrementNode.classList.remove("lm-mod-active"),this.incrementNode.classList.remove("lm-mod-active"))}_moveThumb(e){e=Math.max(0,Math.min(e,this._maximum)),this._value!==e&&(this._value=e,this.update(),this._thumbMoved.emit(e))}},e.SingletonLayout=ie,e.SplitLayout=B,e.SplitPanel=N,e.StackedLayout=se,e.StackedPanel=ne,e.TabBar=$,e.TabPanel=class extends b{constructor(e={}){super(),this._currentChanged=new r.Signal(this),this._addRequested=new r.Signal(this),this.addClass("lm-TabPanel"),this.tabBar=new $(e),this.tabBar.addClass("lm-TabPanel-tabBar"),this.stackedPanel=new ne,this.stackedPanel.addClass("lm-TabPanel-stackedPanel"),this.tabBar.tabMoved.connect(this._onTabMoved,this),this.tabBar.currentChanged.connect(this._onCurrentChanged,this),this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested,this),this.tabBar.tabActivateRequested.connect(this._onTabActivateRequested,this),this.tabBar.addRequested.connect(this._onTabAddRequested,this),this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved,this),this._tabPlacement=e.tabPlacement||"top";let t=J.directionFromPlacement(this._tabPlacement),i=J.orientationFromPlacement(this._tabPlacement);this.tabBar.orientation=i,this.tabBar.dataset.placement=this._tabPlacement;let s=new P({direction:t,spacing:0});P.setStretch(this.tabBar,0),P.setStretch(this.stackedPanel,1),s.addWidget(this.tabBar),s.addWidget(this.stackedPanel),this.layout=s}get currentChanged(){return this._currentChanged}get currentIndex(){return this.tabBar.currentIndex}set currentIndex(e){this.tabBar.currentIndex=e}get currentWidget(){let e=this.tabBar.currentTitle;return e?e.owner:null}set currentWidget(e){this.tabBar.currentTitle=e?e.title:null}get tabsMovable(){return this.tabBar.tabsMovable}set tabsMovable(e){this.tabBar.tabsMovable=e}get addButtonEnabled(){return this.tabBar.addButtonEnabled}set addButtonEnabled(e){this.tabBar.addButtonEnabled=e}get tabPlacement(){return this._tabPlacement}set tabPlacement(e){if(this._tabPlacement===e)return;this._tabPlacement=e;let t=J.directionFromPlacement(e),i=J.orientationFromPlacement(e);this.tabBar.orientation=i,this.tabBar.dataset.placement=e,this.layout.direction=t}get addRequested(){return this._addRequested}get widgets(){return this.stackedPanel.widgets}addWidget(e){this.insertWidget(this.widgets.length,e)}insertWidget(e,t){t!==this.currentWidget&&t.hide(),this.stackedPanel.insertWidget(e,t),this.tabBar.insertTab(e,t.title),t.node.setAttribute("role","tabpanel");let i=this.tabBar.renderer;if(i instanceof $.Renderer){let e=i.createTabKey({title:t.title,current:!1,zIndex:0});t.node.setAttribute("aria-labelledby",e)}}_onCurrentChanged(e,t){let{previousIndex:i,previousTitle:a,currentIndex:r,currentTitle:o}=t,h=a?a.owner:null,d=o?o.owner:null;h&&h.hide(),d&&d.show(),this._currentChanged.emit({previousIndex:i,previousWidget:h,currentIndex:r,currentWidget:d}),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush()}_onTabAddRequested(e,t){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabMoved(e,t){this.stackedPanel.insertWidget(t.toIndex,t.title.owner)}_onWidgetRemoved(e,t){t.node.removeAttribute("role"),t.node.removeAttribute("aria-labelledby"),this.tabBar.removeTab(t.title)}},e.Title=f,e.Widget=b}));
 //# sourceMappingURL=index.min.js.map
\ No newline at end of file
diff --git a/node_modules/@lumino/widgets/dist/index.min.js.map b/node_modules/@lumino/widgets/dist/index.min.js.map
index da38479..9ea7897 100644
--- a/node_modules/@lumino/widgets/dist/index.min.js.map
+++ b/node_modules/@lumino/widgets/dist/index.min.js.map
@@ -1 +1 @@
-{"version":3,"names":["BoxSizer","constructor","this","sizeHint","minSize","maxSize","Infinity","stretch","size","done","BoxEngine","Private","Utils","calc","sizers","space","count","length","totalMin","totalMax","totalSize","totalStretch","stretchCount","i","sizer","min","max","hint","Math","nearZero","notDoneCount","freeSpace","distSpace","distStretch","amt","adjust","index","delta","growLimit","shrinkLimit","n","grow","limit","shrink","growSizer","shrinkSizer","Title","options","_label","_caption","_mnemonic","_icon","undefined","_iconClass","_iconLabel","_className","_closable","_changed","Signal","_isDisposed","owner","label","mnemonic","icon","iconClass","iconLabel","caption","className","closable","_dataset","dataset","changed","value","emit","isDisposed","dispose","clearData","Widget","_flags","_layout","_parent","_disposed","_hiddenMode","HiddenMode","Display","node","createNode","addClass","setFlag","Flag","IsDisposed","parent","isAttached","detach","title","MessageLoop","AttachedProperty","disposed","testFlag","IsAttached","isHidden","IsHidden","isVisible","titleProperty","get","id","hiddenMode","_toggleHidden","Scale","style","willChange","contains","Error","msg","ChildMessage","sendMessage","Msg","ParentChanged","layout","DisallowLayout","children","widget","hasClass","name","classList","add","removeClass","remove","toggleClass","force","toggle","update","postMessage","UpdateRequest","fit","FitRequest","activate","ActivateRequest","close","CloseRequest","show","BeforeShow","clearFlag","AfterShow","hide","BeforeHide","AfterHide","setHidden","hidden","flag","processMessage","type","notifyLayout","onResize","onUpdateRequest","onFitRequest","onBeforeShow","IsVisible","onAfterShow","onBeforeHide","onAfterHide","onBeforeAttach","onAfterAttach","onBeforeDetach","onAfterDetach","onActivateRequest","onCloseRequest","onChildAdded","onChildRemoved","processParentMessage","transform","setAttribute","ContentVisibility","contentVisibility","zIndex","removeAttribute","Message","BeforeAttach","AfterAttach","BeforeDetach","AfterDetach","ConflatableMessage","child","super","ResizeMessage","width","height","UnknownSize","attach","host","ref","isConnected","insertBefore","parentNode","removeChild","create","document","createElement","tag","Layout","_fitPolicy","fitPolicy","init","minWidth","minHeight","maxWidth","maxHeight","onChildShown","onChildHidden","removeWidget","getHorizontalAlignment","horizontalAlignmentProperty","setHorizontalAlignment","set","getVerticalAlignment","verticalAlignmentProperty","setVerticalAlignment","LayoutItem","_top","NaN","_left","_width","_height","_minWidth","_minHeight","_maxWidth","_maxHeight","position","contain","top","left","limits","ElementExt","sizeLimits","clampW","clampH","resized","onAlignmentChanged","PanelLayout","_widgets","pop","widgets","Symbol","iterator","addWidget","insertWidget","indexOf","j","ArrayExt","insert","attachWidget","move","moveWidget","removeWidgetAt","removeAt","detachWidget","fromIndex","toIndex","clampDimension","floor","Utils$1","SplitLayout","widgetOffset","_fixed","_spacing","_dirty","_hasNormedSizes","_sizers","_items","_handles","_box","_alignment","_orientation","renderer","orientation","alignment","spacing","item","handles","absoluteSizes","map","relativeSizes","normalize","setRelativeSizes","sizes","temp","slice","push","normed","moveHandle","handle","offsetLeft","offsetTop","createHandle","average","averageSize","createSizer","appendChild","_update","_fit","updateItemPosition","isHorizontal","handleStyle","nVisible","lastHandleIndex","horz","minW","minH","getStretch","box","boxSizing","horizontalSum","verticalSum","offsetWidth","offsetHeight","paddingTop","paddingLeft","extra","offset","fullOffset","stretchProperty","setStretch","coerce","reduce","v","s","values","sum","a","b","abs","AccordionLayout","_titles","titleSpace","titles","updateTitle","oldTitle","expanded","newTitle","createTitle","replaceChild","UUID","uuid4","titleStyle","data","createSectionTitle","Panel","createLayout","SplitPanel","_handleMoved","_pressData","_releaseMouse","handleMoved","handleEvent","event","_evtPointerDown","_evtPointerMove","_evtPointerUp","_evtKeyDown","preventDefault","stopPropagation","addEventListener","removeEventListener","keyCode","button","findFirstIndex","target","rect","getBoundingClientRect","clientX","clientY","window","getComputedStyle","override","Drag","overrideCursor","cursor","pos","Renderer","defaultRenderer","AccordionPanel","_widgetSizesCache","WeakMap","_expansionToggled","expansionToggled","connect","_onTitleChanged","collapse","_toggleExpansion","expand","_evtClick","_eventKeyDown","sender","_computeWidgetSize","widgetSizes","prev","curr","newSize","previousSize","widgetToCollapse","sz","lastIndexOf","forEach","_","idx","currentSize","defaultPrevented","handled","toString","key","match","click","direction","newIndex","focus","titleClassName","_titleID","_titleKeys","_uuid","_nInstance","createCollapseIcon","createTitleKey","aData","textContent","BoxLayout","_direction","getSizeBasis","sizeBasisProperty","setSizeBasis","onChildSizingChanged","dir","clampSpacing","BoxPanel","CommandPalette","_activeIndex","_results","commands","commandChanged","_onGenericChange","keyBindingChanged","searchNode","getElementsByClassName","inputNode","contentNode","items","addItem","createItem","refresh","addItems","newItems","removeItem","removeItemAt","clearItems","display","_toggleFocused","input","select","VirtualDOM","render","query","results","search","canActivate","content","renderEmptyMessage","activeIndex","Array","result","indices","category","renderHeader","active","renderItem","scrollTop","element","scrollIntoViewIfNeeded","_execute","altKey","ctrlKey","metaKey","shiftKey","_activatePreviousItem","_activateNextItem","ai","start","stop","findLastIndex","part","toLowerCase","isEnabled","execute","command","args","focused","activeElement","formatHeader","h","li","createItemClass","createItemDataset","isToggleable","role","isToggled","renderItemIcon","renderItemContent","renderItemShortcut","formatEmptyMessage","createIconClass","div","renderItemLabel","renderItemCaption","formatItemLabel","formatItemCaption","formatItemShortcut","StringExt","highlight","mark","kb","keyBinding","CommandRegistry","formatKeystroke","keys","fuzzySearch","source","score","rgx","rgxMatch","exec","matchSumOfDeltas","pivot","lowerBound","categoryIndices","labelIndices","matchType","scoreCmp","m1","d1","i1","i2","d2","localeCompare","r1","rank","r2","wrapper","clear","spellcheck","CommandItem","scores","text","replace","matchItems","sort","createResults","_commands","trim","JSONExt","emptyObject","findLastValue","keyBindings","deepEqual","Menu","_childIndex","_openTimerID","_closeTimerID","_childMenu","_parentMenu","_aboutToClose","_menuRequested","aboutToClose","menuRequested","parentMenu","childMenu","rootMenu","menu","leafMenu","activeItem","childNodes","activateNextItem","activatePreviousItem","triggerActiveItem","_cancelOpenTimer","_cancelCloseTimer","_openChildMenu","console","log","insertItem","open","x","y","forceX","forceY","_a","_b","horizontalAlignment","_c","documentElement","openRootMenu","_evtMouseUp","_evtMouseMove","_evtMouseEnter","_evtMouseLeave","_evtMouseDown","collapsedFlags","computeCollapsed","collapsed","onfocus","kc","getKeyboardLayout","keyForKeydownEvent","findMnemonic","multiple","auto","hitTest","_startCloseTimer","submenu","_startOpenTimer","hitTestMenus","activateFirst","_closeChildMenu","saveWindowData","itemNode","openSubmenu","setTimeout","TIMER_DELAY","clearTimeout","static","aria","createItemARIA","tabindex","renderIcon","renderLabel","renderShortcut","renderSubmenu","formatLabel","formatShortcut","prefix","suffix","char","span","SUBMENU_OVERLAP","transientWindowDataCache","transientCacheCounter","getWindowData","_getWindowData","pageXOffset","pageYOffset","clientWidth","clientHeight","tabIndex","MenuItem","fill","k1","k2","windowData","px","py","cw","ch","opacity","body","itemRect","right","borderTop","bottom","borderBottom","paddingBottom","upperKey","toUpperCase","k","mn","itemCmpRank","itemCmp","s1","Selector","calculateSpecificity","selector","s2","isValid","validateSelector","groupByTarget","sortBySelector","currentTarget","elementFromPoint","availableItems","matches","parentElement","ARROW_KEYS","TabBar","_currentIndex","_titlesEditable","_previousTitle","_dragData","_addButtonEnabled","_tabMoved","_currentChanged","_addRequested","_tabCloseRequested","_tabDetachRequested","_tabActivateRequested","_document","tabsMovable","titlesEditable","allowDeselect","addButtonEnabled","insertBehavior","removeBehavior","currentChanged","tabMoved","tabActivateRequested","addRequested","tabCloseRequested","tabDetachRequested","currentTitle","currentIndex","pi","pt","ci","ct","previousIndex","previousTitle","_name","addButtonNode","addTab","insertTab","asTitle","_adjustCurrentForInsert","_adjustCurrentForMove","removeTab","removeTabAt","disconnect","_adjustCurrentForRemove","clearTabs","releaseMouse","_evtDblClick","eventPhase","Event","CAPTURING_PHASE","_evtKeyDownCapturing","tabHandlingTabindex","_getCurrentTabindex","current","renderTab","elemTabindex","querySelector","getAttribute","tabs","tab","oldValue","innerHTML","onblur","focusedElement","includes","focusable","nextFocused","focusedIndex","addButtonClicked","pressX","pressY","tabPos","tabSize","tabPressPos","targetIndex","tabLayout","contentRect","dragActive","dragAborted","detachRequested","closeIconSelector","dragExceeded","tabRect","tabPressOffset","snapTabLayout","detachExceeded","layoutTabs","finalizeTabPosition","duration","parseTransitionDuration","resetTabPositions","bh","_tabID","_tabKeys","createTabKey","createTabStyle","createTabClass","createTabDataset","createTabARIA","renderCloseIcon","addButtonSelector","DRAG_THRESHOLD","DETACH_THRESHOLD","parseFloat","transitionDuration","margin","marginLeft","marginTop","dx","dy","pressPos","localPos","clientPos","clientSize","targetPos","targetEnd","pxPos","threshold","ideal","tgt","final","DockLayout","_root","Map","bar","tabBars","isEmpty","iterAllWidgets","empty","iterUserWidgets","selectedWidgets","iterSelectedWidgets","iterTabBars","iterHandles","offsetX","offsetY","findSplitNode","holdSizes","saveLayout","holdAllSizes","main","createConfig","restoreLayout","config","mainConfig","widgetSet","Set","normalizeAreaConfig","oldWidgets","oldTabBars","oldHandles","has","tabBar","realizeAreaConfig","createTabBar","_createTabBar","_createHandle","mode","refNode","findTabNode","_insertTab","_insertSplit","_removeWidget","hitTestTabAreas","borderLeft","tabNode","hitTestTabNodes","borderWidth","borderRight","borderHeight","delete","removeAria","splitNode","removeFirstOf","syncHandles","maybeParent","childNode","childHandle","TabLayoutNode","splitHandle","gChild","gHandle","gSizer","_createTabNode","addAria","after","findFirstTabNode","merge","root","_splitRoot","normalizeSizes","GOLDEN_RATIO","sibling","SplitLayoutNode","normalized","oldRoot","newRoot","normalizeTabAreaConfig","normalizeSplitAreaConfig","realizeTabAreaConfig","realizeSplitAreaConfig","tabSizer","widgetSizer","tabBarItem","widgetItem","tabBarSizer","createNormalizedSizes","horizontal","fixed","tabId","DockPanel","_drag","_tabsMovable","_tabsConstrained","_layoutModified","_mode","_renderer","_edges","edges","DEFAULT_EDGES","tabsConstrained","overlay","Overlay","layoutModified","createSingleDocumentConfig","LayoutModified","selectWidget","find","activateWidget","Platform","IS_EDGE","IS_IE","flush","_evtDragEnter","_evtDragLeave","_evtDragOver","_evtDrop","isGeneratedTabBarProperty","mimeData","hasData","_showOverlay","dropAction","proposedAction","zone","findDropTarget","factory","getData","getDropRef","deltaX","deltaY","xPos","yPos","paddingRight","tabHeight","_onTabMoved","_onCurrentChanged","_onTabCloseRequested","_onTabDetachRequested","_onTabActivateRequested","_onTabAddRequested","MimeData","setData","dragImage","cloneNode","supportedActions","then","_timer","_hidden","geo","delay","panel","from","selected","next","panelRect","pl","pr","pb","al","at","ar","ab","rx","round","ry","GridLayout","_rowSpacing","_columnSpacing","_rowStarts","_columnStarts","_rowSizers","_columnSizers","rowCount","reallocSizers","columnCount","rowSpacing","clampValue","columnSpacing","rowStretch","setRowStretch","columnStretch","setColumnStretch","it","filter","maxRow","maxCol","rowSpanCmp","getCellConfig","row","rowSpan","distributeMin","columnSpanCmp","c1","column","c2","columnSpan","fixedRowSpace","fixedColSpace","w","cellConfigProperty","setCellConfig","normalizeConfig","portion","MenuBar","_tabFocusIndex","_menus","_overflowMenu","_menuItemSizes","_overflowIndex","_forceItemsPosition","forceItemsPosition","_overflowMenuOptions","overflowMenuOptions","overflowIndex","overflowMenu","activeMenu","menus","openActiveMenu","addMenu","insertMenu","_onMenuAboutToClose","_onMenuMenuRequested","removeMenu","removeMenuAt","clearMenus","_evtFocusOut","_focusItemAt","tabFocusIndex","totalMenuSize","tabbable","disabled","overflowMenuTitle","overflowMenuItems","screenSize","_updateOverflowIndex","itemMenus","stopImmediatePropagation","_positionForMenu","relatedTarget","newMenu","oldMenu","decrement","increment","track","thumb","findPart","scrollBar","thumbNode","trackNode","decrementNode","incrementNode","SingletonLayout","_widget","StackedLayout","StackedPanel","_widgetRemoved","widgetRemoved","orientationFromPlacement","plc","placementToOrientationMap","directionFromPlacement","placementToDirectionMap","_groupByTarget","_idTick","_sortBySelector","others","DisposableDelegate","_counter","_activeWidget","_currentWidget","_numbers","_nodes","_activeChanged","activeChanged","currentWidget","activeWidget","focusNumber","_onWidgetDisposed","_setWidgets","valid","previous","first","second","_evtFocus","_evtBlur","oldCurrent","oldActive","newValue","focusTarget","_onRepeat","_repeatTimer","mouseX","mouseY","thumbRect","_pageRequested","_stepRequested","_value","_page","_maximum","_thumbMoved","maximum","page","thumbMoved","stepRequested","pageRequested","thumbStyle","_moveThumb","trackPos","trackSpan","trackRect","stackedPanel","_onWidgetRemoved","_tabPlacement","tabPlacement","previousWidget"],"sources":["../src/boxengine.ts","../src/widget.ts","../src/layout.ts","../src/utils.ts","../src/title.ts","../src/panellayout.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/stackedpanel.ts","../src/tabpanel.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/focustracker.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n  /**\n   * The preferred size for the sizer.\n   *\n   * #### Notes\n   * The sizer will be given this initial size subject to its size\n   * bounds. The sizer will not deviate from this size unless such\n   * deviation is required to fit into the available layout space.\n   *\n   * There is no limit to this value, but it will be clamped to the\n   * bounds defined by {@link minSize} and {@link maxSize}.\n   *\n   * The default value is `0`.\n   */\n  sizeHint = 0;\n\n  /**\n   * The minimum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized less than this value, even if\n   * it means the sizer will overflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity)`\n   * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `0`.\n   */\n  minSize = 0;\n\n  /**\n   * The maximum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized greater than this value, even if\n   * it means the sizer will underflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity]`\n   * and that it is `>=` to {@link minSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `Infinity`.\n   */\n  maxSize = Infinity;\n\n  /**\n   * The stretch factor for the sizer.\n   *\n   * #### Notes\n   * This controls how much the sizer stretches relative to its sibling\n   * sizers when layout space is distributed. A stretch factor of zero\n   * is special and will cause the sizer to only be resized after all\n   * other sizers with a stretch factor greater than zero have been\n   * resized to their limits.\n   *\n   * It is assumed that this value is an integer that lies in the range\n   * `[0, Infinity)`. Failure to adhere to this constraint will yield\n   * undefined results.\n   *\n   * The default value is `1`.\n   */\n  stretch = 1;\n\n  /**\n   * The computed size of the sizer.\n   *\n   * #### Notes\n   * This value is the output of a call to {@link BoxEngine.calc}. It represents\n   * the computed size for the object along the layout orientation,\n   * and will always lie in the range `[minSize, maxSize]`.\n   *\n   * This value is output only.\n   *\n   * Changing this value will have no effect.\n   */\n  size = 0;\n\n  /**\n   * An internal storage property for the layout algorithm.\n   *\n   * #### Notes\n   * This value is used as temporary storage by the layout algorithm.\n   *\n   * Changing this value will have no effect.\n   */\n  done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n  /**\n   * Calculate the optimal layout sizes for a sequence of box sizers.\n   *\n   * This distributes the available layout space among the box sizers\n   * according to the following algorithm:\n   *\n   * 1. Initialize the sizers's size to its size hint and compute the\n   *    sums for each of size hint, min size, and max size.\n   *\n   * 2. If the total size hint equals the available space, return.\n   *\n   * 3. If the available space is less than the total min size, set all\n   *    sizers to their min size and return.\n   *\n   * 4. If the available space is greater than the total max size, set\n   *    all sizers to their max size and return.\n   *\n   * 5. If the layout space is less than the total size hint, distribute\n   *    the negative delta as follows:\n   *\n   *    a. Shrink each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the negative space and the sum of\n   *       stretch factors. If the sizer reaches its min size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains negative\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its min size,\n   *       remove it from the computation.\n   *\n   * 6. If the layout space is greater than the total size hint,\n   *    distribute the positive delta as follows:\n   *\n   *    a. Expand each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the postive space and the sum of\n   *       stretch factors. If the sizer reaches its max size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains positive\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its max size,\n   *       remove it from the computation.\n   *\n   * 7. return\n   *\n   * @param sizers - The sizers for a particular layout line.\n   *\n   * @param space - The available layout space for the sizers.\n   *\n   * @returns The delta between the provided available space and the\n   *   actual consumed space. This value will be zero if the sizers\n   *   can be adjusted to fit, negative if the available space is too\n   *   small, and positive if the available space is too large.\n   *\n   * #### Notes\n   * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n   *\n   * This function can be called at any time to recompute the layout for\n   * an existing sequence of sizers. The previously computed results will\n   * have no effect on the new output. It is therefore not necessary to\n   * create new sizer objects on each resize event.\n   */\n  export function calc(sizers: ArrayLike<BoxSizer>, space: number): number {\n    // Bail early if there is nothing to do.\n    let count = sizers.length;\n    if (count === 0) {\n      return space;\n    }\n\n    // Setup the size and stretch counters.\n    let totalMin = 0;\n    let totalMax = 0;\n    let totalSize = 0;\n    let totalStretch = 0;\n    let stretchCount = 0;\n\n    // Setup the sizers and compute the totals.\n    for (let i = 0; i < count; ++i) {\n      let sizer = sizers[i];\n      let min = sizer.minSize;\n      let max = sizer.maxSize;\n      let hint = sizer.sizeHint;\n      sizer.done = false;\n      sizer.size = Math.max(min, Math.min(hint, max));\n      totalSize += sizer.size;\n      totalMin += min;\n      totalMax += max;\n      if (sizer.stretch > 0) {\n        totalStretch += sizer.stretch;\n        stretchCount++;\n      }\n    }\n\n    // If the space is equal to the total size, return early.\n    if (space === totalSize) {\n      return 0;\n    }\n\n    // If the space is less than the total min, minimize each sizer.\n    if (space <= totalMin) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.minSize;\n      }\n      return space - totalMin;\n    }\n\n    // If the space is greater than the total max, maximize each sizer.\n    if (space >= totalMax) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.maxSize;\n      }\n      return space - totalMax;\n    }\n\n    // The loops below perform sub-pixel precision sizing. A near zero\n    // value is used for compares instead of zero to ensure that the\n    // loop terminates when the subdivided space is reasonably small.\n    let nearZero = 0.01;\n\n    // A counter which is decremented each time a sizer is resized to\n    // its limit. This ensures the loops terminate even if there is\n    // space remaining to distribute.\n    let notDoneCount = count;\n\n    // Distribute negative delta space.\n    if (space < totalSize) {\n      // Shrink each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its min size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = totalSize - space;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n    }\n    // Distribute positive delta space.\n    else {\n      // Expand each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its max size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = space - totalSize;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n    }\n\n    // Indicate that the consumed space equals the available space.\n    return 0;\n  }\n\n  /**\n   * Adjust a sizer by a delta and update its neighbors accordingly.\n   *\n   * @param sizers - The sizers which should be adjusted.\n   *\n   * @param index - The index of the sizer to grow.\n   *\n   * @param delta - The amount to adjust the sizer, positive or negative.\n   *\n   * #### Notes\n   * This will adjust the indicated sizer by the specified amount, along\n   * with the sizes of the appropriate neighbors, subject to the limits\n   * specified by each of the sizers.\n   *\n   * This is useful when implementing box layouts where the boundaries\n   * between the sizers are interactively adjustable by the user.\n   */\n  export function adjust(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Bail early when there is nothing to do.\n    if (sizers.length === 0 || delta === 0) {\n      return;\n    }\n\n    // Dispatch to the proper implementation.\n    if (delta > 0) {\n      growSizer(sizers, index, delta);\n    } else {\n      shrinkSizer(sizers, index, -delta);\n    }\n  }\n\n  /**\n   * Grow a sizer by a positive delta and adjust neighbors.\n   */\n  function growSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the left can expand.\n    let growLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the right can shrink.\n    let shrinkLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the left by the delta.\n    let grow = delta;\n    for (let i = index; i >= 0 && grow > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the right by the delta.\n    let shrink = delta;\n    for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n\n  /**\n   * Shrink a sizer by a positive delta and adjust neighbors.\n   */\n  function shrinkSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the right can expand.\n    let growLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the left can shrink.\n    let shrinkLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the right by the delta.\n    let grow = delta;\n    for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the left by the delta.\n    let shrink = delta;\n    for (let i = index; i >= 0 && shrink > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n  ConflatableMessage,\n  IMessageHandler,\n  Message,\n  MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n  /**\n   * Construct a new widget.\n   *\n   * @param options - The options for initializing the widget.\n   */\n  constructor(options: Widget.IOptions = {}) {\n    this.node = Private.createNode(options);\n    this.addClass('lm-Widget');\n  }\n\n  /**\n   * Dispose of the widget and its descendant widgets.\n   *\n   * #### Notes\n   * It is unsafe to use the widget after it has been disposed.\n   *\n   * All calls made to this method after the first are a no-op.\n   */\n  dispose(): void {\n    // Do nothing if the widget is already disposed.\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Set the disposed flag and emit the disposed signal.\n    this.setFlag(Widget.Flag.IsDisposed);\n    this._disposed.emit(undefined);\n\n    // Remove or detach the widget if necessary.\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n\n    // Dispose of the widget layout.\n    if (this._layout) {\n      this._layout.dispose();\n      this._layout = null;\n    }\n\n    // Dispose the title\n    this.title.dispose();\n\n    // Clear the extra data associated with the widget.\n    Signal.clearData(this);\n    MessageLoop.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * A signal emitted when the widget is disposed.\n   */\n  get disposed(): ISignal<this, void> {\n    return this._disposed;\n  }\n\n  /**\n   * Get the DOM node owned by the widget.\n   */\n  readonly node: HTMLElement;\n\n  /**\n   * Test whether the widget has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this.testFlag(Widget.Flag.IsDisposed);\n  }\n\n  /**\n   * Test whether the widget's node is attached to the DOM.\n   */\n  get isAttached(): boolean {\n    return this.testFlag(Widget.Flag.IsAttached);\n  }\n\n  /**\n   * Test whether the widget is explicitly hidden.\n   *\n   * #### Notes\n   * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n   * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n   */\n  get isHidden(): boolean {\n    return this.testFlag(Widget.Flag.IsHidden);\n  }\n\n  /**\n   * Test whether the widget is visible.\n   *\n   * #### Notes\n   * A widget is visible when it is attached to the DOM, is not\n   * explicitly hidden, and has no explicitly hidden ancestors.\n   *\n   * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n   * It recursively checks the visibility of all parent widgets.\n   */\n  get isVisible(): boolean {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let parent: Widget | null = this;\n    do {\n      if (parent.isHidden || !parent.isAttached) {\n        return false;\n      }\n      parent = parent.parent;\n    } while (parent != null);\n    return true;\n  }\n\n  /**\n   * The title object for the widget.\n   *\n   * #### Notes\n   * The title object is used by some container widgets when displaying\n   * the widget alongside some title, such as a tab panel or side bar.\n   *\n   * Since not all widgets will use the title, it is created on demand.\n   *\n   * The `owner` property of the title is set to this widget.\n   */\n  get title(): Title<Widget> {\n    return Private.titleProperty.get(this);\n  }\n\n  /**\n   * Get the id of the widget's DOM node.\n   */\n  get id(): string {\n    return this.node.id;\n  }\n\n  /**\n   * Set the id of the widget's DOM node.\n   */\n  set id(value: string) {\n    this.node.id = value;\n  }\n\n  /**\n   * The dataset for the widget's DOM node.\n   */\n  get dataset(): DOMStringMap {\n    return this.node.dataset;\n  }\n\n  /**\n   * Get the method for hiding the widget.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding the widget.\n   */\n  set hiddenMode(value: Widget.HiddenMode) {\n    if (this._hiddenMode === value) {\n      return;\n    }\n\n    if (this.isHidden) {\n      // Reset styles set by previous mode.\n      this._toggleHidden(false);\n    }\n\n    if (value == Widget.HiddenMode.Scale) {\n      this.node.style.willChange = 'transform';\n    } else {\n      this.node.style.willChange = 'auto';\n    }\n\n    this._hiddenMode = value;\n\n    if (this.isHidden) {\n      // Set styles for new mode.\n      this._toggleHidden(true);\n    }\n  }\n\n  /**\n   * Get the parent of the widget.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent of the widget.\n   *\n   * #### Notes\n   * Children are typically added to a widget by using a layout, which\n   * means user code will not normally set the parent widget directly.\n   *\n   * The widget will be automatically removed from its old parent.\n   *\n   * This is a no-op if there is no effective parent change.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (value && this.contains(value)) {\n      throw new Error('Invalid parent widget.');\n    }\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-removed', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    this._parent = value;\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-added', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    if (!this.isDisposed) {\n      MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n    }\n  }\n\n  /**\n   * Get the layout for the widget.\n   */\n  get layout(): Layout | null {\n    return this._layout;\n  }\n\n  /**\n   * Set the layout for the widget.\n   *\n   * #### Notes\n   * The layout is single-use only. It cannot be changed after the\n   * first assignment.\n   *\n   * The layout is disposed automatically when the widget is disposed.\n   */\n  set layout(value: Layout | null) {\n    if (this._layout === value) {\n      return;\n    }\n    if (this.testFlag(Widget.Flag.DisallowLayout)) {\n      throw new Error('Cannot set widget layout.');\n    }\n    if (this._layout) {\n      throw new Error('Cannot change widget layout.');\n    }\n    if (value!.parent) {\n      throw new Error('Cannot change layout parent.');\n    }\n    this._layout = value;\n    value!.parent = this;\n  }\n\n  /**\n   * Create an iterator over the widget's children.\n   *\n   * @returns A new iterator over the children of the widget.\n   *\n   * #### Notes\n   * The widget must have a populated layout in order to have children.\n   *\n   * If a layout is not installed, the returned iterator will be empty.\n   */\n  *children(): IterableIterator<Widget> {\n    if (this._layout) {\n      yield* this._layout;\n    }\n  }\n\n  /**\n   * Test whether a widget is a descendant of this widget.\n   *\n   * @param widget - The descendant widget of interest.\n   *\n   * @returns `true` if the widget is a descendant, `false` otherwise.\n   */\n  contains(widget: Widget): boolean {\n    for (let value: Widget | null = widget; value; value = value._parent) {\n      if (value === this) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Test whether the widget's DOM node has the given class name.\n   *\n   * @param name - The class name of interest.\n   *\n   * @returns `true` if the node has the class, `false` otherwise.\n   */\n  hasClass(name: string): boolean {\n    return this.node.classList.contains(name);\n  }\n\n  /**\n   * Add a class name to the widget's DOM node.\n   *\n   * @param name - The class name to add to the node.\n   *\n   * #### Notes\n   * If the class name is already added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  addClass(name: string): void {\n    this.node.classList.add(name);\n  }\n\n  /**\n   * Remove a class name from the widget's DOM node.\n   *\n   * @param name - The class name to remove from the node.\n   *\n   * #### Notes\n   * If the class name is not yet added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  removeClass(name: string): void {\n    this.node.classList.remove(name);\n  }\n\n  /**\n   * Toggle a class name on the widget's DOM node.\n   *\n   * @param name - The class name to toggle on the node.\n   *\n   * @param force - Whether to force add the class (`true`) or force\n   *   remove the class (`false`). If not provided, the presence of\n   *   the class will be toggled from its current state.\n   *\n   * @returns `true` if the class is now present, `false` otherwise.\n   *\n   * #### Notes\n   * The class name must not contain whitespace.\n   */\n  toggleClass(name: string, force?: boolean): boolean {\n    if (force === true) {\n      this.node.classList.add(name);\n      return true;\n    }\n    if (force === false) {\n      this.node.classList.remove(name);\n      return false;\n    }\n    return this.node.classList.toggle(name);\n  }\n\n  /**\n   * Post an `'update-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  update(): void {\n    MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n  }\n\n  /**\n   * Post a `'fit-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  fit(): void {\n    MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n  }\n\n  /**\n   * Post an `'activate-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  activate(): void {\n    MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n  }\n\n  /**\n   * Send a `'close-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for sending the message.\n   */\n  close(): void {\n    MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n  }\n\n  /**\n   * Show the widget and make it visible to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `false`.\n   *\n   * If the widget is not explicitly hidden, this is a no-op.\n   */\n  show(): void {\n    if (!this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n    }\n    this.clearFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(false);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-shown', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Hide the widget and make it hidden to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `true`.\n   *\n   * If the widget is explicitly hidden, this is a no-op.\n   */\n  hide(): void {\n    if (this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n    }\n    this.setFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(true);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-hidden', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Show or hide the widget according to a boolean value.\n   *\n   * @param hidden - `true` to hide the widget, or `false` to show it.\n   *\n   * #### Notes\n   * This is a convenience method for `hide()` and `show()`.\n   */\n  setHidden(hidden: boolean): void {\n    if (hidden) {\n      this.hide();\n    } else {\n      this.show();\n    }\n  }\n\n  /**\n   * Test whether the given widget flag is set.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  testFlag(flag: Widget.Flag): boolean {\n    return (this._flags & flag) !== 0;\n  }\n\n  /**\n   * Set the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  setFlag(flag: Widget.Flag): void {\n    this._flags |= flag;\n  }\n\n  /**\n   * Clear the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  clearFlag(flag: Widget.Flag): void {\n    this._flags &= ~flag;\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   *\n   * #### Notes\n   * Subclasses may reimplement this method as needed.\n   */\n  processMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.notifyLayout(msg);\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.notifyLayout(msg);\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.notifyLayout(msg);\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.notifyLayout(msg);\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.setFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.notifyLayout(msg);\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.notifyLayout(msg);\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n          this.setFlag(Widget.Flag.IsVisible);\n        }\n        this.setFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.notifyLayout(msg);\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.clearFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterDetach(msg);\n        break;\n      case 'activate-request':\n        this.notifyLayout(msg);\n        this.onActivateRequest(msg);\n        break;\n      case 'close-request':\n        this.notifyLayout(msg);\n        this.onCloseRequest(msg);\n        break;\n      case 'child-added':\n        this.notifyLayout(msg);\n        this.onChildAdded(msg as Widget.ChildMessage);\n        break;\n      case 'child-removed':\n        this.notifyLayout(msg);\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      default:\n        this.notifyLayout(msg);\n        break;\n    }\n  }\n\n  /**\n   * Invoke the message processing routine of the widget's layout.\n   *\n   * @param msg - The message to dispatch to the layout.\n   *\n   * #### Notes\n   * This is a no-op if the widget does not have a layout.\n   *\n   * This will not typically be called directly by user code.\n   */\n  protected notifyLayout(msg: Message): void {\n    if (this._layout) {\n      this._layout.processParentMessage(msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   *\n   * #### Notes\n   * The default implementation unparents or detaches the widget.\n   */\n  protected onCloseRequest(msg: Message): void {\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {}\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onUpdateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onActivateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n  private _toggleHidden(hidden: boolean) {\n    if (hidden) {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.addClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = 'scale(0)';\n          this.node.setAttribute('aria-hidden', 'true');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = 'hidden';\n          this.node.style.zIndex = '-1';\n          break;\n      }\n    } else {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.removeClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = '';\n          this.node.removeAttribute('aria-hidden');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = '';\n          this.node.style.zIndex = '';\n          break;\n      }\n    }\n  }\n\n  private _flags = 0;\n  private _layout: Layout | null = null;\n  private _parent: Widget | null = null;\n  private _disposed = new Signal<this, void>(this);\n  private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n  /**\n   * An options object for initializing a widget.\n   */\n  export interface IOptions {\n    /**\n     * The optional node to use for the widget.\n     *\n     * If a node is provided, the widget will assume full ownership\n     * and control of the node, as if it had created the node itself.\n     *\n     * The default is a new `<div>`.\n     */\n    node?: HTMLElement;\n\n    /**\n     * The optional element tag, used for constructing the widget's node.\n     *\n     * If a pre-constructed node is provided via the `node` arg, this\n     * value is ignored.\n     */\n    tag?: keyof HTMLElementTagNameMap;\n  }\n\n  /**\n   * The method for hiding the widget.\n   *\n   * The default is Display.\n   *\n   * Using `Scale` will often increase performance as most browsers will not\n   * trigger style computation for the `transform` action. This should be used\n   * sparingly and tested, since increasing the number of composition layers\n   * may slow things down.\n   *\n   * To ensure the transformation does not trigger style recomputation, you\n   * may need to set the widget CSS style `will-change: transform`. This\n   * should be used only when needed as it may overwhelm the browser with a\n   * high number of layers. See\n   * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n   */\n  export enum HiddenMode {\n    /**\n     * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n     * CSS from the standard Lumino CSS.\n     */\n    Display = 0,\n\n    /**\n     * Hide the widget by setting the `transform` to `'scale(0)'`.\n     */\n    Scale,\n\n    /**\n     *Hide the widget by setting the `content-visibility` to `'hidden'`.\n     */\n    ContentVisibility\n  }\n\n  /**\n   * An enum of widget bit flags.\n   */\n  export enum Flag {\n    /**\n     * The widget has been disposed.\n     */\n    IsDisposed = 0x1,\n\n    /**\n     * The widget is attached to the DOM.\n     */\n    IsAttached = 0x2,\n\n    /**\n     * The widget is hidden.\n     */\n    IsHidden = 0x4,\n\n    /**\n     * The widget is visible.\n     *\n     * @deprecated since 2.7.0, apply that flag consistently was not reliable\n     * so it was dropped in favor of a recursive check of the visibility of all parents.\n     */\n    IsVisible = 0x8,\n\n    /**\n     * A layout cannot be set on the widget.\n     */\n    DisallowLayout = 0x10\n  }\n\n  /**\n   * A collection of stateless messages related to widgets.\n   */\n  export namespace Msg {\n    /**\n     * A singleton `'before-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const BeforeShow = new Message('before-show');\n\n    /**\n     * A singleton `'after-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const AfterShow = new Message('after-show');\n\n    /**\n     * A singleton `'before-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const BeforeHide = new Message('before-hide');\n\n    /**\n     * A singleton `'after-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const AfterHide = new Message('after-hide');\n\n    /**\n     * A singleton `'before-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is attached.\n     */\n    export const BeforeAttach = new Message('before-attach');\n\n    /**\n     * A singleton `'after-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is attached.\n     */\n    export const AfterAttach = new Message('after-attach');\n\n    /**\n     * A singleton `'before-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is detached.\n     */\n    export const BeforeDetach = new Message('before-detach');\n\n    /**\n     * A singleton `'after-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is detached.\n     */\n    export const AfterDetach = new Message('after-detach');\n\n    /**\n     * A singleton `'parent-changed'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget when its parent has changed.\n     */\n    export const ParentChanged = new Message('parent-changed');\n\n    /**\n     * A singleton conflatable `'update-request'` message.\n     *\n     * #### Notes\n     * This message can be dispatched to supporting widgets in order to\n     * update their content based on the current widget state. Not all\n     * widgets will respond to messages of this type.\n     *\n     * For widgets with a layout, this message will inform the layout to\n     * update the position and size of its child widgets.\n     */\n    export const UpdateRequest = new ConflatableMessage('update-request');\n\n    /**\n     * A singleton conflatable `'fit-request'` message.\n     *\n     * #### Notes\n     * For widgets with a layout, this message will inform the layout to\n     * recalculate its size constraints to fit the space requirements of\n     * its child widgets, and to update their position and size. Not all\n     * layouts will respond to messages of this type.\n     */\n    export const FitRequest = new ConflatableMessage('fit-request');\n\n    /**\n     * A singleton conflatable `'activate-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should\n     * perform the actions necessary to activate the widget, which\n     * may include focusing its node or descendant node.\n     */\n    export const ActivateRequest = new ConflatableMessage('activate-request');\n\n    /**\n     * A singleton conflatable `'close-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should close\n     * and remove itself from the widget hierarchy.\n     */\n    export const CloseRequest = new ConflatableMessage('close-request');\n  }\n\n  /**\n   * A message class for child related messages.\n   */\n  export class ChildMessage extends Message {\n    /**\n     * Construct a new child message.\n     *\n     * @param type - The message type.\n     *\n     * @param child - The child widget for the message.\n     */\n    constructor(type: string, child: Widget) {\n      super(type);\n      this.child = child;\n    }\n\n    /**\n     * The child widget for the message.\n     */\n    readonly child: Widget;\n  }\n\n  /**\n   * A message class for `'resize'` messages.\n   */\n  export class ResizeMessage extends Message {\n    /**\n     * Construct a new resize message.\n     *\n     * @param width - The **offset width** of the widget, or `-1` if\n     *   the width is not known.\n     *\n     * @param height - The **offset height** of the widget, or `-1` if\n     *   the height is not known.\n     */\n    constructor(width: number, height: number) {\n      super('resize');\n      this.width = width;\n      this.height = height;\n    }\n\n    /**\n     * The offset width of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the width is unknown.\n     */\n    readonly width: number;\n\n    /**\n     * The offset height of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the height is unknown.\n     */\n    readonly height: number;\n  }\n\n  /**\n   * The namespace for the `ResizeMessage` class statics.\n   */\n  export namespace ResizeMessage {\n    /**\n     * A singleton `'resize'` message with an unknown size.\n     */\n    export const UnknownSize = new ResizeMessage(-1, -1);\n  }\n\n  /**\n   * Attach a widget to a host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param host - The DOM node to use as the widget's host.\n   *\n   * @param ref - The child of `host` to use as the reference element.\n   *   If this is provided, the widget will be inserted before this\n   *   node in the host. The default is `null`, which will cause the\n   *   widget to be added as the last child of the host.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget, if\n   * the widget is already attached, or if the host is not attached\n   * to the DOM.\n   */\n  export function attach(\n    widget: Widget,\n    host: HTMLElement,\n    ref: HTMLElement | null = null\n  ): void {\n    if (widget.parent) {\n      throw new Error('Cannot attach a child widget.');\n    }\n    if (widget.isAttached || widget.node.isConnected) {\n      throw new Error('Widget is already attached.');\n    }\n    if (!host.isConnected) {\n      throw new Error('Host is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    host.insertBefore(widget.node, ref);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n  }\n\n  /**\n   * Detach the widget from its host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget,\n   * or if the widget is not attached to the DOM.\n   */\n  export function detach(widget: Widget): void {\n    if (widget.parent) {\n      throw new Error('Cannot detach a child widget.');\n    }\n    if (!widget.isAttached || !widget.node.isConnected) {\n      throw new Error('Widget is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    widget.node.parentNode!.removeChild(widget.node);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An attached property for the widget title object.\n   */\n  export const titleProperty = new AttachedProperty<Widget, Title<Widget>>({\n    name: 'title',\n    create: owner => new Title<Widget>({ owner })\n  });\n\n  /**\n   * Create a DOM node for the given widget options.\n   */\n  export function createNode(options: Widget.IOptions): HTMLElement {\n    return options.node || document.createElement(options.tag || 'div');\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable<Widget>, IDisposable {\n  /**\n   * Construct a new layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: Layout.IOptions = {}) {\n    this._fitPolicy = options.fitPolicy || 'set-min-size';\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This should be reimplemented to clear and dispose of the widgets.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    this._parent = null;\n    this._disposed = true;\n    Signal.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * Test whether the layout is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Get the parent widget of the layout.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent widget of the layout.\n   *\n   * #### Notes\n   * This is set automatically when installing the layout on the parent\n   * widget. The parent widget should not be set directly by user code.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (this._parent) {\n      throw new Error('Cannot change parent widget.');\n    }\n    if (value!.layout !== this) {\n      throw new Error('Invalid parent widget.');\n    }\n    this._parent = value;\n    this.init();\n  }\n\n  /**\n   * Get the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  get fitPolicy(): Layout.FitPolicy {\n    return this._fitPolicy;\n  }\n\n  /**\n   * Set the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   *\n   * Changing the fit policy will clear the current size constraint\n   * for the parent widget and then re-fit the parent.\n   */\n  set fitPolicy(value: Layout.FitPolicy) {\n    // Bail if the policy does not change\n    if (this._fitPolicy === value) {\n      return;\n    }\n\n    // Update the internal policy.\n    this._fitPolicy = value;\n\n    // Clear the size constraints and schedule a fit of the parent.\n    if (this._parent) {\n      let style = this._parent.node.style;\n      style.minWidth = '';\n      style.minHeight = '';\n      style.maxWidth = '';\n      style.maxHeight = '';\n      this._parent.fit();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This abstract method must be implemented by a subclass.\n   */\n  abstract [Symbol.iterator](): IterableIterator<Widget>;\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method should *not* modify the widget's `parent`.\n   */\n  abstract removeWidget(widget: Widget): void;\n\n  /**\n   * Process a message sent to the parent widget.\n   *\n   * @param msg - The message sent to the parent widget.\n   *\n   * #### Notes\n   * This method is called by the parent widget to process a message.\n   *\n   * Subclasses may reimplement this method as needed.\n   */\n  processParentMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.onAfterDetach(msg);\n        break;\n      case 'child-removed':\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      case 'child-shown':\n        this.onChildShown(msg as Widget.ChildMessage);\n        break;\n      case 'child-hidden':\n        this.onChildHidden(msg as Widget.ChildMessage);\n        break;\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   *\n   * #### Notes\n   * This method is invoked immediately after the layout is installed\n   * on the parent widget.\n   *\n   * The default implementation reparents all of the widgets to the\n   * layout parent widget.\n   *\n   * Subclasses should reimplement this method and attach the child\n   * widget nodes to the parent widget's node.\n   */\n  protected init(): void {\n    for (const widget of this) {\n      widget.parent = this.parent;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the specified layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the available layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * This will remove the child widget from the layout.\n   *\n   * Subclasses should **not** typically reimplement this method.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    this.removeWidget(msg.child);\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n  private _disposed = false;\n  private _fitPolicy: Layout.FitPolicy;\n  private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n  /**\n   * A type alias for the layout fit policy.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  export type FitPolicy =\n    | /**\n     * No size constraint will be applied to the parent widget.\n     */\n    'set-no-constraint'\n\n    /**\n     * The computed min size will be applied to the parent widget.\n     */\n    | 'set-min-size';\n\n  /**\n   * An options object for initializing a layout.\n   */\n  export interface IOptions {\n    /**\n     * The fit policy for the layout.\n     *\n     * The default is `'set-min-size'`.\n     */\n    fitPolicy?: FitPolicy;\n  }\n\n  /**\n   * A type alias for the horizontal alignment of a widget.\n   */\n  export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n  /**\n   * A type alias for the vertical alignment of a widget.\n   */\n  export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n  /**\n   * Get the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The horizontal alignment for the widget.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   */\n  export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n    return Private.horizontalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the horizontal alignment.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setHorizontalAlignment(\n    widget: Widget,\n    value: HorizontalAlignment\n  ): void {\n    Private.horizontalAlignmentProperty.set(widget, value);\n  }\n\n  /**\n   * Get the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The vertical alignment for the widget.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   */\n  export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n    return Private.verticalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the vertical alignment.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setVerticalAlignment(\n    widget: Widget,\n    value: VerticalAlignment\n  ): void {\n    Private.verticalAlignmentProperty.set(widget, value);\n  }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n  /**\n   * Construct a new layout item.\n   *\n   * @param widget - The widget to be managed by the item.\n   *\n   * #### Notes\n   * The widget will be set to absolute positioning.\n   * The widget will use strict CSS containment.\n   */\n  constructor(widget: Widget) {\n    this.widget = widget;\n    this.widget.node.style.position = 'absolute';\n    this.widget.node.style.contain = 'strict';\n  }\n\n  /**\n   * Dispose of the the layout item.\n   *\n   * #### Notes\n   * This will reset the positioning of the widget.\n   */\n  dispose(): void {\n    // Do nothing if the item is already disposed.\n    if (this._disposed) {\n      return;\n    }\n\n    // Mark the item as disposed.\n    this._disposed = true;\n\n    // Reset the widget style.\n    let style = this.widget.node.style;\n    style.position = '';\n    style.top = '';\n    style.left = '';\n    style.width = '';\n    style.height = '';\n    style.contain = '';\n  }\n\n  /**\n   * The widget managed by the layout item.\n   */\n  readonly widget: Widget;\n\n  /**\n   * The computed minimum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minWidth(): number {\n    return this._minWidth;\n  }\n\n  /**\n   * The computed minimum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minHeight(): number {\n    return this._minHeight;\n  }\n\n  /**\n   * The computed maximum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxWidth(): number {\n    return this._maxWidth;\n  }\n\n  /**\n   * The computed maximum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxHeight(): number {\n    return this._maxHeight;\n  }\n\n  /**\n   * Whether the layout item is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Whether the managed widget is hidden.\n   */\n  get isHidden(): boolean {\n    return this.widget.isHidden;\n  }\n\n  /**\n   * Whether the managed widget is visible.\n   */\n  get isVisible(): boolean {\n    return this.widget.isVisible;\n  }\n\n  /**\n   * Whether the managed widget is attached.\n   */\n  get isAttached(): boolean {\n    return this.widget.isAttached;\n  }\n\n  /**\n   * Update the computed size limits of the managed widget.\n   */\n  fit(): void {\n    let limits = ElementExt.sizeLimits(this.widget.node);\n    this._minWidth = limits.minWidth;\n    this._minHeight = limits.minHeight;\n    this._maxWidth = limits.maxWidth;\n    this._maxHeight = limits.maxHeight;\n  }\n\n  /**\n   * Update the position and size of the managed widget.\n   *\n   * @param left - The left edge position of the layout box.\n   *\n   * @param top - The top edge position of the layout box.\n   *\n   * @param width - The width of the layout box.\n   *\n   * @param height - The height of the layout box.\n   */\n  update(left: number, top: number, width: number, height: number): void {\n    // Clamp the size to the computed size limits.\n    let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n    let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n    // Adjust the left edge for the horizontal alignment, if needed.\n    if (clampW < width) {\n      switch (Layout.getHorizontalAlignment(this.widget)) {\n        case 'left':\n          break;\n        case 'center':\n          left += (width - clampW) / 2;\n          break;\n        case 'right':\n          left += width - clampW;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Adjust the top edge for the vertical alignment, if needed.\n    if (clampH < height) {\n      switch (Layout.getVerticalAlignment(this.widget)) {\n        case 'top':\n          break;\n        case 'center':\n          top += (height - clampH) / 2;\n          break;\n        case 'bottom':\n          top += height - clampH;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Set up the resize variables.\n    let resized = false;\n    let style = this.widget.node.style;\n\n    // Update the top edge of the widget if needed.\n    if (this._top !== top) {\n      this._top = top;\n      style.top = `${top}px`;\n    }\n\n    // Update the left edge of the widget if needed.\n    if (this._left !== left) {\n      this._left = left;\n      style.left = `${left}px`;\n    }\n\n    // Update the width of the widget if needed.\n    if (this._width !== clampW) {\n      resized = true;\n      this._width = clampW;\n      style.width = `${clampW}px`;\n    }\n\n    // Update the height of the widget if needed.\n    if (this._height !== clampH) {\n      resized = true;\n      this._height = clampH;\n      style.height = `${clampH}px`;\n    }\n\n    // Send a resize message to the widget if needed.\n    if (resized) {\n      let msg = new Widget.ResizeMessage(clampW, clampH);\n      MessageLoop.sendMessage(this.widget, msg);\n    }\n  }\n\n  private _top = NaN;\n  private _left = NaN;\n  private _width = NaN;\n  private _height = NaN;\n  private _minWidth = 0;\n  private _minHeight = 0;\n  private _maxWidth = Infinity;\n  private _maxHeight = Infinity;\n  private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The attached property for a widget horizontal alignment.\n   */\n  export const horizontalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.HorizontalAlignment\n  >({\n    name: 'horizontalAlignment',\n    create: () => 'center',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The attached property for a widget vertical alignment.\n   */\n  export const verticalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.VerticalAlignment\n  >({\n    name: 'verticalAlignment',\n    create: () => 'top',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The change handler for the attached alignment properties.\n   */\n  function onAlignmentChanged(child: Widget): void {\n    if (child.parent && child.parent.layout) {\n      child.parent.update();\n    }\n  }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n  /**\n   * Clamp a dimension value to an integer >= 0.\n   */\n  export function clampDimension(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title<T> implements IDisposable {\n  /**\n   * Construct a new title.\n   *\n   * @param options - The options for initializing the title.\n   */\n  constructor(options: Title.IOptions<T>) {\n    this.owner = options.owner;\n    if (options.label !== undefined) {\n      this._label = options.label;\n    }\n    if (options.mnemonic !== undefined) {\n      this._mnemonic = options.mnemonic;\n    }\n    if (options.icon !== undefined) {\n      this._icon = options.icon;\n    }\n\n    if (options.iconClass !== undefined) {\n      this._iconClass = options.iconClass;\n    }\n    if (options.iconLabel !== undefined) {\n      this._iconLabel = options.iconLabel;\n    }\n    if (options.caption !== undefined) {\n      this._caption = options.caption;\n    }\n    if (options.className !== undefined) {\n      this._className = options.className;\n    }\n    if (options.closable !== undefined) {\n      this._closable = options.closable;\n    }\n    this._dataset = options.dataset || {};\n  }\n\n  /**\n   * A signal emitted when the state of the title changes.\n   */\n  get changed(): ISignal<this, void> {\n    return this._changed;\n  }\n\n  /**\n   * The object which owns the title.\n   */\n  readonly owner: T;\n\n  /**\n   * Get the label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get label(): string {\n    return this._label;\n  }\n\n  /**\n   * Set the label for the title.\n   */\n  set label(value: string) {\n    if (this._label === value) {\n      return;\n    }\n    this._label = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the mnemonic index for the title.\n   *\n   * #### Notes\n   * The default value is `-1`.\n   */\n  get mnemonic(): number {\n    return this._mnemonic;\n  }\n\n  /**\n   * Set the mnemonic index for the title.\n   */\n  set mnemonic(value: number) {\n    if (this._mnemonic === value) {\n      return;\n    }\n    this._mnemonic = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon renderer for the title.\n   *\n   * #### Notes\n   * The default value is undefined.\n   */\n  get icon(): VirtualElement.IRenderer | undefined {\n    return this._icon;\n  }\n\n  /**\n   * Set the icon renderer for the title.\n   *\n   * #### Notes\n   * A renderer is an object that supplies a render and unrender function.\n   */\n  set icon(value: VirtualElement.IRenderer | undefined) {\n    if (this._icon === value) {\n      return;\n    }\n    this._icon = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconClass(): string {\n    return this._iconClass;\n  }\n\n  /**\n   * Set the icon class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconClass(value: string) {\n    if (this._iconClass === value) {\n      return;\n    }\n    this._iconClass = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconLabel(): string {\n    return this._iconLabel;\n  }\n\n  /**\n   * Set the icon label for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconLabel(value: string) {\n    if (this._iconLabel === value) {\n      return;\n    }\n    this._iconLabel = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the caption for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get caption(): string {\n    return this._caption;\n  }\n\n  /**\n   * Set the caption for the title.\n   */\n  set caption(value: string) {\n    if (this._caption === value) {\n      return;\n    }\n    this._caption = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the extra class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get className(): string {\n    return this._className;\n  }\n\n  /**\n   * Set the extra class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set className(value: string) {\n    if (this._className === value) {\n      return;\n    }\n    this._className = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the closable state for the title.\n   *\n   * #### Notes\n   * The default value is `false`.\n   */\n  get closable(): boolean {\n    return this._closable;\n  }\n\n  /**\n   * Set the closable state for the title.\n   *\n   * #### Notes\n   * This controls the presence of a close icon when applicable.\n   */\n  set closable(value: boolean) {\n    if (this._closable === value) {\n      return;\n    }\n    this._closable = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the dataset for the title.\n   *\n   * #### Notes\n   * The default value is an empty dataset.\n   */\n  get dataset(): Title.Dataset {\n    return this._dataset;\n  }\n\n  /**\n   * Set the dataset for the title.\n   *\n   * #### Notes\n   * This controls the data attributes when applicable.\n   */\n  set dataset(value: Title.Dataset) {\n    if (this._dataset === value) {\n      return;\n    }\n    this._dataset = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Test whether the title has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this._isDisposed;\n  }\n\n  /**\n   * Dispose of the resources held by the title.\n   *\n   * #### Notes\n   * It is the responsibility of the owner to call the title disposal.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n    this._isDisposed = true;\n\n    Signal.clearData(this);\n  }\n\n  private _label = '';\n  private _caption = '';\n  private _mnemonic = -1;\n  private _icon: VirtualElement.IRenderer | undefined = undefined;\n  private _iconClass = '';\n  private _iconLabel = '';\n  private _className = '';\n  private _closable = false;\n  private _dataset: Title.Dataset;\n  private _changed = new Signal<this, void>(this);\n  private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n  /**\n   * A type alias for a simple immutable string dataset.\n   */\n  export type Dataset = { readonly [key: string]: string };\n\n  /**\n   * An options object for initializing a title.\n   */\n  export interface IOptions<T> {\n    /**\n     * The object which owns the title.\n     */\n    owner: T;\n\n    /**\n     * The label for the title.\n     */\n    label?: string;\n\n    /**\n     * The mnemonic index for the title.\n     */\n    mnemonic?: number;\n\n    /**\n     * The icon renderer for the title.\n     */\n    icon?: VirtualElement.IRenderer;\n\n    /**\n     * The icon class name for the title.\n     */\n    iconClass?: string;\n\n    /**\n     * The icon label for the title.\n     */\n    iconLabel?: string;\n\n    /**\n     * The caption for the title.\n     */\n    caption?: string;\n\n    /**\n     * The extra class name for the title.\n     */\n    className?: string;\n\n    /**\n     * The closable state for the title.\n     */\n    closable?: boolean;\n\n    /**\n     * The dataset for the title.\n     */\n    dataset?: Dataset;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    while (this._widgets.length > 0) {\n      this._widgets.pop()!.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * A read-only array of the widgets in the layout.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this._widgets;\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    yield* this._widgets;\n  }\n\n  /**\n   * Add a widget to the end of the layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this._widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    widget.parent = this.parent;\n\n    // Look up the current index of the widget.\n    let i = this._widgets.indexOf(widget);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._widgets.length));\n\n    // If the widget is not in the array, insert it.\n    if (i === -1) {\n      // Insert the widget into the array.\n      ArrayExt.insert(this._widgets, j, widget);\n\n      // If the layout is parented, attach the widget to the DOM.\n      if (this.parent) {\n        this.attachWidget(j, widget);\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the widget exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._widgets.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the widget to the new location.\n    ArrayExt.move(this._widgets, i, j);\n\n    // If the layout is parented, move the widget in the DOM.\n    if (this.parent) {\n      this.moveWidget(i, j, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    this.removeWidgetAt(this._widgets.indexOf(widget));\n  }\n\n  /**\n   * Remove the widget at a given index from the layout.\n   *\n   * @param index - The index of the widget to remove.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  removeWidgetAt(index: number): void {\n    // Remove the widget from the array.\n    let widget = ArrayExt.removeAt(this._widgets, index);\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (widget && this.parent) {\n      this.detachWidget(index, widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    let index = 0;\n    for (const widget of this) {\n      this.attachWidget(index++, widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[index];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation moves the widget's node to the proper\n   * location in the parent's node and sends the appropriate attach and\n   * detach messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is moved in the parent's node.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` and  message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[toIndex];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widgets: Widget[] = [];\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n  /**\n   * Construct a new split layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: SplitLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.orientation !== undefined) {\n      this._orientation = options.orientation;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n    this._handles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the split layout.\n   */\n  readonly renderer: SplitLayout.IRenderer;\n\n  /**\n   * Get the layout orientation for the split layout.\n   */\n  get orientation(): SplitLayout.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split layout.\n   */\n  set orientation(value: SplitLayout.Orientation) {\n    if (this._orientation === value) {\n      return;\n    }\n    this._orientation = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['orientation'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  get alignment(): SplitLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  set alignment(value: SplitLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the split layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the split handles in the layout.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return this._handles;\n  }\n\n  /**\n   * Get the absolute sizes of the widgets in the layout.\n   *\n   * @returns A new array of the absolute sizes of the widgets.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  absoluteSizes(): number[] {\n    return this._sizers.map(sizer => sizer.size);\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the layout.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return Private.normalize(this._sizers.map(sizer => sizer.size));\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the layout.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    // Copy the sizes and pad with zeros as needed.\n    let n = this._sizers.length;\n    let temp = sizes.slice(0, n);\n    while (temp.length < n) {\n      temp.push(0);\n    }\n\n    // Normalize the padded sizes.\n    let normed = Private.normalize(temp);\n\n    // Apply the normalized sizes to the sizers.\n    for (let i = 0; i < n; ++i) {\n      let sizer = this._sizers[i];\n      sizer.sizeHint = normed[i];\n      sizer.size = normed[i];\n    }\n\n    // Set the flag indicating the sizes are normalized.\n    this._hasNormedSizes = true;\n\n    // Trigger an update of the parent widget.\n    if (update && this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Move the offset position of a split handle.\n   *\n   * @param index - The index of the handle of the interest.\n   *\n   * @param position - The desired offset position of the handle.\n   *\n   * #### Notes\n   * The position is relative to the offset parent.\n   *\n   * This will move the handle as close as possible to the desired\n   * position. The sibling widgets will be adjusted as necessary.\n   */\n  moveHandle(index: number, position: number): void {\n    // Bail if the index is invalid or the handle is hidden.\n    let handle = this._handles[index];\n    if (!handle || handle.classList.contains('lm-mod-hidden')) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (this._orientation === 'horizontal') {\n      delta = position - handle.offsetLeft;\n    } else {\n      delta = position - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent widget resizing unless needed.\n    for (let sizer of this._sizers) {\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(this._sizers, index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['orientation'] = this.orientation;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create the item, handle, and sizer for the new widget.\n    let item = new LayoutItem(widget);\n    let handle = Private.createHandle(this.renderer);\n    let average = Private.averageSize(this._sizers);\n    let sizer = Private.createSizer(average);\n\n    // Insert the item, handle, and sizer into the internal arrays.\n    ArrayExt.insert(this._items, index, item);\n    ArrayExt.insert(this._sizers, index, sizer);\n    ArrayExt.insert(this._handles, index, handle);\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget and handle nodes to the parent.\n    this.parent!.node.appendChild(widget.node);\n    this.parent!.node.appendChild(handle);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the item, sizer, and handle for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n    ArrayExt.move(this._handles, fromIndex, toIndex);\n\n    // Post a fit request to the parent to show/hide last handle.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the item, handle, and sizer for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n    let handle = ArrayExt.removeAt(this._handles, index);\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget and handle nodes from the parent.\n    this.parent!.node.removeChild(widget.node);\n    this.parent!.node.removeChild(handle!);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const item = this._items[i];\n    if (item.isHidden) {\n      return;\n    }\n\n    // Fetch the style for the handle.\n    let handleStyle = this._handles[i].style;\n\n    // Update the widget and handle, and advance the relevant edge.\n    if (isHorizontal) {\n      left += this.widgetOffset;\n      item.update(left, top, size, height);\n      left += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${this._spacing}px`;\n      handleStyle.height = `${height}px`;\n    } else {\n      top += this.widgetOffset;\n      item.update(left, top, width, size);\n      top += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${width}px`;\n      handleStyle.height = `${this._spacing}px`;\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Update the handles and track the visible widget count.\n    let nVisible = 0;\n    let lastHandleIndex = -1;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      if (this._items[i].isHidden) {\n        this._handles[i].classList.add('lm-mod-hidden');\n      } else {\n        this._handles[i].classList.remove('lm-mod-hidden');\n        lastHandleIndex = i;\n        nVisible++;\n      }\n    }\n\n    // Hide the handle for the last visible widget.\n    if (lastHandleIndex !== -1) {\n      this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed =\n      this._spacing * Math.max(0, nVisible - 1) +\n      this.widgetOffset * this._items.length;\n\n    // Setup the computed minimum size.\n    let horz = this._orientation === 'horizontal';\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed size limits.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // Prevent resizing unless necessary.\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the stretch factor.\n      sizer.stretch = SplitLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0 && this.widgetOffset === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Set up the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n    let horz = this._orientation === 'horizontal';\n\n    if (nVisible > 0) {\n      // Compute the adjusted layout space.\n      let space: number;\n      if (horz) {\n        // left += this.widgetOffset;\n        space = Math.max(0, width - this._fixed);\n      } else {\n        // top += this.widgetOffset;\n        space = Math.max(0, height - this._fixed);\n      }\n\n      // Scale the size hints if they are normalized.\n      if (this._hasNormedSizes) {\n        for (let sizer of this._sizers) {\n          sizer.sizeHint *= space;\n        }\n        this._hasNormedSizes = false;\n      }\n\n      // Distribute the layout space to the box sizers.\n      let delta = BoxEngine.calc(this._sizers, space);\n\n      // Account for alignment if there is extra layout space.\n      if (delta > 0) {\n        switch (this._alignment) {\n          case 'start':\n            break;\n          case 'center':\n            extra = 0;\n            offset = delta / 2;\n            break;\n          case 'end':\n            extra = 0;\n            offset = delta;\n            break;\n          case 'justify':\n            extra = delta / nVisible;\n            offset = 0;\n            break;\n          default:\n            throw 'unreachable';\n        }\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      const item = this._items[i];\n\n      // Fetch the computed size for the widget.\n      const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n      this.updateItemPosition(\n        i,\n        horz,\n        horz ? left + offset : left,\n        horz ? top : top + offset,\n        height,\n        width,\n        size\n      );\n\n      const fullOffset =\n        this.widgetOffset +\n        (this._handles[i].classList.contains('lm-mod-hidden')\n          ? 0\n          : this._spacing);\n\n      if (horz) {\n        left += size + fullOffset;\n      } else {\n        top += size + fullOffset;\n      }\n    }\n  }\n\n  protected widgetOffset = 0;\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _hasNormedSizes = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _handles: HTMLDivElement[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: SplitLayout.Alignment = 'start';\n  private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n  /**\n   * A type alias for a split layout orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a split layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a split layout.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The orientation of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Orientation}.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a split layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new handle for use with a split layout.\n     *\n     * @returns A new handle element.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * Get the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Create a new box sizer with the given size hint.\n   */\n  export function createSizer(size: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = Math.floor(size);\n    return sizer;\n  }\n\n  /**\n   * Create a new split handle node using the given renderer.\n   */\n  export function createHandle(\n    renderer: SplitLayout.IRenderer\n  ): HTMLDivElement {\n    let handle = renderer.createHandle();\n    handle.style.position = 'absolute';\n    // Do not use size containment to allow the handle to fill the available space\n    handle.style.contain = 'style';\n    return handle;\n  }\n\n  /**\n   * Compute the average size of an array of box sizers.\n   */\n  export function averageSize(sizers: BoxSizer[]): number {\n    return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n  }\n\n  /**\n   * Normalize an array of values.\n   */\n  export function normalize(values: number[]): number[] {\n    let n = values.length;\n    if (n === 0) {\n      return [];\n    }\n    let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n    return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof SplitLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n  /**\n   * Construct a new accordion layout.\n   *\n   * @param options - The options for initializing the layout.\n   *\n   * #### Notes\n   * The default orientation will be vertical.\n   *\n   * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n   */\n  constructor(options: AccordionLayout.IOptions) {\n    super({ ...options, orientation: options.orientation || 'vertical' });\n    this.titleSpace = options.titleSpace || 22;\n  }\n\n  /**\n   * The section title height or width depending on the orientation.\n   */\n  get titleSpace(): number {\n    return this.widgetOffset;\n  }\n  set titleSpace(value: number) {\n    value = Utils.clampDimension(value);\n    if (this.widgetOffset === value) {\n      return;\n    }\n    this.widgetOffset = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return this._titles;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Clear the layout state.\n    this._titles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the accordion layout.\n   */\n  readonly renderer: AccordionLayout.IRenderer;\n\n  public updateTitle(index: number, widget: Widget): void {\n    const oldTitle = this._titles[index];\n    const expanded = oldTitle.classList.contains('lm-mod-expanded');\n    const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n    this._titles[index] = newTitle;\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.replaceChild(newTitle, oldTitle);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (!widget.id) {\n      widget.id = `id-${UUID.uuid4()}`;\n    }\n    super.insertWidget(index, widget);\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    const title = Private.createTitle(this.renderer, widget.title);\n\n    ArrayExt.insert(this._titles, index, title);\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.appendChild(title);\n\n    widget.node.setAttribute('role', 'region');\n    widget.node.setAttribute('aria-labelledby', title.id);\n\n    super.attachWidget(index, widget);\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    ArrayExt.move(this._titles, fromIndex, toIndex);\n    super.moveWidget(fromIndex, toIndex, widget);\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    const title = ArrayExt.removeAt(this._titles, index);\n\n    this.parent!.node.removeChild(title!);\n\n    super.detachWidget(index, widget);\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const titleStyle = this._titles[i].style;\n\n    // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n    titleStyle.top = `${top}px`;\n    titleStyle.left = `${left}px`;\n    titleStyle.height = `${this.widgetOffset}px`;\n    if (isHorizontal) {\n      titleStyle.width = `${height}px`;\n    } else {\n      titleStyle.width = `${width}px`;\n    }\n\n    super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n  }\n\n  private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n  /**\n   * A type alias for a accordion layout orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion layout alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * An options object for initializing a accordion layout.\n   */\n  export interface IOptions extends SplitLayout.IOptions {\n    /**\n     * The renderer to use for the accordion layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The section title height or width depending on the orientation.\n     *\n     * The default is `22`.\n     */\n    titleSpace?: number;\n  }\n\n  /**\n   * A renderer for use with an accordion layout.\n   */\n  export interface IRenderer extends SplitLayout.IRenderer {\n    /**\n     * Common class name for all accordion titles.\n     */\n    readonly titleClassName: string;\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param title - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(title: Title<Widget>): HTMLElement;\n  }\n}\n\nnamespace Private {\n  /**\n   * Create the title HTML element.\n   *\n   * @param renderer Accordion renderer\n   * @param data Widget title\n   * @returns Title HTML element\n   */\n  export function createTitle(\n    renderer: AccordionLayout.IRenderer,\n    data: Title<Widget>,\n    expanded: boolean = true\n  ): HTMLElement {\n    const title = renderer.createSectionTitle(data);\n    title.style.position = 'absolute';\n    title.style.contain = 'strict';\n    title.setAttribute('aria-label', `${data.label} Section`);\n    title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n    title.setAttribute('aria-controls', data.owner.id);\n    if (expanded) {\n      title.classList.add('lm-mod-expanded');\n    }\n    return title;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n  /**\n   * Construct a new panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: Panel.IOptions = {}) {\n    super();\n    this.addClass('lm-Panel');\n    this.layout = Private.createLayout(options);\n  }\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return (this.layout as PanelLayout).widgets;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    (this.layout as PanelLayout).addWidget(widget);\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    (this.layout as PanelLayout).insertWidget(index, widget);\n  }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n  /**\n   * An options object for creating a panel.\n   */\n  export interface IOptions {\n    /**\n     * The panel layout to use for the panel.\n     *\n     * The default is a new `PanelLayout`.\n     */\n    layout?: PanelLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a panel layout for the given panel options.\n   */\n  export function createLayout(options: Panel.IOptions): PanelLayout {\n    return options.layout || new PanelLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n  /**\n   * Construct a new split panel.\n   *\n   * @param options - The options for initializing the split panel.\n   */\n  constructor(options: SplitPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-SplitPanel');\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    super.dispose();\n  }\n\n  /**\n   * Get the layout orientation for the split panel.\n   */\n  get orientation(): SplitPanel.Orientation {\n    return (this.layout as SplitLayout).orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split panel.\n   */\n  set orientation(value: SplitPanel.Orientation) {\n    (this.layout as SplitLayout).orientation = value;\n  }\n\n  /**\n   * Get the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  get alignment(): SplitPanel.Alignment {\n    return (this.layout as SplitLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  set alignment(value: SplitPanel.Alignment) {\n    (this.layout as SplitLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the split panel.\n   */\n  get spacing(): number {\n    return (this.layout as SplitLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split panel.\n   */\n  set spacing(value: number) {\n    (this.layout as SplitLayout).spacing = value;\n  }\n\n  /**\n   * The renderer used by the split panel.\n   */\n  get renderer(): SplitPanel.IRenderer {\n    return (this.layout as SplitLayout).renderer;\n  }\n\n  /**\n   * A signal emitted when a split handle has moved.\n   */\n  get handleMoved(): ISignal<this, void> {\n    return this._handleMoved;\n  }\n\n  /**\n   * A read-only array of the split handles in the panel.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return (this.layout as SplitLayout).handles;\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the panel.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return (this.layout as SplitLayout).relativeSizes();\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the panel.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n  }\n\n  /**\n   * Handle the DOM events for the split panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the `'keydown'` event for the split panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    if (this._pressData) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the split panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the primary button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the target, if any.\n    let layout = this.layout as SplitLayout;\n    let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n      return handle.contains(event.target as HTMLElement);\n    });\n\n    // Bail early if the mouse press was not on a handle.\n    if (index === -1) {\n      return;\n    }\n\n    // Stop the event when a split handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    document.addEventListener('pointerup', this, true);\n    document.addEventListener('pointermove', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset delta for the handle press.\n    let delta: number;\n    let handle = layout.handles[index];\n    let rect = handle.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      delta = event.clientX - rect.left;\n    } else {\n      delta = event.clientY - rect.top;\n    }\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!);\n    this._pressData = { index, delta, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the split panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Stop the event when dragging a split handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let pos: number;\n    let layout = this.layout as SplitLayout;\n    let rect = this.node.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      pos = event.clientX - rect.left - this._pressData!.delta;\n    } else {\n      pos = event.clientY - rect.top - this._pressData!.delta;\n    }\n\n    // Move the handle as close to the desired position as possible.\n    layout.moveHandle(this._pressData!.index, pos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the split panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the primary button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse grab for the split panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Emit the handle moved signal.\n    this._handleMoved.emit();\n\n    // Remove the extra document listeners.\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('pointerup', this, true);\n    document.removeEventListener('pointermove', this, true);\n    document.removeEventListener('contextmenu', this, true);\n  }\n\n  private _handleMoved = new Signal<any, void>(this);\n  private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n  /**\n   * A type alias for a split panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a split panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a split panel renderer.\n   */\n  export type IRenderer = SplitLayout.IRenderer;\n\n  /**\n   * An options object for initializing a split panel.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The layout orientation of the panel.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The split layout to use for the split panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `SplitLayout`.\n     */\n    layout?: SplitLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new handle for use with a split panel.\n     *\n     * @returns A new handle element for a split panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-SplitPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * Get the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return SplitLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    SplitLayout.setStretch(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The index of the pressed handle.\n     */\n    index: number;\n\n    /**\n     * The offset of the press in handle coordinates.\n     */\n    delta: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * Create a split layout for the given panel options.\n   */\n  export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n    return (\n      options.layout ||\n      new SplitLayout({\n        renderer: options.renderer || SplitPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n  /**\n   * Construct a new accordion panel.\n   *\n   * @param options - The options for initializing the accordion panel.\n   *\n   */\n  constructor(options: AccordionPanel.IOptions = {}) {\n    super({ ...options, layout: Private.createLayout(options) });\n    this.addClass('lm-AccordionPanel');\n  }\n\n  /**\n   * The renderer used by the accordion panel.\n   */\n  get renderer(): AccordionPanel.IRenderer {\n    return (this.layout as AccordionLayout).renderer;\n  }\n\n  /**\n   * The section title space.\n   *\n   * This is the height if the panel is vertical and the width if it is\n   * horizontal.\n   */\n  get titleSpace(): number {\n    return (this.layout as AccordionLayout).titleSpace;\n  }\n  set titleSpace(value: number) {\n    (this.layout as AccordionLayout).titleSpace = value;\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return (this.layout as AccordionLayout).titles;\n  }\n\n  /**\n   * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n   */\n  get expansionToggled(): ISignal<this, number> {\n    return this._expansionToggled;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    super.addWidget(widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Collapse the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  collapse(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && !widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Expand the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  expand(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    super.insertWidget(index, widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Handle the DOM events for the accordion panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    super.handleEvent(event);\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._eventKeyDown(event as KeyboardEvent);\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    super.onBeforeAttach(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    super.onAfterDetach(msg);\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<Widget>): void {\n    const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n      return widget.contains(sender.owner);\n    });\n\n    if (index >= 0) {\n      (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n      this.update();\n    }\n  }\n\n  /**\n   * Compute the size of widgets in this panel on the title click event.\n   * On closing, the size of the widget is cached and we will try to expand\n   * the last opened widget.\n   * On opening, we will use the cached size if it is available to restore the\n   * widget.\n   * In both cases, if we can not compute the size of widgets, we will let\n   * `SplitLayout` decide.\n   *\n   * @param index - The index of widget to be opened of closed\n   *\n   * @returns Relative size of widgets in this panel, if this size can\n   * not be computed, return `undefined`\n   */\n  private _computeWidgetSize(index: number): number[] | undefined {\n    const layout = this.layout as AccordionLayout;\n\n    const widget = layout.widgets[index];\n    if (!widget) {\n      return undefined;\n    }\n    const isHidden = widget.isHidden;\n    const widgetSizes = layout.absoluteSizes();\n    const delta = (isHidden ? -1 : 1) * this.spacing;\n    const totalSize = widgetSizes.reduce(\n      (prev: number, curr: number) => prev + curr\n    );\n\n    let newSize = [...widgetSizes];\n\n    if (!isHidden) {\n      // Hide the widget\n      const currentSize = widgetSizes[index];\n\n      this._widgetSizesCache.set(widget, currentSize);\n      newSize[index] = 0;\n\n      const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // All widget are closed, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n\n      newSize[widgetToCollapse] =\n        widgetSizes[widgetToCollapse] + currentSize + delta;\n    } else {\n      // Show the widget\n      const previousSize = this._widgetSizesCache.get(widget);\n      if (!previousSize) {\n        // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n      newSize[index] += previousSize;\n\n      const widgetToCollapse = newSize\n        .map(sz => sz - previousSize > 0)\n        .lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // Can not reduce the size of one widget, reduce all opened widgets\n        // proportionally with its size.\n        newSize.forEach((_, idx) => {\n          if (idx !== index) {\n            newSize[idx] -=\n              (widgetSizes[idx] / totalSize) * (previousSize - delta);\n          }\n        });\n      } else {\n        newSize[widgetToCollapse] -= previousSize - delta;\n      }\n    }\n    return newSize.map(sz => sz / (totalSize + delta));\n  }\n  /**\n   * Handle the `'click'` event for the accordion panel\n   */\n  private _evtClick(event: MouseEvent): void {\n    const target = event.target as HTMLElement | null;\n\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._toggleExpansion(index);\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the accordion panel.\n   */\n  private _eventKeyDown(event: KeyboardEvent): void {\n    if (event.defaultPrevented) {\n      return;\n    }\n\n    const target = event.target as HTMLElement | null;\n    let handled = false;\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        const keyCode = event.keyCode.toString();\n\n        // If Space or Enter is pressed on title, emulate click event\n        if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n          target.click();\n          handled = true;\n        } else if (\n          this.orientation === 'horizontal'\n            ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n            : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n        ) {\n          // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n          const direction =\n            event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n              ? -1\n              : 1;\n          const length = this.titles.length;\n          const newIndex = (index + length + direction) % length;\n\n          this.titles[newIndex].focus();\n          handled = true;\n        } else if (event.key === 'End' || keyCode === '35') {\n          // If End is pressed on title, focus on the last title\n          this.titles[this.titles.length - 1].focus();\n          handled = true;\n        } else if (event.key === 'Home' || keyCode === '36') {\n          // If Home is pressed on title, focus on the first title\n          this.titles[0].focus();\n          handled = true;\n        }\n      }\n\n      if (handled) {\n        event.preventDefault();\n      }\n    }\n  }\n\n  private _toggleExpansion(index: number) {\n    const title = this.titles[index];\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    const newSize = this._computeWidgetSize(index);\n    if (newSize) {\n      this.setRelativeSizes(newSize, false);\n    }\n\n    if (widget.isHidden) {\n      title.classList.add('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'true');\n      widget.show();\n    } else {\n      title.classList.remove('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'false');\n      widget.hide();\n    }\n\n    // Emit the expansion state signal.\n    this._expansionToggled.emit(index);\n  }\n\n  private _widgetSizesCache: WeakMap<Widget, number> = new WeakMap();\n  private _expansionToggled = new Signal<this, number>(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n  /**\n   * A type alias for a accordion panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a accordion panel renderer.\n   */\n  export type IRenderer = AccordionLayout.IRenderer;\n\n  /**\n   * An options object for initializing a accordion panel.\n   */\n  export interface IOptions extends Partial<AccordionLayout.IOptions> {\n    /**\n     * The accordion layout to use for the accordion panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `AccordionLayout`.\n     */\n    layout?: AccordionLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer extends SplitPanel.Renderer implements IRenderer {\n    constructor() {\n      super();\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches any title node in the accordion.\n     */\n    readonly titleClassName = 'lm-AccordionPanel-title';\n\n    /**\n     * Render the collapse indicator for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the collapse indicator.\n     */\n    createCollapseIcon(data: Title<Widget>): HTMLElement {\n      return document.createElement('span');\n    }\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(data: Title<Widget>): HTMLElement {\n      const handle = document.createElement('h3');\n      handle.setAttribute('tabindex', '0');\n      handle.id = this.createTitleKey(data);\n      handle.className = this.titleClassName;\n      for (const aData in data.dataset) {\n        handle.dataset[aData] = data.dataset[aData];\n      }\n\n      const collapser = handle.appendChild(this.createCollapseIcon(data));\n      collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n      const label = handle.appendChild(document.createElement('span'));\n      label.className = 'lm-AccordionPanel-titleLabel';\n      label.textContent = data.label;\n      label.title = data.caption || data.label;\n\n      return handle;\n    }\n\n    /**\n     * Create a unique render key for the title.\n     *\n     * @param data - The data to use for the title.\n     *\n     * @returns The unique render key for the title.\n     *\n     * #### Notes\n     * This method caches the key against the section title the first time\n     * the key is generated.\n     */\n    createTitleKey(data: Title<Widget>): string {\n      let key = this._titleKeys.get(data);\n      if (key === undefined) {\n        key = `title-key-${this._uuid}-${this._titleID++}`;\n        this._titleKeys.set(data, key);\n      }\n      return key;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _titleID = 0;\n    private _titleKeys = new WeakMap<Title<Widget>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n  /**\n   * Create an accordion layout for the given panel options.\n   *\n   * @param options Panel options\n   * @returns Panel layout\n   */\n  export function createLayout(\n    options: AccordionPanel.IOptions\n  ): AccordionLayout {\n    return (\n      options.layout ||\n      new AccordionLayout({\n        renderer: options.renderer || AccordionPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing,\n        titleSpace: options.titleSpace\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n  /**\n   * Construct a new box layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: BoxLayout.IOptions = {}) {\n    super();\n    if (options.direction !== undefined) {\n      this._direction = options.direction;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the layout direction for the box layout.\n   */\n  get direction(): BoxLayout.Direction {\n    return this._direction;\n  }\n\n  /**\n   * Set the layout direction for the box layout.\n   */\n  set direction(value: BoxLayout.Direction) {\n    if (this._direction === value) {\n      return;\n    }\n    this._direction = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['direction'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the box layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['direction'] = this.direction;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Create and add a new sizer for the widget.\n    ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Move the sizer for the widget.\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Remove the sizer for the widget.\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n    // Setup the computed minimum size.\n    let horz = Private.isHorizontal(this._direction);\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the size basis and stretch factor.\n      sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n      sizer.stretch = BoxLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Distribute the layout space and adjust the start position.\n    let delta: number;\n    switch (this._direction) {\n      case 'left-to-right':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        break;\n      case 'top-to-bottom':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        break;\n      case 'right-to-left':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        left += width;\n        break;\n      case 'bottom-to-top':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        top += height;\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Setup the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n\n    // Account for alignment if there is extra layout space.\n    if (delta > 0) {\n      switch (this._alignment) {\n        case 'start':\n          break;\n        case 'center':\n          extra = 0;\n          offset = delta / 2;\n          break;\n        case 'end':\n          extra = 0;\n          offset = delta;\n          break;\n        case 'justify':\n          extra = delta / nVisible;\n          offset = 0;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the computed size for the widget.\n      let size = this._sizers[i].size;\n\n      // Update the widget geometry and advance the relevant edge.\n      switch (this._direction) {\n        case 'left-to-right':\n          item.update(left + offset, top, size + extra, height);\n          left += size + extra + this._spacing;\n          break;\n        case 'top-to-bottom':\n          item.update(left, top + offset, width, size + extra);\n          top += size + extra + this._spacing;\n          break;\n        case 'right-to-left':\n          item.update(left - offset - size - extra, top, size + extra, height);\n          left -= size + extra + this._spacing;\n          break;\n        case 'bottom-to-top':\n          item.update(left, top - offset - size - extra, width, size + extra);\n          top -= size + extra + this._spacing;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n  }\n\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: BoxLayout.Alignment = 'start';\n  private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n  /**\n   * A type alias for a box layout direction.\n   */\n  export type Direction =\n    | 'left-to-right'\n    | 'right-to-left'\n    | 'top-to-bottom'\n    | 'bottom-to-top';\n\n  /**\n   * A type alias for a box layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a box layout.\n   */\n  export interface IOptions {\n    /**\n     * The direction of the layout.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * Get the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n\n  /**\n   * Get the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return Private.sizeBasisProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    Private.sizeBasisProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * The property descriptor for a widget size basis.\n   */\n  export const sizeBasisProperty = new AttachedProperty<Widget, number>({\n    name: 'sizeBasis',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Test whether a direction has horizontal orientation.\n   */\n  export function isHorizontal(dir: BoxLayout.Direction): boolean {\n    return dir === 'left-to-right' || dir === 'right-to-left';\n  }\n\n  /**\n   * Clamp a spacing value to an integer >= 0.\n   */\n  export function clampSpacing(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof BoxLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n  /**\n   * Construct a new box panel.\n   *\n   * @param options - The options for initializing the box panel.\n   */\n  constructor(options: BoxPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-BoxPanel');\n  }\n\n  /**\n   * Get the layout direction for the box panel.\n   */\n  get direction(): BoxPanel.Direction {\n    return (this.layout as BoxLayout).direction;\n  }\n\n  /**\n   * Set the layout direction for the box panel.\n   */\n  set direction(value: BoxPanel.Direction) {\n    (this.layout as BoxLayout).direction = value;\n  }\n\n  /**\n   * Get the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxPanel.Alignment {\n    return (this.layout as BoxLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxPanel.Alignment) {\n    (this.layout as BoxLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the box panel.\n   */\n  get spacing(): number {\n    return (this.layout as BoxLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box panel.\n   */\n  set spacing(value: number) {\n    (this.layout as BoxLayout).spacing = value;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-BoxPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-BoxPanel-child');\n  }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n  /**\n   * A type alias for a box panel direction.\n   */\n  export type Direction = BoxLayout.Direction;\n\n  /**\n   * A type alias for a box panel alignment.\n   */\n  export type Alignment = BoxLayout.Alignment;\n\n  /**\n   * An options object for initializing a box panel.\n   */\n  export interface IOptions {\n    /**\n     * The layout direction of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Direction}.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The box layout to use for the box panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `BoxLayout`.\n     */\n    layout?: BoxLayout;\n  }\n\n  /**\n   * Get the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return BoxLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    BoxLayout.setStretch(widget, value);\n  }\n\n  /**\n   * Get the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return BoxLayout.getSizeBasis(widget);\n  }\n\n  /**\n   * Set the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    BoxLayout.setSizeBasis(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a box layout for the given panel options.\n   */\n  export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n    return options.layout || new BoxLayout(options);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n  /**\n   * Construct a new command palette.\n   *\n   * @param options - The options for initializing the palette.\n   */\n  constructor(options: CommandPalette.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-CommandPalette');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || CommandPalette.defaultRenderer;\n    this.commands.commandChanged.connect(this._onGenericChange, this);\n    this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._items.length = 0;\n    this._results = null;\n    super.dispose();\n  }\n\n  /**\n   * The command registry used by the command palette.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the command palette.\n   */\n  readonly renderer: CommandPalette.IRenderer;\n\n  /**\n   * The command palette search node.\n   *\n   * #### Notes\n   * This is the node which contains the search-related elements.\n   */\n  get searchNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-search'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The command palette input node.\n   *\n   * #### Notes\n   * This is the actual input node for the search area.\n   */\n  get inputNode(): HTMLInputElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-input'\n    )[0] as HTMLInputElement;\n  }\n\n  /**\n   * The command palette content node.\n   *\n   * #### Notes\n   * This is the node which holds the command item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * A read-only array of the command items in the palette.\n   */\n  get items(): ReadonlyArray<CommandPalette.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Add a command item to the command palette.\n   *\n   * @param options - The options for creating the command item.\n   *\n   * @returns The command item added to the palette.\n   */\n  addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n    // Create a new command item for the options.\n    let item = Private.createItem(this.commands, options);\n\n    // Add the item to the array.\n    this._items.push(item);\n\n    // Refresh the search results.\n    this.refresh();\n\n    // Return the item added to the palette.\n    return item;\n  }\n\n  /**\n   * Adds command items to the command palette.\n   *\n   * @param items - An array of options for creating each command item.\n   *\n   * @returns The command items added to the palette.\n   */\n  addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n    const newItems = items.map(item => Private.createItem(this.commands, item));\n    newItems.forEach(item => this._items.push(item));\n    this.refresh();\n    return newItems;\n  }\n\n  /**\n   * Remove an item from the command palette.\n   *\n   * @param item - The item to remove from the palette.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the palette.\n   */\n  removeItem(item: CommandPalette.IItem): void {\n    this.removeItemAt(this._items.indexOf(item));\n  }\n\n  /**\n   * Remove the item at a given index from the command palette.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Remove all items from the command palette.\n   */\n  clearItems(): void {\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the array of items.\n    this._items.length = 0;\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Clear the search results and schedule an update.\n   *\n   * #### Notes\n   * This should be called whenever the search results of the palette\n   * should be updated.\n   *\n   * This is typically called automatically by the palette as needed,\n   * but can be called manually if the input text is programatically\n   * changed.\n   *\n   * The rendered results are updated asynchronously.\n   */\n  refresh(): void {\n    this._results = null;\n    if (this.inputNode.value !== '') {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'inherit';\n    } else {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'none';\n    }\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the command palette.\n   *\n   * @param event - The DOM event sent to the command palette.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the command palette's DOM node.\n   * It should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'input':\n        this.refresh();\n        break;\n      case 'focus':\n      case 'blur':\n        this._toggleFocused();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('input', this);\n    this.node.addEventListener('focus', this, true);\n    this.node.addEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('input', this);\n    this.node.removeEventListener('focus', this, true);\n    this.node.removeEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   */\n  protected onAfterShow(msg: Message): void {\n    this.update();\n    super.onAfterShow(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      let input = this.inputNode;\n      input.focus();\n      input.select();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (!this.isVisible) {\n      // Ensure to clear the content if the widget is hidden\n      VirtualDOM.render(null, this.contentNode);\n      return;\n    }\n\n    // Fetch the current query text and content node.\n    let query = this.inputNode.value;\n    let contentNode = this.contentNode;\n\n    // Ensure the search results are generated.\n    let results = this._results;\n    if (!results) {\n      // Generate and store the new search results.\n      results = this._results = Private.search(this._items, query);\n\n      // Reset the active index.\n      this._activeIndex = query\n        ? ArrayExt.findFirstIndex(results, Private.canActivate)\n        : -1;\n    }\n\n    // If there is no query and no results, clear the content.\n    if (!query && results.length === 0) {\n      VirtualDOM.render(null, contentNode);\n      return;\n    }\n\n    // If the is a query but no results, render the empty message.\n    if (query && results.length === 0) {\n      let content = this.renderer.renderEmptyMessage({ query });\n      VirtualDOM.render(content, contentNode);\n      return;\n    }\n\n    // Create the render content for the search results.\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let content = new Array<VirtualElement>(results.length);\n    for (let i = 0, n = results.length; i < n; ++i) {\n      let result = results[i];\n      if (result.type === 'header') {\n        let indices = result.indices;\n        let category = result.category;\n        content[i] = renderer.renderHeader({ category, indices });\n      } else {\n        let item = result.item;\n        let indices = result.indices;\n        let active = i === activeIndex;\n        content[i] = renderer.renderItem({ item, indices, active });\n      }\n    }\n\n    // Render the search result content.\n    VirtualDOM.render(content, contentNode);\n\n    // Adjust the scroll position as needed.\n    if (activeIndex < 0 || activeIndex >= results.length) {\n      contentNode.scrollTop = 0;\n    } else {\n      let element = contentNode.children[activeIndex];\n      ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n    }\n  }\n\n  /**\n   * Handle the `'click'` event for the command palette.\n   */\n  private _evtClick(event: MouseEvent): void {\n    // Bail if the click is not the left button.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Clear input if the target is clear button\n    if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n      this.inputNode.value = '';\n      this.refresh();\n      return;\n    }\n\n    // Find the index of the item which was clicked.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return node.contains(event.target as HTMLElement);\n    });\n\n    // Bail if the click was not on an item.\n    if (index === -1) {\n      return;\n    }\n\n    // Kill the event when a content item is clicked.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Execute the item if possible.\n    this._execute(index);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the command palette.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n      return;\n    }\n    switch (event.keyCode) {\n      case 13: // Enter\n        event.preventDefault();\n        event.stopPropagation();\n        this._execute(this._activeIndex);\n        break;\n      case 38: // Up Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activatePreviousItem();\n        break;\n      case 40: // Down Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activateNextItem();\n        break;\n    }\n  }\n\n  /**\n   * Activate the next enabled command item.\n   */\n  private _activateNextItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the next enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this._activeIndex = ArrayExt.findFirstIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Activate the previous enabled command item.\n   */\n  private _activatePreviousItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the previous enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this._activeIndex = ArrayExt.findLastIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Execute the command item at the given index, if possible.\n   */\n  private _execute(index: number): void {\n    // Bail if there are no search results.\n    if (!this._results) {\n      return;\n    }\n\n    // Bail if the index is out of range.\n    let part = this._results[index];\n    if (!part) {\n      return;\n    }\n\n    // Update the search text if the item is a header.\n    if (part.type === 'header') {\n      let input = this.inputNode;\n      input.value = `${part.category.toLowerCase()} `;\n      input.focus();\n      this.refresh();\n      return;\n    }\n\n    // Bail if item is not enabled.\n    if (!part.item.isEnabled) {\n      return;\n    }\n\n    // Execute the item.\n    this.commands.execute(part.item.command, part.item.args);\n\n    // Clear the query text.\n    this.inputNode.value = '';\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Toggle the focused modifier based on the input node focus state.\n   */\n  private _toggleFocused(): void {\n    let focused = document.activeElement === this.inputNode;\n    this.toggleClass('lm-mod-focused', focused);\n  }\n\n  /**\n   * A signal handler for generic command changes.\n   */\n  private _onGenericChange(): void {\n    this.refresh();\n  }\n\n  private _activeIndex = -1;\n  private _items: CommandPalette.IItem[] = [];\n  private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n  /**\n   * An options object for creating a command palette.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the command palette.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the command palette.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for creating a command item.\n   */\n  export interface IItemOptions {\n    /**\n     * The category for the item.\n     */\n    category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    command: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     *\n     * The rank is used as a tie-breaker when ordering command items\n     * for display. Items are sorted in the following order:\n     *   1. Text match (lower is better)\n     *   2. Category (locale order)\n     *   3. Rank (lower is better)\n     *   4. Label (locale order)\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n\n  /**\n   * An object which represents an item in a command palette.\n   *\n   * #### Notes\n   * Item objects are created automatically by a command palette.\n   */\n  export interface IItem {\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    readonly label: string;\n\n    /**\n     * The display caption for the command item.\n     */\n    readonly caption: string;\n\n    /**\n     * The icon renderer for the command item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the command item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the command item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The extra class name for the command item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the command item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the command item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the command item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    readonly isToggleable: boolean;\n\n    /**\n     * Whether the command item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the command item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * The render data for a command palette header.\n   */\n  export interface IHeaderRenderData {\n    /**\n     * The category of the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched characters in the category.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * The render data for a command palette item.\n   */\n  export interface IItemRenderData {\n    /**\n     * The command palette item to render.\n     */\n    readonly item: IItem;\n\n    /**\n     * The indices of the matched characters in the label.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n  }\n\n  /**\n   * The render data for a command palette empty message.\n   */\n  export interface IEmptyMessageRenderData {\n    /**\n     * The query which failed to match any commands.\n     */\n    query: string;\n  }\n\n  /**\n   * A renderer for use with a command palette.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement;\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     *\n     * #### Notes\n     * The command palette will not render invisible items.\n     */\n    renderItem(data: IItemRenderData): VirtualElement;\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement {\n      let content = this.formatHeader(data);\n      return h.li({ className: 'lm-CommandPalette-header' }, content);\n    }\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IItemRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      if (data.item.isToggleable) {\n        return h.li(\n          {\n            className,\n            dataset,\n            role: 'menuitemcheckbox',\n            'aria-checked': `${data.item.isToggled}`\n          },\n          this.renderItemIcon(data),\n          this.renderItemContent(data),\n          this.renderItemShortcut(data)\n        );\n      }\n      return h.li(\n        {\n          className,\n          dataset,\n          role: 'menuitem'\n        },\n        this.renderItemIcon(data),\n        this.renderItemContent(data),\n        this.renderItemShortcut(data)\n      );\n    }\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n      let content = this.formatEmptyMessage(data);\n      return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n    }\n\n    /**\n     * Render the icon for a command palette item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the icon.\n     */\n    renderItemIcon(data: IItemRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the content for a command palette item.\n     *\n     * @param data - The data to use for rendering the content.\n     *\n     * @returns A virtual element representing the content.\n     */\n    renderItemContent(data: IItemRenderData): VirtualElement {\n      return h.div(\n        { className: 'lm-CommandPalette-itemContent' },\n        this.renderItemLabel(data),\n        this.renderItemCaption(data)\n      );\n    }\n\n    /**\n     * Render the label for a command palette item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the label.\n     */\n    renderItemLabel(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemLabel(data);\n      return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n    }\n\n    /**\n     * Render the caption for a command palette item.\n     *\n     * @param data - The data to use for rendering the caption.\n     *\n     * @returns A virtual element representing the caption.\n     */\n    renderItemCaption(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemCaption(data);\n      return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n    }\n\n    /**\n     * Render the shortcut for a command palette item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the shortcut.\n     */\n    renderItemShortcut(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemShortcut(data);\n      return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n    }\n\n    /**\n     * Create the class name for the command palette item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the command palette item.\n     */\n    createItemClass(data: IItemRenderData): string {\n      // Set up the initial class name.\n      let name = 'lm-CommandPalette-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the command palette item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the command palette item.\n     */\n    createItemDataset(data: IItemRenderData): ElementDataset {\n      return { ...data.item.dataset, command: data.item.command };\n    }\n\n    /**\n     * Create the class name for the command item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IItemRenderData): string {\n      let name = 'lm-CommandPalette-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the header node.\n     *\n     * @param data - The data to use for the header content.\n     *\n     * @returns The content to add to the header node.\n     */\n    formatHeader(data: IHeaderRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.category;\n      }\n      return StringExt.highlight(data.category, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the empty message node.\n     *\n     * @param data - The data to use for the empty message content.\n     *\n     * @returns The content to add to the empty message node.\n     */\n    formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n      return `No commands found that match '${data.query}'`;\n    }\n\n    /**\n     * Create the render content for the item shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatItemShortcut(data: IItemRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n\n    /**\n     * Create the render content for the item label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatItemLabel(data: IItemRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.item.label;\n      }\n      return StringExt.highlight(data.item.label, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the item caption node.\n     *\n     * @param data - The data to use for the caption content.\n     *\n     * @returns The content to add to the caption node.\n     */\n    formatItemCaption(data: IItemRenderData): h.Child {\n      return data.item.caption;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a command palette.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let search = document.createElement('div');\n    let wrapper = document.createElement('div');\n    let input = document.createElement('input');\n    let content = document.createElement('ul');\n    let clear = document.createElement('button');\n    search.className = 'lm-CommandPalette-search';\n    wrapper.className = 'lm-CommandPalette-wrapper';\n    input.className = 'lm-CommandPalette-input';\n    clear.className = 'lm-close-icon';\n\n    content.className = 'lm-CommandPalette-content';\n    content.setAttribute('role', 'menu');\n    input.spellcheck = false;\n    wrapper.appendChild(input);\n    wrapper.appendChild(clear);\n    search.appendChild(wrapper);\n    node.appendChild(search);\n    node.appendChild(content);\n    return node;\n  }\n\n  /**\n   * Create a new command item from a command registry and options.\n   */\n  export function createItem(\n    commands: CommandRegistry,\n    options: CommandPalette.IItemOptions\n  ): CommandPalette.IItem {\n    return new CommandItem(commands, options);\n  }\n\n  /**\n   * A search result object for a header label.\n   */\n  export interface IHeaderResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'header';\n\n    /**\n     * The category for the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A search result object for a command item.\n   */\n  export interface IItemResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'item';\n\n    /**\n     * The command item which was matched.\n     */\n    readonly item: CommandPalette.IItem;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A type alias for a search result item.\n   */\n  export type SearchResult = IHeaderResult | IItemResult;\n\n  /**\n   * Search an array of command items for fuzzy matches.\n   */\n  export function search(\n    items: CommandPalette.IItem[],\n    query: string\n  ): SearchResult[] {\n    // Fuzzy match the items for the query.\n    let scores = matchItems(items, query);\n\n    // Sort the items based on their score.\n    scores.sort(scoreCmp);\n\n    // Create the results for the search.\n    return createResults(scores);\n  }\n\n  /**\n   * Test whether a result item can be activated.\n   */\n  export function canActivate(result: SearchResult): boolean {\n    return result.type === 'item' && result.item.isEnabled;\n  }\n\n  /**\n   * Normalize a category for a command item.\n   */\n  function normalizeCategory(category: string): string {\n    return category.trim().replace(/\\s+/g, ' ');\n  }\n\n  /**\n   * Normalize the query text for a fuzzy search.\n   */\n  function normalizeQuery(text: string): string {\n    return text.replace(/\\s+/g, '').toLowerCase();\n  }\n\n  /**\n   * An enum of the supported match types.\n   */\n  const enum MatchType {\n    Label,\n    Category,\n    Split,\n    Default\n  }\n\n  /**\n   * A text match score with associated command item.\n   */\n  interface IScore {\n    /**\n     * The numerical type for the text match.\n     */\n    matchType: MatchType;\n\n    /**\n     * The numerical score for the text match.\n     */\n    score: number;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    categoryIndices: number[] | null;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    labelIndices: number[] | null;\n\n    /**\n     * The command item associated with the match.\n     */\n    item: CommandPalette.IItem;\n  }\n\n  /**\n   * Perform a fuzzy match on an array of command items.\n   */\n  function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n    // Normalize the query text to lower case with no whitespace.\n    query = normalizeQuery(query);\n\n    // Create the array to hold the scores.\n    let scores: IScore[] = [];\n\n    // Iterate over the items and match against the query.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Ignore items which are not visible.\n      let item = items[i];\n      if (!item.isVisible) {\n        continue;\n      }\n\n      // If the query is empty, all items are matched by default.\n      if (!query) {\n        scores.push({\n          matchType: MatchType.Default,\n          categoryIndices: null,\n          labelIndices: null,\n          score: 0,\n          item\n        });\n        continue;\n      }\n\n      // Run the fuzzy search for the item and query.\n      let score = fuzzySearch(item, query);\n\n      // Ignore the item if it is not a match.\n      if (!score) {\n        continue;\n      }\n\n      // Penalize disabled items.\n      // TODO - push disabled items all the way down in sort cmp?\n      if (!item.isEnabled) {\n        score.score += 1000;\n      }\n\n      // Add the score to the results.\n      scores.push(score);\n    }\n\n    // Return the final array of scores.\n    return scores;\n  }\n\n  /**\n   * Perform a fuzzy search on a single command item.\n   */\n  function fuzzySearch(\n    item: CommandPalette.IItem,\n    query: string\n  ): IScore | null {\n    // Create the source text to be searched.\n    let category = item.category.toLowerCase();\n    let label = item.label.toLowerCase();\n    let source = `${category} ${label}`;\n\n    // Set up the match score and indices array.\n    let score = Infinity;\n    let indices: number[] | null = null;\n\n    // The regex for search word boundaries\n    let rgx = /\\b\\w/g;\n\n    // Search the source by word boundary.\n    // eslint-disable-next-line no-constant-condition\n    while (true) {\n      // Find the next word boundary in the source.\n      let rgxMatch = rgx.exec(source);\n\n      // Break if there is no more source context.\n      if (!rgxMatch) {\n        break;\n      }\n\n      // Run the string match on the relevant substring.\n      let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n      // Break if there is no match.\n      if (!match) {\n        break;\n      }\n\n      // Update the match if the score is better.\n      if (match.score <= score) {\n        score = match.score;\n        indices = match.indices;\n      }\n    }\n\n    // Bail if there was no match.\n    if (!indices || score === Infinity) {\n      return null;\n    }\n\n    // Compute the pivot index between category and label text.\n    let pivot = category.length + 1;\n\n    // Find the slice index to separate matched indices.\n    let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n    // Extract the matched category and label indices.\n    let categoryIndices = indices.slice(0, j);\n    let labelIndices = indices.slice(j);\n\n    // Adjust the label indices for the pivot offset.\n    for (let i = 0, n = labelIndices.length; i < n; ++i) {\n      labelIndices[i] -= pivot;\n    }\n\n    // Handle a pure label match.\n    if (categoryIndices.length === 0) {\n      return {\n        matchType: MatchType.Label,\n        categoryIndices: null,\n        labelIndices,\n        score,\n        item\n      };\n    }\n\n    // Handle a pure category match.\n    if (labelIndices.length === 0) {\n      return {\n        matchType: MatchType.Category,\n        categoryIndices,\n        labelIndices: null,\n        score,\n        item\n      };\n    }\n\n    // Handle a split match.\n    return {\n      matchType: MatchType.Split,\n      categoryIndices,\n      labelIndices,\n      score,\n      item\n    };\n  }\n\n  /**\n   * A sort comparison function for a match score.\n   */\n  function scoreCmp(a: IScore, b: IScore): number {\n    // First compare based on the match type\n    let m1 = a.matchType - b.matchType;\n    if (m1 !== 0) {\n      return m1;\n    }\n\n    // Otherwise, compare based on the match score.\n    let d1 = a.score - b.score;\n    if (d1 !== 0) {\n      return d1;\n    }\n\n    // Find the match index based on the match type.\n    let i1 = 0;\n    let i2 = 0;\n    switch (a.matchType) {\n      case MatchType.Label:\n        i1 = a.labelIndices![0];\n        i2 = b.labelIndices![0];\n        break;\n      case MatchType.Category:\n      case MatchType.Split:\n        i1 = a.categoryIndices![0];\n        i2 = b.categoryIndices![0];\n        break;\n    }\n\n    // Compare based on the match index.\n    if (i1 !== i2) {\n      return i1 - i2;\n    }\n\n    // Otherwise, compare by category.\n    let d2 = a.item.category.localeCompare(b.item.category);\n    if (d2 !== 0) {\n      return d2;\n    }\n\n    // Otherwise, compare by rank.\n    let r1 = a.item.rank;\n    let r2 = b.item.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity safe\n    }\n\n    // Finally, compare by label.\n    return a.item.label.localeCompare(b.item.label);\n  }\n\n  /**\n   * Create the results from an array of sorted scores.\n   */\n  function createResults(scores: IScore[]): SearchResult[] {\n    // Set up the search results array.\n    let results: SearchResult[] = [];\n\n    // Iterate over each score in the array.\n    for (let i = 0, n = scores.length; i < n; ++i) {\n      // Extract the current item and indices.\n      let { item, categoryIndices, labelIndices } = scores[i];\n\n      // Extract the category for the current item.\n      let category = item.category;\n\n      // Is this the same category as the preceding result?\n      if (i === 0 || category !== scores[i - 1].item.category) {\n        // Add the header result for the category.\n        results.push({ type: 'header', category, indices: categoryIndices });\n      }\n\n      // Create the item result for the score.\n      results.push({ type: 'item', item, indices: labelIndices });\n    }\n\n    // Return the final results.\n    return results;\n  }\n\n  /**\n   * A concrete implementation of `CommandPalette.IItem`.\n   */\n  class CommandItem implements CommandPalette.IItem {\n    /**\n     * Construct a new command item.\n     */\n    constructor(\n      commands: CommandRegistry,\n      options: CommandPalette.IItemOptions\n    ) {\n      this._commands = commands;\n      this.category = normalizeCategory(options.category);\n      this.command = options.command;\n      this.args = options.args || JSONExt.emptyObject;\n      this.rank = options.rank !== undefined ? options.rank : Infinity;\n    }\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    get label(): string {\n      return this._commands.label(this.command, this.args);\n    }\n\n    /**\n     * The icon renderer for the command item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      return this._commands.icon(this.command, this.args);\n    }\n\n    /**\n     * The icon class for the command item.\n     */\n    get iconClass(): string {\n      return this._commands.iconClass(this.command, this.args);\n    }\n\n    /**\n     * The icon label for the command item.\n     */\n    get iconLabel(): string {\n      return this._commands.iconLabel(this.command, this.args);\n    }\n\n    /**\n     * The display caption for the command item.\n     */\n    get caption(): string {\n      return this._commands.caption(this.command, this.args);\n    }\n\n    /**\n     * The extra class name for the command item.\n     */\n    get className(): string {\n      return this._commands.className(this.command, this.args);\n    }\n\n    /**\n     * The dataset for the command item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      return this._commands.dataset(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is enabled.\n     */\n    get isEnabled(): boolean {\n      return this._commands.isEnabled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggled.\n     */\n    get isToggled(): boolean {\n      return this._commands.isToggled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    get isToggleable(): boolean {\n      return this._commands.isToggleable(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is visible.\n     */\n    get isVisible(): boolean {\n      return this._commands.isVisible(this.command, this.args);\n    }\n\n    /**\n     * The key binding for the command item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      let { command, args } = this;\n      return (\n        ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n          return kb.command === command && JSONExt.deepEqual(kb.args, args);\n        }) || null\n      );\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ARIAAttrNames,\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n  pageXOffset: number;\n  pageYOffset: number;\n  clientWidth: number;\n  clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n  /**\n   * Construct a new menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: Menu.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-Menu');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || Menu.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the menu.\n   */\n  dispose(): void {\n    this.close();\n    this._items.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted just before the menu is closed.\n   *\n   * #### Notes\n   * This signal is emitted when the menu receives a `'close-request'`\n   * message, just before it removes itself from the DOM.\n   *\n   * This signal is not emitted if the menu is already detached from\n   * the DOM when it receives the `'close-request'` message.\n   */\n  get aboutToClose(): ISignal<this, void> {\n    return this._aboutToClose;\n  }\n\n  /**\n   * A signal emitted when a new menu is requested by the user.\n   *\n   * #### Notes\n   * This signal is emitted whenever the user presses the right or left\n   * arrow keys, and a submenu cannot be opened or closed in response.\n   *\n   * This signal is useful when implementing menu bars in order to open\n   * the next or previous menu in response to a user key press.\n   *\n   * This signal is only emitted for the root menu in a hierarchy.\n   */\n  get menuRequested(): ISignal<this, 'next' | 'previous'> {\n    return this._menuRequested;\n  }\n\n  /**\n   * The command registry used by the menu.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the menu.\n   */\n  readonly renderer: Menu.IRenderer;\n\n  /**\n   * The parent menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu is an open submenu.\n   */\n  get parentMenu(): Menu | null {\n    return this._parentMenu;\n  }\n\n  /**\n   * The child menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu has an open submenu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The root menu of the menu hierarchy.\n   */\n  get rootMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._parentMenu) {\n      menu = menu._parentMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The leaf menu of the menu hierarchy.\n   */\n  get leafMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._childMenu) {\n      menu = menu._childMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The menu content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-Menu-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu item.\n   */\n  get activeItem(): Menu.IItem | null {\n    return this._items[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the item will be set to `null`.\n   */\n  set activeItem(value: Menu.IItem | null) {\n    this.activeIndex = value ? this._items.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu item.\n   *\n   * #### Notes\n   * This will be `-1` if no menu item is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._items.length) {\n      value = -1;\n    }\n\n    // Ensure the item can be activated.\n    if (value !== -1 && !Private.canActivate(this._items[value])) {\n      value = -1;\n    }\n\n    // Bail if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Make active element in focus\n    if (\n      this._activeIndex >= 0 &&\n      this.contentNode.childNodes[this._activeIndex]\n    ) {\n      (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n    }\n\n    // schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menu items in the menu.\n   */\n  get items(): ReadonlyArray<Menu.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Activate the next selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activateNextItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this.activeIndex = ArrayExt.findFirstIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Activate the previous selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activatePreviousItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this.activeIndex = ArrayExt.findLastIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Trigger the active menu item.\n   *\n   * #### Notes\n   * If the active item is a submenu, it will be opened and the first\n   * item will be activated.\n   *\n   * If the active item is a command, the command will be executed.\n   *\n   * If the menu is not attached, this is a no-op.\n   *\n   * If there is no active item, this is a no-op.\n   */\n  triggerActiveItem(): void {\n    // Bail if the menu is not attached.\n    if (!this.isAttached) {\n      return;\n    }\n\n    // Bail if there is no active item.\n    let item = this.activeItem;\n    if (!item) {\n      return;\n    }\n\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // If the item is a submenu, open it.\n    if (item.type === 'submenu') {\n      this._openChildMenu(true);\n      return;\n    }\n\n    // Close the root menu before executing the command.\n    this.rootMenu.close();\n\n    // Execute the command for the item.\n    let { command, args } = item;\n    if (this.commands.isEnabled(command, args)) {\n      this.commands.execute(command, args);\n    } else {\n      console.log(`Command '${command}' is disabled.`);\n    }\n  }\n\n  /**\n   * Add a menu item to the end of the menu.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   */\n  addItem(options: Menu.IItemOptions): Menu.IItem {\n    return this.insertItem(this._items.length, options);\n  }\n\n  /**\n   * Insert a menu item into the menu at the specified index.\n   *\n   * @param index - The index at which to insert the item.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the items.\n   */\n  insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Clamp the insert index to the array bounds.\n    let i = Math.max(0, Math.min(index, this._items.length));\n\n    // Create the item for the options.\n    let item = Private.createItem(this, options);\n\n    // Insert the item into the array.\n    ArrayExt.insert(this._items, i, item);\n\n    // Schedule an update of the items.\n    this.update();\n\n    // Return the item added to the menu.\n    return item;\n  }\n\n  /**\n   * Remove an item from the menu.\n   *\n   * @param item - The item to remove from the menu.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the menu.\n   */\n  removeItem(item: Menu.IItem): void {\n    let index = this._items.indexOf(item);\n    if (index === -1) {\n      return;\n    }\n    this.removeItemAt(index);\n  }\n\n  /**\n   * Remove the item at a given index from the menu.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Remove all menu items from the menu.\n   */\n  clearItems(): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the items.\n    this._items.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Open the menu at the specified location.\n   *\n   * @param x - The client X coordinate of the menu location.\n   *\n   * @param y - The client Y coordinate of the menu location.\n   *\n   * @param options - The additional options for opening the menu.\n   *\n   * #### Notes\n   * The menu will be opened at the given location unless it will not\n   * fully fit on the screen. If it will not fit, it will be adjusted\n   * to fit naturally on the screen.\n   *\n   * The menu will be attached under the `host` element in the DOM\n   * (or `document.body` if `host` is `null`) and before the `ref`\n   * element (or as the last child of `host` if `ref` is `null`).\n   * The menu may be displayed outside of the `host` element\n   * following the rules of CSS absolute positioning.\n   *\n   * This is a no-op if the menu is already attached to the DOM.\n   */\n  open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n    // Bail early if the menu is already attached.\n    if (this.isAttached) {\n      return;\n    }\n\n    // Extract the menu options.\n    let forceX = options.forceX || false;\n    let forceY = options.forceY || false;\n    const host = options.host ?? null;\n    const ref = options.ref ?? null;\n    const horizontalAlignment =\n      options.horizontalAlignment ??\n      (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n    // Open the menu as a root menu.\n    Private.openRootMenu(\n      this,\n      x,\n      y,\n      forceX,\n      forceY,\n      horizontalAlignment,\n      host,\n      ref\n    );\n\n    // Activate the menu to accept keyboard input.\n    this.activate();\n  }\n\n  /**\n   * Handle the DOM events for the menu.\n   *\n   * @param event - The DOM event sent to the menu.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu's DOM nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseenter':\n        this._evtMouseEnter(event as MouseEvent);\n        break;\n      case 'mouseleave':\n        this._evtMouseLeave(event as MouseEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mouseup', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseenter', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('contextmenu', this);\n    document.addEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mouseup', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseenter', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('contextmenu', this);\n    document.removeEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this.node.focus();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let items = this._items;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let collapsedFlags = Private.computeCollapsed(items);\n    let content = new Array<VirtualElement>(items.length);\n    for (let i = 0, n = items.length; i < n; ++i) {\n      let item = items[i];\n      let active = i === activeIndex;\n      let collapsed = collapsedFlags[i];\n      content[i] = renderer.renderItem({\n        item,\n        active,\n        collapsed,\n        onfocus: () => {\n          this.activeIndex = i;\n        }\n      });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   */\n  protected onCloseRequest(msg: Message): void {\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Close any open child menu.\n    let childMenu = this._childMenu;\n    if (childMenu) {\n      this._childIndex = -1;\n      this._childMenu = null;\n      childMenu._parentMenu = null;\n      childMenu.close();\n    }\n\n    // Remove this menu from its parent and activate the parent.\n    let parentMenu = this._parentMenu;\n    if (parentMenu) {\n      this._parentMenu = null;\n      parentMenu._childIndex = -1;\n      parentMenu._childMenu = null;\n      parentMenu.activate();\n    }\n\n    // Emit the `aboutToClose` signal if the menu is attached.\n    if (this.isAttached) {\n      this._aboutToClose.emit(undefined);\n    }\n\n    // Finish closing the menu.\n    super.onCloseRequest(msg);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // A menu handles all keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Enter\n    if (kc === 13) {\n      this.triggerActiveItem();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this.close();\n      return;\n    }\n\n    // Left Arrow\n    if (kc === 37) {\n      if (this._parentMenu) {\n        this.close();\n      } else {\n        this._menuRequested.emit('previous');\n      }\n      return;\n    }\n\n    // Up Arrow\n    if (kc === 38) {\n      this.activatePreviousItem();\n      return;\n    }\n\n    // Right Arrow\n    if (kc === 39) {\n      let item = this.activeItem;\n      if (item && item.type === 'submenu') {\n        this.triggerActiveItem();\n      } else {\n        this.rootMenu._menuRequested.emit('next');\n      }\n      return;\n    }\n\n    // Down Arrow\n    if (kc === 40) {\n      this.activateNextItem();\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._items, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that item is triggered.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.triggerActiveItem();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n    }\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    if (event.button !== 0) {\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n    this.triggerActiveItem();\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Hit test the item nodes for the item under the mouse.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the mouse is already over the active index.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Update and coerce the active index.\n    this.activeIndex = index;\n    index = this.activeIndex;\n\n    // If the index is the current child index, cancel the timers.\n    if (index === this._childIndex) {\n      this._cancelOpenTimer();\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // If a child menu is currently open, start the close timer.\n    if (this._childIndex !== -1) {\n      this._startCloseTimer();\n    }\n\n    // Cancel the open timer to give a full delay for opening.\n    this._cancelOpenTimer();\n\n    // Bail if the active item is not a valid submenu item.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      return;\n    }\n\n    // Start the open timer to open the active item submenu.\n    this._startOpenTimer();\n  }\n\n  /**\n   * Handle the `'mouseenter'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseEnter(event: MouseEvent): void {\n    // Synchronize the active ancestor items.\n    for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n      menu._cancelOpenTimer();\n      menu._cancelCloseTimer();\n      menu.activeIndex = menu._childIndex;\n    }\n  }\n\n  /**\n   * Handle the `'mouseleave'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseLeave(event: MouseEvent): void {\n    // Cancel any pending submenu opening.\n    this._cancelOpenTimer();\n\n    // If there is no open child menu, just reset the active index.\n    if (!this._childMenu) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // If the mouse is over the child menu, cancel the close timer.\n    let { clientX, clientY } = event;\n    if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // Otherwise, reset the active index and start the close timer.\n    this.activeIndex = -1;\n    this._startCloseTimer();\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the document node.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the menu is not a root menu.\n    if (this._parentMenu) {\n      return;\n    }\n\n    // The mouse button which is pressed is irrelevant. If the press\n    // is not on a menu, the entire hierarchy is closed and the event\n    // is allowed to propagate. This allows other code to act on the\n    // event, such as focusing the clicked element.\n    if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n      event.preventDefault();\n      event.stopPropagation();\n    } else {\n      this.close();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if the active item is not a valid submenu.\n   */\n  private _openChildMenu(activateFirst = false): void {\n    // If the item is not a valid submenu, close the child menu.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Do nothing if the child menu will not change.\n    let submenu = item.submenu;\n    if (submenu === this._childMenu) {\n      return;\n    }\n\n    // Prior to any DOM modifications save window data\n    Menu.saveWindowData();\n\n    // Ensure the current child menu is closed.\n    this._closeChildMenu();\n\n    // Update the private child state.\n    this._childMenu = submenu;\n    this._childIndex = this._activeIndex;\n\n    // Set the parent menu reference for the child.\n    submenu._parentMenu = this;\n\n    // Ensure the menu is updated and lookup the item node.\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    let itemNode = this.contentNode.children[this._activeIndex];\n\n    // Open the submenu at the active node.\n    Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n    // Activate the first item if desired.\n    if (activateFirst) {\n      submenu.activeIndex = -1;\n      submenu.activateNextItem();\n    }\n\n    // Activate the child menu.\n    submenu.activate();\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    if (this._childMenu) {\n      this._childMenu.close();\n    }\n  }\n\n  /**\n   * Start the open timer, unless it is already pending.\n   */\n  private _startOpenTimer(): void {\n    if (this._openTimerID === 0) {\n      this._openTimerID = window.setTimeout(() => {\n        this._openTimerID = 0;\n        this._openChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Start the close timer, unless it is already pending.\n   */\n  private _startCloseTimer(): void {\n    if (this._closeTimerID === 0) {\n      this._closeTimerID = window.setTimeout(() => {\n        this._closeTimerID = 0;\n        this._closeChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Cancel the open timer, if the timer is pending.\n   */\n  private _cancelOpenTimer(): void {\n    if (this._openTimerID !== 0) {\n      clearTimeout(this._openTimerID);\n      this._openTimerID = 0;\n    }\n  }\n\n  /**\n   * Cancel the close timer, if the timer is pending.\n   */\n  private _cancelCloseTimer(): void {\n    if (this._closeTimerID !== 0) {\n      clearTimeout(this._closeTimerID);\n      this._closeTimerID = 0;\n    }\n  }\n\n  /**\n   * Save window data used for menu positioning in transient cache.\n   *\n   * In order to avoid layout trashing it is recommended to invoke this\n   * method immediately prior to opening the menu and any DOM modifications\n   * (like closing previously visible menu, or adding a class to menu widget).\n   *\n   * The transient cache will be released upon `open()` call.\n   */\n  static saveWindowData(): void {\n    Private.saveWindowData();\n  }\n\n  private _childIndex = -1;\n  private _activeIndex = -1;\n  private _openTimerID = 0;\n  private _closeTimerID = 0;\n  private _items: Menu.IItem[] = [];\n  private _childMenu: Menu | null = null;\n  private _parentMenu: Menu | null = null;\n  private _aboutToClose = new Signal<this, void>(this);\n  private _menuRequested = new Signal<this, 'next' | 'previous'>(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n  /**\n   * An options object for creating a menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the menu.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for the `open` method on a menu.\n   */\n  export interface IOpenOptions {\n    /**\n     * Whether to force the X position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * X coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceX?: boolean;\n\n    /**\n     * Whether to force the Y position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * Y coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceY?: boolean;\n\n    /**\n     * The DOM node to use as the menu's host.\n     *\n     * If not specified then uses `document.body`.\n     */\n    host?: HTMLElement;\n\n    /**\n     * The child of `host` to use as the reference element.\n     * If this is provided, the menu will be inserted before this\n     * node in the host. The default is `null`, which will cause the\n     * menu to be added as the last child of the host.\n     */\n    ref?: HTMLElement;\n\n    /**\n     * The alignment of the menu.\n     *\n     * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n     */\n    horizontalAlignment?: 'left' | 'right';\n  }\n\n  /**\n   * A type alias for a menu item type.\n   */\n  export type ItemType = 'command' | 'submenu' | 'separator';\n\n  /**\n   * An options object for creating a menu item.\n   */\n  export interface IItemOptions {\n    /**\n     * The type of the menu item.\n     *\n     * The default value is `'command'`.\n     */\n    type?: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     *\n     * The default value is an empty string.\n     */\n    command?: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     *\n     * The default value is `null`.\n     */\n    submenu?: Menu | null;\n  }\n\n  /**\n   * An object which represents a menu item.\n   *\n   * #### Notes\n   * Item objects are created automatically by a menu.\n   */\n  export interface IItem {\n    /**\n     * The type of the menu item.\n     */\n    readonly type: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    readonly label: string;\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    readonly mnemonic: number;\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the menu item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the menu item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The display caption for the menu item.\n     */\n    readonly caption: string;\n\n    /**\n     * The extra class name for the menu item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the menu item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the menu item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the menu item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * An object which holds the data to render a menu item.\n   */\n  export interface IRenderData {\n    /**\n     * The item to be rendered.\n     */\n    readonly item: IItem;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the item should be collapsed.\n     */\n    readonly collapsed: boolean;\n\n    /**\n     * Handler for when element is in focus.\n     */\n    readonly onfocus?: () => void;\n  }\n\n  /**\n   * A renderer for use with a menu.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          tabindex: '0',\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data),\n        this.renderShortcut(data),\n        this.renderSubmenu(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-Menu-itemLabel' }, content);\n    }\n\n    /**\n     * Render the shortcut element for a menu item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the item shortcut.\n     */\n    renderShortcut(data: IRenderData): VirtualElement {\n      let content = this.formatShortcut(data);\n      return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n    }\n\n    /**\n     * Render the submenu icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the submenu icon.\n     *\n     * @returns A virtual element representing the submenu icon.\n     */\n    renderSubmenu(data: IRenderData): VirtualElement {\n      return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n    }\n\n    /**\n     * Create the class name for the menu item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      // Setup the initial class name.\n      let name = 'lm-Menu-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (!data.item.isVisible) {\n        name += ' lm-mod-hidden';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n      if (data.collapsed) {\n        name += ' lm-mod-collapsed';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the menu item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the menu item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      let result: ElementDataset;\n      let { type, command, dataset } = data.item;\n      if (type === 'command') {\n        result = { ...dataset, type, command };\n      } else {\n        result = { ...dataset, type };\n      }\n      return result;\n    }\n\n    /**\n     * Create the class name for the menu item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-Menu-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the aria attributes for menu item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      let aria: { [T in ARIAAttrNames]?: string } = {};\n      switch (data.item.type) {\n        case 'separator':\n          aria.role = 'presentation';\n          break;\n        case 'submenu':\n          aria['aria-haspopup'] = 'true';\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          break;\n        default:\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          if (data.item.isToggled) {\n            aria.role = 'menuitemcheckbox';\n            aria['aria-checked'] = 'true';\n          } else {\n            aria.role = 'menuitem';\n          }\n      }\n      return aria;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.item;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n\n    /**\n     * Create the render content for the shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatShortcut(data: IRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The ms delay for opening and closing a submenu.\n   */\n  export const TIMER_DELAY = 300;\n\n  /**\n   * The horizontal pixel overlap for an open submenu.\n   */\n  export const SUBMENU_OVERLAP = 3;\n\n  let transientWindowDataCache: IWindowData | null = null;\n  let transientCacheCounter: number = 0;\n\n  function getWindowData(): IWindowData {\n    // if transient cache is in use, take one from it\n    if (transientCacheCounter > 0) {\n      transientCacheCounter--;\n      return transientWindowDataCache!;\n    }\n    return _getWindowData();\n  }\n\n  /**\n   * Store window data in transient cache.\n   *\n   * The transient cache will be released upon `getWindowData()` call.\n   * If this function is called multiple times, the cache will be\n   * retained until as many calls to `getWindowData()` were made.\n   *\n   * Note: should be called before any DOM modifications.\n   */\n  export function saveWindowData(): void {\n    transientWindowDataCache = _getWindowData();\n    transientCacheCounter++;\n  }\n\n  /**\n   * Create the DOM node for a menu.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-Menu-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menu');\n    node.tabIndex = 0;\n    return node;\n  }\n\n  /**\n   * Test whether a menu item can be activated.\n   */\n  export function canActivate(item: Menu.IItem): boolean {\n    return item.type !== 'separator' && item.isEnabled && item.isVisible;\n  }\n\n  /**\n   * Create a new menu item for an owner menu.\n   */\n  export function createItem(\n    owner: Menu,\n    options: Menu.IItemOptions\n  ): Menu.IItem {\n    return new MenuItem(owner.commands, options);\n  }\n\n  /**\n   * Hit test a menu hierarchy starting at the given root.\n   */\n  export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n    for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n      if (ElementExt.hitTest(temp.node, x, y)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Compute which extra separator items should be collapsed.\n   */\n  export function computeCollapsed(\n    items: ReadonlyArray<Menu.IItem>\n  ): boolean[] {\n    // Allocate the return array and fill it with `false`.\n    let result = new Array<boolean>(items.length);\n    ArrayExt.fill(result, false);\n\n    // Collapse the leading separators.\n    let k1 = 0;\n    let n = items.length;\n    for (; k1 < n; ++k1) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k1] = true;\n    }\n\n    // Hide the trailing separators.\n    let k2 = n - 1;\n    for (; k2 >= 0; --k2) {\n      let item = items[k2];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k2] = true;\n    }\n\n    // Hide the remaining consecutive separators.\n    let hide = false;\n    while (++k1 < k2) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        hide = false;\n      } else if (hide) {\n        result[k1] = true;\n      } else {\n        hide = true;\n      }\n    }\n\n    // Return the resulting flags.\n    return result;\n  }\n\n  function _getWindowData(): IWindowData {\n    return {\n      pageXOffset: window.pageXOffset,\n      pageYOffset: window.pageYOffset,\n      clientWidth: document.documentElement.clientWidth,\n      clientHeight: document.documentElement.clientHeight\n    };\n  }\n\n  /**\n   * Open a menu as a root menu at the target location.\n   */\n  export function openRootMenu(\n    menu: Menu,\n    x: number,\n    y: number,\n    forceX: boolean,\n    forceY: boolean,\n    horizontalAlignment: 'left' | 'right',\n    host: HTMLElement | null,\n    ref: HTMLElement | null\n  ): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData();\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before attaching and measuring.\n    MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch - (forceY ? y : 0);\n\n    // Fetch common variables.\n    let node = menu.node;\n    let style = node.style;\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(menu, host || document.body, ref);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // align the menu to the right of the target if requested or language is RTL\n    if (horizontalAlignment === 'right') {\n      x -= width;\n    }\n\n    // Adjust the X position of the menu to fit on-screen.\n    if (!forceX && x + width > px + cw) {\n      x = px + cw - width;\n    }\n\n    // Adjust the Y position of the menu to fit on-screen.\n    if (!forceY && y + height > py + ch) {\n      if (y > py + ch) {\n        y = py + ch - height;\n      } else {\n        y = y - height;\n      }\n    }\n\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * Open a menu as a submenu using an item node for positioning.\n   */\n  export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData();\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before opening.\n    MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch;\n\n    // Fetch common variables.\n    let node = submenu.node;\n    let style = node.style;\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(submenu, document.body);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // Compute the box sizing for the menu.\n    let box = ElementExt.boxSizing(submenu.node);\n\n    // Get the bounding rect for the target item node.\n    let itemRect = itemNode.getBoundingClientRect();\n\n    // Compute the target X position.\n    let x = itemRect.right - SUBMENU_OVERLAP;\n\n    // Adjust the X position to fit on the screen.\n    if (x + width > px + cw) {\n      x = itemRect.left + SUBMENU_OVERLAP - width;\n    }\n\n    // Compute the target Y position.\n    let y = itemRect.top - box.borderTop - box.paddingTop;\n\n    // Adjust the Y position to fit on the screen.\n    if (y + height > py + ch) {\n      y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n    }\n\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    items: ReadonlyArray<Menu.IItem>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Lookup the item\n      let item = items[k];\n\n      // Ignore items which cannot be activated.\n      if (!canActivate(item)) {\n        continue;\n      }\n\n      // Ignore items with an empty label.\n      let label = item.label;\n      if (label.length === 0) {\n        continue;\n      }\n\n      // Lookup the mnemonic index for the label.\n      let mn = item.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < label.length) {\n        if (label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n\n  /**\n   * A concrete implementation of `Menu.IItem`.\n   */\n  class MenuItem implements Menu.IItem {\n    /**\n     * Construct a new menu item.\n     */\n    constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n      this._commands = commands;\n      this.type = options.type || 'command';\n      this.command = options.command || '';\n      this.args = options.args || JSONExt.emptyObject;\n      this.submenu = options.submenu || null;\n    }\n\n    /**\n     * The type of the menu item.\n     */\n    readonly type: Menu.ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    get label(): string {\n      if (this.type === 'command') {\n        return this._commands.label(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.label;\n      }\n      return '';\n    }\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    get mnemonic(): number {\n      if (this.type === 'command') {\n        return this._commands.mnemonic(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.mnemonic;\n      }\n      return -1;\n    }\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      if (this.type === 'command') {\n        return this._commands.icon(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.icon;\n      }\n      return undefined;\n    }\n\n    /**\n     * The icon class for the menu item.\n     */\n    get iconClass(): string {\n      if (this.type === 'command') {\n        return this._commands.iconClass(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconClass;\n      }\n      return '';\n    }\n\n    /**\n     * The icon label for the menu item.\n     */\n    get iconLabel(): string {\n      if (this.type === 'command') {\n        return this._commands.iconLabel(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconLabel;\n      }\n      return '';\n    }\n\n    /**\n     * The display caption for the menu item.\n     */\n    get caption(): string {\n      if (this.type === 'command') {\n        return this._commands.caption(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.caption;\n      }\n      return '';\n    }\n\n    /**\n     * The extra class name for the menu item.\n     */\n    get className(): string {\n      if (this.type === 'command') {\n        return this._commands.className(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.className;\n      }\n      return '';\n    }\n\n    /**\n     * The dataset for the menu item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      if (this.type === 'command') {\n        return this._commands.dataset(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.dataset;\n      }\n      return {};\n    }\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    get isEnabled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isEnabled(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    get isToggled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isToggled(this.command, this.args);\n      }\n      return false;\n    }\n\n    /**\n     * Whether the menu item is visible.\n     */\n    get isVisible(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isVisible(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * The key binding for the menu item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      if (this.type === 'command') {\n        let { command, args } = this;\n        return (\n          ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n            return kb.command === command && JSONExt.deepEqual(kb.args, args);\n          }) || null\n        );\n      }\n      return null;\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n  /**\n   * Construct a new context menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: ContextMenu.IOptions) {\n    const { groupByTarget, sortBySelector, ...others } = options;\n    this.menu = new Menu(others);\n    this._groupByTarget = groupByTarget !== false;\n    this._sortBySelector = sortBySelector !== false;\n  }\n\n  /**\n   * The menu widget which displays the matched context items.\n   */\n  readonly menu: Menu;\n\n  /**\n   * Add an item to the context menu.\n   *\n   * @param options - The options for creating the item.\n   *\n   * @returns A disposable which will remove the item from the menu.\n   */\n  addItem(options: ContextMenu.IItemOptions): IDisposable {\n    // Create an item from the given options.\n    let item = Private.createItem(options, this._idTick++);\n\n    // Add the item to the internal array.\n    this._items.push(item);\n\n    // Return a disposable which will remove the item.\n    return new DisposableDelegate(() => {\n      ArrayExt.removeFirstOf(this._items, item);\n    });\n  }\n\n  /**\n   * Open the context menu in response to a `'contextmenu'` event.\n   *\n   * @param event - The `'contextmenu'` event of interest.\n   *\n   * @returns `true` if the menu was opened, or `false` if no items\n   *   matched the event and the menu was not opened.\n   *\n   * #### Notes\n   * This method will populate the context menu with items which match\n   * the propagation path of the event, then open the menu at the mouse\n   * position indicated by the event.\n   */\n  open(event: MouseEvent): boolean {\n    // Prior to any DOM modifications update the window data.\n    Menu.saveWindowData();\n\n    // Clear the current contents of the context menu.\n    this.menu.clearItems();\n\n    // Bail early if there are no items to match.\n    if (this._items.length === 0) {\n      return false;\n    }\n\n    // Find the matching items for the event.\n    let items = Private.matchItems(\n      this._items,\n      event,\n      this._groupByTarget,\n      this._sortBySelector\n    );\n\n    // Bail if there are no matching items.\n    if (!items || items.length === 0) {\n      return false;\n    }\n\n    // Add the filtered items to the menu.\n    for (const item of items) {\n      this.menu.addItem(item);\n    }\n\n    // Open the context menu at the current mouse position.\n    this.menu.open(event.clientX, event.clientY);\n\n    // Indicate success.\n    return true;\n  }\n\n  private _groupByTarget: boolean = true;\n  private _idTick = 0;\n  private _items: Private.IItem[] = [];\n  private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n  /**\n   * An options object for initializing a context menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry to use with the context menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the context menu.\n     */\n    renderer?: Menu.IRenderer;\n\n    /**\n     * Whether to sort by selector and rank or only rank.\n     *\n     * Default true.\n     */\n    sortBySelector?: boolean;\n\n    /**\n     * Whether to group items following the DOM hierarchy.\n     *\n     * Default true.\n     *\n     * #### Note\n     * If true, when the mouse event occurs on element `span` within `div.top`,\n     * the items matching `div.top` will be shown before the ones matching `body`.\n     */\n    groupByTarget?: boolean;\n  }\n\n  /**\n   * An options object for creating a context menu item.\n   */\n  export interface IItemOptions extends Menu.IItemOptions {\n    /**\n     * The CSS selector for the context menu item.\n     *\n     * The context menu item will only be displayed in the context menu\n     * when the selector matches a node on the propagation path of the\n     * contextmenu event. This allows the menu item to be restricted to\n     * user-defined contexts.\n     *\n     * The selector must not contain commas.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     *\n     * The rank is used as a tie-breaker when ordering context menu\n     * items for display. Items are sorted in the following order:\n     *   1. Depth in the DOM tree (deeper is better)\n     *   2. Selector specificity (higher is better)\n     *   3. Rank (lower is better)\n     *   4. Insertion order\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A normalized item for a context menu.\n   */\n  export interface IItem extends Menu.IItemOptions {\n    /**\n     * The selector for the item.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     */\n    rank: number;\n\n    /**\n     * The tie-breaking id for the item.\n     */\n    id: number;\n  }\n\n  /**\n   * Create a normalized context menu item from an options object.\n   */\n  export function createItem(\n    options: ContextMenu.IItemOptions,\n    id: number\n  ): IItem {\n    let selector = validateSelector(options.selector);\n    let rank = options.rank !== undefined ? options.rank : Infinity;\n    return { ...options, selector, rank, id };\n  }\n\n  /**\n   * Find the items which match a context menu event.\n   *\n   * The results are sorted by DOM level, specificity, and rank.\n   */\n  export function matchItems(\n    items: IItem[],\n    event: MouseEvent,\n    groupByTarget: boolean,\n    sortBySelector: boolean\n  ): IItem[] | null {\n    // Look up the target of the event.\n    let target = event.target as Element | null;\n\n    // Bail if there is no target.\n    if (!target) {\n      return null;\n    }\n\n    // Look up the current target of the event.\n    let currentTarget = event.currentTarget as Element | null;\n\n    // Bail if there is no current target.\n    if (!currentTarget) {\n      return null;\n    }\n\n    // There are some third party libraries that cause the `target` to\n    // be detached from the DOM before lumino can process the event.\n    // If that happens, search for a new target node by point. If that\n    // node is still dangling, bail.\n    if (!currentTarget.contains(target)) {\n      target = document.elementFromPoint(event.clientX, event.clientY);\n      if (!target || !currentTarget.contains(target)) {\n        return null;\n      }\n    }\n\n    // Set up the result array.\n    let result: IItem[] = [];\n\n    // Copy the items array to allow in-place modification.\n    let availableItems: Array<IItem | null> = items.slice();\n\n    // Walk up the DOM hierarchy searching for matches.\n    while (target !== null) {\n      // Set up the match array for this DOM level.\n      let matches: IItem[] = [];\n\n      // Search the remaining items for matches.\n      for (let i = 0, n = availableItems.length; i < n; ++i) {\n        // Fetch the item.\n        let item = availableItems[i];\n\n        // Skip items which are already consumed.\n        if (!item) {\n          continue;\n        }\n\n        // Skip items which do not match the element.\n        if (!Selector.matches(target, item.selector)) {\n          continue;\n        }\n\n        // Add the matched item to the result for this DOM level.\n        matches.push(item);\n\n        // Mark the item as consumed.\n        availableItems[i] = null;\n      }\n\n      // Sort the matches for this level and add them to the results.\n      if (matches.length !== 0) {\n        if (groupByTarget) {\n          matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n        }\n        result.push(...matches);\n      }\n\n      // Stop searching at the limits of the DOM range.\n      if (target === currentTarget) {\n        break;\n      }\n\n      // Step to the parent DOM level.\n      target = target.parentElement;\n    }\n\n    if (!groupByTarget) {\n      result.sort(sortBySelector ? itemCmp : itemCmpRank);\n    }\n\n    // Return the matched and sorted results.\n    return result;\n  }\n\n  /**\n   * Validate the selector for a menu item.\n   *\n   * This returns the validated selector, or throws if the selector is\n   * invalid or contains commas.\n   */\n  function validateSelector(selector: string): string {\n    if (selector.indexOf(',') !== -1) {\n      throw new Error(`Selector cannot contain commas: ${selector}`);\n    }\n    if (!Selector.isValid(selector)) {\n      throw new Error(`Invalid selector: ${selector}`);\n    }\n    return selector;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by ranks.\n   */\n  function itemCmpRank(a: IItem, b: IItem): number {\n    // Sort based on rank.\n    let r1 = a.rank;\n    let r2 = b.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity-safe\n    }\n\n    // When all else fails, sort by item id.\n    return a.id - b.id;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by selectors and ranks.\n   */\n  function itemCmp(a: IItem, b: IItem): number {\n    // Sort first based on selector specificity.\n    let s1 = Selector.calculateSpecificity(a.selector);\n    let s2 = Selector.calculateSpecificity(b.selector);\n    if (s1 !== s2) {\n      return s2 - s1;\n    }\n\n    // If specificities are equal\n    return itemCmpRank(a, b);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ElementARIAAttrs,\n  ElementBaseAttrs,\n  ElementDataset,\n  ElementInlineStyle,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n  'ArrowLeft',\n  'ArrowUp',\n  'ArrowRight',\n  'ArrowDown',\n  'Home',\n  'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar<T> extends Widget {\n  /**\n   * Construct a new tab bar.\n   *\n   * @param options - The options for initializing the tab bar.\n   */\n  constructor(options: TabBar.IOptions<T> = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-TabBar');\n    this.contentNode.setAttribute('role', 'tablist');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this._document = options.document || document;\n    this.tabsMovable = options.tabsMovable || false;\n    this.titlesEditable = options.titlesEditable || false;\n    this.allowDeselect = options.allowDeselect || false;\n    this.addButtonEnabled = options.addButtonEnabled || false;\n    this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n    this.name = options.name || '';\n    this.orientation = options.orientation || 'horizontal';\n    this.removeBehavior = options.removeBehavior || 'select-tab-after';\n    this.renderer = options.renderer || TabBar.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    this._titles.length = 0;\n    this._previousTitle = null;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabBar.ICurrentChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when a tab is moved by the user.\n   *\n   * #### Notes\n   * This signal is emitted when a tab is moved by user interaction.\n   *\n   * This signal is not emitted when a tab is moved programmatically.\n   */\n  get tabMoved(): ISignal<this, TabBar.ITabMovedArgs<T>> {\n    return this._tabMoved;\n  }\n\n  /**\n   * A signal emitted when a tab is clicked by the user.\n   *\n   * #### Notes\n   * If the clicked tab is not the current tab, the clicked tab will be\n   * made current and the `currentChanged` signal will be emitted first.\n   *\n   * This signal is emitted even if the clicked tab is the current tab.\n   */\n  get tabActivateRequested(): ISignal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  > {\n    return this._tabActivateRequested;\n  }\n\n  /**\n   * A signal emitted when the tab bar add button is clicked.\n   */\n  get addRequested(): ISignal<this, void> {\n    return this._addRequested;\n  }\n\n  /**\n   * A signal emitted when a tab close icon is clicked.\n   *\n   * #### Notes\n   * This signal is not emitted unless the tab title is `closable`.\n   */\n  get tabCloseRequested(): ISignal<this, TabBar.ITabCloseRequestedArgs<T>> {\n    return this._tabCloseRequested;\n  }\n\n  /**\n   * A signal emitted when a tab is dragged beyond the detach threshold.\n   *\n   * #### Notes\n   * This signal is emitted when the user drags a tab with the mouse,\n   * and mouse is dragged beyond the detach threshold.\n   *\n   * The consumer of the signal should call `releaseMouse` and remove\n   * the tab in order to complete the detach.\n   *\n   * This signal is only emitted once per drag cycle.\n   */\n  get tabDetachRequested(): ISignal<this, TabBar.ITabDetachRequestedArgs<T>> {\n    return this._tabDetachRequested;\n  }\n\n  /**\n   * The renderer used by the tab bar.\n   */\n  readonly renderer: TabBar.IRenderer<T>;\n\n  /**\n   * The document to use with the tab bar.\n   *\n   * The default is the global `document` instance.\n   */\n  get document(): Document | ShadowRoot {\n    return this._document;\n  }\n\n  /**\n   * Whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  tabsMovable: boolean;\n\n  /**\n   * Whether the titles can be user-edited.\n   *\n   */\n  get titlesEditable(): boolean {\n    return this._titlesEditable;\n  }\n\n  /**\n   * Set whether titles can be user edited.\n   *\n   */\n  set titlesEditable(value: boolean) {\n    this._titlesEditable = value;\n  }\n\n  /**\n   * Whether a tab can be deselected by the user.\n   *\n   * #### Notes\n   * Tabs can be always be deselected programmatically.\n   */\n  allowDeselect: boolean;\n\n  /**\n   * The selection behavior when inserting a tab.\n   */\n  insertBehavior: TabBar.InsertBehavior;\n\n  /**\n   * The selection behavior when removing a tab.\n   */\n  removeBehavior: TabBar.RemoveBehavior;\n\n  /**\n   * Get the currently selected title.\n   *\n   * #### Notes\n   * This will be `null` if no tab is selected.\n   */\n  get currentTitle(): Title<T> | null {\n    return this._titles[this._currentIndex] || null;\n  }\n\n  /**\n   * Set the currently selected title.\n   *\n   * #### Notes\n   * If the title does not exist, the title will be set to `null`.\n   */\n  set currentTitle(value: Title<T> | null) {\n    this.currentIndex = value ? this._titles.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this._currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the value is out of range, the index will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    // Adjust for an out of range index.\n    if (value < 0 || value >= this._titles.length) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._currentIndex === value) {\n      return;\n    }\n\n    // Look up the previous index and title.\n    let pi = this._currentIndex;\n    let pt = this._titles[pi] || null;\n\n    // Look up the current index and title.\n    let ci = value;\n    let ct = this._titles[ci] || null;\n\n    // Update the current index and previous title.\n    this._currentIndex = ci;\n    this._previousTitle = pt;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: ci,\n      currentTitle: ct\n    });\n  }\n\n  /**\n   * Get the name of the tab bar.\n   */\n  get name(): string {\n    return this._name;\n  }\n\n  /**\n   * Set the name of the tab bar.\n   */\n  set name(value: string) {\n    this._name = value;\n    if (value) {\n      this.contentNode.setAttribute('aria-label', value);\n    } else {\n      this.contentNode.removeAttribute('aria-label');\n    }\n  }\n\n  /**\n   * Get the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  get orientation(): TabBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  set orientation(value: TabBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Toggle the orientation values.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n    this.contentNode.setAttribute('aria-orientation', value);\n  }\n\n  /**\n   * Whether the add button is enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add button is enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    // Do nothing if the value does not change.\n    if (this._addButtonEnabled === value) {\n      return;\n    }\n\n    this._addButtonEnabled = value;\n    if (value) {\n      this.addButtonNode.classList.remove('lm-mod-hidden');\n    } else {\n      this.addButtonNode.classList.add('lm-mod-hidden');\n    }\n  }\n\n  /**\n   * A read-only array of the titles in the tab bar.\n   */\n  get titles(): ReadonlyArray<Title<T>> {\n    return this._titles;\n  }\n\n  /**\n   * The tab bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the tab nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * The tab bar add button node.\n   *\n   * #### Notes\n   * This is the node which holds the add button.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get addButtonNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-addButton'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Add a tab to the end of the tab bar.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  addTab(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return this.insertTab(this._titles.length, value);\n  }\n\n  /**\n   * Insert a tab into the tab bar at the specified index.\n   *\n   * @param index - The index at which to insert the tab.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the tabs.\n   *\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  insertTab(index: number, value: Title<T> | Title.IOptions<T>): Title<T> {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Coerce the value to a title.\n    let title = Private.asTitle(value);\n\n    // Look up the index of the title.\n    let i = this._titles.indexOf(title);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._titles.length));\n\n    // If the title is not in the array, insert it.\n    if (i === -1) {\n      // Insert the title into the array.\n      ArrayExt.insert(this._titles, j, title);\n\n      // Connect to the title changed signal.\n      title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the tabs.\n      this.update();\n\n      // Adjust the current index for the insert.\n      this._adjustCurrentForInsert(j, title);\n\n      // Return the title added to the tab bar.\n      return title;\n    }\n\n    // Otherwise, the title exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._titles.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return title;\n    }\n\n    // Move the title to the new location.\n    ArrayExt.move(this._titles, i, j);\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the move.\n    this._adjustCurrentForMove(i, j);\n\n    // Return the title added to the tab bar.\n    return title;\n  }\n\n  /**\n   * Remove a tab from the tab bar.\n   *\n   * @param title - The title for the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the title is not in the tab bar.\n   */\n  removeTab(title: Title<T>): void {\n    this.removeTabAt(this._titles.indexOf(title));\n  }\n\n  /**\n   * Remove the tab at a given index from the tab bar.\n   *\n   * @param index - The index of the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeTabAt(index: number): void {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Remove the title from the array.\n    let title = ArrayExt.removeAt(this._titles, index);\n\n    // Bail if the index is out of range.\n    if (!title) {\n      return;\n    }\n\n    // Disconnect from the title changed signal.\n    title.changed.disconnect(this._onTitleChanged, this);\n\n    // Clear the previous title if it's being removed.\n    if (title === this._previousTitle) {\n      this._previousTitle = null;\n    }\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the remove.\n    this._adjustCurrentForRemove(index, title);\n  }\n\n  /**\n   * Remove all tabs from the tab bar.\n   */\n  clearTabs(): void {\n    // Bail if there is nothing to remove.\n    if (this._titles.length === 0) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Disconnect from the title changed signals.\n    for (let title of this._titles) {\n      title.changed.disconnect(this._onTitleChanged, this);\n    }\n\n    // Get the current index and title.\n    let pi = this.currentIndex;\n    let pt = this.currentTitle;\n\n    // Reset the current index and previous title.\n    this._currentIndex = -1;\n    this._previousTitle = null;\n\n    // Clear the title array.\n    this._titles.length = 0;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // If no tab was selected, there's nothing else to do.\n    if (pi === -1) {\n      return;\n    }\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   *\n   * #### Notes\n   * This will cause the tab bar to stop handling mouse events and to\n   * restore the tabs to their non-dragged positions.\n   */\n  releaseMouse(): void {\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the DOM events for the tab bar.\n   *\n   * @param event - The DOM event sent to the tab bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tab bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'dblclick':\n        this._evtDblClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        event.eventPhase === Event.CAPTURING_PHASE\n          ? this._evtKeyDownCapturing(event as KeyboardEvent)\n          : this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n    this.node.addEventListener('dblclick', this);\n    this.node.addEventListener('keydown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this.node.removeEventListener('dblclick', this);\n    this.node.removeEventListener('keydown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let titles = this._titles;\n    let renderer = this.renderer;\n    let currentTitle = this.currentTitle;\n    let content = new Array<VirtualElement>(titles.length);\n    // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n    // If the add button handles it, no need to do anything. If no element of the tab\n    // bar handles it, set it on the current or the first tab to ensure one element\n    // handles it after update.\n    const tabHandlingTabindex =\n      this._getCurrentTabindex() ??\n      (this._currentIndex > -1 ? this._currentIndex : 0);\n\n    for (let i = 0, n = titles.length; i < n; ++i) {\n      let title = titles[i];\n      let current = title === currentTitle;\n      let zIndex = current ? n : n - i - 1;\n      let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n      content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * Get the index of the tab which handles tabindex=\"0\".\n   * If the add button handles tabindex=\"0\", -1 is returned.\n   * If none of the previous handles tabindex=\"0\", null is returned.\n   */\n  private _getCurrentTabindex(): number | null {\n    let index = null;\n    const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n    if (elemTabindex) {\n      index = [...this.contentNode.children].indexOf(elemTabindex);\n    } else if (\n      this._addButtonEnabled &&\n      this.addButtonNode.getAttribute('tabindex') === '0'\n    ) {\n      index = -1;\n    }\n    return index;\n  }\n\n  /**\n   * Handle the `'dblclick'` event for the tab bar.\n   */\n  private _evtDblClick(event: MouseEvent): void {\n    // Do nothing if titles are not editable\n    if (!this.titlesEditable) {\n      return;\n    }\n\n    let tabs = this.contentNode.children;\n\n    // Find the index of the targeted tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab.\n    if (index === -1) {\n      return;\n    }\n\n    let title = this.titles[index];\n    let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n    if (label && label.contains(event.target as HTMLElement)) {\n      let value = title.label || '';\n\n      // Clear the label element\n      let oldValue = label.innerHTML;\n      label.innerHTML = '';\n\n      let input = document.createElement('input');\n      input.classList.add('lm-TabBar-tabInput');\n      input.value = value;\n      label.appendChild(input);\n\n      let onblur = () => {\n        input.removeEventListener('blur', onblur);\n        label.innerHTML = oldValue;\n        this.node.addEventListener('keydown', this);\n      };\n\n      input.addEventListener('dblclick', (event: Event) =>\n        event.stopPropagation()\n      );\n      input.addEventListener('blur', onblur);\n      input.addEventListener('keydown', (event: KeyboardEvent) => {\n        if (event.key === 'Enter') {\n          if (input.value !== '') {\n            title.label = title.caption = input.value;\n          }\n          onblur();\n        } else if (event.key === 'Escape') {\n          onblur();\n        }\n      });\n      this.node.removeEventListener('keydown', this);\n      input.select();\n      input.focus();\n\n      if (label.children.length > 0) {\n        (label.children[0] as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at capturing phase.\n   */\n  private _evtKeyDownCapturing(event: KeyboardEvent): void {\n    if (event.eventPhase !== Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.key === 'Escape') {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at target phase.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Allow for navigation using tab key\n    if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Check if Enter or Spacebar key has been pressed and open that tab\n    if (\n      event.key === 'Enter' ||\n      event.key === 'Spacebar' ||\n      event.key === ' '\n    ) {\n      // Get focus element that is in focus by the tab key\n      const focusedElement = document.activeElement;\n\n      // Test first if the focus is on the add button node\n      if (\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(focusedElement)\n      ) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._addRequested.emit();\n      } else {\n        const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n          tab.contains(focusedElement)\n        );\n        if (index >= 0) {\n          event.preventDefault();\n          event.stopPropagation();\n          this.currentIndex = index;\n        }\n      }\n      // Handle the arrow keys to switch tabs.\n    } else if (ARROW_KEYS.includes(event.key)) {\n      // Create a list of all focusable elements in the tab bar.\n      const focusable: Element[] = [...this.contentNode.children];\n      if (this.addButtonEnabled) {\n        focusable.push(this.addButtonNode);\n      }\n      // If the tab bar contains only one element, nothing to do.\n      if (focusable.length <= 1) {\n        return;\n      }\n      event.preventDefault();\n      event.stopPropagation();\n\n      // Get the current focused element.\n      let focusedIndex = focusable.indexOf(document.activeElement as Element);\n      if (focusedIndex === -1) {\n        focusedIndex = this._currentIndex;\n      }\n\n      // Find the next element to focus on.\n      let nextFocused: Element | null | undefined;\n      if (\n        (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowDown' && this._orientation === 'vertical')\n      ) {\n        nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n      } else if (\n        (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowUp' && this._orientation === 'vertical')\n      ) {\n        nextFocused =\n          focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n      } else if (event.key === 'Home') {\n        nextFocused = focusable[0];\n      } else if (event.key === 'End') {\n        nextFocused = focusable[focusable.length - 1];\n      }\n\n      // Change the focused element and the tabindex value.\n      if (nextFocused) {\n        focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n        nextFocused?.setAttribute('tabindex', '0');\n        (nextFocused as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the tab bar.\n   */\n  private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse press.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if a drag is in progress.\n    if (this._dragData) {\n      return;\n    }\n\n    // Do nothing if a title editable input was clicked.\n    if (\n      (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n    ) {\n      return;\n    }\n\n    // Check if the add button was clicked.\n    let addButtonClicked =\n      this.addButtonEnabled &&\n      this.addButtonNode.contains(event.target as HTMLElement);\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Find the index of the pressed tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab or the add button.\n    if (index === -1 && !addButtonClicked) {\n      return;\n    }\n\n    // Pressing on a tab stops the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Initialize the non-measured parts of the drag data.\n    this._dragData = {\n      tab: tabs[index] as HTMLElement,\n      index: index,\n      pressX: event.clientX,\n      pressY: event.clientY,\n      tabPos: -1,\n      tabSize: -1,\n      tabPressPos: -1,\n      targetIndex: -1,\n      tabLayout: null,\n      contentRect: null,\n      override: null,\n      dragActive: false,\n      dragAborted: false,\n      detachRequested: false\n    };\n\n    // Add the document pointer up listener.\n    this.document.addEventListener('pointerup', this, true);\n\n    // Do nothing else if the middle button or add button is clicked.\n    if (event.button === 1 || addButtonClicked) {\n      return;\n    }\n\n    // Do nothing else if the close icon is clicked.\n    let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n    if (icon && icon.contains(event.target as HTMLElement)) {\n      return;\n    }\n\n    // Add the extra listeners if the tabs are movable.\n    if (this.tabsMovable) {\n      this.document.addEventListener('pointermove', this, true);\n      this.document.addEventListener('keydown', this, true);\n      this.document.addEventListener('contextmenu', this, true);\n    }\n\n    // Update the current index as appropriate.\n    if (this.allowDeselect && this.currentIndex === index) {\n      this.currentIndex = -1;\n    } else {\n      this.currentIndex = index;\n    }\n\n    // Do nothing else if there is no current tab.\n    if (this.currentIndex === -1) {\n      return;\n    }\n\n    // Emit the tab activate request signal.\n    this._tabActivateRequested.emit({\n      index: this.currentIndex,\n      title: this.currentTitle!\n    });\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the tab bar.\n   */\n  private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Suppress the event during a drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Bail early if the drag threshold has not been met.\n    if (!data.dragActive && !Private.dragExceeded(data, event)) {\n      return;\n    }\n\n    // Activate the drag if necessary.\n    if (!data.dragActive) {\n      // Fill in the rest of the drag data measurements.\n      let tabRect = data.tab.getBoundingClientRect();\n      if (this._orientation === 'horizontal') {\n        data.tabPos = data.tab.offsetLeft;\n        data.tabSize = tabRect.width;\n        data.tabPressPos = data.pressX - tabRect.left;\n      } else {\n        data.tabPos = data.tab.offsetTop;\n        data.tabSize = tabRect.height;\n        data.tabPressPos = data.pressY - tabRect.top;\n      }\n      data.tabPressOffset = {\n        x: data.pressX - tabRect.left,\n        y: data.pressY - tabRect.top\n      };\n      data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n      data.contentRect = this.contentNode.getBoundingClientRect();\n      data.override = Drag.overrideCursor('default');\n\n      // Add the dragging style classes.\n      data.tab.classList.add('lm-mod-dragging');\n      this.addClass('lm-mod-dragging');\n\n      // Mark the drag as active.\n      data.dragActive = true;\n    }\n\n    // Emit the detach requested signal if the threshold is exceeded.\n    if (!data.detachRequested && Private.detachExceeded(data, event)) {\n      // Only emit the signal once per drag cycle.\n      data.detachRequested = true;\n\n      // Setup the arguments for the signal.\n      let index = data.index;\n      let clientX = event.clientX;\n      let clientY = event.clientY;\n      let tab = tabs[index] as HTMLElement;\n      let title = this._titles[index];\n\n      // Emit the tab detach requested signal.\n      this._tabDetachRequested.emit({\n        index,\n        title,\n        tab,\n        clientX,\n        clientY,\n        offset: data.tabPressOffset\n      });\n\n      // Bail if the signal handler aborted the drag.\n      if (data.dragAborted) {\n        return;\n      }\n    }\n\n    // Update the positions of the tabs.\n    Private.layoutTabs(tabs, data, event, this._orientation);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the document.\n   */\n  private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse release.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if no drag is in progress.\n    const data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Remove the extra mouse event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Handle a release when the drag is not active.\n    if (!data.dragActive) {\n      // Clear the drag data.\n      this._dragData = null;\n\n      // Handle clicking the add button.\n      let addButtonClicked =\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(event.target as HTMLElement);\n      if (addButtonClicked) {\n        this._addRequested.emit(undefined);\n        return;\n      }\n\n      // Lookup the tab nodes.\n      let tabs = this.contentNode.children;\n\n      // Find the index of the released tab.\n      let index = ArrayExt.findFirstIndex(tabs, tab => {\n        return ElementExt.hitTest(tab, event.clientX, event.clientY);\n      });\n\n      // Do nothing if the release is not on the original pressed tab.\n      if (index !== data.index) {\n        return;\n      }\n\n      // Ignore the release if the title is not closable.\n      let title = this._titles[index];\n      if (!title.closable) {\n        return;\n      }\n\n      // Emit the close requested signal if the middle button is released.\n      if (event.button === 1) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Emit the close requested signal if the close icon was released.\n      let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n      if (icon && icon.contains(event.target as HTMLElement)) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Otherwise, there is nothing left to do.\n      return;\n    }\n\n    // Do nothing if the left button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Position the tab at its final resting position.\n    Private.finalizeTabPosition(data, this._orientation);\n\n    // Remove the dragging class from the tab so it can be transitioned.\n    data.tab.classList.remove('lm-mod-dragging');\n\n    // Parse the transition duration for releasing the tab.\n    let duration = Private.parseTransitionDuration(data.tab);\n\n    // Complete the release on a timer to allow the tab to transition.\n    setTimeout(() => {\n      // Do nothing if the drag has been aborted.\n      if (data.dragAborted) {\n        return;\n      }\n\n      // Clear the drag data reference.\n      this._dragData = null;\n\n      // Reset the positions of the tabs.\n      Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n      // Clear the cursor grab.\n      data.override!.dispose();\n\n      // Remove the remaining dragging style.\n      this.removeClass('lm-mod-dragging');\n\n      // If the tab was not moved, there is nothing else to do.\n      let i = data.index;\n      let j = data.targetIndex;\n      if (j === -1 || i === j) {\n        return;\n      }\n\n      // Move the title to the new locations.\n      ArrayExt.move(this._titles, i, j);\n\n      // Adjust the current index for the move.\n      this._adjustCurrentForMove(i, j);\n\n      // Emit the tab moved signal.\n      this._tabMoved.emit({\n        fromIndex: i,\n        toIndex: j,\n        title: this._titles[j]\n      });\n\n      // Update the tabs immediately to prevent flicker.\n      MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    }, duration);\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   */\n  private _releaseMouse(): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Clear the drag data reference.\n    this._dragData = null;\n\n    // Remove the extra document event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Indicate the drag has been aborted. This allows the mouse\n    // event handlers to return early when the drag is canceled.\n    data.dragAborted = true;\n\n    // If the drag is not active, there's nothing more to do.\n    if (!data.dragActive) {\n      return;\n    }\n\n    // Reset the tabs to their non-dragged positions.\n    Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n    // Clear the cursor override.\n    data.override!.dispose();\n\n    // Clear the dragging style classes.\n    data.tab.classList.remove('lm-mod-dragging');\n    this.removeClass('lm-mod-dragging');\n  }\n\n  /**\n   * Adjust the current index for a tab insert operation.\n   *\n   * This method accounts for the tab bar's insertion behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForInsert(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ct = this.currentTitle;\n    let ci = this._currentIndex;\n    let bh = this.insertBehavior;\n\n    // TODO: do we need to do an update to update the aria-selected attribute?\n\n    // Handle the behavior where the new tab is always selected,\n    // or the behavior where the new tab is selected if needed.\n    if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n      this._currentIndex = i;\n      this._previousTitle = ct;\n      this._currentChanged.emit({\n        previousIndex: ci,\n        previousTitle: ct,\n        currentIndex: i,\n        currentTitle: title\n      });\n      return;\n    }\n\n    // Otherwise, silently adjust the current index if needed.\n    if (ci >= i) {\n      this._currentIndex++;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab move operation.\n   *\n   * This method will not cause the actual current tab to change.\n   * It silently adjusts the index to account for the given move.\n   */\n  private _adjustCurrentForMove(i: number, j: number): void {\n    if (this._currentIndex === i) {\n      this._currentIndex = j;\n    } else if (this._currentIndex < i && this._currentIndex >= j) {\n      this._currentIndex++;\n    } else if (this._currentIndex > i && this._currentIndex <= j) {\n      this._currentIndex--;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab remove operation.\n   *\n   * This method accounts for the tab bar's remove behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForRemove(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ci = this._currentIndex;\n    let bh = this.removeBehavior;\n\n    // Silently adjust the index if the current tab is not removed.\n    if (ci !== i) {\n      if (ci > i) {\n        this._currentIndex--;\n      }\n      return;\n    }\n\n    // TODO: do we need to do an update to adjust the aria-selected value?\n\n    // No tab gets selected if the tab bar is empty.\n    if (this._titles.length === 0) {\n      this._currentIndex = -1;\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: -1,\n        currentTitle: null\n      });\n      return;\n    }\n\n    // Handle behavior where the next sibling tab is selected.\n    if (bh === 'select-tab-after') {\n      this._currentIndex = Math.min(i, this._titles.length - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous sibling tab is selected.\n    if (bh === 'select-tab-before') {\n      this._currentIndex = Math.max(0, i - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous history tab is selected.\n    if (bh === 'select-previous-tab') {\n      if (this._previousTitle) {\n        this._currentIndex = this._titles.indexOf(this._previousTitle);\n        this._previousTitle = null;\n      } else {\n        this._currentIndex = Math.min(i, this._titles.length - 1);\n      }\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Otherwise, no tab gets selected.\n    this._currentIndex = -1;\n    this._currentChanged.emit({\n      previousIndex: i,\n      previousTitle: title,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<T>): void {\n    this.update();\n  }\n\n  private _name: string;\n  private _currentIndex = -1;\n  private _titles: Title<T>[] = [];\n  private _orientation: TabBar.Orientation;\n  private _document: Document | ShadowRoot;\n  private _titlesEditable: boolean = false;\n  private _previousTitle: Title<T> | null = null;\n  private _dragData: Private.IDragData | null = null;\n  private _addButtonEnabled: boolean = false;\n  private _tabMoved = new Signal<this, TabBar.ITabMovedArgs<T>>(this);\n  private _currentChanged = new Signal<this, TabBar.ICurrentChangedArgs<T>>(\n    this\n  );\n  private _addRequested = new Signal<this, void>(this);\n  private _tabCloseRequested = new Signal<\n    this,\n    TabBar.ITabCloseRequestedArgs<T>\n  >(this);\n  private _tabDetachRequested = new Signal<\n    this,\n    TabBar.ITabDetachRequestedArgs<T>\n  >(this);\n  private _tabActivateRequested = new Signal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n  /**\n   * A type alias for a tab bar orientation.\n   */\n  export type Orientation =\n    | /**\n     * The tabs are arranged in a single row, left-to-right.\n     *\n     * The tab text orientation is horizontal.\n     */\n    'horizontal'\n\n    /**\n     * The tabs are arranged in a single column, top-to-bottom.\n     *\n     * The tab text orientation is horizontal.\n     */\n    | 'vertical';\n\n  /**\n   * A type alias for the selection behavior on tab insert.\n   */\n  export type InsertBehavior =\n    | /**\n     * The selected tab will not be changed.\n     */\n    'none'\n\n    /**\n     * The inserted tab will be selected.\n     */\n    | 'select-tab'\n\n    /**\n     * The inserted tab will be selected if the current tab is null.\n     */\n    | 'select-tab-if-needed';\n\n  /**\n   * A type alias for the selection behavior on tab remove.\n   */\n  export type RemoveBehavior =\n    | /**\n     * No tab will be selected.\n     */\n    'none'\n\n    /**\n     * The tab after the removed tab will be selected if possible.\n     */\n    | 'select-tab-after'\n\n    /**\n     * The tab before the removed tab will be selected if possible.\n     */\n    | 'select-tab-before'\n\n    /**\n     * The previously selected tab will be selected if possible.\n     */\n    | 'select-previous-tab';\n\n  /**\n   * An options object for creating a tab bar.\n   */\n  export interface IOptions<T> {\n    /**\n     * The document to use with the tab bar.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n\n    /**\n     * Name of the tab bar.\n     *\n     * This is used for accessibility reasons. The default is the empty string.\n     */\n    name?: string;\n\n    /**\n     * The layout orientation of the tab bar.\n     *\n     * The default is `horizontal`.\n     */\n    orientation?: TabBar.Orientation;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether a tab can be deselected by the user.\n     *\n     * The default is `false`.\n     */\n    allowDeselect?: boolean;\n\n    /**\n     * Whether the titles can be directly edited by the user.\n     *\n     * The default is `false`.\n     */\n    titlesEditable?: boolean;\n\n    /**\n     * Whether the add button is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The selection behavior when inserting a tab.\n     *\n     * The default is `'select-tab-if-needed'`.\n     */\n    insertBehavior?: TabBar.InsertBehavior;\n\n    /**\n     * The selection behavior when removing a tab.\n     *\n     * The default is `'select-tab-after'`.\n     */\n    removeBehavior?: TabBar.RemoveBehavior;\n\n    /**\n     * A renderer to use with the tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer<T>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs<T> {\n    /**\n     * The previously selected index.\n     */\n    readonly previousIndex: number;\n\n    /**\n     * The previously selected title.\n     */\n    readonly previousTitle: Title<T> | null;\n\n    /**\n     * The currently selected index.\n     */\n    readonly currentIndex: number;\n\n    /**\n     * The currently selected title.\n     */\n    readonly currentTitle: Title<T> | null;\n  }\n\n  /**\n   * The arguments object for the `tabMoved` signal.\n   */\n  export interface ITabMovedArgs<T> {\n    /**\n     * The previous index of the tab.\n     */\n    readonly fromIndex: number;\n\n    /**\n     * The current index of the tab.\n     */\n    readonly toIndex: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabActivateRequested` signal.\n   */\n  export interface ITabActivateRequestedArgs<T> {\n    /**\n     * The index of the tab to activate.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabCloseRequested` signal.\n   */\n  export interface ITabCloseRequestedArgs<T> {\n    /**\n     * The index of the tab to close.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabDetachRequested` signal.\n   */\n  export interface ITabDetachRequestedArgs<T> {\n    /**\n     * The index of the tab to detach.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * The node representing the tab.\n     */\n    readonly tab: HTMLElement;\n\n    /**\n     * The current client X position of the mouse.\n     */\n    readonly clientX: number;\n\n    /**\n     * The current client Y position of the mouse.\n     */\n    readonly clientY: number;\n\n    /**\n     * The mouse position in the tab coordinate.\n     */\n    readonly offset?: { x: number; y: number };\n  }\n\n  /**\n   * An object which holds the data to render a tab.\n   */\n  export interface IRenderData<T> {\n    /**\n     * The title associated with the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * Whether the tab is the current tab.\n     */\n    readonly current: boolean;\n\n    /**\n     * The z-index for the tab.\n     */\n    readonly zIndex: number;\n\n    /**\n     * The tabindex value for the tab.\n     */\n    readonly tabIndex?: number;\n  }\n\n  /**\n   * A renderer for use with a tab bar.\n   */\n  export interface IRenderer<T> {\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector: string;\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<T>): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer<any> {\n    constructor() {\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<any>): VirtualElement {\n      let title = data.title.caption;\n      let key = this.createTabKey(data);\n      let id = key;\n      let style = this.createTabStyle(data);\n      let className = this.createTabClass(data);\n      let dataset = this.createTabDataset(data);\n      let aria = this.createTabARIA(data);\n      if (data.title.closable) {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data),\n          this.renderCloseIcon(data)\n        );\n      } else {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data)\n        );\n      }\n    }\n\n    /**\n     * Render the icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab icon.\n     */\n    renderIcon(data: IRenderData<any>): VirtualElement {\n      const { title } = data;\n      let className = this.createIconClass(data);\n\n      // If title.icon is undefined, it will be ignored.\n      return h.div({ className }, title.icon!, title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab label.\n     */\n    renderLabel(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n    }\n\n    /**\n     * Render the close icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab close icon.\n     */\n    renderCloseIcon(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n    }\n\n    /**\n     * Create a unique render key for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The unique render key for the tab.\n     *\n     * #### Notes\n     * This method caches the key against the tab title the first time\n     * the key is generated. This enables efficient rendering of moved\n     * tabs and avoids subtle hover style artifacts.\n     */\n    createTabKey(data: IRenderData<any>): string {\n      let key = this._tabKeys.get(data.title);\n      if (key === undefined) {\n        key = `tab-key-${this._uuid}-${this._tabID++}`;\n        this._tabKeys.set(data.title, key);\n      }\n      return key;\n    }\n\n    /**\n     * Create the inline style object for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The inline style data for the tab.\n     */\n    createTabStyle(data: IRenderData<any>): ElementInlineStyle {\n      return { zIndex: `${data.zIndex}` };\n    }\n\n    /**\n     * Create the class name for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab.\n     */\n    createTabClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tab';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.title.closable) {\n        name += ' lm-mod-closable';\n      }\n      if (data.current) {\n        name += ' lm-mod-current';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The dataset for the tab.\n     */\n    createTabDataset(data: IRenderData<any>): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the ARIA attributes for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The ARIA attributes for the tab.\n     */\n    createTabARIA(data: IRenderData<any>): ElementARIAAttrs | ElementBaseAttrs {\n      return {\n        role: 'tab',\n        'aria-selected': data.current.toString(),\n        tabindex: `${data.tabIndex ?? '-1'}`\n      };\n    }\n\n    /**\n     * Create the class name for the tab icon.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab icon.\n     */\n    createIconClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tabIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _tabID = 0;\n    private _tabKeys = new WeakMap<Title<any>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * A selector which matches the add button node in the tab bar.\n   */\n  export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The start drag distance threshold.\n   */\n  export const DRAG_THRESHOLD = 5;\n\n  /**\n   * The detach distance threshold.\n   */\n  export const DETACH_THRESHOLD = 20;\n\n  /**\n   * A struct which holds the drag data for a tab bar.\n   */\n  export interface IDragData {\n    /**\n     * The tab node being dragged.\n     */\n    tab: HTMLElement;\n\n    /**\n     * The index of the tab being dragged.\n     */\n    index: number;\n\n    /**\n     * The mouse press client X position.\n     */\n    pressX: number;\n\n    /**\n     * The mouse press client Y position.\n     */\n    pressY: number;\n\n    /**\n     * The offset left/top of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPos: number;\n\n    /**\n     * The offset width/height of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabSize: number;\n\n    /**\n     * The original mouse X/Y position in tab coordinates.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPressPos: number;\n\n    /**\n     * The original mouse position in tab coordinates.\n     *\n     * This is undefined if the drag is not active.\n     */\n    tabPressOffset?: { x: number; y: number };\n\n    /**\n     * The tab target index upon mouse release.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    targetIndex: number;\n\n    /**\n     * The array of tab layout objects snapped at drag start.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    tabLayout: ITabLayout[] | null;\n\n    /**\n     * The bounding client rect of the tab bar content node.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    contentRect: DOMRect | null;\n\n    /**\n     * The disposable to clean up the cursor override.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    override: IDisposable | null;\n\n    /**\n     * Whether the drag is currently active.\n     */\n    dragActive: boolean;\n\n    /**\n     * Whether the drag has been aborted.\n     */\n    dragAborted: boolean;\n\n    /**\n     * Whether a detach request as been made.\n     */\n    detachRequested: boolean;\n  }\n\n  /**\n   * An object which holds layout data for a tab.\n   */\n  export interface ITabLayout {\n    /**\n     * The left/top margin value for the tab.\n     */\n    margin: number;\n\n    /**\n     * The offset left/top position of the tab.\n     */\n    pos: number;\n\n    /**\n     * The offset width/height of the tab.\n     */\n    size: number;\n  }\n\n  /**\n   * Create the DOM node for a tab bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.setAttribute('role', 'tablist');\n    content.className = 'lm-TabBar-content';\n    node.appendChild(content);\n\n    let add = document.createElement('div');\n    add.className = 'lm-TabBar-addButton lm-mod-hidden';\n    add.setAttribute('tabindex', '-1');\n    add.setAttribute('role', 'button');\n    node.appendChild(add);\n    return node;\n  }\n\n  /**\n   * Coerce a title or options into a real title.\n   */\n  export function asTitle<T>(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return value instanceof Title ? value : new Title<T>(value);\n  }\n\n  /**\n   * Parse the transition duration for a tab node.\n   */\n  export function parseTransitionDuration(tab: HTMLElement): number {\n    let style = window.getComputedStyle(tab);\n    return 1000 * (parseFloat(style.transitionDuration!) || 0);\n  }\n\n  /**\n   * Get a snapshot of the current tab layout values.\n   */\n  export function snapTabLayout(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): ITabLayout[] {\n    let layout = new Array<ITabLayout>(tabs.length);\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let node = tabs[i] as HTMLElement;\n      let style = window.getComputedStyle(node);\n      if (orientation === 'horizontal') {\n        layout[i] = {\n          pos: node.offsetLeft,\n          size: node.offsetWidth,\n          margin: parseFloat(style.marginLeft!) || 0\n        };\n      } else {\n        layout[i] = {\n          pos: node.offsetTop,\n          size: node.offsetHeight,\n          margin: parseFloat(style.marginTop!) || 0\n        };\n      }\n    }\n    return layout;\n  }\n\n  /**\n   * Test if the event exceeds the drag threshold.\n   */\n  export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n    let dx = Math.abs(event.clientX - data.pressX);\n    let dy = Math.abs(event.clientY - data.pressY);\n    return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n  }\n\n  /**\n   * Test if the event exceeds the drag detach threshold.\n   */\n  export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n    let rect = data.contentRect!;\n    return (\n      event.clientX < rect.left - DETACH_THRESHOLD ||\n      event.clientX >= rect.right + DETACH_THRESHOLD ||\n      event.clientY < rect.top - DETACH_THRESHOLD ||\n      event.clientY >= rect.bottom + DETACH_THRESHOLD\n    );\n  }\n\n  /**\n   * Update the relative tab positions and computed target index.\n   */\n  export function layoutTabs(\n    tabs: HTMLCollection,\n    data: IDragData,\n    event: MouseEvent,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive values.\n    let pressPos: number;\n    let localPos: number;\n    let clientPos: number;\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      pressPos = data.pressX;\n      localPos = event.clientX - data.contentRect!.left;\n      clientPos = event.clientX;\n      clientSize = data.contentRect!.width;\n    } else {\n      pressPos = data.pressY;\n      localPos = event.clientY - data.contentRect!.top;\n      clientPos = event.clientY;\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the target data.\n    let targetIndex = data.index;\n    let targetPos = localPos - data.tabPressPos;\n    let targetEnd = targetPos + data.tabSize;\n\n    // Update the relative tab positions.\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let pxPos: string;\n      let layout = data.tabLayout![i];\n      let threshold = layout.pos + (layout.size >> 1);\n      if (i < data.index && targetPos < threshold) {\n        pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n        targetIndex = Math.min(targetIndex, i);\n      } else if (i > data.index && targetEnd > threshold) {\n        pxPos = `${-data.tabSize - layout.margin}px`;\n        targetIndex = Math.max(targetIndex, i);\n      } else if (i === data.index) {\n        let ideal = clientPos - pressPos;\n        let limit = clientSize - (data.tabPos + data.tabSize);\n        pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n      } else {\n        pxPos = '';\n      }\n      if (orientation === 'horizontal') {\n        (tabs[i] as HTMLElement).style.left = pxPos;\n      } else {\n        (tabs[i] as HTMLElement).style.top = pxPos;\n      }\n    }\n\n    // Update the computed target index.\n    data.targetIndex = targetIndex;\n  }\n\n  /**\n   * Position the drag tab at its final resting relative position.\n   */\n  export function finalizeTabPosition(\n    data: IDragData,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive client size.\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      clientSize = data.contentRect!.width;\n    } else {\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the ideal final tab position.\n    let ideal: number;\n    if (data.targetIndex === data.index) {\n      ideal = 0;\n    } else if (data.targetIndex > data.index) {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n    } else {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos - data.tabPos;\n    }\n\n    // Compute the tab position limit.\n    let limit = clientSize - (data.tabPos + data.tabSize);\n    let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n    // Set the final orientation-sensitive position.\n    if (orientation === 'horizontal') {\n      data.tab.style.left = `${final}px`;\n    } else {\n      data.tab.style.top = `${final}px`;\n    }\n  }\n\n  /**\n   * Reset the relative positions of the given tabs.\n   */\n  export function resetTabPositions(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): void {\n    for (const tab of tabs) {\n      if (orientation === 'horizontal') {\n        (tab as HTMLElement).style.left = '';\n      } else {\n        (tab as HTMLElement).style.top = '';\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n  /**\n   * Construct a new dock layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: DockLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n    this._document = options.document || document;\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   */\n  dispose(): void {\n    // Get an iterator over the widgets in the layout.\n    let widgets = this[Symbol.iterator]();\n\n    // Dispose of the layout items.\n    this._items.forEach(item => {\n      item.dispose();\n    });\n\n    // Clear the layout state before disposing the widgets.\n    this._box = null;\n    this._root = null;\n    this._items.clear();\n\n    // Dispose of the widgets contained in the old layout root.\n    for (const widget of widgets) {\n      widget.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the dock layout.\n   */\n  readonly renderer: DockLayout.IRenderer;\n\n  /**\n   * The method for hiding child widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    for (const bar of this.tabBars()) {\n      if (bar.titles.length > 1) {\n        for (const title of bar.titles) {\n          title.owner.hiddenMode = this._hiddenMode;\n        }\n      }\n    }\n  }\n\n  /**\n   * Get the inter-element spacing for the dock layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the dock layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Whether the dock layout is empty.\n   */\n  get isEmpty(): boolean {\n    return this._root === null;\n  }\n\n  /**\n   * Create an iterator over all widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This iterator includes the generated tab bars.\n   */\n  [Symbol.iterator](): IterableIterator<Widget> {\n    return this._root ? this._root.iterAllWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the user widgets in the layout.\n   *\n   * @returns A new iterator over the user widgets in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  widgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterUserWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the layout.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the layout.\n   */\n  selectedWidgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterSelectedWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the layout.\n   *\n   * @returns A new iterator over the tab bars in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  tabBars(): IterableIterator<TabBar<Widget>> {\n    return this._root ? this._root.iterTabBars() : empty();\n  }\n\n  /**\n   * Create an iterator over the handles in the layout.\n   *\n   * @returns A new iterator over the handles in the layout.\n   */\n  handles(): IterableIterator<HTMLDivElement> {\n    return this._root ? this._root.iterHandles() : empty();\n  }\n\n  /**\n   * Move a handle to the given offset position.\n   *\n   * @param handle - The handle to move.\n   *\n   * @param offsetX - The desired offset X position of the handle.\n   *\n   * @param offsetY - The desired offset Y position of the handle.\n   *\n   * #### Notes\n   * If the given handle is not contained in the layout, this is no-op.\n   *\n   * The handle will be moved as close as possible to the desired\n   * position without violating any of the layout constraints.\n   *\n   * Only one of the coordinates is used depending on the orientation\n   * of the handle. This method accepts both coordinates to make it\n   * easy to invoke from a mouse move event without needing to know\n   * the handle orientation.\n   */\n  moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n    // Bail early if there is no root or if the handle is hidden.\n    let hidden = handle.classList.contains('lm-mod-hidden');\n    if (!this._root || hidden) {\n      return;\n    }\n\n    // Lookup the split node for the handle.\n    let data = this._root.findSplitNode(handle);\n    if (!data) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (data.node.orientation === 'horizontal') {\n      delta = offsetX - handle.offsetLeft;\n    } else {\n      delta = offsetY - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent sibling resizing unless needed.\n    data.node.holdSizes();\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Save the current configuration of the dock layout.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockLayout.ILayoutConfig {\n    // Bail early if there is no root.\n    if (!this._root) {\n      return { main: null };\n    }\n\n    // Hold the current sizes in the layout tree.\n    this._root.holdAllSizes();\n\n    // Return the layout config.\n    return { main: this._root.createConfig() };\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   */\n  restoreLayout(config: DockLayout.ILayoutConfig): void {\n    // Create the widget set for validating the config.\n    let widgetSet = new Set<Widget>();\n\n    // Normalize the main area config and collect the widgets.\n    let mainConfig: DockLayout.AreaConfig | null;\n    if (config.main) {\n      mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n    } else {\n      mainConfig = null;\n    }\n\n    // Create iterators over the old content.\n    let oldWidgets = this.widgets();\n    let oldTabBars = this.tabBars();\n    let oldHandles = this.handles();\n\n    // Clear the root before removing the old content.\n    this._root = null;\n\n    // Unparent the old widgets which are not in the new config.\n    for (const widget of oldWidgets) {\n      if (!widgetSet.has(widget)) {\n        widget.parent = null;\n      }\n    }\n\n    // Dispose of the old tab bars.\n    for (const tabBar of oldTabBars) {\n      tabBar.dispose();\n    }\n\n    // Remove the old handles.\n    for (const handle of oldHandles) {\n      if (handle.parentNode) {\n        handle.parentNode.removeChild(handle);\n      }\n    }\n\n    // Reparent the new widgets to the current parent.\n    for (const widget of widgetSet) {\n      widget.parent = this.parent;\n    }\n\n    // Create the root node for the new config.\n    if (mainConfig) {\n      this._root = Private.realizeAreaConfig(\n        mainConfig,\n        {\n          // Ignoring optional `document` argument as we must reuse `this._document`\n          createTabBar: (document?: Document | ShadowRoot) =>\n            this._createTabBar(),\n          createHandle: () => this._createHandle()\n        },\n        this._document\n      );\n    } else {\n      this._root = null;\n    }\n\n    // If there is no parent, there is nothing more to do.\n    if (!this.parent) {\n      return;\n    }\n\n    // Attach the new widgets to the parent.\n    widgetSet.forEach(widget => {\n      this.attachWidget(widget);\n    });\n\n    // Post a fit request to the parent.\n    this.parent.fit();\n  }\n\n  /**\n   * Add a widget to the dock layout.\n   *\n   * @param widget - The widget to add to the dock layout.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * The widget will be moved if it is already contained in the layout.\n   *\n   * An error will be thrown if the reference widget is invalid.\n   */\n  addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n    // Parse the options.\n    let ref = options.ref || null;\n    let mode = options.mode || 'tab-after';\n\n    // Find the tab node which holds the reference widget.\n    let refNode: Private.TabLayoutNode | null = null;\n    if (this._root && ref) {\n      refNode = this._root.findTabNode(ref);\n    }\n\n    // Throw an error if the reference widget is invalid.\n    if (ref && !refNode) {\n      throw new Error('Reference widget is not in the layout.');\n    }\n\n    // Reparent the widget to the current layout parent.\n    widget.parent = this.parent;\n\n    // Insert the widget according to the insert mode.\n    switch (mode) {\n      case 'tab-after':\n        this._insertTab(widget, ref, refNode, true);\n        break;\n      case 'tab-before':\n        this._insertTab(widget, ref, refNode, false);\n        break;\n      case 'split-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false);\n        break;\n      case 'split-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false);\n        break;\n      case 'split-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true);\n        break;\n      case 'split-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true);\n        break;\n      case 'merge-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n        break;\n      case 'merge-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n        break;\n      case 'merge-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n        break;\n      case 'merge-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n        break;\n    }\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Ensure the widget is attached to the parent widget.\n    this.attachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Remove the widget from its current layout location.\n    this._removeWidget(widget);\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Detach the widget from the parent widget.\n    this.detachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Find the tab area which contains the given client position.\n   *\n   * @param clientX - The client X position of interest.\n   *\n   * @param clientY - The client Y position of interest.\n   *\n   * @returns The geometry of the tab area at the given position, or\n   *   `null` if there is no tab area at the given position.\n   */\n  hitTestTabAreas(\n    clientX: number,\n    clientY: number\n  ): DockLayout.ITabAreaGeometry | null {\n    // Bail early if hit testing cannot produce valid results.\n    if (!this._root || !this.parent || !this.parent.isVisible) {\n      return null;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent.node);\n    }\n\n    // Convert from client to local coordinates.\n    let rect = this.parent.node.getBoundingClientRect();\n    let x = clientX - rect.left - this._box.borderLeft;\n    let y = clientY - rect.top - this._box.borderTop;\n\n    // Find the tab layout node at the local position.\n    let tabNode = this._root.hitTestTabNodes(x, y);\n\n    // Bail if a tab layout node was not found.\n    if (!tabNode) {\n      return null;\n    }\n\n    // Extract the data from the tab node.\n    let { tabBar, top, left, width, height } = tabNode;\n\n    // Compute the right and bottom edges of the tab area.\n    let borderWidth = this._box.borderLeft + this._box.borderRight;\n    let borderHeight = this._box.borderTop + this._box.borderBottom;\n    let right = rect.width - borderWidth - (left + width);\n    let bottom = rect.height - borderHeight - (top + height);\n\n    // Return the hit test results.\n    return { tabBar, x, y, top, left, right, bottom, width, height };\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    // Perform superclass initialization.\n    super.init();\n\n    // Attach each widget to the parent.\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n\n    // Attach each handle to the parent.\n    for (const handle of this.handles()) {\n      this.parent!.node.appendChild(handle);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Attach the widget to the layout parent widget.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is already attached.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Do nothing if the widget is already attached.\n    if (this.parent!.node === widget.node.parentNode) {\n      return;\n    }\n\n    // Create the layout item for the widget.\n    this._items.set(widget, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach the widget from the layout parent widget.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not attached.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Do nothing if the widget is not attached.\n    if (this.parent!.node !== widget.node.parentNode) {\n      return;\n    }\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Delete the layout item for the widget.\n    let item = this._items.get(widget);\n    if (item) {\n      this._items.delete(widget);\n      item.dispose();\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Remove the specified widget from the layout structure.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not in the layout tree.\n   *\n   * This does not detach the widget from the parent node.\n   */\n  private _removeWidget(widget: Widget): void {\n    // Bail early if there is no layout root.\n    if (!this._root) {\n      return;\n    }\n\n    // Find the tab node which contains the given widget.\n    let tabNode = this._root.findTabNode(widget);\n\n    // Bail early if the tab node is not found.\n    if (!tabNode) {\n      return;\n    }\n\n    Private.removeAria(widget);\n\n    // If there are multiple tabs, just remove the widget's tab.\n    if (tabNode.tabBar.titles.length > 1) {\n      tabNode.tabBar.removeTab(widget.title);\n      if (\n        this._hiddenMode === Widget.HiddenMode.Scale &&\n        tabNode.tabBar.titles.length == 1\n      ) {\n        const existingWidget = tabNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Display;\n      }\n      return;\n    }\n\n    // Otherwise, the tab node needs to be removed...\n\n    // Dispose the tab bar.\n    tabNode.tabBar.dispose();\n\n    // Handle the case where the tab node is the root.\n    if (this._root === tabNode) {\n      this._root = null;\n      return;\n    }\n\n    // Otherwise, remove the tab node from its parent...\n\n    // Prevent widget resizing unless needed.\n    this._root.holdAllSizes();\n\n    // Clear the parent reference on the tab node.\n    let splitNode = tabNode.parent!;\n    tabNode.parent = null;\n\n    // Remove the tab node from its parent split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n    let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n    ArrayExt.removeAt(splitNode.sizers, i);\n\n    // Remove the handle from its parent DOM node.\n    if (handle.parentNode) {\n      handle.parentNode.removeChild(handle);\n    }\n\n    // If there are multiple children, just update the handles.\n    if (splitNode.children.length > 1) {\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Otherwise, the split node also needs to be removed...\n\n    // Clear the parent reference on the split node.\n    let maybeParent = splitNode.parent;\n    splitNode.parent = null;\n\n    // Lookup the remaining child node and handle.\n    let childNode = splitNode.children[0];\n    let childHandle = splitNode.handles[0];\n\n    // Clear the split node data.\n    splitNode.children.length = 0;\n    splitNode.handles.length = 0;\n    splitNode.sizers.length = 0;\n\n    // Remove the child handle from its parent node.\n    if (childHandle.parentNode) {\n      childHandle.parentNode.removeChild(childHandle);\n    }\n\n    // Handle the case where the split node is the root.\n    if (this._root === splitNode) {\n      childNode.parent = null;\n      this._root = childNode;\n      return;\n    }\n\n    // Otherwise, move the child node to the parent node...\n    let parentNode = maybeParent!;\n\n    // Lookup the index of the split node.\n    let j = parentNode.children.indexOf(splitNode);\n\n    // Handle the case where the child node is a tab node.\n    if (childNode instanceof Private.TabLayoutNode) {\n      childNode.parent = parentNode;\n      parentNode.children[j] = childNode;\n      return;\n    }\n\n    // Remove the split data from the parent.\n    let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n    ArrayExt.removeAt(parentNode.children, j);\n    ArrayExt.removeAt(parentNode.sizers, j);\n\n    // Remove the handle from its parent node.\n    if (splitHandle.parentNode) {\n      splitHandle.parentNode.removeChild(splitHandle);\n    }\n\n    // The child node and the split parent node will have the same\n    // orientation. Merge the grand-children with the parent node.\n    for (let i = 0, n = childNode.children.length; i < n; ++i) {\n      let gChild = childNode.children[i];\n      let gHandle = childNode.handles[i];\n      let gSizer = childNode.sizers[i];\n      ArrayExt.insert(parentNode.children, j + i, gChild);\n      ArrayExt.insert(parentNode.handles, j + i, gHandle);\n      ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n      gChild.parent = parentNode;\n    }\n\n    // Clear the child node.\n    childNode.children.length = 0;\n    childNode.handles.length = 0;\n    childNode.sizers.length = 0;\n    childNode.parent = null;\n\n    // Sync the handles on the parent node.\n    parentNode.syncHandles();\n  }\n\n  /**\n   * Create the tab layout node to hold the widget.\n   */\n  private _createTabNode(widget: Widget): Private.TabLayoutNode {\n    let tabNode = new Private.TabLayoutNode(this._createTabBar());\n    tabNode.tabBar.addTab(widget.title);\n    Private.addAria(widget, tabNode.tabBar);\n    return tabNode;\n  }\n\n  /**\n   * Insert a widget next to an existing tab.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertTab(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    after: boolean\n  ): void {\n    // Do nothing if the tab is inserted next to itself.\n    if (widget === ref) {\n      return;\n    }\n\n    // Create the root if it does not exist.\n    if (!this._root) {\n      let tabNode = new Private.TabLayoutNode(this._createTabBar());\n      tabNode.tabBar.addTab(widget.title);\n      this._root = tabNode;\n      Private.addAria(widget, tabNode.tabBar);\n      return;\n    }\n\n    // Use the first tab node as the ref node if needed.\n    if (!refNode) {\n      refNode = this._root.findFirstTabNode()!;\n    }\n\n    // If the widget is not contained in the ref node, ensure it is\n    // removed from the layout and hidden before being added again.\n    if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n      this._removeWidget(widget);\n      widget.hide();\n    }\n\n    // Lookup the target index for inserting the tab.\n    let index: number;\n    if (ref) {\n      index = refNode.tabBar.titles.indexOf(ref.title);\n    } else {\n      index = refNode.tabBar.currentIndex;\n    }\n\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      if (refNode.tabBar.titles.length === 0) {\n        // Singular tab should use display mode to limit number of layers.\n        widget.hiddenMode = Widget.HiddenMode.Display;\n      } else if (refNode.tabBar.titles.length == 1) {\n        // If we are adding a second tab, switch the existing tab back to scale.\n        const existingWidget = refNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n      } else {\n        // For the third and subsequent tabs no special action is needed.\n        widget.hiddenMode = Widget.HiddenMode.Scale;\n      }\n    } else {\n      // For all other modes just propagate the current mode.\n      widget.hiddenMode = this._hiddenMode;\n    }\n\n    // Insert the widget's tab relative to the target index.\n    refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n    Private.addAria(widget, refNode.tabBar);\n  }\n\n  /**\n   * Insert a widget as a new split area.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertSplit(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    orientation: Private.Orientation,\n    after: boolean,\n    merge: boolean = false\n  ): void {\n    // Do nothing if there is no effective split.\n    if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n      return;\n    }\n\n    // Ensure the widget is removed from the current layout.\n    this._removeWidget(widget);\n\n    // Set the root if it does not exist.\n    if (!this._root) {\n      this._root = this._createTabNode(widget);\n      return;\n    }\n\n    // If the ref node parent is null, split the root.\n    if (!refNode || !refNode.parent) {\n      // Ensure the root is split with the correct orientation.\n      let root = this._splitRoot(orientation);\n\n      // Determine the insert index for the new tab node.\n      let i = after ? root.children.length : 0;\n\n      // Normalize the split node.\n      root.normalizeSizes();\n\n      // Create the sizer for new tab node.\n      let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n      // Insert the tab node sized to the golden ratio.\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(root.children, i, tabNode);\n      ArrayExt.insert(root.sizers, i, sizer);\n      ArrayExt.insert(root.handles, i, this._createHandle());\n      tabNode.parent = root;\n\n      // Re-normalize the split node to maintain the ratios.\n      root.normalizeSizes();\n\n      // Finally, synchronize the visibility of the handles.\n      root.syncHandles();\n      return;\n    }\n\n    // Lookup the split node for the ref widget.\n    let splitNode = refNode.parent;\n\n    // If the split node already had the correct orientation,\n    // the widget can be inserted into the split node directly.\n    if (splitNode.orientation === orientation) {\n      // Find the index of the ref node.\n      let i = splitNode.children.indexOf(refNode);\n\n      // Conditionally reuse a tab layout found in the wanted position.\n      if (merge) {\n        let j = i + (after ? 1 : -1);\n        let sibling = splitNode.children[j];\n        if (sibling instanceof Private.TabLayoutNode) {\n          this._insertTab(widget, null, sibling, true);\n          ++sibling.tabBar.currentIndex;\n          return;\n        }\n      }\n\n      // Normalize the split node.\n      splitNode.normalizeSizes();\n\n      // Consume half the space for the insert location.\n      let s = (splitNode.sizers[i].sizeHint /= 2);\n\n      // Insert the tab node sized to the other half.\n      let j = i + (after ? 1 : 0);\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(splitNode.children, j, tabNode);\n      ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n      ArrayExt.insert(splitNode.handles, j, this._createHandle());\n      tabNode.parent = splitNode;\n\n      // Finally, synchronize the visibility of the handles.\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Remove the ref node from the split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n    // Create a new normalized split node for the children.\n    let childNode = new Private.SplitLayoutNode(orientation);\n    childNode.normalized = true;\n\n    // Add the ref node sized to half the space.\n    childNode.children.push(refNode);\n    childNode.sizers.push(Private.createSizer(0.5));\n    childNode.handles.push(this._createHandle());\n    refNode.parent = childNode;\n\n    // Add the tab node sized to the other half.\n    let j = after ? 1 : 0;\n    let tabNode = this._createTabNode(widget);\n    ArrayExt.insert(childNode.children, j, tabNode);\n    ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n    ArrayExt.insert(childNode.handles, j, this._createHandle());\n    tabNode.parent = childNode;\n\n    // Synchronize the visibility of the handles.\n    childNode.syncHandles();\n\n    // Finally, add the new child node to the original split node.\n    ArrayExt.insert(splitNode.children, i, childNode);\n    childNode.parent = splitNode;\n  }\n\n  /**\n   * Ensure the root is a split node with the given orientation.\n   */\n  private _splitRoot(\n    orientation: Private.Orientation\n  ): Private.SplitLayoutNode {\n    // Bail early if the root already meets the requirements.\n    let oldRoot = this._root;\n    if (oldRoot instanceof Private.SplitLayoutNode) {\n      if (oldRoot.orientation === orientation) {\n        return oldRoot;\n      }\n    }\n\n    // Create a new root node with the specified orientation.\n    let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n    // Add the old root to the new root.\n    if (oldRoot) {\n      newRoot.children.push(oldRoot);\n      newRoot.sizers.push(Private.createSizer(0));\n      newRoot.handles.push(this._createHandle());\n      oldRoot.parent = newRoot;\n    }\n\n    // Return the new root as a convenience.\n    return newRoot;\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the size limits for the layout tree.\n    if (this._root) {\n      let limits = this._root.fit(this._spacing, this._items);\n      minW = limits.minWidth;\n      minH = limits.minHeight;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Bail early if there is no root layout node.\n    if (!this._root) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let x = this._box.paddingTop;\n    let y = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the geometry of the layout tree.\n    this._root.update(x, y, width, height, this._spacing, this._items);\n  }\n\n  /**\n   * Create a new tab bar for use by the dock layout.\n   *\n   * #### Notes\n   * The tab bar will be attached to the parent if it exists.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar using the renderer.\n    let tabBar = this.renderer.createTabBar(this._document);\n\n    // Enforce necessary tab bar behavior.\n    tabBar.orientation = 'horizontal';\n\n    // Attach the tab bar to the parent if possible.\n    if (this.parent) {\n      this.attachWidget(tabBar);\n    }\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for the dock layout.\n   *\n   * #### Notes\n   * The handle will be attached to the parent if it exists.\n   */\n  private _createHandle(): HTMLDivElement {\n    // Create the handle using the renderer.\n    let handle = this.renderer.createHandle();\n\n    // Initialize the handle layout behavior.\n    let style = handle.style;\n    style.position = 'absolute';\n    style.contain = 'strict';\n    style.top = '0';\n    style.left = '0';\n    style.width = '0';\n    style.height = '0';\n\n    // Attach the handle to the parent if it exists.\n    if (this.parent) {\n      this.parent.node.appendChild(handle);\n    }\n\n    // Return the initialized handle.\n    return handle;\n  }\n\n  private _spacing = 4;\n  private _dirty = false;\n  private _root: Private.LayoutNode | null = null;\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _document: Document | ShadowRoot;\n  private _hiddenMode: Widget.HiddenMode;\n  private _items: Private.ItemMap = new Map<Widget, LayoutItem>();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n  /**\n   * An options object for creating a dock layout.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * The renderer to use for the dock layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a dock layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new tab bar for use with a dock layout.\n     *\n     * @returns A new tab bar for a dock layout.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget>;\n\n    /**\n     * Create a new handle node for use with a dock layout.\n     *\n     * @returns A new handle node for a dock layout.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * A type alias for the supported insertion modes.\n   *\n   * An insert mode is used to specify how a widget should be added\n   * to the dock layout relative to a reference widget.\n   */\n  export type InsertMode =\n    | /**\n     * The area to the top of the reference widget.\n     *\n     * The widget will be inserted just above the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the top edge of the dock layout.\n     */\n    'split-top'\n\n    /**\n     * The area to the left of the reference widget.\n     *\n     * The widget will be inserted just left of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the left edge of the dock layout.\n     */\n    | 'split-left'\n\n    /**\n     * The area to the right of the reference widget.\n     *\n     * The widget will be inserted just right of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted  at the right edge of the dock layout.\n     */\n    | 'split-right'\n\n    /**\n     * The area to the bottom of the reference widget.\n     *\n     * The widget will be inserted just below the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the bottom edge of the dock layout.\n     */\n    | 'split-bottom'\n\n    /**\n     * Like `split-top` but if a tab layout exists above the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-top'\n\n    /**\n     * Like `split-left` but if a tab layout exists left of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-left'\n\n    /**\n     * Like `split-right` but if a tab layout exists right of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-right'\n\n    /**\n     * Like `split-bottom` but if a tab layout exists below the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-bottom'\n\n    /**\n     * The tab position before the reference widget.\n     *\n     * The widget will be added as a tab before the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-before'\n\n    /**\n     * The tab position after the reference widget.\n     *\n     * The widget will be added as a tab after the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-after';\n\n  /**\n   * An options object for adding a widget to the dock layout.\n   */\n  export interface IAddOptions {\n    /**\n     * The insertion mode for adding the widget.\n     *\n     * The default is `'tab-after'`.\n     */\n    mode?: InsertMode;\n\n    /**\n     * The reference widget for the insert location.\n     *\n     * The default is `null`.\n     */\n    ref?: Widget | null;\n  }\n\n  /**\n   * A layout config object for a tab area.\n   */\n  export interface ITabAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'tab-area';\n\n    /**\n     * The widgets contained in the tab area.\n     */\n    widgets: Widget[];\n\n    /**\n     * The index of the selected tab.\n     */\n    currentIndex: number;\n  }\n\n  /**\n   * A layout config object for a split area.\n   */\n  export interface ISplitAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'split-area';\n\n    /**\n     * The orientation of the split area.\n     */\n    orientation: 'horizontal' | 'vertical';\n\n    /**\n     * The children in the split area.\n     */\n    children: AreaConfig[];\n\n    /**\n     * The relative sizes of the children.\n     */\n    sizes: number[];\n  }\n\n  /**\n   * A type alias for a general area config.\n   */\n  export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n  /**\n   * A dock layout configuration object.\n   */\n  export interface ILayoutConfig {\n    /**\n     * The layout config for the main dock area.\n     */\n    main: AreaConfig | null;\n  }\n\n  /**\n   * An object which represents the geometry of a tab area.\n   */\n  export interface ITabAreaGeometry {\n    /**\n     * The tab bar for the tab area.\n     */\n    tabBar: TabBar<Widget>;\n\n    /**\n     * The local X position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the local X coordinate of the hit test query.\n     */\n    x: number;\n\n    /**\n     * The local Y position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the local Y coordinate of the hit test query.\n     */\n    y: number;\n\n    /**\n     * The local coordinate of the top edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the top edge of the tab area.\n     */\n    top: number;\n\n    /**\n     * The local coordinate of the left edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the left edge of the tab area.\n     */\n    left: number;\n\n    /**\n     * The local coordinate of the right edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the right edge of the layout parent\n     * widget, to the right edge of the tab area.\n     */\n    right: number;\n\n    /**\n     * The local coordinate of the bottom edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the bottom edge of the layout parent\n     * widget, to the bottom edge of the tab area.\n     */\n    bottom: number;\n\n    /**\n     * The width of the tab area.\n     *\n     * #### Notes\n     * This is total width allocated for the tab area.\n     */\n    width: number;\n\n    /**\n     * The height of the tab area.\n     *\n     * #### Notes\n     * This is total height allocated for the tab area.\n     */\n    height: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * A type alias for a dock layout node.\n   */\n  export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n  /**\n   * A type alias for the orientation of a split layout node.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a layout item map.\n   */\n  export type ItemMap = Map<Widget, LayoutItem>;\n\n  /**\n   * Create a box sizer with an initial size hint.\n   */\n  export function createSizer(hint: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = hint;\n    sizer.size = hint;\n    return sizer;\n  }\n\n  /**\n   * Normalize an area config object and collect the visited widgets.\n   */\n  export function normalizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    let result: DockLayout.AreaConfig | null;\n    if (config.type === 'tab-area') {\n      result = normalizeTabAreaConfig(config, widgetSet);\n    } else {\n      result = normalizeSplitAreaConfig(config, widgetSet);\n    }\n    return result;\n  }\n\n  /**\n   * Convert a normalized area config into a layout tree.\n   */\n  export function realizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): LayoutNode {\n    let node: LayoutNode;\n    if (config.type === 'tab-area') {\n      node = realizeTabAreaConfig(config, renderer, document);\n    } else {\n      node = realizeSplitAreaConfig(config, renderer, document);\n    }\n    return node;\n  }\n\n  /**\n   * A layout node which holds the data for a tabbed area.\n   */\n  export class TabLayoutNode {\n    /**\n     * Construct a new tab layout node.\n     *\n     * @param tabBar - The tab bar to use for the layout node.\n     */\n    constructor(tabBar: TabBar<Widget>) {\n      let tabSizer = new BoxSizer();\n      let widgetSizer = new BoxSizer();\n      tabSizer.stretch = 0;\n      widgetSizer.stretch = 1;\n      this.tabBar = tabBar;\n      this.sizers = [tabSizer, widgetSizer];\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * The tab bar for the layout node.\n     */\n    readonly tabBar: TabBar<Widget>;\n\n    /**\n     * The sizers for the layout node.\n     */\n    readonly sizers: [BoxSizer, BoxSizer];\n\n    /**\n     * The most recent value for the `top` edge of the layout box.\n     */\n    get top(): number {\n      return this._top;\n    }\n\n    /**\n     * The most recent value for the `left` edge of the layout box.\n     */\n    get left(): number {\n      return this._left;\n    }\n\n    /**\n     * The most recent value for the `width` of the layout box.\n     */\n    get width(): number {\n      return this._width;\n    }\n\n    /**\n     * The most recent value for the `height` of the layout box.\n     */\n    get height(): number {\n      return this._height;\n    }\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      yield this.tabBar;\n      yield* this.iterUserWidgets();\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const title of this.tabBar.titles) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      let title = this.tabBar.currentTitle;\n      if (title) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      yield this.tabBar;\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    // eslint-disable-next-line require-yield\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      return;\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      return this;\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      if (x < this._left || x >= this._left + this._width) {\n        return null;\n      }\n      if (y < this._top || y >= this._top + this._height) {\n        return null;\n      }\n      return this;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ITabAreaConfig {\n      let widgets = this.tabBar.titles.map(title => title.owner);\n      let currentIndex = this.tabBar.currentIndex;\n      return { type: 'tab-area', widgets, currentIndex };\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      return;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Set up the limit variables.\n      let minWidth = 0;\n      let minHeight = 0;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Lookup the tab bar and widget sizers.\n      let [tabBarSizer, widgetSizer] = this.sizers;\n\n      // Update the tab bar limits.\n      if (tabBarItem) {\n        tabBarItem.fit();\n      }\n\n      // Update the widget limits.\n      if (widgetItem) {\n        widgetItem.fit();\n      }\n\n      // Update the results and sizer for the tab bar.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        minWidth = Math.max(minWidth, tabBarItem.minWidth);\n        minHeight += tabBarItem.minHeight;\n        tabBarSizer.minSize = tabBarItem.minHeight;\n        tabBarSizer.maxSize = tabBarItem.maxHeight;\n      } else {\n        tabBarSizer.minSize = 0;\n        tabBarSizer.maxSize = 0;\n      }\n\n      // Update the results and sizer for the current widget.\n      if (widgetItem && !widgetItem.isHidden) {\n        minWidth = Math.max(minWidth, widgetItem.minWidth);\n        minHeight += widgetItem.minHeight;\n        widgetSizer.minSize = widgetItem.minHeight;\n        widgetSizer.maxSize = Infinity;\n      } else {\n        widgetSizer.minSize = 0;\n        widgetSizer.maxSize = Infinity;\n      }\n\n      // Return the computed size limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Update the layout box values.\n      this._top = top;\n      this._left = left;\n      this._width = width;\n      this._height = height;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, height);\n\n      // Update the tab bar item using the computed size.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        let size = this.sizers[0].size;\n        tabBarItem.update(left, top, width, size);\n        top += size;\n      }\n\n      // Layout the widget using the computed size.\n      if (widgetItem && !widgetItem.isHidden) {\n        let size = this.sizers[1].size;\n        widgetItem.update(left, top, width, size);\n      }\n    }\n\n    private _top = 0;\n    private _left = 0;\n    private _width = 0;\n    private _height = 0;\n  }\n\n  /**\n   * A layout node which holds the data for a split area.\n   */\n  export class SplitLayoutNode {\n    /**\n     * Construct a new split layout node.\n     *\n     * @param orientation - The orientation of the node.\n     */\n    constructor(orientation: Orientation) {\n      this.orientation = orientation;\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * Whether the sizers have been normalized.\n     */\n    normalized = false;\n\n    /**\n     * The orientation of the node.\n     */\n    readonly orientation: Orientation;\n\n    /**\n     * The child nodes for the split node.\n     */\n    readonly children: LayoutNode[] = [];\n\n    /**\n     * The box sizers for the layout children.\n     */\n    readonly sizers: BoxSizer[] = [];\n\n    /**\n     * The handles for the layout children.\n     */\n    readonly handles: HTMLDivElement[] = [];\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterAllWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterUserWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterSelectedWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      for (const child of this.children) {\n        yield* child.iterTabBars();\n      }\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      yield* this.handles;\n      for (const child of this.children) {\n        yield* child.iterHandles();\n      }\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findTabNode(widget);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      let index = this.handles.indexOf(handle);\n      if (index !== -1) {\n        return { index, node: this };\n      }\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findSplitNode(handle);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      if (this.children.length === 0) {\n        return null;\n      }\n      return this.children[0].findFirstTabNode();\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].hitTestTabNodes(x, y);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ISplitAreaConfig {\n      let orientation = this.orientation;\n      let sizes = this.createNormalizedSizes();\n      let children = this.children.map(child => child.createConfig());\n      return { type: 'split-area', orientation, children, sizes };\n    }\n\n    /**\n     * Sync the visibility and orientation of the handles.\n     */\n    syncHandles(): void {\n      this.handles.forEach((handle, i) => {\n        handle.setAttribute('data-orientation', this.orientation);\n        if (i === this.handles.length - 1) {\n          handle.classList.add('lm-mod-hidden');\n        } else {\n          handle.classList.remove('lm-mod-hidden');\n        }\n      });\n    }\n\n    /**\n     * Hold the current sizes of the box sizers.\n     *\n     * This sets the size hint of each sizer to its current size.\n     */\n    holdSizes(): void {\n      for (const sizer of this.sizers) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      for (const child of this.children) {\n        child.holdAllSizes();\n      }\n      this.holdSizes();\n    }\n\n    /**\n     * Normalize the sizes of the split layout node.\n     */\n    normalizeSizes(): void {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return;\n      }\n\n      // Hold the current sizes of the sizers.\n      this.holdSizes();\n\n      // Compute the sum of the sizes.\n      let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint = 1 / n;\n        }\n      } else {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint /= sum;\n        }\n      }\n\n      // Mark the sizes as normalized.\n      this.normalized = true;\n    }\n\n    /**\n     * Snap the normalized sizes of the split layout node.\n     */\n    createNormalizedSizes(): number[] {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return [];\n      }\n\n      // Grab the current sizes of the sizers.\n      let sizes = this.sizers.map(sizer => sizer.size);\n\n      // Compute the sum of the sizes.\n      let sum = sizes.reduce((v, size) => v + size, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] = 1 / n;\n        }\n      } else {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] /= sum;\n        }\n      }\n\n      // Return the normalized sizes.\n      return sizes;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Compute the required fixed space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n      // Set up the limit variables.\n      let minWidth = horizontal ? fixed : 0;\n      let minHeight = horizontal ? 0 : fixed;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Fit the children and update the limits.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let limits = this.children[i].fit(spacing, items);\n        if (horizontal) {\n          minHeight = Math.max(minHeight, limits.minHeight);\n          minWidth += limits.minWidth;\n          this.sizers[i].minSize = limits.minWidth;\n        } else {\n          minWidth = Math.max(minWidth, limits.minWidth);\n          minHeight += limits.minHeight;\n          this.sizers[i].minSize = limits.minHeight;\n        }\n      }\n\n      // Return the computed limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Compute the available layout space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n      let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n      // De-normalize the sizes if needed.\n      if (this.normalized) {\n        for (const sizer of this.sizers) {\n          sizer.sizeHint *= space;\n        }\n        this.normalized = false;\n      }\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, space);\n\n      // Update the geometry of the child nodes and handles.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let child = this.children[i];\n        let size = this.sizers[i].size;\n        let handleStyle = this.handles[i].style;\n        if (horizontal) {\n          child.update(left, top, size, height, spacing, items);\n          left += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${spacing}px`;\n          handleStyle.height = `${height}px`;\n          left += spacing;\n        } else {\n          child.update(left, top, width, size, spacing, items);\n          top += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${width}px`;\n          handleStyle.height = `${spacing}px`;\n          top += spacing;\n        }\n      }\n    }\n  }\n\n  export function addAria(widget: Widget, tabBar: TabBar<Widget>): void {\n    widget.node.setAttribute('role', 'tabpanel');\n    let renderer = tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  export function removeAria(widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n  }\n\n  /**\n   * Normalize a tab area config and collect the visited widgets.\n   */\n  function normalizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.ITabAreaConfig | null {\n    // Bail early if there is no content.\n    if (config.widgets.length === 0) {\n      return null;\n    }\n\n    // Setup the filtered widgets array.\n    let widgets: Widget[] = [];\n\n    // Filter the config for unique widgets.\n    for (const widget of config.widgets) {\n      if (!widgetSet.has(widget)) {\n        widgetSet.add(widget);\n        widgets.push(widget);\n      }\n    }\n\n    // Bail if there are no effective widgets.\n    if (widgets.length === 0) {\n      return null;\n    }\n\n    // Normalize the current index.\n    let index = config.currentIndex;\n    if (index !== -1 && (index < 0 || index >= widgets.length)) {\n      index = 0;\n    }\n\n    // Return a normalized config object.\n    return { type: 'tab-area', widgets, currentIndex: index };\n  }\n\n  /**\n   * Normalize a split area config and collect the visited widgets.\n   */\n  function normalizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    // Set up the result variables.\n    let orientation = config.orientation;\n    let children: DockLayout.AreaConfig[] = [];\n    let sizes: number[] = [];\n\n    // Normalize the config children.\n    for (let i = 0, n = config.children.length; i < n; ++i) {\n      // Normalize the child config.\n      let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n      // Ignore an empty child.\n      if (!child) {\n        continue;\n      }\n\n      // Add the child or hoist its content as appropriate.\n      if (child.type === 'tab-area' || child.orientation !== orientation) {\n        children.push(child);\n        sizes.push(Math.abs(config.sizes[i] || 0));\n      } else {\n        children.push(...child.children);\n        sizes.push(...child.sizes);\n      }\n    }\n\n    // Bail if there are no effective children.\n    if (children.length === 0) {\n      return null;\n    }\n\n    // If there is only one effective child, return that child.\n    if (children.length === 1) {\n      return children[0];\n    }\n\n    // Return a normalized config object.\n    return { type: 'split-area', orientation, children, sizes };\n  }\n\n  /**\n   * Convert a normalized tab area config into a layout tree.\n   */\n  function realizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): TabLayoutNode {\n    // Create the tab bar for the layout node.\n    let tabBar = renderer.createTabBar(document);\n\n    // Hide each widget and add it to the tab bar.\n    for (const widget of config.widgets) {\n      widget.hide();\n      tabBar.addTab(widget.title);\n      Private.addAria(widget, tabBar);\n    }\n\n    // Set the current index of the tab bar.\n    tabBar.currentIndex = config.currentIndex;\n\n    // Return the new tab layout node.\n    return new TabLayoutNode(tabBar);\n  }\n\n  /**\n   * Convert a normalized split area config into a layout tree.\n   */\n  function realizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): SplitLayoutNode {\n    // Create the split layout node.\n    let node = new SplitLayoutNode(config.orientation);\n\n    // Add each child to the layout node.\n    config.children.forEach((child, i) => {\n      // Create the child data for the layout node.\n      let childNode = realizeAreaConfig(child, renderer, document);\n      let sizer = createSizer(config.sizes[i]);\n      let handle = renderer.createHandle();\n\n      // Add the child data to the layout node.\n      node.children.push(childNode);\n      node.handles.push(handle);\n      node.sizers.push(sizer);\n\n      // Update the parent for the child node.\n      childNode.parent = node;\n    });\n\n    // Synchronize the handle state for the layout node.\n    node.syncHandles();\n\n    // Normalize the sizes for the layout node.\n    node.normalizeSizes();\n\n    // Return the new layout node.\n    return node;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n  /**\n   * Construct a new dock panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: DockPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-DockPanel');\n    this._document = options.document || document;\n    this._mode = options.mode || 'multiple-document';\n    this._renderer = options.renderer || DockPanel.defaultRenderer;\n    this._edges = options.edges || Private.DEFAULT_EDGES;\n    if (options.tabsMovable !== undefined) {\n      this._tabsMovable = options.tabsMovable;\n    }\n    if (options.tabsConstrained !== undefined) {\n      this._tabsConstrained = options.tabsConstrained;\n    }\n    if (options.addButtonEnabled !== undefined) {\n      this._addButtonEnabled = options.addButtonEnabled;\n    }\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = this._mode;\n\n    // Create the delegate renderer for the layout.\n    let renderer: DockPanel.IRenderer = {\n      createTabBar: () => this._createTabBar(),\n      createHandle: () => this._createHandle()\n    };\n\n    // Set up the dock layout for the panel.\n    this.layout = new DockLayout({\n      document: this._document,\n      renderer,\n      spacing: options.spacing,\n      hiddenMode: options.hiddenMode\n    });\n\n    // Set up the overlay drop indicator.\n    this.overlay = options.overlay || new DockPanel.Overlay();\n    this.node.appendChild(this.overlay.node);\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    // Ensure the mouse is released.\n    this._releaseMouse();\n\n    // Hide the overlay.\n    this.overlay.hide(0);\n\n    // Cancel a drag if one is in progress.\n    if (this._drag) {\n      this._drag.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The method for hiding widgets.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as DockLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as DockLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when the layout configuration is modified.\n   *\n   * #### Notes\n   * This signal is emitted whenever the current layout configuration\n   * may have changed.\n   *\n   * This signal is emitted asynchronously in a collapsed fashion, so\n   * that multiple synchronous modifications results in only a single\n   * emit of the signal.\n   */\n  get layoutModified(): ISignal<this, void> {\n    return this._layoutModified;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The overlay used by the dock panel.\n   */\n  readonly overlay: DockPanel.IOverlay;\n\n  /**\n   * The renderer used by the dock panel.\n   */\n  get renderer(): DockPanel.IRenderer {\n    return (this.layout as DockLayout).renderer;\n  }\n\n  /**\n   * Get the spacing between the widgets.\n   */\n  get spacing(): number {\n    return (this.layout as DockLayout).spacing;\n  }\n\n  /**\n   * Set the spacing between the widgets.\n   */\n  set spacing(value: number) {\n    (this.layout as DockLayout).spacing = value;\n  }\n\n  /**\n   * Get the mode for the dock panel.\n   */\n  get mode(): DockPanel.Mode {\n    return this._mode;\n  }\n\n  /**\n   * Set the mode for the dock panel.\n   *\n   * #### Notes\n   * Changing the mode is a destructive operation with respect to the\n   * panel's layout configuration. If layout state must be preserved,\n   * save the current layout config before changing the mode.\n   */\n  set mode(value: DockPanel.Mode) {\n    // Bail early if the mode does not change.\n    if (this._mode === value) {\n      return;\n    }\n\n    // Update the internal mode.\n    this._mode = value;\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = value;\n\n    // Get the layout for the panel.\n    let layout = this.layout as DockLayout;\n\n    // Configure the layout for the specified mode.\n    switch (value) {\n      case 'multiple-document':\n        for (const tabBar of layout.tabBars()) {\n          tabBar.show();\n        }\n        break;\n      case 'single-document':\n        layout.restoreLayout(Private.createSingleDocumentConfig(this));\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Whether the tabs can be dragged / moved at runtime.\n   */\n  get tabsMovable(): boolean {\n    return this._tabsMovable;\n  }\n\n  /**\n   * Enable / Disable draggable / movable tabs.\n   */\n  set tabsMovable(value: boolean) {\n    this._tabsMovable = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.tabsMovable = value;\n    }\n  }\n\n  /**\n   * Whether the tabs are constrained to their source dock panel\n   */\n  get tabsConstrained(): boolean {\n    return this._tabsConstrained;\n  }\n\n  /**\n   * Constrain/Allow tabs to be dragged outside of this dock panel\n   */\n  set tabsConstrained(value: boolean) {\n    this._tabsConstrained = value;\n  }\n\n  /**\n   * Whether the add buttons for each tab bar are enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add buttons for each tab bar are enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    this._addButtonEnabled = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.addButtonEnabled = value;\n    }\n  }\n\n  /**\n   * Whether the dock panel is empty.\n   */\n  get isEmpty(): boolean {\n    return (this.layout as DockLayout).isEmpty;\n  }\n\n  /**\n   * Create an iterator over the user widgets in the panel.\n   *\n   * @returns A new iterator over the user widgets in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  *widgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).widgets();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the panel.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the panel.\n   */\n  *selectedWidgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).selectedWidgets();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the panel.\n   *\n   * @returns A new iterator over the tab bars in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  *tabBars(): IterableIterator<TabBar<Widget>> {\n    yield* (this.layout as DockLayout).tabBars();\n  }\n\n  /**\n   * Create an iterator over the handles in the panel.\n   *\n   * @returns A new iterator over the handles in the panel.\n   */\n  *handles(): IterableIterator<HTMLDivElement> {\n    yield* (this.layout as DockLayout).handles();\n  }\n\n  /**\n   * Select a specific widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will make the widget the current widget in its tab area.\n   */\n  selectWidget(widget: Widget): void {\n    // Find the tab bar which contains the widget.\n    let tabBar = find(this.tabBars(), bar => {\n      return bar.titles.indexOf(widget.title) !== -1;\n    });\n\n    // Throw an error if no tab bar is found.\n    if (!tabBar) {\n      throw new Error('Widget is not contained in the dock panel.');\n    }\n\n    // Ensure the widget is the current widget.\n    tabBar.currentTitle = widget.title;\n  }\n\n  /**\n   * Activate a specified widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will select and activate the given widget.\n   */\n  activateWidget(widget: Widget): void {\n    this.selectWidget(widget);\n    widget.activate();\n  }\n\n  /**\n   * Save the current layout configuration of the dock panel.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockPanel.ILayoutConfig {\n    return (this.layout as DockLayout).saveLayout();\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   *\n   * The dock panel automatically reverts to `'multiple-document'`\n   * mode when a layout config is restored.\n   */\n  restoreLayout(config: DockPanel.ILayoutConfig): void {\n    // Reset the mode.\n    this._mode = 'multiple-document';\n\n    // Restore the layout.\n    (this.layout as DockLayout).restoreLayout(config);\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Add a widget to the dock panel.\n   *\n   * @param widget - The widget to add to the dock panel.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * If the panel is in single document mode, the options are ignored\n   * and the widget is always added as tab in the hidden tab bar.\n   */\n  addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n    // Add the widget to the layout.\n    if (this._mode === 'single-document') {\n      (this.layout as DockLayout).addWidget(widget);\n    } else {\n      (this.layout as DockLayout).addWidget(widget, options);\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   */\n  processMessage(msg: Message): void {\n    if (msg.type === 'layout-modified') {\n      this._layoutModified.emit(undefined);\n    } else {\n      super.processMessage(msg);\n    }\n  }\n\n  /**\n   * Handle the DOM events for the dock panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'lm-dragenter':\n        this._evtDragEnter(event as Drag.Event);\n        break;\n      case 'lm-dragleave':\n        this._evtDragLeave(event as Drag.Event);\n        break;\n      case 'lm-dragover':\n        this._evtDragOver(event as Drag.Event);\n        break;\n      case 'lm-drop':\n        this._evtDrop(event as Drag.Event);\n        break;\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('lm-dragenter', this);\n    this.node.addEventListener('lm-dragleave', this);\n    this.node.addEventListener('lm-dragover', this);\n    this.node.addEventListener('lm-drop', this);\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('lm-dragenter', this);\n    this.node.removeEventListener('lm-dragleave', this);\n    this.node.removeEventListener('lm-dragover', this);\n    this.node.removeEventListener('lm-drop', this);\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Add the widget class to the child.\n    msg.child.addClass('lm-DockPanel-widget');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Remove the widget class from the child.\n    msg.child.removeClass('lm-DockPanel-widget');\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `'lm-dragenter'` event for the dock panel.\n   */\n  private _evtDragEnter(event: Drag.Event): void {\n    // If the factory mime type is present, mark the event as\n    // handled in order to get the rest of the drag events.\n    if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n  }\n\n  /**\n   * Handle the `'lm-dragleave'` event for the dock panel.\n   */\n  private _evtDragLeave(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    if (this._tabsConstrained && event.source !== this) return;\n\n    event.stopPropagation();\n\n    // The new target might be a descendant, so we might still handle the drop.\n    // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n    // hide is cancelled by the lm-dragover handler's show overlay logic.\n    this.overlay.hide(1);\n  }\n\n  /**\n   * Handle the `'lm-dragover'` event for the dock panel.\n   */\n  private _evtDragOver(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Show the drop indicator overlay and update the drop\n    // action based on the drop target zone under the mouse.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      this._showOverlay(event.clientX, event.clientY) === 'invalid'\n    ) {\n      event.dropAction = 'none';\n    } else {\n      event.stopPropagation();\n      event.dropAction = event.proposedAction;\n    }\n  }\n\n  /**\n   * Handle the `'lm-drop'` event for the dock panel.\n   */\n  private _evtDrop(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Hide the drop indicator overlay.\n    this.overlay.hide(0);\n\n    // Bail if the proposed action is to do nothing.\n    if (event.proposedAction === 'none') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the drop target under the mouse.\n    let { clientX, clientY } = event;\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // Bail if the drop zone is invalid.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      zone === 'invalid'\n    ) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory mime type has invalid data.\n    let mimeData = event.mimeData;\n    let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n    if (typeof factory !== 'function') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory does not produce a widget.\n    let widget = factory();\n    if (!(widget instanceof Widget)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the widget is an ancestor of the dock panel.\n    if (widget.contains(this)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the reference widget for the drop target.\n    let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n    // Add the widget according to the indicated drop zone.\n    switch (zone) {\n      case 'root-all':\n        this.addWidget(widget);\n        break;\n      case 'root-top':\n        this.addWidget(widget, { mode: 'split-top' });\n        break;\n      case 'root-left':\n        this.addWidget(widget, { mode: 'split-left' });\n        break;\n      case 'root-right':\n        this.addWidget(widget, { mode: 'split-right' });\n        break;\n      case 'root-bottom':\n        this.addWidget(widget, { mode: 'split-bottom' });\n        break;\n      case 'widget-all':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      case 'widget-top':\n        this.addWidget(widget, { mode: 'split-top', ref });\n        break;\n      case 'widget-left':\n        this.addWidget(widget, { mode: 'split-left', ref });\n        break;\n      case 'widget-right':\n        this.addWidget(widget, { mode: 'split-right', ref });\n        break;\n      case 'widget-bottom':\n        this.addWidget(widget, { mode: 'split-bottom', ref });\n        break;\n      case 'widget-tab':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Accept the proposed drop action.\n    event.dropAction = event.proposedAction;\n\n    // Stop propagation if we have not bailed so far.\n    event.stopPropagation();\n\n    // Activate the dropped widget.\n    this.activateWidget(widget);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the dock panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      // Finalize the mouse release.\n      this._releaseMouse();\n\n      // Schedule an emit of the layout modified signal.\n      MessageLoop.postMessage(this, Private.LayoutModified);\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the dock panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the mouse target, if any.\n    let layout = this.layout as DockLayout;\n    let target = event.target as HTMLElement;\n    let handle = find(layout.handles(), handle => handle.contains(target));\n    if (!handle) {\n      return;\n    }\n\n    // Stop the event when a handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    this._document.addEventListener('keydown', this, true);\n    this._document.addEventListener('pointerup', this, true);\n    this._document.addEventListener('pointermove', this, true);\n    this._document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset deltas for the handle press.\n    let rect = handle.getBoundingClientRect();\n    let deltaX = event.clientX - rect.left;\n    let deltaY = event.clientY - rect.top;\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!, this._document);\n    this._pressData = { handle, deltaX, deltaY, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the dock panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event when dragging a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let rect = this.node.getBoundingClientRect();\n    let xPos = event.clientX - rect.left - this._pressData.deltaX;\n    let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n    // Set the handle as close to the desired position as possible.\n    let layout = this.layout as DockLayout;\n    layout.moveHandle(this._pressData.handle, xPos, yPos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the dock panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Release the mouse grab for the dock panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra document listeners.\n    this._document.removeEventListener('keydown', this, true);\n    this._document.removeEventListener('pointerup', this, true);\n    this._document.removeEventListener('pointermove', this, true);\n    this._document.removeEventListener('contextmenu', this, true);\n  }\n\n  /**\n   * Show the overlay indicator at the given client position.\n   *\n   * Returns the drop zone at the specified client position.\n   *\n   * #### Notes\n   * If the position is not over a valid zone, the overlay is hidden.\n   */\n  private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n    // Find the dock target for the given client position.\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // If the drop zone is invalid, hide the overlay and bail.\n    if (zone === 'invalid') {\n      this.overlay.hide(100);\n      return zone;\n    }\n\n    // Setup the variables needed to compute the overlay geometry.\n    let top: number;\n    let left: number;\n    let right: number;\n    let bottom: number;\n    let box = ElementExt.boxSizing(this.node); // TODO cache this?\n    let rect = this.node.getBoundingClientRect();\n\n    // Compute the overlay geometry based on the dock zone.\n    switch (zone) {\n      case 'root-all':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-top':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = rect.height * Private.GOLDEN_RATIO;\n        break;\n      case 'root-left':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = rect.width * Private.GOLDEN_RATIO;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-right':\n        top = box.paddingTop;\n        left = rect.width * Private.GOLDEN_RATIO;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-bottom':\n        top = rect.height * Private.GOLDEN_RATIO;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'widget-all':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-top':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height / 2;\n        break;\n      case 'widget-left':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right + target!.width / 2;\n        bottom = target!.bottom;\n        break;\n      case 'widget-right':\n        top = target!.top;\n        left = target!.left + target!.width / 2;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-bottom':\n        top = target!.top + target!.height / 2;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-tab': {\n        const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height - tabHeight;\n        break;\n      }\n      default:\n        throw 'unreachable';\n    }\n\n    // Show the overlay with the computed geometry.\n    this.overlay.show({ top, left, right, bottom });\n\n    // Finally, return the computed drop zone.\n    return zone;\n  }\n\n  /**\n   * Create a new tab bar for use by the panel.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar.\n    let tabBar = this._renderer.createTabBar(this._document);\n\n    // Set the generated tab bar property for the tab bar.\n    Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n    // Hide the tab bar when in single document mode.\n    if (this._mode === 'single-document') {\n      tabBar.hide();\n    }\n\n    // Enforce necessary tab bar behavior.\n    // TODO do we really want to enforce *all* of these?\n    tabBar.tabsMovable = this._tabsMovable;\n    tabBar.allowDeselect = false;\n    tabBar.addButtonEnabled = this._addButtonEnabled;\n    tabBar.removeBehavior = 'select-previous-tab';\n    tabBar.insertBehavior = 'select-tab-if-needed';\n\n    // Connect the signal handlers for the tab bar.\n    tabBar.tabMoved.connect(this._onTabMoved, this);\n    tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n    tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n    tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for use by the panel.\n   */\n  private _createHandle(): HTMLDivElement {\n    return this._renderer.createHandle();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from a tab bar.\n   */\n  private _onTabMoved(): void {\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `currentChanged` signal from a tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousTitle, currentTitle } = args;\n\n    // Hide the previous widget.\n    if (previousTitle) {\n      previousTitle.owner.hide();\n    }\n\n    // Show the current widget.\n    if (currentTitle) {\n      currentTitle.owner.show();\n    }\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `addRequested` signal from a tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from a tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from a tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabDetachRequested` signal from a tab bar.\n   */\n  private _onTabDetachRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabDetachRequestedArgs<Widget>\n  ): void {\n    // Do nothing if a drag is already in progress.\n    if (this._drag) {\n      return;\n    }\n\n    // Release the tab bar's hold on the mouse.\n    sender.releaseMouse();\n\n    // Extract the data from the args.\n    let { title, tab, clientX, clientY, offset } = args;\n\n    // Setup the mime data for the drag operation.\n    let mimeData = new MimeData();\n    let factory = () => title.owner;\n    mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n    // Create the drag image for the drag operation.\n    let dragImage = tab.cloneNode(true) as HTMLElement;\n    if (offset) {\n      dragImage.style.top = `-${offset.y}px`;\n      dragImage.style.left = `-${offset.x}px`;\n    }\n\n    // Create the drag object to manage the drag-drop operation.\n    this._drag = new Drag({\n      document: this._document,\n      mimeData,\n      dragImage,\n      proposedAction: 'move',\n      supportedActions: 'move',\n      source: this\n    });\n\n    // Hide the tab node in the original tab.\n    tab.classList.add('lm-mod-hidden');\n    let cleanup = () => {\n      this._drag = null;\n      tab.classList.remove('lm-mod-hidden');\n    };\n\n    // Start the drag operation and cleanup when done.\n    this._drag.start(clientX, clientY).then(cleanup);\n  }\n\n  private _edges: DockPanel.IEdges;\n  private _document: Document | ShadowRoot;\n  private _mode: DockPanel.Mode;\n  private _drag: Drag | null = null;\n  private _renderer: DockPanel.IRenderer;\n  private _tabsMovable: boolean = true;\n  private _tabsConstrained: boolean = false;\n  private _addButtonEnabled: boolean = false;\n  private _pressData: Private.IPressData | null = null;\n  private _layoutModified = new Signal<this, void>(this);\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n  /**\n   * An options object for creating a dock panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n    /**\n     * The overlay to use with the dock panel.\n     *\n     * The default is a new `Overlay` instance.\n     */\n    overlay?: IOverlay;\n\n    /**\n     * The renderer to use for the dock panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The spacing between the items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The mode for the dock panel.\n     *\n     * The default is `'multiple-document'`.\n     */\n    mode?: DockPanel.Mode;\n\n    /**\n     * The sizes of the edge drop zones, in pixels.\n     * If not given, default values will be used.\n     */\n    edges?: IEdges;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * Allow tabs to be draggable / movable by user.\n     *\n     * The default is `'true'`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Constrain tabs to this dock panel\n     *\n     * The default is `'false'`.\n     */\n    tabsConstrained?: boolean;\n\n    /**\n     * Enable add buttons in each of the dock panel's tab bars.\n     *\n     * The default is `'false'`.\n     */\n    addButtonEnabled?: boolean;\n  }\n\n  /**\n   * The sizes of the edge drop zones, in pixels.\n   */\n  export interface IEdges {\n    /**\n     * The size of the top edge drop zone.\n     */\n    top: number;\n\n    /**\n     * The size of the right edge drop zone.\n     */\n    right: number;\n\n    /**\n     * The size of the bottom edge drop zone.\n     */\n    bottom: number;\n\n    /**\n     * The size of the left edge drop zone.\n     */\n    left: number;\n  }\n\n  /**\n   * A type alias for the supported dock panel modes.\n   */\n  export type Mode =\n    | /**\n     * The single document mode.\n     *\n     * In this mode, only a single widget is visible at a time, and that\n     * widget fills the available layout space. No tab bars are visible.\n     */\n    'single-document'\n\n    /**\n     * The multiple document mode.\n     *\n     * In this mode, multiple documents are displayed in separate tab\n     * areas, and those areas can be individually resized by the user.\n     */\n    | 'multiple-document';\n\n  /**\n   * A type alias for a layout configuration object.\n   */\n  export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n  /**\n   * A type alias for the supported insertion modes.\n   */\n  export type InsertMode = DockLayout.InsertMode;\n\n  /**\n   * A type alias for the add widget options.\n   */\n  export type IAddOptions = DockLayout.IAddOptions;\n\n  /**\n   * An object which holds the geometry for overlay positioning.\n   */\n  export interface IOverlayGeometry {\n    /**\n     * The distance between the overlay and parent top edges.\n     */\n    top: number;\n\n    /**\n     * The distance between the overlay and parent left edges.\n     */\n    left: number;\n\n    /**\n     * The distance between the overlay and parent right edges.\n     */\n    right: number;\n\n    /**\n     * The distance between the overlay and parent bottom edges.\n     */\n    bottom: number;\n  }\n\n  /**\n   * An object which manages the overlay node for a dock panel.\n   */\n  export interface IOverlay {\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     *\n     * #### Notes\n     * The given geometry values assume the node will use absolute\n     * positioning.\n     *\n     * This is called on every mouse move event during a drag in order\n     * to update the position of the overlay. It should be efficient.\n     */\n    show(geo: IOverlayGeometry): void;\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 should hide the overlay immediately.\n     *\n     * #### Notes\n     * This is called whenever the overlay node should been hidden.\n     */\n    hide(delay: number): void;\n  }\n\n  /**\n   * A concrete implementation of `IOverlay`.\n   *\n   * This is the default overlay implementation for a dock panel.\n   */\n  export class Overlay implements IOverlay {\n    /**\n     * Construct a new overlay.\n     */\n    constructor() {\n      this.node = document.createElement('div');\n      this.node.classList.add('lm-DockPanel-overlay');\n      this.node.classList.add('lm-mod-hidden');\n      this.node.style.position = 'absolute';\n      this.node.style.contain = 'strict';\n    }\n\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     */\n    show(geo: IOverlayGeometry): void {\n      // Update the position of the overlay.\n      let style = this.node.style;\n      style.top = `${geo.top}px`;\n      style.left = `${geo.left}px`;\n      style.right = `${geo.right}px`;\n      style.bottom = `${geo.bottom}px`;\n\n      // Clear any pending hide timer.\n      clearTimeout(this._timer);\n      this._timer = -1;\n\n      // If the overlay is already visible, we're done.\n      if (!this._hidden) {\n        return;\n      }\n\n      // Clear the hidden flag.\n      this._hidden = false;\n\n      // Finally, show the overlay.\n      this.node.classList.remove('lm-mod-hidden');\n    }\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 will hide the overlay immediately.\n     */\n    hide(delay: number): void {\n      // Do nothing if the overlay is already hidden.\n      if (this._hidden) {\n        return;\n      }\n\n      // Hide immediately if the delay is <= 0.\n      if (delay <= 0) {\n        clearTimeout(this._timer);\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n        return;\n      }\n\n      // Do nothing if a hide is already pending.\n      if (this._timer !== -1) {\n        return;\n      }\n\n      // Otherwise setup the hide timer.\n      this._timer = window.setTimeout(() => {\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n      }, delay);\n    }\n\n    private _timer = -1;\n    private _hidden = true;\n  }\n\n  /**\n   * A type alias for a dock panel renderer;\n   */\n  export type IRenderer = DockLayout.IRenderer;\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new tab bar for use with a dock panel.\n     *\n     * @returns A new tab bar for a dock panel.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget> {\n      let bar = new TabBar<Widget>({ document });\n      bar.addClass('lm-DockPanel-tabBar');\n      return bar;\n    }\n\n    /**\n     * Create a new handle node for use with a dock panel.\n     *\n     * @returns A new handle node for a dock panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-DockPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * The default sizes for the edge drop zones, in pixels.\n   */\n  export const DEFAULT_EDGES = {\n    /**\n     * The size of the top edge dock zone for the root panel, in pixels.\n     * This is different from the others to distinguish between the top\n     * tab bar and the top root zone.\n     */\n    top: 12,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    right: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    bottom: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    left: 40\n  };\n\n  /**\n   * A singleton `'layout-modified'` conflatable message.\n   */\n  export const LayoutModified = new ConflatableMessage('layout-modified');\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The handle which was pressed.\n     */\n    handle: HTMLDivElement;\n\n    /**\n     * The X offset of the press in handle coordinates.\n     */\n    deltaX: number;\n\n    /**\n     * The Y offset of the press in handle coordinates.\n     */\n    deltaY: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * A type alias for a drop zone.\n   */\n  export type DropZone =\n    | /**\n     * An invalid drop zone.\n     */\n    'invalid'\n\n    /**\n     * The entirety of the root dock area.\n     */\n    | 'root-all'\n\n    /**\n     * The top portion of the root dock area.\n     */\n    | 'root-top'\n\n    /**\n     * The left portion of the root dock area.\n     */\n    | 'root-left'\n\n    /**\n     * The right portion of the root dock area.\n     */\n    | 'root-right'\n\n    /**\n     * The bottom portion of the root dock area.\n     */\n    | 'root-bottom'\n\n    /**\n     * The entirety of a tabbed widget area.\n     */\n    | 'widget-all'\n\n    /**\n     * The top portion of tabbed widget area.\n     */\n    | 'widget-top'\n\n    /**\n     * The left portion of tabbed widget area.\n     */\n    | 'widget-left'\n\n    /**\n     * The right portion of tabbed widget area.\n     */\n    | 'widget-right'\n\n    /**\n     * The bottom portion of tabbed widget area.\n     */\n    | 'widget-bottom'\n\n    /**\n     * The the bar of a tabbed widget area.\n     */\n    | 'widget-tab';\n\n  /**\n   * An object which holds the drop target zone and widget.\n   */\n  export interface IDropTarget {\n    /**\n     * The semantic zone for the mouse position.\n     */\n    zone: DropZone;\n\n    /**\n     * The tab area geometry for the drop zone, or `null`.\n     */\n    target: DockLayout.ITabAreaGeometry | null;\n  }\n\n  /**\n   * An attached property used to track generated tab bars.\n   */\n  export const isGeneratedTabBarProperty = new AttachedProperty<\n    Widget,\n    boolean\n  >({\n    name: 'isGeneratedTabBar',\n    create: () => false\n  });\n\n  /**\n   * Create a single document config for the widgets in a dock panel.\n   */\n  export function createSingleDocumentConfig(\n    panel: DockPanel\n  ): DockPanel.ILayoutConfig {\n    // Return an empty config if the panel is empty.\n    if (panel.isEmpty) {\n      return { main: null };\n    }\n\n    // Get a flat array of the widgets in the panel.\n    let widgets = Array.from(panel.widgets());\n\n    // Get the first selected widget in the panel.\n    let selected = panel.selectedWidgets().next().value;\n\n    // Compute the current index for the new config.\n    let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n    // Return the single document config.\n    return { main: { type: 'tab-area', widgets, currentIndex } };\n  }\n\n  /**\n   * Find the drop target at the given client position.\n   */\n  export function findDropTarget(\n    panel: DockPanel,\n    clientX: number,\n    clientY: number,\n    edges: DockPanel.IEdges\n  ): IDropTarget {\n    // Bail if the mouse is not over the dock panel.\n    if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Look up the layout for the panel.\n    let layout = panel.layout as DockLayout;\n\n    // If the layout is empty, indicate the entire root drop zone.\n    if (layout.isEmpty) {\n      return { zone: 'root-all', target: null };\n    }\n\n    // Test the edge zones when in multiple document mode.\n    if (panel.mode === 'multiple-document') {\n      // Get the client rect for the dock panel.\n      let panelRect = panel.node.getBoundingClientRect();\n\n      // Compute the distance to each edge of the panel.\n      let pl = clientX - panelRect.left + 1;\n      let pt = clientY - panelRect.top + 1;\n      let pr = panelRect.right - clientX;\n      let pb = panelRect.bottom - clientY;\n\n      // Find the minimum distance to an edge.\n      let pd = Math.min(pt, pr, pb, pl);\n\n      // Return a root zone if the mouse is within an edge.\n      switch (pd) {\n        case pt:\n          if (pt < edges.top) {\n            return { zone: 'root-top', target: null };\n          }\n          break;\n        case pr:\n          if (pr < edges.right) {\n            return { zone: 'root-right', target: null };\n          }\n          break;\n        case pb:\n          if (pb < edges.bottom) {\n            return { zone: 'root-bottom', target: null };\n          }\n          break;\n        case pl:\n          if (pl < edges.left) {\n            return { zone: 'root-left', target: null };\n          }\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Hit test the dock layout at the given client position.\n    let target = layout.hitTestTabAreas(clientX, clientY);\n\n    // Bail if no target area was found.\n    if (!target) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Return the whole tab area when in single document mode.\n    if (panel.mode === 'single-document') {\n      return { zone: 'widget-all', target };\n    }\n\n    // Compute the distance to each edge of the tab area.\n    let al = target.x - target.left + 1;\n    let at = target.y - target.top + 1;\n    let ar = target.left + target.width - target.x;\n    let ab = target.top + target.height - target.y;\n\n    const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n    if (at < tabHeight) {\n      return { zone: 'widget-tab', target };\n    }\n\n    // Get the X and Y edge sizes for the area.\n    let rx = Math.round(target.width / 3);\n    let ry = Math.round(target.height / 3);\n\n    // If the mouse is not within an edge, indicate the entire area.\n    if (al > rx && ar > rx && at > ry && ab > ry) {\n      return { zone: 'widget-all', target };\n    }\n\n    // Scale the distances by the slenderness ratio.\n    al /= rx;\n    at /= ry;\n    ar /= rx;\n    ab /= ry;\n\n    // Find the minimum distance to the area edge.\n    let ad = Math.min(al, at, ar, ab);\n\n    // Find the widget zone for the area edge.\n    let zone: DropZone;\n    switch (ad) {\n      case al:\n        zone = 'widget-left';\n        break;\n      case at:\n        zone = 'widget-top';\n        break;\n      case ar:\n        zone = 'widget-right';\n        break;\n      case ab:\n        zone = 'widget-bottom';\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Return the final drop target.\n    return { zone, target };\n  }\n\n  /**\n   * Get the drop reference widget for a tab bar.\n   */\n  export function getDropRef(tabBar: TabBar<Widget>): Widget | null {\n    if (tabBar.titles.length === 0) {\n      return null;\n    }\n    if (tabBar.currentTitle) {\n      return tabBar.currentTitle.owner;\n    }\n    return tabBar.titles[tabBar.titles.length - 1].owner;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n  /**\n   * Construct a new grid layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: GridLayout.IOptions = {}) {\n    super(options);\n    if (options.rowCount !== undefined) {\n      Private.reallocSizers(this._rowSizers, options.rowCount);\n    }\n    if (options.columnCount !== undefined) {\n      Private.reallocSizers(this._columnSizers, options.columnCount);\n    }\n    if (options.rowSpacing !== undefined) {\n      this._rowSpacing = Private.clampValue(options.rowSpacing);\n    }\n    if (options.columnSpacing !== undefined) {\n      this._columnSpacing = Private.clampValue(options.columnSpacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the widgets and layout items.\n    for (const item of this._items) {\n      let widget = item.widget;\n      item.dispose();\n      widget.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._rowStarts.length = 0;\n    this._rowSizers.length = 0;\n    this._columnStarts.length = 0;\n    this._columnSizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the number of rows in the layout.\n   */\n  get rowCount(): number {\n    return this._rowSizers.length;\n  }\n\n  /**\n   * Set the number of rows in the layout.\n   *\n   * #### Notes\n   * The minimum row count is `1`.\n   */\n  set rowCount(value: number) {\n    // Do nothing if the row count does not change.\n    if (value === this.rowCount) {\n      return;\n    }\n\n    // Reallocate the row sizers.\n    Private.reallocSizers(this._rowSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the number of columns in the layout.\n   */\n  get columnCount(): number {\n    return this._columnSizers.length;\n  }\n\n  /**\n   * Set the number of columns in the layout.\n   *\n   * #### Notes\n   * The minimum column count is `1`.\n   */\n  set columnCount(value: number) {\n    // Do nothing if the column count does not change.\n    if (value === this.columnCount) {\n      return;\n    }\n\n    // Reallocate the column sizers.\n    Private.reallocSizers(this._columnSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the row spacing for the layout.\n   */\n  get rowSpacing(): number {\n    return this._rowSpacing;\n  }\n\n  /**\n   * Set the row spacing for the layout.\n   */\n  set rowSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._rowSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._rowSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the column spacing for the layout.\n   */\n  get columnSpacing(): number {\n    return this._columnSpacing;\n  }\n\n  /**\n   * Set the col spacing for the layout.\n   */\n  set columnSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._columnSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._columnSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @returns The stretch factor for the row.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  rowStretch(index: number): number {\n    let sizer = this._rowSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @param value - The stretch factor for the row.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setRowStretch(index: number, value: number): void {\n    // Look up the row sizer.\n    let sizer = this._rowSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @returns The stretch factor for the column.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  columnStretch(index: number): number {\n    let sizer = this._columnSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @param value - The stretch factor for the column.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setColumnStretch(index: number, value: number): void {\n    // Look up the column sizer.\n    let sizer = this._columnSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    for (const item of this._items) {\n      yield item.widget;\n    }\n  }\n\n  /**\n   * Add a widget to the grid layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, this is no-op.\n   */\n  addWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is already in the layout.\n    if (i !== -1) {\n      return;\n    }\n\n    // Add the widget to the layout.\n    this._items.push(new LayoutItem(widget));\n\n    // Attach the widget to the parent.\n    if (this.parent) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the grid layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is not in the layout.\n    if (i === -1) {\n      return;\n    }\n\n    // Remove the widget from the layout.\n    let item = ArrayExt.removeAt(this._items, i)!;\n\n    // Detach the widget from the parent.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n\n    // Dispose the layout item.\n    item.dispose();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Reset the min sizes of the sizers.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      this._rowSizers[i].minSize = 0;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      this._columnSizers[i].minSize = 0;\n    }\n\n    // Filter for the visible layout items.\n    let items = this._items.filter(it => !it.isHidden);\n\n    // Fit the layout items.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      items[i].fit();\n    }\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Sort the items by row span.\n    items.sort(Private.rowSpanCmp);\n\n    // Update the min sizes of the row sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the row bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n      // Distribute the minimum height to the sizers as needed.\n      Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n    }\n\n    // Sort the items by column span.\n    items.sort(Private.columnSpanCmp);\n\n    // Update the min sizes of the column sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the column bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let c1 = Math.min(config.column, maxCol);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Distribute the minimum width to the sizers as needed.\n      Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n    }\n\n    // If no size constraint is needed, just update the parent.\n    if (this.fitPolicy === 'set-no-constraint') {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n      return;\n    }\n\n    // Set up the computed min size.\n    let minH = maxRow * this._rowSpacing;\n    let minW = maxCol * this._columnSpacing;\n\n    // Add the sizer minimums to the computed min size.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      minH += this._rowSizers[i].minSize;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      minW += this._columnSizers[i].minSize;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Compute the total fixed row and column space.\n    let fixedRowSpace = maxRow * this._rowSpacing;\n    let fixedColSpace = maxCol * this._columnSpacing;\n\n    // Distribute the available space to the box sizers.\n    BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n    BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n    // Update the row start positions.\n    for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n      this._rowStarts[i] = pos;\n      pos += this._rowSizers[i].size + this._rowSpacing;\n    }\n\n    // Update the column start positions.\n    for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n      this._columnStarts[i] = pos;\n      pos += this._columnSizers[i].size + this._columnSpacing;\n    }\n\n    // Update the geometry of the layout items.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the cell bounds for the widget.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let c1 = Math.min(config.column, maxCol);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Compute the cell geometry.\n      let x = this._columnStarts[c1];\n      let y = this._rowStarts[r1];\n      let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n      let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n      // Update the geometry of the layout item.\n      item.update(x, y, w, h);\n    }\n  }\n\n  private _dirty = false;\n  private _rowSpacing = 4;\n  private _columnSpacing = 4;\n  private _items: LayoutItem[] = [];\n  private _rowStarts: number[] = [];\n  private _columnStarts: number[] = [];\n  private _rowSizers: BoxSizer[] = [new BoxSizer()];\n  private _columnSizers: BoxSizer[] = [new BoxSizer()];\n  private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n  /**\n   * An options object for initializing a grid layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The initial row count for the layout.\n     *\n     * The default is `1`.\n     */\n    rowCount?: number;\n\n    /**\n     * The initial column count for the layout.\n     *\n     * The default is `1`.\n     */\n    columnCount?: number;\n\n    /**\n     * The spacing between rows in the layout.\n     *\n     * The default is `4`.\n     */\n    rowSpacing?: number;\n\n    /**\n     * The spacing between columns in the layout.\n     *\n     * The default is `4`.\n     */\n    columnSpacing?: number;\n  }\n\n  /**\n   * An object which holds the cell configuration for a widget.\n   */\n  export interface ICellConfig {\n    /**\n     * The row index for the widget.\n     */\n    readonly row: number;\n\n    /**\n     * The column index for the widget.\n     */\n    readonly column: number;\n\n    /**\n     * The row span for the widget.\n     */\n    readonly rowSpan: number;\n\n    /**\n     * The column span for the widget.\n     */\n    readonly columnSpan: number;\n  }\n\n  /**\n   * Get the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The cell config for the widget.\n   */\n  export function getCellConfig(widget: Widget): ICellConfig {\n    return Private.cellConfigProperty.get(widget);\n  }\n\n  /**\n   * Set the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the cell config.\n   */\n  export function setCellConfig(\n    widget: Widget,\n    value: Partial<ICellConfig>\n  ): void {\n    Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for the widget cell config.\n   */\n  export const cellConfigProperty = new AttachedProperty<\n    Widget,\n    GridLayout.ICellConfig\n  >({\n    name: 'cellConfig',\n    create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n    changed: onChildCellConfigChanged\n  });\n\n  /**\n   * Normalize a partial cell config object.\n   */\n  export function normalizeConfig(\n    config: Partial<GridLayout.ICellConfig>\n  ): GridLayout.ICellConfig {\n    let row = Math.max(0, Math.floor(config.row || 0));\n    let column = Math.max(0, Math.floor(config.column || 0));\n    let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n    let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n    return { row, column, rowSpan, columnSpan };\n  }\n\n  /**\n   * Clamp a value to an integer >= 0.\n   */\n  export function clampValue(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * A sort comparison function for row spans.\n   */\n  export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.rowSpan - c2.rowSpan;\n  }\n\n  /**\n   * A sort comparison function for column spans.\n   */\n  export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.columnSpan - c2.columnSpan;\n  }\n\n  /**\n   * Reallocate the box sizers for the given grid dimensions.\n   */\n  export function reallocSizers(sizers: BoxSizer[], count: number): void {\n    // Coerce the count to the valid range.\n    count = Math.max(1, Math.floor(count));\n\n    // Add the missing sizers.\n    while (sizers.length < count) {\n      sizers.push(new BoxSizer());\n    }\n\n    // Remove the extra sizers.\n    if (sizers.length > count) {\n      sizers.length = count;\n    }\n  }\n\n  /**\n   * Distribute a min size constraint across a range of sizers.\n   */\n  export function distributeMin(\n    sizers: BoxSizer[],\n    i1: number,\n    i2: number,\n    minSize: number\n  ): void {\n    // Sanity check the indices.\n    if (i2 < i1) {\n      return;\n    }\n\n    // Handle the simple case of no cell span.\n    if (i1 === i2) {\n      let sizer = sizers[i1];\n      sizer.minSize = Math.max(sizer.minSize, minSize);\n      return;\n    }\n\n    // Compute the total current min size of the span.\n    let totalMin = 0;\n    for (let i = i1; i <= i2; ++i) {\n      totalMin += sizers[i].minSize;\n    }\n\n    // Do nothing if the total is greater than the required.\n    if (totalMin >= minSize) {\n      return;\n    }\n\n    // Compute the portion of the space to allocate to each sizer.\n    let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n    // Add the portion to each sizer.\n    for (let i = i1; i <= i2; ++i) {\n      sizers[i].minSize += portion;\n    }\n  }\n\n  /**\n   * The change handler for the child cell config property.\n   */\n  function onChildCellConfigChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof GridLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n  /**\n   * Construct a new menu bar.\n   *\n   * @param options - The options for initializing the menu bar.\n   */\n  constructor(options: MenuBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-MenuBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.renderer = options.renderer || MenuBar.defaultRenderer;\n    this._forceItemsPosition = options.forceItemsPosition || {\n      forceX: true,\n      forceY: true\n    };\n    this._overflowMenuOptions = options.overflowMenuOptions || {\n      isVisible: true\n    };\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._closeChildMenu();\n    this._menus.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the menu bar.\n   */\n  readonly renderer: MenuBar.IRenderer;\n\n  /**\n   * The child menu of the menu bar.\n   *\n   * #### Notes\n   * This will be `null` if the menu bar does not have an open menu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The overflow index of the menu bar.\n   */\n  get overflowIndex(): number {\n    return this._overflowIndex;\n  }\n\n  /**\n   * The overflow menu of the menu bar.\n   */\n  get overflowMenu(): Menu | null {\n    return this._overflowMenu;\n  }\n\n  /**\n   * Get the menu bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu title nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-MenuBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu.\n   */\n  get activeMenu(): Menu | null {\n    return this._menus[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu.\n   *\n   * #### Notes\n   * If the menu does not exist, the menu will be set to `null`.\n   */\n  set activeMenu(value: Menu | null) {\n    this.activeIndex = value ? this._menus.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu.\n   *\n   * #### Notes\n   * This will be `-1` if no menu is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu.\n   *\n   * #### Notes\n   * If the menu cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._menus.length) {\n      value = -1;\n    }\n\n    // An empty menu cannot be active\n    if (value > -1 && this._menus[value].items.length === 0) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menus in the menu bar.\n   */\n  get menus(): ReadonlyArray<Menu> {\n    return this._menus;\n  }\n\n  /**\n   * Open the active menu and activate its first menu item.\n   *\n   * #### Notes\n   * If there is no active menu, this is a no-op.\n   */\n  openActiveMenu(): void {\n    // Bail early if there is no active item.\n    if (this._activeIndex === -1) {\n      return;\n    }\n\n    // Open the child menu.\n    this._openChildMenu();\n\n    // Activate the first item in the child menu.\n    if (this._childMenu) {\n      this._childMenu.activeIndex = -1;\n      this._childMenu.activateNextItem();\n    }\n  }\n\n  /**\n   * Add a menu to the end of the menu bar.\n   *\n   * @param menu - The menu to add to the menu bar.\n   *\n   * #### Notes\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  addMenu(menu: Menu, update: boolean = true): void {\n    this.insertMenu(this._menus.length, menu, update);\n  }\n\n  /**\n   * Insert a menu into the menu bar at the specified index.\n   *\n   * @param index - The index at which to insert the menu.\n   *\n   * @param menu - The menu to insert into the menu bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the menus.\n   *\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  insertMenu(index: number, menu: Menu, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Look up the index of the menu.\n    let i = this._menus.indexOf(menu);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._menus.length));\n\n    // If the menu is not in the array, insert it.\n    if (i === -1) {\n      // Insert the menu into the array.\n      ArrayExt.insert(this._menus, j, menu);\n\n      // Add the styling class to the menu.\n      menu.addClass('lm-MenuBar-menu');\n\n      // Connect to the menu signals.\n      menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n      menu.menuRequested.connect(this._onMenuMenuRequested, this);\n      menu.title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the items.\n      if (update) {\n        this.update();\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the menu exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._menus.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the menu to the new locations.\n    ArrayExt.move(this._menus, i, j);\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove a menu from the menu bar.\n   *\n   * @param menu - The menu to remove from the menu bar.\n   *\n   * #### Notes\n   * This is a no-op if the menu is not in the menu bar.\n   */\n  removeMenu(menu: Menu, update: boolean = true): void {\n    this.removeMenuAt(this._menus.indexOf(menu), update);\n  }\n\n  /**\n   * Remove the menu at a given index from the menu bar.\n   *\n   * @param index - The index of the menu to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeMenuAt(index: number, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Remove the menu from the array.\n    let menu = ArrayExt.removeAt(this._menus, index);\n\n    // Bail if the index is out of range.\n    if (!menu) {\n      return;\n    }\n\n    // Disconnect from the menu signals.\n    menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n    menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n    menu.title.changed.disconnect(this._onTitleChanged, this);\n\n    // Remove the styling class from the menu.\n    menu.removeClass('lm-MenuBar-menu');\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove all menus from the menu bar.\n   */\n  clearMenus(): void {\n    // Bail if there is nothing to remove.\n    if (this._menus.length === 0) {\n      return;\n    }\n\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Disconnect from the menu signals and remove the styling class.\n    for (let menu of this._menus) {\n      menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n      menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n      menu.title.changed.disconnect(this._onTitleChanged, this);\n      menu.removeClass('lm-MenuBar-menu');\n    }\n\n    // Clear the menus array.\n    this._menus.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the menu bar.\n   *\n   * @param event - The DOM event sent to the menu bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu bar's DOM nodes. It\n   * should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n      case 'mouseleave':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'focusout':\n        this._evtFocusOut(event as FocusEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mousedown', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('focusout', this);\n    this.node.addEventListener('contextmenu', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mousedown', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('focusout', this);\n    this.node.removeEventListener('contextmenu', this);\n    this._closeChildMenu();\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this._focusItemAt(0);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    this.update();\n    super.onResize(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let menus = this._menus;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let tabFocusIndex =\n      this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n        ? this._tabFocusIndex\n        : 0;\n    let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n    let totalMenuSize = 0;\n    let isVisible = false;\n\n    // Check that the overflow menu doesn't count\n    length = this._overflowMenu !== null ? length - 1 : length;\n    let content = new Array<VirtualElement>(length);\n\n    // Render visible menus\n    for (let i = 0; i < length; ++i) {\n      content[i] = renderer.renderItem({\n        title: menus[i].title,\n        active: i === activeIndex,\n        tabbable: i === tabFocusIndex,\n        disabled: menus[i].items.length === 0,\n        onfocus: () => {\n          this._tabFocusIndex = i;\n          this.activeIndex = i;\n        }\n      });\n      // Calculate size of current menu\n      totalMenuSize += this._menuItemSizes[i];\n      // Check if overflow menu is already rendered\n      if (menus[i].title.label === this._overflowMenuOptions.title) {\n        isVisible = true;\n        length--;\n      }\n    }\n    // Render overflow menu if needed and active\n    if (this._overflowMenuOptions.isVisible) {\n      if (this._overflowIndex > -1 && !isVisible) {\n        // Create overflow menu\n        if (this._overflowMenu === null) {\n          const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n          this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n          this._overflowMenu.title.label = overflowMenuTitle;\n          this._overflowMenu.title.mnemonic = 0;\n          this.addMenu(this._overflowMenu, false);\n        }\n        // Move menus to overflow menu\n        for (let i = menus.length - 2; i >= length; i--) {\n          const submenu = this.menus[i];\n          submenu.title.mnemonic = 0;\n          this._overflowMenu.insertItem(0, {\n            type: 'submenu',\n            submenu: submenu\n          });\n          this.removeMenu(submenu, false);\n        }\n        content[length] = renderer.renderItem({\n          title: this._overflowMenu.title,\n          active: length === activeIndex && menus[length].items.length !== 0,\n          tabbable: length === tabFocusIndex,\n          disabled: menus[length].items.length === 0,\n          onfocus: () => {\n            this._tabFocusIndex = length;\n            this.activeIndex = length;\n          }\n        });\n        length++;\n      } else if (this._overflowMenu !== null) {\n        // Remove submenus from overflow menu\n        let overflowMenuItems = this._overflowMenu.items;\n        let screenSize = this.node.offsetWidth;\n        let n = this._overflowMenu.items.length;\n        for (let i = 0; i < n; ++i) {\n          let index = menus.length - 1 - i;\n          if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n            let menu = overflowMenuItems[0].submenu as Menu;\n            this._overflowMenu.removeItemAt(0);\n            this.insertMenu(length, menu, false);\n            content[length] = renderer.renderItem({\n              title: menu.title,\n              active: false,\n              tabbable: length === tabFocusIndex,\n              disabled: menus[length].items.length === 0,\n              onfocus: () => {\n                this._tabFocusIndex = length;\n                this.activeIndex = length;\n              }\n            });\n            length++;\n          }\n        }\n        if (this._overflowMenu.items.length === 0) {\n          this.removeMenu(this._overflowMenu, false);\n          content.pop();\n          this._overflowMenu = null;\n          this._overflowIndex = -1;\n        }\n      }\n    }\n    VirtualDOM.render(content, this.contentNode);\n    this._updateOverflowIndex();\n  }\n\n  /**\n   * Calculate and update the current overflow index.\n   */\n  private _updateOverflowIndex(): void {\n    if (!this._overflowMenuOptions.isVisible) {\n      return;\n    }\n\n    // Get elements visible in the main menu bar\n    const itemMenus = this.contentNode.childNodes;\n    let screenSize = this.node.offsetWidth;\n    let totalMenuSize = 0;\n    let index = -1;\n    let n = itemMenus.length;\n\n    if (this._menuItemSizes.length == 0) {\n      // Check if it is the first resize and get info about menu items sizes\n      for (let i = 0; i < n; i++) {\n        let item = itemMenus[i] as HTMLLIElement;\n        // Add sizes to array\n        totalMenuSize += item.offsetWidth;\n        this._menuItemSizes.push(item.offsetWidth);\n        if (totalMenuSize > screenSize && index === -1) {\n          index = i;\n        }\n      }\n    } else {\n      // Calculate current menu size\n      for (let i = 0; i < this._menuItemSizes.length; i++) {\n        totalMenuSize += this._menuItemSizes[i];\n        if (totalMenuSize > screenSize) {\n          index = i;\n          break;\n        }\n      }\n    }\n    this._overflowIndex = index;\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu bar.\n   *\n   * #### Notes\n   * All keys are trapped except the tab key that is ignored.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Reset the active index on tab, but do not trap the tab key.\n    if (kc === 9) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // A menu bar handles all other keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Enter, Space, Up Arrow, Down Arrow\n    if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n      // The active index may have changed (for example, user hovers over an\n      // item with the mouse), so be sure to use the focus index.\n      this.activeIndex = this._tabFocusIndex;\n      if (this.activeIndex !== this._tabFocusIndex) {\n        // Bail if the setter refused to set activeIndex to tabFocusIndex\n        // because it means that the item at tabFocusIndex cannot be opened (for\n        // example, it has an empty menu)\n        return;\n      }\n      this.openActiveMenu();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this._closeChildMenu();\n      this._focusItemAt(this.activeIndex);\n      return;\n    }\n\n    // Left or Right Arrow\n    if (kc === 37 || kc === 39) {\n      let direction = kc === 37 ? -1 : 1;\n      let start = this._tabFocusIndex + direction;\n      let n = this._menus.length;\n      for (let i = 0; i < n; i++) {\n        let index = (n + start + direction * i) % n;\n        if (this._menus[index].items.length) {\n          this._focusItemAt(index);\n          return;\n        }\n      }\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._menus, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that menu is opened.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.openActiveMenu();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n      this._focusItemAt(this.activeIndex);\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n      this._focusItemAt(this.activeIndex);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the mouse press was not on the menu bar. This can occur\n    // when the document listener is installed for an active menu bar.\n    if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n      return;\n    }\n\n    // Stop the propagation of the event. Immediate propagation is\n    // also stopped so that an open menu does not handle the event.\n    event.stopPropagation();\n    event.stopImmediatePropagation();\n\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // If the press was not on an item, close the child menu.\n    if (index === -1) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // If the press was not the left mouse button, do nothing further.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Otherwise, toggle the open state of the child menu.\n    if (this._childMenu) {\n      this._closeChildMenu();\n      this.activeIndex = index;\n    } else {\n      // If we don't call preventDefault() here, then the item in the menu\n      // bar will take focus over the menu that is being opened.\n      event.preventDefault();\n      const position = this._positionForMenu(index);\n      Menu.saveWindowData();\n      // Begin DOM modifications.\n      this.activeIndex = index;\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the active index will not change.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Bail early if a child menu is open and the mouse is not over\n    // an item. This allows the child menu to be kept open when the\n    // mouse is over the empty part of the menu bar.\n    if (index === -1 && this._childMenu) {\n      return;\n    }\n\n    // Get position for the new menu >before< updating active index.\n    const position =\n      index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n    // Before any modification, update window data.\n    Menu.saveWindowData();\n\n    // Begin DOM modifications.\n\n    // Update the active index to the hovered item.\n    this.activeIndex = index;\n\n    // Open the new menu if a menu is already open.\n    if (position) {\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Find initial position for the menu based on menubar item position.\n   *\n   * NOTE: this should be called before updating active index to avoid\n   * an additional layout and style invalidation as changing active\n   * index modifies DOM.\n   */\n  private _positionForMenu(index: number): Private.IPosition {\n    let itemNode = this.contentNode.children[index];\n    let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n    return {\n      top: bottom,\n      left\n    };\n  }\n\n  /**\n   * Handle the `'focusout'` event for the menu bar.\n   */\n  private _evtFocusOut(event: FocusEvent): void {\n    // Reset the active index if there is no open menu and the menubar is losing focus.\n    if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n      this.activeIndex = -1;\n    }\n  }\n\n  /**\n   * Focus an item in the menu bar.\n   *\n   * #### Notes\n   * Does not open the associated menu.\n   */\n  private _focusItemAt(index: number): void {\n    const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n    if (itemNode) {\n      itemNode.focus();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if there is no active menu.\n   */\n  private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n    // If there is no active menu, close the current menu.\n    let newMenu = this.activeMenu;\n    if (!newMenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Bail if there is no effective menu change.\n    let oldMenu = this._childMenu;\n    if (oldMenu === newMenu) {\n      return;\n    }\n\n    // Swap the internal menu reference.\n    this._childMenu = newMenu;\n\n    // Close the current menu, or setup for the new menu.\n    if (oldMenu) {\n      oldMenu.close();\n    } else {\n      document.addEventListener('mousedown', this, true);\n    }\n\n    // Update the tab focus index and ensure the menu bar is updated.\n    this._tabFocusIndex = this.activeIndex;\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n    // Get the positioning data for the new menu.\n    let { left, top } = options;\n    if (typeof left === 'undefined' || typeof top === 'undefined') {\n      ({ left, top } = this._positionForMenu(this._activeIndex));\n    }\n    // Begin DOM modifications\n\n    if (!oldMenu) {\n      // Continue setup for new menu\n      this.addClass('lm-mod-active');\n    }\n\n    // Open the new menu at the computed location.\n    if (newMenu.items.length > 0) {\n      newMenu.open(left, top, this._forceItemsPosition);\n    }\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    // Bail if no child menu is open.\n    if (!this._childMenu) {\n      return;\n    }\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    let menu = this._childMenu;\n    this._childMenu = null;\n\n    // Close the menu.\n    menu.close();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `aboutToClose` signal of a menu.\n   */\n  private _onMenuAboutToClose(sender: Menu): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    this._childMenu = null;\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `menuRequested` signal of a child menu.\n   */\n  private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Look up the active index and menu count.\n    let i = this._activeIndex;\n    let n = this._menus.length;\n\n    // Active the next requested index.\n    switch (args) {\n      case 'next':\n        this.activeIndex = i === n - 1 ? 0 : i + 1;\n        break;\n      case 'previous':\n        this.activeIndex = i === 0 ? n - 1 : i - 1;\n        break;\n    }\n\n    // Open the active menu.\n    this.openActiveMenu();\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(): void {\n    this.update();\n  }\n\n  // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n  private _activeIndex = -1;\n  // Track which item can be focused using the TAB key. Unlike _activeIndex will\n  // always point to a menuitem. Whenever you update this value, it's important\n  // to follow it with an \"update-request\" message so that the `tabindex`\n  // attribute on each menubar item gets properly updated.\n  private _tabFocusIndex = 0;\n  private _forceItemsPosition: Menu.IOpenOptions;\n  private _overflowMenuOptions: IOverflowMenuOptions;\n  private _menus: Menu[] = [];\n  private _childMenu: Menu | null = null;\n  private _overflowMenu: Menu | null = null;\n  private _menuItemSizes: number[] = [];\n  private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n  /**\n   * An options object for creating a menu bar.\n   */\n  export interface IOptions {\n    /**\n     * A custom renderer for creating menu bar content.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n    /**\n     * Whether to force the position of the menu. The MenuBar forces the\n     * coordinates of its menus by default. With this option you can disable it.\n     *\n     * Setting to `false` will enable the logic which repositions the\n     * coordinates of the menu if it will not fit entirely on screen.\n     *\n     * The default is `true`.\n     */\n    forceItemsPosition?: Menu.IOpenOptions;\n    /**\n     * Whether to add a overflow menu if there's overflow.\n     *\n     * Setting to `true` will enable the logic that creates an overflow menu\n     * to show the menu items that don't fit entirely on the screen.\n     *\n     * The default is `true`.\n     */\n    overflowMenuOptions?: IOverflowMenuOptions;\n  }\n\n  /**\n   * An object which holds the data to render a menu bar item.\n   */\n  export interface IRenderData {\n    /**\n     * The title to be rendered.\n     */\n    readonly title: Title<Widget>;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the user can tab to the item.\n     */\n    readonly tabbable: boolean;\n\n    /**\n     * Whether the item is disabled.\n     *\n     * #### Notes\n     * A disabled item cannot be active.\n     * A disabled item cannot be focussed.\n     */\n    readonly disabled?: boolean;\n\n    readonly onfocus?: (event: FocusEvent) => void;\n  }\n\n  /**\n   * A renderer for use with a menu bar.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.title.icon is undefined, it will be ignored.\n      return h.div({ className }, data.title.icon!, data.title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n    }\n\n    /**\n     * Create the class name for the menu bar item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-item';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.active && !data.disabled) {\n        name += ' lm-mod-active';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a menu bar item.\n     *\n     * @param data - The data to use for the item.\n     *\n     * @returns The dataset for the menu bar item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the aria attributes for menu bar item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      return {\n        role: 'menuitem',\n        'aria-haspopup': 'true',\n        'aria-disabled': data.disabled ? 'true' : 'false'\n      };\n    }\n\n    /**\n     * Create the class name for the menu bar item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-itemIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.title;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n  /**\n   * Determines if a overflow menu appears when the menu items overflow.\n   *\n   * Defaults to `true`.\n   */\n  isVisible: boolean;\n  /**\n   * Determines the title of the overflow menu.\n   *\n   * Default: `...`.\n   */\n  title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a menu bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-MenuBar-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menubar');\n    return node;\n  }\n\n  /**\n   * Position for the menu relative to top-left screen corner.\n   */\n  export interface IPosition {\n    /**\n     * Pixels right from screen origin.\n     */\n    left: number;\n    /**\n     * Pixels down from screen origin.\n     */\n    top: number;\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    menus: ReadonlyArray<Menu>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = menus.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Look up the menu title.\n      let title = menus[k].title;\n\n      // Ignore titles with an empty label.\n      if (title.label.length === 0) {\n        continue;\n      }\n\n      // Look up the mnemonic index for the label.\n      let mn = title.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < title.label.length) {\n        if (title.label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n  /**\n   * Construct a new scroll bar.\n   *\n   * @param options - The options for initializing the scroll bar.\n   */\n  constructor(options: ScrollBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-ScrollBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n\n    // Set the orientation.\n    this._orientation = options.orientation || 'vertical';\n    this.dataset['orientation'] = this._orientation;\n\n    // Parse the rest of the options.\n    if (options.maximum !== undefined) {\n      this._maximum = Math.max(0, options.maximum);\n    }\n    if (options.page !== undefined) {\n      this._page = Math.max(0, options.page);\n    }\n    if (options.value !== undefined) {\n      this._value = Math.max(0, Math.min(options.value, this._maximum));\n    }\n  }\n\n  /**\n   * A signal emitted when the user moves the scroll thumb.\n   *\n   * #### Notes\n   * The payload is the current value of the scroll bar.\n   */\n  get thumbMoved(): ISignal<this, number> {\n    return this._thumbMoved;\n  }\n\n  /**\n   * A signal emitted when the user clicks a step button.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get stepRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._stepRequested;\n  }\n\n  /**\n   * A signal emitted when the user clicks the scroll track.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get pageRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._pageRequested;\n  }\n\n  /**\n   * Get the orientation of the scroll bar.\n   */\n  get orientation(): ScrollBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the scroll bar.\n   */\n  set orientation(value: ScrollBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making changes.\n    this._releaseMouse();\n\n    // Update the internal orientation.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the current value of the scroll bar.\n   */\n  get value(): number {\n    return this._value;\n  }\n\n  /**\n   * Set the current value of the scroll bar.\n   *\n   * #### Notes\n   * The value will be clamped to the range `[0, maximum]`.\n   */\n  set value(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Do nothing if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size is the amount of visible content in the scrolled\n   * region, expressed in data units. It determines the size of the\n   * scroll bar thumb.\n   */\n  get page(): number {\n    return this._page;\n  }\n\n  /**\n   * Set the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size will be clamped to the range `[0, Infinity]`.\n   */\n  set page(value: number) {\n    // Clamp the page size to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._page === value) {\n      return;\n    }\n\n    // Update the internal page size.\n    this._page = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the maximum value of the scroll bar.\n   */\n  get maximum(): number {\n    return this._maximum;\n  }\n\n  /**\n   * Set the maximum value of the scroll bar.\n   *\n   * #### Notes\n   * The max size will be clamped to the range `[0, Infinity]`.\n   */\n  set maximum(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._maximum === value) {\n      return;\n    }\n\n    // Update the internal values.\n    this._maximum = value;\n\n    // Clamp the current value to the new range.\n    this._value = Math.min(this._value, value);\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * The scroll bar decrement button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get decrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar increment button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get incrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[1] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar track node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get trackNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-track'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar thumb node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get thumbNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-thumb'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Handle the DOM events for the scroll bar.\n   *\n   * @param event - The DOM event sent to the scroll bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the scroll bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A method invoked on a 'before-attach' message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('mousedown', this);\n    this.update();\n  }\n\n  /**\n   * A method invoked on an 'after-detach' message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('mousedown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A method invoked on an 'update-request' message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    // Convert the value and page into percentages.\n    let value = (this._value * 100) / this._maximum;\n    let page = (this._page * 100) / (this._page + this._maximum);\n\n    // Clamp the value and page to the relevant range.\n    value = Math.max(0, Math.min(value, 100));\n    page = Math.max(0, Math.min(page, 100));\n\n    // Fetch the thumb style.\n    let thumbStyle = this.thumbNode.style;\n\n    // Update the thumb style for the current orientation.\n    if (this._orientation === 'horizontal') {\n      thumbStyle.top = '';\n      thumbStyle.height = '';\n      thumbStyle.left = `${value}%`;\n      thumbStyle.width = `${page}%`;\n      thumbStyle.transform = `translate(${-value}%, 0%)`;\n    } else {\n      thumbStyle.left = '';\n      thumbStyle.width = '';\n      thumbStyle.top = `${value}%`;\n      thumbStyle.height = `${page}%`;\n      thumbStyle.transform = `translate(0%, ${-value}%)`;\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the scroll bar.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Ignore anything except the `Escape` key.\n    if (event.keyCode !== 27) {\n      return;\n    }\n\n    // Fetch the previous scroll value.\n    let value = this._pressData ? this._pressData.value : -1;\n\n    // Release the mouse.\n    this._releaseMouse();\n\n    // Restore the old scroll value if possible.\n    if (value !== -1) {\n      this._moveThumb(value);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the scroll bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse press.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Send an activate request to the scroll bar. This can be\n    // used by message hooks to activate something relevant.\n    this.activate();\n\n    // Do nothing if the mouse is already captured.\n    if (this._pressData) {\n      return;\n    }\n\n    // Find the pressed scroll bar part.\n    let part = Private.findPart(this, event.target as HTMLElement);\n\n    // Do nothing if the part is not of interest.\n    if (!part) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Override the mouse cursor.\n    let override = Drag.overrideCursor('default');\n\n    // Set up the press data.\n    this._pressData = {\n      part,\n      override,\n      delta: -1,\n      value: -1,\n      mouseX: event.clientX,\n      mouseY: event.clientY\n    };\n\n    // Add the extra event listeners.\n    document.addEventListener('mousemove', this, true);\n    document.addEventListener('mouseup', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Handle a thumb press.\n    if (part === 'thumb') {\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Update the press data delta for the current orientation.\n      if (this._orientation === 'horizontal') {\n        this._pressData.delta = event.clientX - thumbRect.left;\n      } else {\n        this._pressData.delta = event.clientY - thumbRect.top;\n      }\n\n      // Add the active class to the thumb node.\n      thumbNode.classList.add('lm-mod-active');\n\n      // Store the current value in the press data.\n      this._pressData.value = this._value;\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track press.\n    if (part === 'track') {\n      // Fetch the client rect for the thumb.\n      let thumbRect = this.thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n\n    // Handle a decrement button press.\n    if (part === 'decrement') {\n      // Add the active class to the decrement node.\n      this.decrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button press.\n    if (part === 'increment') {\n      // Add the active class to the increment node.\n      this.incrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the scroll bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Update the mouse position.\n    this._pressData.mouseX = event.clientX;\n    this._pressData.mouseY = event.clientY;\n\n    // Bail if the thumb is not being dragged.\n    if (this._pressData.part !== 'thumb') {\n      return;\n    }\n\n    // Get the client rect for the thumb and track.\n    let thumbRect = this.thumbNode.getBoundingClientRect();\n    let trackRect = this.trackNode.getBoundingClientRect();\n\n    // Fetch the scroll geometry based on the orientation.\n    let trackPos: number;\n    let trackSpan: number;\n    if (this._orientation === 'horizontal') {\n      trackPos = event.clientX - trackRect.left - this._pressData.delta;\n      trackSpan = trackRect.width - thumbRect.width;\n    } else {\n      trackPos = event.clientY - trackRect.top - this._pressData.delta;\n      trackSpan = trackRect.height - thumbRect.height;\n    }\n\n    // Compute the desired value from the scroll geometry.\n    let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n    // Move the thumb to the computed value.\n    this._moveThumb(value);\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the scroll bar.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse release.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse and restore the node states.\n   */\n  private _releaseMouse(): void {\n    // Bail if there is no press data.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the repeat timer.\n    clearTimeout(this._repeatTimer);\n    this._repeatTimer = -1;\n\n    // Clear the press data.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra event listeners.\n    document.removeEventListener('mousemove', this, true);\n    document.removeEventListener('mouseup', this, true);\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('contextmenu', this, true);\n\n    // Remove the active classes from the nodes.\n    this.thumbNode.classList.remove('lm-mod-active');\n    this.decrementNode.classList.remove('lm-mod-active');\n    this.incrementNode.classList.remove('lm-mod-active');\n  }\n\n  /**\n   * Move the thumb to the specified position.\n   */\n  private _moveThumb(value: number): void {\n    // Clamp the value to the allowed range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Bail if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update of the scroll bar.\n    this.update();\n\n    // Emit the thumb moved signal.\n    this._thumbMoved.emit(value);\n  }\n\n  /**\n   * A timeout callback for repeating the mouse press.\n   */\n  private _onRepeat = () => {\n    // Clear the repeat timer id.\n    this._repeatTimer = -1;\n\n    // Bail if the mouse has been released.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Look up the part that was pressed.\n    let part = this._pressData.part;\n\n    // Bail if the thumb was pressed.\n    if (part === 'thumb') {\n      return;\n    }\n\n    // Schedule the timer for another repeat.\n    this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n    // Get the current mouse position.\n    let mouseX = this._pressData.mouseX;\n    let mouseY = this._pressData.mouseY;\n\n    // Handle a decrement button repeat.\n    if (part === 'decrement') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button repeat.\n    if (part === 'increment') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track repeat.\n    if (part === 'track') {\n      // Bail if the mouse is not over the track.\n      if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Bail if the mouse is over the thumb.\n      if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n  };\n\n  private _value = 0;\n  private _page = 10;\n  private _maximum = 100;\n  private _repeatTimer = -1;\n  private _orientation: ScrollBar.Orientation;\n  private _pressData: Private.IPressData | null = null;\n  private _thumbMoved = new Signal<this, number>(this);\n  private _stepRequested = new Signal<this, 'decrement' | 'increment'>(this);\n  private _pageRequested = new Signal<this, 'decrement' | 'increment'>(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n  /**\n   * A type alias for a scroll bar orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * An options object for creating a scroll bar.\n   */\n  export interface IOptions {\n    /**\n     * The orientation of the scroll bar.\n     *\n     * The default is `'vertical'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The value for the scroll bar.\n     *\n     * The default is `0`.\n     */\n    value?: number;\n\n    /**\n     * The page size for the scroll bar.\n     *\n     * The default is `10`.\n     */\n    page?: number;\n\n    /**\n     * The maximum value for the scroll bar.\n     *\n     * The default is `100`.\n     */\n    maximum?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A type alias for the parts of a scroll bar.\n   */\n  export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The scroll bar part which was pressed.\n     */\n    part: ScrollBarPart;\n\n    /**\n     * The offset of the press in thumb coordinates, or -1.\n     */\n    delta: number;\n\n    /**\n     * The scroll value at the time the thumb was pressed, or -1.\n     */\n    value: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n\n    /**\n     * The current X position of the mouse.\n     */\n    mouseX: number;\n\n    /**\n     * The current Y position of the mouse.\n     */\n    mouseY: number;\n  }\n\n  /**\n   * Create the DOM node for a scroll bar.\n   */\n  export function createNode(): HTMLElement {\n    let node = document.createElement('div');\n    let decrement = document.createElement('div');\n    let increment = document.createElement('div');\n    let track = document.createElement('div');\n    let thumb = document.createElement('div');\n    decrement.className = 'lm-ScrollBar-button';\n    increment.className = 'lm-ScrollBar-button';\n    decrement.dataset['action'] = 'decrement';\n    increment.dataset['action'] = 'increment';\n    track.className = 'lm-ScrollBar-track';\n    thumb.className = 'lm-ScrollBar-thumb';\n    track.appendChild(thumb);\n    node.appendChild(decrement);\n    node.appendChild(track);\n    node.appendChild(increment);\n    return node;\n  }\n\n  /**\n   * Find the scroll bar part which contains the given target.\n   */\n  export function findPart(\n    scrollBar: ScrollBar,\n    target: HTMLElement\n  ): ScrollBarPart | null {\n    // Test the thumb.\n    if (scrollBar.thumbNode.contains(target)) {\n      return 'thumb';\n    }\n\n    // Test the track.\n    if (scrollBar.trackNode.contains(target)) {\n      return 'track';\n    }\n\n    // Test the decrement button.\n    if (scrollBar.decrementNode.contains(target)) {\n      return 'decrement';\n    }\n\n    // Test the increment button.\n    if (scrollBar.incrementNode.contains(target)) {\n      return 'increment';\n    }\n\n    // Indicate no match.\n    return null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n  /**\n   * Construct a new stacked panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: StackedPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-StackedPanel');\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as StackedLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as StackedLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when a widget is removed from a stacked panel.\n   */\n  get widgetRemoved(): ISignal<this, Widget> {\n    return this._widgetRemoved;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-StackedPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-StackedPanel-child');\n    this._widgetRemoved.emit(msg.child);\n  }\n\n  private _widgetRemoved = new Signal<this, Widget>(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n  /**\n   * An options object for creating a stacked panel.\n   */\n  export interface IOptions {\n    /**\n     * The stacked layout to use for the stacked panel.\n     *\n     * The default is a new `StackedLayout`.\n     */\n    layout?: StackedLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a stacked layout for the given panel options.\n   */\n  export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n    return options.layout || new StackedLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n  /**\n   * Construct a new tab panel.\n   *\n   * @param options - The options for initializing the tab panel.\n   */\n  constructor(options: TabPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-TabPanel');\n\n    // Create the tab bar and stacked panel.\n    this.tabBar = new TabBar<Widget>(options);\n    this.tabBar.addClass('lm-TabPanel-tabBar');\n    this.stackedPanel = new StackedPanel();\n    this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n    // Connect the tab bar signal handlers.\n    this.tabBar.tabMoved.connect(this._onTabMoved, this);\n    this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    this.tabBar.tabActivateRequested.connect(\n      this._onTabActivateRequested,\n      this\n    );\n    this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Connect the stacked panel signal handlers.\n    this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n    // Get the data related to the placement.\n    this._tabPlacement = options.tabPlacement || 'top';\n    let direction = Private.directionFromPlacement(this._tabPlacement);\n    let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = this._tabPlacement;\n\n    // Create the box layout.\n    let layout = new BoxLayout({ direction, spacing: 0 });\n\n    // Set the stretch factors for the child widgets.\n    BoxLayout.setStretch(this.tabBar, 0);\n    BoxLayout.setStretch(this.stackedPanel, 1);\n\n    // Add the child widgets to the layout.\n    layout.addWidget(this.tabBar);\n    layout.addWidget(this.stackedPanel);\n\n    // Install the layout on the tab panel.\n    this.layout = layout;\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabPanel.ICurrentChangedArgs> {\n    return this._currentChanged;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this.tabBar.currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the index is out of range, it will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    this.tabBar.currentIndex = value;\n  }\n\n  /**\n   * Get the currently selected widget.\n   *\n   * #### Notes\n   * This will be `null` if there is no selected tab.\n   */\n  get currentWidget(): Widget | null {\n    let title = this.tabBar.currentTitle;\n    return title ? title.owner : null;\n  }\n\n  /**\n   * Set the currently selected widget.\n   *\n   * #### Notes\n   * If the widget is not in the panel, it will be set to `null`.\n   */\n  set currentWidget(value: Widget | null) {\n    this.tabBar.currentTitle = value ? value.title : null;\n  }\n\n  /**\n   * Get the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  get tabsMovable(): boolean {\n    return this.tabBar.tabsMovable;\n  }\n\n  /**\n   * Set the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  set tabsMovable(value: boolean) {\n    this.tabBar.tabsMovable = value;\n  }\n\n  /**\n   * Get the whether the add button is enabled.\n   *\n   */\n  get addButtonEnabled(): boolean {\n    return this.tabBar.addButtonEnabled;\n  }\n\n  /**\n   * Set the whether the add button is enabled.\n   *\n   */\n  set addButtonEnabled(value: boolean) {\n    this.tabBar.addButtonEnabled = value;\n  }\n\n  /**\n   * Get the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  get tabPlacement(): TabPanel.TabPlacement {\n    return this._tabPlacement;\n  }\n\n  /**\n   * Set the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  set tabPlacement(value: TabPanel.TabPlacement) {\n    // Bail if the placement does not change.\n    if (this._tabPlacement === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._tabPlacement = value;\n\n    // Get the values related to the placement.\n    let direction = Private.directionFromPlacement(value);\n    let orientation = Private.orientationFromPlacement(value);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = value;\n\n    // Update the layout direction.\n    (this.layout as BoxLayout).direction = direction;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The tab bar used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the tab bar directly can lead to undefined behavior.\n   */\n  readonly tabBar: TabBar<Widget>;\n\n  /**\n   * The stacked panel used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the panel directly can lead to undefined behavior.\n   */\n  readonly stackedPanel: StackedPanel;\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this.stackedPanel.widgets;\n  }\n\n  /**\n   * Add a widget to the end of the tab panel.\n   *\n   * @param widget - The widget to add to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this.widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the tab panel at a specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (widget !== this.currentWidget) {\n      widget.hide();\n    }\n    this.stackedPanel.insertWidget(index, widget);\n    this.tabBar.insertTab(index, widget.title);\n\n    widget.node.setAttribute('role', 'tabpanel');\n\n    let renderer = this.tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  /**\n   * Handle the `currentChanged` signal from the tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n    // Extract the widgets from the titles.\n    let previousWidget = previousTitle ? previousTitle.owner : null;\n    let currentWidget = currentTitle ? currentTitle.owner : null;\n\n    // Hide the previous widget.\n    if (previousWidget) {\n      previousWidget.hide();\n    }\n\n    // Show the current widget.\n    if (currentWidget) {\n      currentWidget.show();\n    }\n\n    // Emit the `currentChanged` signal for the tab panel.\n    this._currentChanged.emit({\n      previousIndex,\n      previousWidget,\n      currentIndex,\n      currentWidget\n    });\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n  }\n\n  /**\n   * Handle the `tabAddRequested` signal from the tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>, args: void): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from the tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from the tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from the tab bar.\n   */\n  private _onTabMoved(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabMovedArgs<Widget>\n  ): void {\n    this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n  }\n\n  /**\n   * Handle the `widgetRemoved` signal from the stacked panel.\n   */\n  private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n    this.tabBar.removeTab(widget.title);\n  }\n\n  private _tabPlacement: TabPanel.TabPlacement;\n  private _currentChanged = new Signal<this, TabPanel.ICurrentChangedArgs>(\n    this\n  );\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n  /**\n   * A type alias for tab placement in a tab bar.\n   */\n  export type TabPlacement =\n    | /**\n     * The tabs are placed as a row above the content.\n     */\n    'top'\n\n    /**\n     * The tabs are placed as a column to the left of the content.\n     */\n    | 'left'\n\n    /**\n     * The tabs are placed as a column to the right of the content.\n     */\n    | 'right'\n\n    /**\n     * The tabs are placed as a row below the content.\n     */\n    | 'bottom';\n\n  /**\n   * An options object for initializing a tab panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the tab panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether the button to add new tabs is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The placement of the tab bar relative to the content.\n     *\n     * The default is `'top'`.\n     */\n    tabPlacement?: TabPlacement;\n\n    /**\n     * The renderer for the panel's tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: TabBar.IRenderer<Widget>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs {\n    /**\n     * The previously selected index.\n     */\n    previousIndex: number;\n\n    /**\n     * The previously selected widget.\n     */\n    previousWidget: Widget | null;\n\n    /**\n     * The currently selected index.\n     */\n    currentIndex: number;\n\n    /**\n     * The currently selected widget.\n     */\n    currentWidget: Widget | null;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Convert a tab placement to tab bar orientation.\n   */\n  export function orientationFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): TabBar.Orientation {\n    return placementToOrientationMap[plc];\n  }\n\n  /**\n   * Convert a tab placement to a box layout direction.\n   */\n  export function directionFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): BoxLayout.Direction {\n    return placementToDirectionMap[plc];\n  }\n\n  /**\n   * A mapping of tab placement to tab bar orientation.\n   */\n  const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n    top: 'horizontal',\n    left: 'vertical',\n    right: 'vertical',\n    bottom: 'horizontal'\n  };\n\n  /**\n   * A mapping of tab placement to box layout direction.\n   */\n  const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n    top: 'top-to-bottom',\n    left: 'left-to-right',\n    right: 'right-to-left',\n    bottom: 'bottom-to-top'\n  };\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this._widget) {\n      let widget = this._widget;\n      this._widget = null;\n      widget.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * Get the child widget for the layout.\n   */\n  get widget(): Widget | null {\n    return this._widget;\n  }\n\n  /**\n   * Set the child widget for the layout.\n   *\n   * #### Notes\n   * Setting the child widget will cause the old child widget to be\n   * automatically disposed. If that is not desired, set the parent\n   * of the old child to `null` before assigning a new child.\n   */\n  set widget(widget: Widget | null) {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    if (widget) {\n      widget.parent = this.parent;\n    }\n\n    // Bail early if the widget does not change.\n    if (this._widget === widget) {\n      return;\n    }\n\n    // Dispose of the old child widget.\n    if (this._widget) {\n      this._widget.dispose();\n    }\n\n    // Update the internal widget.\n    this._widget = widget;\n\n    // Attach the new child widget if needed.\n    if (this.parent && widget) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    if (this._widget) {\n      yield this._widget;\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Bail early if the widget does not exist in the layout.\n    if (this._widget !== widget) {\n      return;\n    }\n\n    // Clear the internal widget.\n    this._widget = null;\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n  constructor(options: StackedLayout.IOptions = {}) {\n    super(options);\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    if (this.widgets.length > 1) {\n      this.widgets.forEach(w => {\n        w.hiddenMode = this._hiddenMode;\n      });\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (\n      this._hiddenMode === Widget.HiddenMode.Scale &&\n      this._items.length > 0\n    ) {\n      if (this._items.length === 1) {\n        this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n      }\n      widget.hiddenMode = Widget.HiddenMode.Scale;\n    } else {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n    }\n\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Reset the z-index for the widget.\n    item!.widget.node.style.zIndex = '';\n\n    // Reset the hidden mode for the widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n\n      // Reset the hidden mode for the first widget if necessary.\n      if (this._items.length === 1) {\n        this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n      }\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the computed minimum size.\n      minW = Math.max(minW, item.minWidth);\n      minH = Math.max(minH, item.minHeight);\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the widget stacking order and layout geometry.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Set the z-index for the widget.\n      item.widget.node.style.zIndex = `${i}`;\n\n      // Update the item geometry.\n      item.update(left, top, width, height);\n    }\n  }\n\n  private _dirty = false;\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n  /**\n   * An options object for initializing a stacked layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker<T extends Widget> implements IDisposable {\n  /**\n   * Dispose of the resources held by the tracker.\n   */\n  dispose(): void {\n    // Do nothing if the tracker is already disposed.\n    if (this._counter < 0) {\n      return;\n    }\n\n    // Mark the tracker as disposed.\n    this._counter = -1;\n\n    // Clear the connections for the tracker.\n    Signal.clearData(this);\n\n    // Remove all event listeners.\n    for (const widget of this._widgets) {\n      widget.node.removeEventListener('focus', this, true);\n      widget.node.removeEventListener('blur', this, true);\n    }\n\n    // Clear the internal data structures.\n    this._activeWidget = null;\n    this._currentWidget = null;\n    this._nodes.clear();\n    this._numbers.clear();\n    this._widgets.length = 0;\n  }\n\n  /**\n   * A signal emitted when the current widget has changed.\n   */\n  get currentChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when the active widget has changed.\n   */\n  get activeChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._activeChanged;\n  }\n\n  /**\n   * A flag indicating whether the tracker is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._counter < 0;\n  }\n\n  /**\n   * The current widget in the tracker.\n   *\n   * #### Notes\n   * The current widget is the widget among the tracked widgets which\n   * has the *descendant node* which has most recently been focused.\n   *\n   * The current widget will not be updated if the node loses focus. It\n   * will only be updated when a different tracked widget gains focus.\n   *\n   * If the current widget is removed from the tracker, the previous\n   * current widget will be restored.\n   *\n   * This behavior is intended to follow a user's conceptual model of\n   * a semantically \"current\" widget, where the \"last thing of type X\"\n   * to be interacted with is the \"current instance of X\", regardless\n   * of whether that instance still has focus.\n   */\n  get currentWidget(): T | null {\n    return this._currentWidget;\n  }\n\n  /**\n   * The active widget in the tracker.\n   *\n   * #### Notes\n   * The active widget is the widget among the tracked widgets which\n   * has the *descendant node* which is currently focused.\n   */\n  get activeWidget(): T | null {\n    return this._activeWidget;\n  }\n\n  /**\n   * A read only array of the widgets being tracked.\n   */\n  get widgets(): ReadonlyArray<T> {\n    return this._widgets;\n  }\n\n  /**\n   * Get the focus number for a particular widget in the tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The focus number for the given widget, or `-1` if the\n   *   widget has not had focus since being added to the tracker, or\n   *   is not contained by the tracker.\n   *\n   * #### Notes\n   * The focus number indicates the relative order in which the widgets\n   * have gained focus. A widget with a larger number has gained focus\n   * more recently than a widget with a smaller number.\n   *\n   * The `currentWidget` will always have the largest focus number.\n   *\n   * All widgets start with a focus number of `-1`, which indicates that\n   * the widget has not been focused since being added to the tracker.\n   */\n  focusNumber(widget: T): number {\n    let n = this._numbers.get(widget);\n    return n === undefined ? -1 : n;\n  }\n\n  /**\n   * Test whether the focus tracker contains a given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns `true` if the widget is tracked, `false` otherwise.\n   */\n  has(widget: T): boolean {\n    return this._numbers.has(widget);\n  }\n\n  /**\n   * Add a widget to the focus tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is already tracked, this is a no-op.\n   */\n  add(widget: T): void {\n    // Do nothing if the widget is already tracked.\n    if (this._numbers.has(widget)) {\n      return;\n    }\n\n    // Test whether the widget has focus.\n    let focused = widget.node.contains(document.activeElement);\n\n    // Set up the initial focus number.\n    let n = focused ? this._counter++ : -1;\n\n    // Add the widget to the internal data structures.\n    this._widgets.push(widget);\n    this._numbers.set(widget, n);\n    this._nodes.set(widget.node, widget);\n\n    // Set up the event listeners. The capturing phase must be used\n    // since the 'focus' and 'blur' events don't bubble and Firefox\n    // doesn't support the 'focusin' or 'focusout' events.\n    widget.node.addEventListener('focus', this, true);\n    widget.node.addEventListener('blur', this, true);\n\n    // Connect the disposed signal handler.\n    widget.disposed.connect(this._onWidgetDisposed, this);\n\n    // Set the current and active widgets if needed.\n    if (focused) {\n      this._setWidgets(widget, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the focus tracker.\n   *\n   * #### Notes\n   * If the widget is the `currentWidget`, the previous current widget\n   * will become the new `currentWidget`.\n   *\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is not tracked, this is a no-op.\n   */\n  remove(widget: T): void {\n    // Bail early if the widget is not tracked.\n    if (!this._numbers.has(widget)) {\n      return;\n    }\n\n    // Disconnect the disposed signal handler.\n    widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n    // Remove the event listeners.\n    widget.node.removeEventListener('focus', this, true);\n    widget.node.removeEventListener('blur', this, true);\n\n    // Remove the widget from the internal data structures.\n    ArrayExt.removeFirstOf(this._widgets, widget);\n    this._nodes.delete(widget.node);\n    this._numbers.delete(widget);\n\n    // Bail early if the widget is not the current widget.\n    if (this._currentWidget !== widget) {\n      return;\n    }\n\n    // Filter the widgets for those which have had focus.\n    let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n    // Get the valid widget with the max focus number.\n    let previous =\n      max(valid, (first, second) => {\n        let a = this._numbers.get(first)!;\n        let b = this._numbers.get(second)!;\n        return a - b;\n      }) || null;\n\n    // Set the current and active widgets.\n    this._setWidgets(previous, null);\n  }\n\n  /**\n   * Handle the DOM events for the focus tracker.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tracked nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'focus':\n        this._evtFocus(event as FocusEvent);\n        break;\n      case 'blur':\n        this._evtBlur(event as FocusEvent);\n        break;\n    }\n  }\n\n  /**\n   * Set the current and active widgets for the tracker.\n   */\n  private _setWidgets(current: T | null, active: T | null): void {\n    // Swap the current widget.\n    let oldCurrent = this._currentWidget;\n    this._currentWidget = current;\n\n    // Swap the active widget.\n    let oldActive = this._activeWidget;\n    this._activeWidget = active;\n\n    // Emit the `currentChanged` signal if needed.\n    if (oldCurrent !== current) {\n      this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n    }\n\n    // Emit the `activeChanged` signal if needed.\n    if (oldActive !== active) {\n      this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n    }\n  }\n\n  /**\n   * Handle the `'focus'` event for a tracked widget.\n   */\n  private _evtFocus(event: FocusEvent): void {\n    // Find the widget which gained focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Update the focus number if necessary.\n    if (widget !== this._currentWidget) {\n      this._numbers.set(widget, this._counter++);\n    }\n\n    // Set the current and active widgets.\n    this._setWidgets(widget, widget);\n  }\n\n  /**\n   * Handle the `'blur'` event for a tracked widget.\n   */\n  private _evtBlur(event: FocusEvent): void {\n    // Find the widget which lost focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Get the node which being focused after this blur.\n    let focusTarget = event.relatedTarget as HTMLElement;\n\n    // If no other node is being focused, clear the active widget.\n    if (!focusTarget) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n\n    // Bail if the focus widget is not changing.\n    if (widget.node.contains(focusTarget)) {\n      return;\n    }\n\n    // If no tracked widget is being focused, clear the active widget.\n    if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n  }\n\n  /**\n   * Handle the `disposed` signal for a tracked widget.\n   */\n  private _onWidgetDisposed(sender: T): void {\n    this.remove(sender);\n  }\n\n  private _counter = 0;\n  private _widgets: T[] = [];\n  private _activeWidget: T | null = null;\n  private _currentWidget: T | null = null;\n  private _numbers = new Map<T, number>();\n  private _nodes = new Map<HTMLElement, T>();\n  private _activeChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(this);\n  private _currentChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(\n    this\n  );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n  /**\n   * An arguments object for the changed signals.\n   */\n  export interface IChangedArgs<T extends Widget> {\n    /**\n     * The old value for the widget.\n     */\n    oldValue: T | null;\n\n    /**\n     * The new value for the widget.\n     */\n    newValue: T | null;\n  }\n}\n"],"mappings":"2/BAoBaA,EAAbC,cAcEC,KAAQC,SAAG,EAeXD,KAAOE,QAAG,EAeVF,KAAOG,QAAGC,IAkBVJ,KAAOK,QAAG,EAcVL,KAAIM,KAAG,EAUPN,KAAIO,MAAG,C,EAMT,IAAiBC,EC+gCPC,EC1TAA,ECh0BOC,EH2GAF,gDA0XhB,KA3TiBG,KAAhB,SAAqBC,EAA6BC,GAEhD,IAAIC,EAAQF,EAAOG,OACnB,GAAc,IAAVD,EACF,OAAOD,EAIT,IAAIG,EAAW,EACXC,EAAW,EACXC,EAAY,EACZC,EAAe,EACfC,EAAe,EAGnB,IAAK,IAAIC,EAAI,EAAGA,EAAIP,IAASO,EAAG,CAC9B,IAAIC,EAAQV,EAAOS,GACfE,EAAMD,EAAMpB,QACZsB,EAAMF,EAAMnB,QACZsB,EAAOH,EAAMr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BoxSizer","constructor","this","sizeHint","minSize","maxSize","Infinity","stretch","size","done","BoxEngine","Private","Utils","calc","sizers","space","count","length","totalMin","totalMax","totalSize","totalStretch","stretchCount","i","sizer","min","max","hint","Math","nearZero","notDoneCount","freeSpace","distSpace","distStretch","amt","adjust","index","delta","growLimit","shrinkLimit","n","grow","limit","shrink","growSizer","shrinkSizer","Title","options","_label","_caption","_mnemonic","_icon","undefined","_iconClass","_iconLabel","_className","_closable","_changed","Signal","_isDisposed","owner","label","mnemonic","icon","iconClass","iconLabel","caption","className","closable","_dataset","dataset","changed","value","emit","isDisposed","dispose","clearData","Widget","_flags","_layout","_parent","_disposed","_hiddenMode","HiddenMode","Display","node","createNode","addClass","setFlag","Flag","IsDisposed","parent","isAttached","detach","title","MessageLoop","AttachedProperty","disposed","testFlag","IsAttached","isHidden","IsHidden","isVisible","titleProperty","get","id","hiddenMode","_toggleHidden","Scale","style","willChange","contains","Error","msg","ChildMessage","sendMessage","Msg","ParentChanged","layout","DisallowLayout","children","widget","hasClass","name","classList","add","removeClass","remove","toggleClass","force","toggle","update","postMessage","UpdateRequest","fit","FitRequest","activate","ActivateRequest","close","CloseRequest","show","BeforeShow","clearFlag","AfterShow","hide","BeforeHide","AfterHide","setHidden","hidden","flag","processMessage","type","notifyLayout","onResize","onUpdateRequest","onFitRequest","onBeforeShow","IsVisible","onAfterShow","onBeforeHide","onAfterHide","onBeforeAttach","onAfterAttach","onBeforeDetach","onAfterDetach","onActivateRequest","onCloseRequest","onChildAdded","onChildRemoved","processParentMessage","transform","setAttribute","ContentVisibility","contentVisibility","zIndex","removeAttribute","Message","BeforeAttach","AfterAttach","BeforeDetach","AfterDetach","ConflatableMessage","child","super","ResizeMessage","width","height","UnknownSize","attach","host","ref","isConnected","insertBefore","parentNode","removeChild","create","document","createElement","tag","Layout","_fitPolicy","fitPolicy","init","minWidth","minHeight","maxWidth","maxHeight","onChildShown","onChildHidden","removeWidget","getHorizontalAlignment","horizontalAlignmentProperty","setHorizontalAlignment","set","getVerticalAlignment","verticalAlignmentProperty","setVerticalAlignment","LayoutItem","_top","NaN","_left","_width","_height","_minWidth","_minHeight","_maxWidth","_maxHeight","position","contain","top","left","limits","ElementExt","sizeLimits","clampW","clampH","resized","onAlignmentChanged","PanelLayout","_widgets","pop","widgets","Symbol","iterator","addWidget","insertWidget","indexOf","j","ArrayExt","insert","attachWidget","move","moveWidget","removeWidgetAt","removeAt","detachWidget","fromIndex","toIndex","clampDimension","floor","Utils$1","SplitLayout","widgetOffset","_fixed","_spacing","_dirty","_hasNormedSizes","_sizers","_items","_handles","_box","_alignment","_orientation","renderer","orientation","alignment","spacing","item","handles","absoluteSizes","map","relativeSizes","normalize","setRelativeSizes","sizes","temp","slice","push","normed","moveHandle","handle","offsetLeft","offsetTop","createHandle","average","averageSize","createSizer","appendChild","_update","_fit","updateItemPosition","isHorizontal","handleStyle","nVisible","lastHandleIndex","horz","minW","minH","getStretch","box","boxSizing","horizontalSum","verticalSum","offsetWidth","offsetHeight","paddingTop","paddingLeft","extra","offset","fullOffset","stretchProperty","setStretch","coerce","reduce","v","s","values","sum","a","b","abs","AccordionLayout","_titles","titleSpace","titles","updateTitle","oldTitle","expanded","newTitle","createTitle","replaceChild","UUID","uuid4","titleStyle","data","createSectionTitle","Panel","createLayout","SplitPanel","_handleMoved","_pressData","_releaseMouse","handleMoved","handleEvent","event","_evtPointerDown","_evtPointerMove","_evtPointerUp","_evtKeyDown","preventDefault","stopPropagation","addEventListener","removeEventListener","keyCode","button","findFirstIndex","target","rect","getBoundingClientRect","clientX","clientY","window","getComputedStyle","override","Drag","overrideCursor","cursor","pos","Renderer","defaultRenderer","AccordionPanel","_widgetSizesCache","WeakMap","_expansionToggled","expansionToggled","connect","_onTitleChanged","collapse","_toggleExpansion","expand","_evtClick","_eventKeyDown","sender","_computeWidgetSize","widgetSizes","prev","curr","newSize","previousSize","widgetToCollapse","sz","lastIndexOf","forEach","_","idx","currentSize","defaultPrevented","handled","toString","key","match","click","direction","newIndex","focus","titleClassName","_titleID","_titleKeys","_uuid","_nInstance","createCollapseIcon","createTitleKey","aData","textContent","BoxLayout","_direction","getSizeBasis","sizeBasisProperty","setSizeBasis","onChildSizingChanged","dir","clampSpacing","BoxPanel","CommandPalette","_activeIndex","_results","commands","commandChanged","_onGenericChange","keyBindingChanged","searchNode","getElementsByClassName","inputNode","contentNode","items","addItem","createItem","refresh","addItems","newItems","removeItem","removeItemAt","clearItems","display","_toggleFocused","input","select","VirtualDOM","render","query","results","search","canActivate","content","renderEmptyMessage","activeIndex","Array","result","indices","category","renderHeader","active","renderItem","scrollTop","element","scrollIntoViewIfNeeded","_execute","altKey","ctrlKey","metaKey","shiftKey","_activatePreviousItem","_activateNextItem","ai","start","stop","findLastIndex","part","toLowerCase","isEnabled","execute","command","args","focused","activeElement","formatHeader","h","li","createItemClass","createItemDataset","isToggleable","role","isToggled","renderItemIcon","renderItemContent","renderItemShortcut","formatEmptyMessage","createIconClass","div","renderItemLabel","renderItemCaption","formatItemLabel","formatItemCaption","formatItemShortcut","StringExt","highlight","mark","kb","keyBinding","CommandRegistry","formatKeystroke","keys","fuzzySearch","source","score","rgx","rgxMatch","exec","matchSumOfDeltas","pivot","lowerBound","categoryIndices","labelIndices","matchType","scoreCmp","m1","d1","i1","i2","d2","localeCompare","r1","rank","r2","wrapper","clear","spellcheck","CommandItem","scores","text","replace","matchItems","sort","createResults","_commands","trim","JSONExt","emptyObject","findLastValue","keyBindings","deepEqual","Menu","_childIndex","_openTimerID","_closeTimerID","_childMenu","_parentMenu","_aboutToClose","_menuRequested","aboutToClose","menuRequested","parentMenu","childMenu","rootMenu","menu","leafMenu","activeItem","childNodes","activateNextItem","activatePreviousItem","triggerActiveItem","_cancelOpenTimer","_cancelCloseTimer","_openChildMenu","console","log","insertItem","open","x","y","forceX","forceY","_a","_b","horizontalAlignment","_c","documentElement","openRootMenu","_evtMouseUp","_evtMouseMove","_evtMouseEnter","_evtMouseLeave","_evtMouseDown","ownerDocument","collapsedFlags","computeCollapsed","collapsed","onfocus","kc","getKeyboardLayout","keyForKeydownEvent","findMnemonic","multiple","auto","hitTest","_startCloseTimer","submenu","_startOpenTimer","hitTestMenus","activateFirst","_closeChildMenu","saveWindowData","itemNode","openSubmenu","setTimeout","TIMER_DELAY","clearTimeout","static","aria","createItemARIA","tabindex","renderIcon","renderLabel","renderShortcut","renderSubmenu","formatLabel","formatShortcut","prefix","suffix","char","span","getWindowData","pageXOffset","defaultView","scrollX","pageYOffset","scrollY","clientWidth","clientHeight","_getWindowData","SUBMENU_OVERLAP","tabIndex","MenuItem","fill","k1","k2","windowData","px","py","cw","ch","opacity","body","itemRect","right","borderTop","bottom","borderBottom","paddingBottom","upperKey","toUpperCase","k","mn","itemCmpRank","itemCmp","s1","Selector","calculateSpecificity","selector","s2","isValid","validateSelector","groupByTarget","sortBySelector","currentTarget","elementFromPoint","availableItems","matches","parentElement","ARROW_KEYS","TabBar","_currentIndex","_titlesEditable","_previousTitle","_dragData","_addButtonEnabled","_tabMoved","_currentChanged","_addRequested","_tabCloseRequested","_tabDetachRequested","_tabActivateRequested","_document","tabsMovable","titlesEditable","allowDeselect","addButtonEnabled","insertBehavior","removeBehavior","currentChanged","tabMoved","tabActivateRequested","addRequested","tabCloseRequested","tabDetachRequested","currentTitle","currentIndex","pi","pt","ci","ct","previousIndex","previousTitle","_name","addButtonNode","addTab","insertTab","asTitle","_adjustCurrentForInsert","_adjustCurrentForMove","removeTab","removeTabAt","disconnect","_adjustCurrentForRemove","clearTabs","releaseMouse","_evtDblClick","eventPhase","Event","CAPTURING_PHASE","_evtKeyDownCapturing","tabHandlingTabindex","_getCurrentTabindex","current","renderTab","elemTabindex","querySelector","getAttribute","tabs","tab","oldValue","innerHTML","onblur","focusedElement","includes","focusable","nextFocused","focusedIndex","addButtonClicked","pressX","pressY","tabPos","tabSize","tabPressPos","targetIndex","tabLayout","contentRect","dragActive","dragAborted","detachRequested","closeIconSelector","dragExceeded","tabRect","tabPressOffset","snapTabLayout","detachExceeded","layoutTabs","finalizeTabPosition","duration","parseTransitionDuration","resetTabPositions","bh","_tabID","_tabKeys","createTabKey","createTabStyle","createTabClass","createTabDataset","createTabARIA","renderCloseIcon","addButtonSelector","DRAG_THRESHOLD","DETACH_THRESHOLD","parseFloat","transitionDuration","margin","marginLeft","marginTop","dx","dy","pressPos","localPos","clientPos","clientSize","targetPos","targetEnd","pxPos","threshold","ideal","tgt","final","DockLayout","_root","Map","bar","tabBars","isEmpty","iterAllWidgets","empty","iterUserWidgets","selectedWidgets","iterSelectedWidgets","iterTabBars","iterHandles","offsetX","offsetY","findSplitNode","holdSizes","saveLayout","holdAllSizes","main","createConfig","restoreLayout","config","mainConfig","widgetSet","Set","normalizeAreaConfig","oldWidgets","oldTabBars","oldHandles","has","tabBar","realizeAreaConfig","createTabBar","_createTabBar","_createHandle","mode","refNode","findTabNode","_insertTab","_insertSplit","_removeWidget","hitTestTabAreas","borderLeft","tabNode","hitTestTabNodes","borderWidth","borderRight","borderHeight","delete","removeAria","splitNode","removeFirstOf","syncHandles","maybeParent","childNode","childHandle","TabLayoutNode","splitHandle","gChild","gHandle","gSizer","_createTabNode","addAria","after","findFirstTabNode","merge","root","_splitRoot","normalizeSizes","GOLDEN_RATIO","sibling","SplitLayoutNode","normalized","oldRoot","newRoot","normalizeTabAreaConfig","normalizeSplitAreaConfig","realizeTabAreaConfig","realizeSplitAreaConfig","tabSizer","widgetSizer","tabBarItem","widgetItem","tabBarSizer","createNormalizedSizes","horizontal","fixed","tabId","DockPanel","_drag","_tabsMovable","_tabsConstrained","_layoutModified","_mode","_renderer","_edges","edges","DEFAULT_EDGES","tabsConstrained","overlay","Overlay","layoutModified","createSingleDocumentConfig","LayoutModified","selectWidget","find","activateWidget","Platform","IS_EDGE","IS_IE","flush","_evtDragEnter","_evtDragLeave","_evtDragOver","_evtDrop","isGeneratedTabBarProperty","mimeData","hasData","_showOverlay","dropAction","proposedAction","zone","findDropTarget","factory","getData","getDropRef","deltaX","deltaY","xPos","yPos","paddingRight","tabHeight","_onTabMoved","_onCurrentChanged","_onTabCloseRequested","_onTabDetachRequested","_onTabActivateRequested","_onTabAddRequested","MimeData","setData","dragImage","cloneNode","supportedActions","then","_timer","_hidden","geo","delay","panel","from","selected","next","panelRect","pl","pr","pb","al","at","ar","ab","rx","round","ry","GridLayout","_rowSpacing","_columnSpacing","_rowStarts","_columnStarts","_rowSizers","_columnSizers","rowCount","reallocSizers","columnCount","rowSpacing","clampValue","columnSpacing","rowStretch","setRowStretch","columnStretch","setColumnStretch","it","filter","maxRow","maxCol","rowSpanCmp","getCellConfig","row","rowSpan","distributeMin","columnSpanCmp","c1","column","c2","columnSpan","fixedRowSpace","fixedColSpace","w","cellConfigProperty","setCellConfig","normalizeConfig","portion","MenuBar","_tabFocusIndex","_menus","_overflowMenu","_menuItemSizes","_overflowIndex","_forceItemsPosition","forceItemsPosition","_overflowMenuOptions","overflowMenuOptions","overflowIndex","overflowMenu","activeMenu","menus","openActiveMenu","addMenu","insertMenu","_onMenuAboutToClose","_onMenuMenuRequested","removeMenu","removeMenuAt","clearMenus","_evtFocusOut","_focusItemAt","tabFocusIndex","totalMenuSize","tabbable","disabled","overflowMenuTitle","overflowMenuItems","screenSize","_updateOverflowIndex","itemMenus","stopImmediatePropagation","_positionForMenu","relatedTarget","newMenu","oldMenu","decrement","increment","track","thumb","findPart","scrollBar","thumbNode","trackNode","decrementNode","incrementNode","SingletonLayout","_widget","StackedLayout","StackedPanel","_widgetRemoved","widgetRemoved","orientationFromPlacement","plc","placementToOrientationMap","directionFromPlacement","placementToDirectionMap","_groupByTarget","_idTick","_sortBySelector","others","DisposableDelegate","_counter","_activeWidget","_currentWidget","_numbers","_nodes","_activeChanged","activeChanged","currentWidget","activeWidget","focusNumber","_onWidgetDisposed","_setWidgets","valid","previous","first","second","_evtFocus","_evtBlur","oldCurrent","oldActive","newValue","focusTarget","_onRepeat","_repeatTimer","mouseX","mouseY","thumbRect","_pageRequested","_stepRequested","_value","_page","_maximum","_thumbMoved","maximum","page","thumbMoved","stepRequested","pageRequested","thumbStyle","_moveThumb","trackPos","trackSpan","trackRect","stackedPanel","_onWidgetRemoved","_tabPlacement","tabPlacement","previousWidget"],"sources":["../src/boxengine.ts","../src/widget.ts","../src/layout.ts","../src/utils.ts","../src/title.ts","../src/panellayout.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/stackedpanel.ts","../src/tabpanel.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/focustracker.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n  /**\n   * The preferred size for the sizer.\n   *\n   * #### Notes\n   * The sizer will be given this initial size subject to its size\n   * bounds. The sizer will not deviate from this size unless such\n   * deviation is required to fit into the available layout space.\n   *\n   * There is no limit to this value, but it will be clamped to the\n   * bounds defined by {@link minSize} and {@link maxSize}.\n   *\n   * The default value is `0`.\n   */\n  sizeHint = 0;\n\n  /**\n   * The minimum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized less than this value, even if\n   * it means the sizer will overflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity)`\n   * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `0`.\n   */\n  minSize = 0;\n\n  /**\n   * The maximum size of the sizer.\n   *\n   * #### Notes\n   * The sizer will never be sized greater than this value, even if\n   * it means the sizer will underflow the available layout space.\n   *\n   * It is assumed that this value lies in the range `[0, Infinity]`\n   * and that it is `>=` to {@link minSize}. Failure to adhere to this\n   * constraint will yield undefined results.\n   *\n   * The default value is `Infinity`.\n   */\n  maxSize = Infinity;\n\n  /**\n   * The stretch factor for the sizer.\n   *\n   * #### Notes\n   * This controls how much the sizer stretches relative to its sibling\n   * sizers when layout space is distributed. A stretch factor of zero\n   * is special and will cause the sizer to only be resized after all\n   * other sizers with a stretch factor greater than zero have been\n   * resized to their limits.\n   *\n   * It is assumed that this value is an integer that lies in the range\n   * `[0, Infinity)`. Failure to adhere to this constraint will yield\n   * undefined results.\n   *\n   * The default value is `1`.\n   */\n  stretch = 1;\n\n  /**\n   * The computed size of the sizer.\n   *\n   * #### Notes\n   * This value is the output of a call to {@link BoxEngine.calc}. It represents\n   * the computed size for the object along the layout orientation,\n   * and will always lie in the range `[minSize, maxSize]`.\n   *\n   * This value is output only.\n   *\n   * Changing this value will have no effect.\n   */\n  size = 0;\n\n  /**\n   * An internal storage property for the layout algorithm.\n   *\n   * #### Notes\n   * This value is used as temporary storage by the layout algorithm.\n   *\n   * Changing this value will have no effect.\n   */\n  done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n  /**\n   * Calculate the optimal layout sizes for a sequence of box sizers.\n   *\n   * This distributes the available layout space among the box sizers\n   * according to the following algorithm:\n   *\n   * 1. Initialize the sizers's size to its size hint and compute the\n   *    sums for each of size hint, min size, and max size.\n   *\n   * 2. If the total size hint equals the available space, return.\n   *\n   * 3. If the available space is less than the total min size, set all\n   *    sizers to their min size and return.\n   *\n   * 4. If the available space is greater than the total max size, set\n   *    all sizers to their max size and return.\n   *\n   * 5. If the layout space is less than the total size hint, distribute\n   *    the negative delta as follows:\n   *\n   *    a. Shrink each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the negative space and the sum of\n   *       stretch factors. If the sizer reaches its min size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains negative\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its min size,\n   *       remove it from the computation.\n   *\n   * 6. If the layout space is greater than the total size hint,\n   *    distribute the positive delta as follows:\n   *\n   *    a. Expand each sizer with a stretch factor greater than zero by\n   *       an amount proportional to the postive space and the sum of\n   *       stretch factors. If the sizer reaches its max size, remove\n   *       it and its stretch factor from the computation.\n   *\n   *    b. If after adjusting all stretch sizers there remains positive\n   *       space, distribute the space equally among the sizers with a\n   *       stretch factor of zero. If a sizer reaches its max size,\n   *       remove it from the computation.\n   *\n   * 7. return\n   *\n   * @param sizers - The sizers for a particular layout line.\n   *\n   * @param space - The available layout space for the sizers.\n   *\n   * @returns The delta between the provided available space and the\n   *   actual consumed space. This value will be zero if the sizers\n   *   can be adjusted to fit, negative if the available space is too\n   *   small, and positive if the available space is too large.\n   *\n   * #### Notes\n   * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n   *\n   * This function can be called at any time to recompute the layout for\n   * an existing sequence of sizers. The previously computed results will\n   * have no effect on the new output. It is therefore not necessary to\n   * create new sizer objects on each resize event.\n   */\n  export function calc(sizers: ArrayLike<BoxSizer>, space: number): number {\n    // Bail early if there is nothing to do.\n    let count = sizers.length;\n    if (count === 0) {\n      return space;\n    }\n\n    // Setup the size and stretch counters.\n    let totalMin = 0;\n    let totalMax = 0;\n    let totalSize = 0;\n    let totalStretch = 0;\n    let stretchCount = 0;\n\n    // Setup the sizers and compute the totals.\n    for (let i = 0; i < count; ++i) {\n      let sizer = sizers[i];\n      let min = sizer.minSize;\n      let max = sizer.maxSize;\n      let hint = sizer.sizeHint;\n      sizer.done = false;\n      sizer.size = Math.max(min, Math.min(hint, max));\n      totalSize += sizer.size;\n      totalMin += min;\n      totalMax += max;\n      if (sizer.stretch > 0) {\n        totalStretch += sizer.stretch;\n        stretchCount++;\n      }\n    }\n\n    // If the space is equal to the total size, return early.\n    if (space === totalSize) {\n      return 0;\n    }\n\n    // If the space is less than the total min, minimize each sizer.\n    if (space <= totalMin) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.minSize;\n      }\n      return space - totalMin;\n    }\n\n    // If the space is greater than the total max, maximize each sizer.\n    if (space >= totalMax) {\n      for (let i = 0; i < count; ++i) {\n        let sizer = sizers[i];\n        sizer.size = sizer.maxSize;\n      }\n      return space - totalMax;\n    }\n\n    // The loops below perform sub-pixel precision sizing. A near zero\n    // value is used for compares instead of zero to ensure that the\n    // loop terminates when the subdivided space is reasonably small.\n    let nearZero = 0.01;\n\n    // A counter which is decremented each time a sizer is resized to\n    // its limit. This ensures the loops terminate even if there is\n    // space remaining to distribute.\n    let notDoneCount = count;\n\n    // Distribute negative delta space.\n    if (space < totalSize) {\n      // Shrink each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its min size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = totalSize - space;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size - amt <= sizer.minSize) {\n            freeSpace -= sizer.size - sizer.minSize;\n            sizer.size = sizer.minSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size -= amt;\n          }\n        }\n      }\n    }\n    // Distribute positive delta space.\n    else {\n      // Expand each stretchable sizer by an amount proportional to its\n      // stretch factor. If a sizer reaches its max size it's marked as\n      // done. The loop progresses in phases where each sizer is given\n      // a chance to consume its fair share for the pass, regardless of\n      // whether a sizer before it reached its limit. This continues\n      // until the stretchable sizers or the free space is exhausted.\n      let freeSpace = space - totalSize;\n      while (stretchCount > 0 && freeSpace > nearZero) {\n        let distSpace = freeSpace;\n        let distStretch = totalStretch;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done || sizer.stretch === 0) {\n            continue;\n          }\n          let amt = (sizer.stretch * distSpace) / distStretch;\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            totalStretch -= sizer.stretch;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n            stretchCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n      // Distribute any remaining space evenly among the non-stretchable\n      // sizers. This progresses in phases in the same manner as above.\n      while (notDoneCount > 0 && freeSpace > nearZero) {\n        let amt = freeSpace / notDoneCount;\n        for (let i = 0; i < count; ++i) {\n          let sizer = sizers[i];\n          if (sizer.done) {\n            continue;\n          }\n          if (sizer.size + amt >= sizer.maxSize) {\n            freeSpace -= sizer.maxSize - sizer.size;\n            sizer.size = sizer.maxSize;\n            sizer.done = true;\n            notDoneCount--;\n          } else {\n            freeSpace -= amt;\n            sizer.size += amt;\n          }\n        }\n      }\n    }\n\n    // Indicate that the consumed space equals the available space.\n    return 0;\n  }\n\n  /**\n   * Adjust a sizer by a delta and update its neighbors accordingly.\n   *\n   * @param sizers - The sizers which should be adjusted.\n   *\n   * @param index - The index of the sizer to grow.\n   *\n   * @param delta - The amount to adjust the sizer, positive or negative.\n   *\n   * #### Notes\n   * This will adjust the indicated sizer by the specified amount, along\n   * with the sizes of the appropriate neighbors, subject to the limits\n   * specified by each of the sizers.\n   *\n   * This is useful when implementing box layouts where the boundaries\n   * between the sizers are interactively adjustable by the user.\n   */\n  export function adjust(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Bail early when there is nothing to do.\n    if (sizers.length === 0 || delta === 0) {\n      return;\n    }\n\n    // Dispatch to the proper implementation.\n    if (delta > 0) {\n      growSizer(sizers, index, delta);\n    } else {\n      shrinkSizer(sizers, index, -delta);\n    }\n  }\n\n  /**\n   * Grow a sizer by a positive delta and adjust neighbors.\n   */\n  function growSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the left can expand.\n    let growLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the right can shrink.\n    let shrinkLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the left by the delta.\n    let grow = delta;\n    for (let i = index; i >= 0 && grow > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the right by the delta.\n    let shrink = delta;\n    for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n\n  /**\n   * Shrink a sizer by a positive delta and adjust neighbors.\n   */\n  function shrinkSizer(\n    sizers: ArrayLike<BoxSizer>,\n    index: number,\n    delta: number\n  ): void {\n    // Compute how much the items to the right can expand.\n    let growLimit = 0;\n    for (let i = index + 1, n = sizers.length; i < n; ++i) {\n      let sizer = sizers[i];\n      growLimit += sizer.maxSize - sizer.size;\n    }\n\n    // Compute how much the items to the left can shrink.\n    let shrinkLimit = 0;\n    for (let i = 0; i <= index; ++i) {\n      let sizer = sizers[i];\n      shrinkLimit += sizer.size - sizer.minSize;\n    }\n\n    // Clamp the delta adjustment to the limits.\n    delta = Math.min(delta, growLimit, shrinkLimit);\n\n    // Grow the sizers to the right by the delta.\n    let grow = delta;\n    for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n      let sizer = sizers[i];\n      let limit = sizer.maxSize - sizer.size;\n      if (limit >= grow) {\n        sizer.sizeHint = sizer.size + grow;\n        grow = 0;\n      } else {\n        sizer.sizeHint = sizer.size + limit;\n        grow -= limit;\n      }\n    }\n\n    // Shrink the sizers to the left by the delta.\n    let shrink = delta;\n    for (let i = index; i >= 0 && shrink > 0; --i) {\n      let sizer = sizers[i];\n      let limit = sizer.size - sizer.minSize;\n      if (limit >= shrink) {\n        sizer.sizeHint = sizer.size - shrink;\n        shrink = 0;\n      } else {\n        sizer.sizeHint = sizer.size - limit;\n        shrink -= limit;\n      }\n    }\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n  ConflatableMessage,\n  IMessageHandler,\n  Message,\n  MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n  /**\n   * Construct a new widget.\n   *\n   * @param options - The options for initializing the widget.\n   */\n  constructor(options: Widget.IOptions = {}) {\n    this.node = Private.createNode(options);\n    this.addClass('lm-Widget');\n  }\n\n  /**\n   * Dispose of the widget and its descendant widgets.\n   *\n   * #### Notes\n   * It is unsafe to use the widget after it has been disposed.\n   *\n   * All calls made to this method after the first are a no-op.\n   */\n  dispose(): void {\n    // Do nothing if the widget is already disposed.\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Set the disposed flag and emit the disposed signal.\n    this.setFlag(Widget.Flag.IsDisposed);\n    this._disposed.emit(undefined);\n\n    // Remove or detach the widget if necessary.\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n\n    // Dispose of the widget layout.\n    if (this._layout) {\n      this._layout.dispose();\n      this._layout = null;\n    }\n\n    // Dispose the title\n    this.title.dispose();\n\n    // Clear the extra data associated with the widget.\n    Signal.clearData(this);\n    MessageLoop.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * A signal emitted when the widget is disposed.\n   */\n  get disposed(): ISignal<this, void> {\n    return this._disposed;\n  }\n\n  /**\n   * Get the DOM node owned by the widget.\n   */\n  readonly node: HTMLElement;\n\n  /**\n   * Test whether the widget has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this.testFlag(Widget.Flag.IsDisposed);\n  }\n\n  /**\n   * Test whether the widget's node is attached to the DOM.\n   */\n  get isAttached(): boolean {\n    return this.testFlag(Widget.Flag.IsAttached);\n  }\n\n  /**\n   * Test whether the widget is explicitly hidden.\n   *\n   * #### Notes\n   * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n   * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n   */\n  get isHidden(): boolean {\n    return this.testFlag(Widget.Flag.IsHidden);\n  }\n\n  /**\n   * Test whether the widget is visible.\n   *\n   * #### Notes\n   * A widget is visible when it is attached to the DOM, is not\n   * explicitly hidden, and has no explicitly hidden ancestors.\n   *\n   * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n   * It recursively checks the visibility of all parent widgets.\n   */\n  get isVisible(): boolean {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let parent: Widget | null = this;\n    do {\n      if (parent.isHidden || !parent.isAttached) {\n        return false;\n      }\n      parent = parent.parent;\n    } while (parent != null);\n    return true;\n  }\n\n  /**\n   * The title object for the widget.\n   *\n   * #### Notes\n   * The title object is used by some container widgets when displaying\n   * the widget alongside some title, such as a tab panel or side bar.\n   *\n   * Since not all widgets will use the title, it is created on demand.\n   *\n   * The `owner` property of the title is set to this widget.\n   */\n  get title(): Title<Widget> {\n    return Private.titleProperty.get(this);\n  }\n\n  /**\n   * Get the id of the widget's DOM node.\n   */\n  get id(): string {\n    return this.node.id;\n  }\n\n  /**\n   * Set the id of the widget's DOM node.\n   */\n  set id(value: string) {\n    this.node.id = value;\n  }\n\n  /**\n   * The dataset for the widget's DOM node.\n   */\n  get dataset(): DOMStringMap {\n    return this.node.dataset;\n  }\n\n  /**\n   * Get the method for hiding the widget.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding the widget.\n   */\n  set hiddenMode(value: Widget.HiddenMode) {\n    if (this._hiddenMode === value) {\n      return;\n    }\n\n    if (this.isHidden) {\n      // Reset styles set by previous mode.\n      this._toggleHidden(false);\n    }\n\n    if (value == Widget.HiddenMode.Scale) {\n      this.node.style.willChange = 'transform';\n    } else {\n      this.node.style.willChange = 'auto';\n    }\n\n    this._hiddenMode = value;\n\n    if (this.isHidden) {\n      // Set styles for new mode.\n      this._toggleHidden(true);\n    }\n  }\n\n  /**\n   * Get the parent of the widget.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent of the widget.\n   *\n   * #### Notes\n   * Children are typically added to a widget by using a layout, which\n   * means user code will not normally set the parent widget directly.\n   *\n   * The widget will be automatically removed from its old parent.\n   *\n   * This is a no-op if there is no effective parent change.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (value && this.contains(value)) {\n      throw new Error('Invalid parent widget.');\n    }\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-removed', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    this._parent = value;\n    if (this._parent && !this._parent.isDisposed) {\n      let msg = new Widget.ChildMessage('child-added', this);\n      MessageLoop.sendMessage(this._parent, msg);\n    }\n    if (!this.isDisposed) {\n      MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n    }\n  }\n\n  /**\n   * Get the layout for the widget.\n   */\n  get layout(): Layout | null {\n    return this._layout;\n  }\n\n  /**\n   * Set the layout for the widget.\n   *\n   * #### Notes\n   * The layout is single-use only. It cannot be changed after the\n   * first assignment.\n   *\n   * The layout is disposed automatically when the widget is disposed.\n   */\n  set layout(value: Layout | null) {\n    if (this._layout === value) {\n      return;\n    }\n    if (this.testFlag(Widget.Flag.DisallowLayout)) {\n      throw new Error('Cannot set widget layout.');\n    }\n    if (this._layout) {\n      throw new Error('Cannot change widget layout.');\n    }\n    if (value!.parent) {\n      throw new Error('Cannot change layout parent.');\n    }\n    this._layout = value;\n    value!.parent = this;\n  }\n\n  /**\n   * Create an iterator over the widget's children.\n   *\n   * @returns A new iterator over the children of the widget.\n   *\n   * #### Notes\n   * The widget must have a populated layout in order to have children.\n   *\n   * If a layout is not installed, the returned iterator will be empty.\n   */\n  *children(): IterableIterator<Widget> {\n    if (this._layout) {\n      yield* this._layout;\n    }\n  }\n\n  /**\n   * Test whether a widget is a descendant of this widget.\n   *\n   * @param widget - The descendant widget of interest.\n   *\n   * @returns `true` if the widget is a descendant, `false` otherwise.\n   */\n  contains(widget: Widget): boolean {\n    for (let value: Widget | null = widget; value; value = value._parent) {\n      if (value === this) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Test whether the widget's DOM node has the given class name.\n   *\n   * @param name - The class name of interest.\n   *\n   * @returns `true` if the node has the class, `false` otherwise.\n   */\n  hasClass(name: string): boolean {\n    return this.node.classList.contains(name);\n  }\n\n  /**\n   * Add a class name to the widget's DOM node.\n   *\n   * @param name - The class name to add to the node.\n   *\n   * #### Notes\n   * If the class name is already added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  addClass(name: string): void {\n    this.node.classList.add(name);\n  }\n\n  /**\n   * Remove a class name from the widget's DOM node.\n   *\n   * @param name - The class name to remove from the node.\n   *\n   * #### Notes\n   * If the class name is not yet added to the node, this is a no-op.\n   *\n   * The class name must not contain whitespace.\n   */\n  removeClass(name: string): void {\n    this.node.classList.remove(name);\n  }\n\n  /**\n   * Toggle a class name on the widget's DOM node.\n   *\n   * @param name - The class name to toggle on the node.\n   *\n   * @param force - Whether to force add the class (`true`) or force\n   *   remove the class (`false`). If not provided, the presence of\n   *   the class will be toggled from its current state.\n   *\n   * @returns `true` if the class is now present, `false` otherwise.\n   *\n   * #### Notes\n   * The class name must not contain whitespace.\n   */\n  toggleClass(name: string, force?: boolean): boolean {\n    if (force === true) {\n      this.node.classList.add(name);\n      return true;\n    }\n    if (force === false) {\n      this.node.classList.remove(name);\n      return false;\n    }\n    return this.node.classList.toggle(name);\n  }\n\n  /**\n   * Post an `'update-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  update(): void {\n    MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n  }\n\n  /**\n   * Post a `'fit-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  fit(): void {\n    MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n  }\n\n  /**\n   * Post an `'activate-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for posting the message.\n   */\n  activate(): void {\n    MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n  }\n\n  /**\n   * Send a `'close-request'` message to the widget.\n   *\n   * #### Notes\n   * This is a simple convenience method for sending the message.\n   */\n  close(): void {\n    MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n  }\n\n  /**\n   * Show the widget and make it visible to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `false`.\n   *\n   * If the widget is not explicitly hidden, this is a no-op.\n   */\n  show(): void {\n    if (!this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n    }\n    this.clearFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(false);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-shown', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Hide the widget and make it hidden to its parent widget.\n   *\n   * #### Notes\n   * This causes the {@link isHidden} property to be `true`.\n   *\n   * If the widget is explicitly hidden, this is a no-op.\n   */\n  hide(): void {\n    if (this.testFlag(Widget.Flag.IsHidden)) {\n      return;\n    }\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n    }\n    this.setFlag(Widget.Flag.IsHidden);\n    this._toggleHidden(true);\n\n    if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n      MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n    }\n    if (this.parent) {\n      let msg = new Widget.ChildMessage('child-hidden', this);\n      MessageLoop.sendMessage(this.parent, msg);\n    }\n  }\n\n  /**\n   * Show or hide the widget according to a boolean value.\n   *\n   * @param hidden - `true` to hide the widget, or `false` to show it.\n   *\n   * #### Notes\n   * This is a convenience method for `hide()` and `show()`.\n   */\n  setHidden(hidden: boolean): void {\n    if (hidden) {\n      this.hide();\n    } else {\n      this.show();\n    }\n  }\n\n  /**\n   * Test whether the given widget flag is set.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  testFlag(flag: Widget.Flag): boolean {\n    return (this._flags & flag) !== 0;\n  }\n\n  /**\n   * Set the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  setFlag(flag: Widget.Flag): void {\n    this._flags |= flag;\n  }\n\n  /**\n   * Clear the given widget flag.\n   *\n   * #### Notes\n   * This will not typically be called directly by user code.\n   *\n   * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n   * It will be removed in a future version.\n   */\n  clearFlag(flag: Widget.Flag): void {\n    this._flags &= ~flag;\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   *\n   * #### Notes\n   * Subclasses may reimplement this method as needed.\n   */\n  processMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.notifyLayout(msg);\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.notifyLayout(msg);\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.notifyLayout(msg);\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.notifyLayout(msg);\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.setFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.notifyLayout(msg);\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.notifyLayout(msg);\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.notifyLayout(msg);\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n          this.setFlag(Widget.Flag.IsVisible);\n        }\n        this.setFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.notifyLayout(msg);\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.clearFlag(Widget.Flag.IsVisible);\n        this.clearFlag(Widget.Flag.IsAttached);\n        this.notifyLayout(msg);\n        this.onAfterDetach(msg);\n        break;\n      case 'activate-request':\n        this.notifyLayout(msg);\n        this.onActivateRequest(msg);\n        break;\n      case 'close-request':\n        this.notifyLayout(msg);\n        this.onCloseRequest(msg);\n        break;\n      case 'child-added':\n        this.notifyLayout(msg);\n        this.onChildAdded(msg as Widget.ChildMessage);\n        break;\n      case 'child-removed':\n        this.notifyLayout(msg);\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      default:\n        this.notifyLayout(msg);\n        break;\n    }\n  }\n\n  /**\n   * Invoke the message processing routine of the widget's layout.\n   *\n   * @param msg - The message to dispatch to the layout.\n   *\n   * #### Notes\n   * This is a no-op if the widget does not have a layout.\n   *\n   * This will not typically be called directly by user code.\n   */\n  protected notifyLayout(msg: Message): void {\n    if (this._layout) {\n      this._layout.processParentMessage(msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   *\n   * #### Notes\n   * The default implementation unparents or detaches the widget.\n   */\n  protected onCloseRequest(msg: Message): void {\n    if (this.parent) {\n      this.parent = null;\n    } else if (this.isAttached) {\n      Widget.detach(this);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {}\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onUpdateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onActivateRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterShow(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterHide(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterAttach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onBeforeDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onAfterDetach(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n  private _toggleHidden(hidden: boolean) {\n    if (hidden) {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.addClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = 'scale(0)';\n          this.node.setAttribute('aria-hidden', 'true');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = 'hidden';\n          this.node.style.zIndex = '-1';\n          break;\n      }\n    } else {\n      switch (this._hiddenMode) {\n        case Widget.HiddenMode.Display:\n          this.removeClass('lm-mod-hidden');\n          break;\n        case Widget.HiddenMode.Scale:\n          this.node.style.transform = '';\n          this.node.removeAttribute('aria-hidden');\n          break;\n        case Widget.HiddenMode.ContentVisibility:\n          // @ts-expect-error content-visibility unknown by DOM lib types\n          this.node.style.contentVisibility = '';\n          this.node.style.zIndex = '';\n          break;\n      }\n    }\n  }\n\n  private _flags = 0;\n  private _layout: Layout | null = null;\n  private _parent: Widget | null = null;\n  private _disposed = new Signal<this, void>(this);\n  private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n  /**\n   * An options object for initializing a widget.\n   */\n  export interface IOptions {\n    /**\n     * The optional node to use for the widget.\n     *\n     * If a node is provided, the widget will assume full ownership\n     * and control of the node, as if it had created the node itself.\n     *\n     * The default is a new `<div>`.\n     */\n    node?: HTMLElement;\n\n    /**\n     * The optional element tag, used for constructing the widget's node.\n     *\n     * If a pre-constructed node is provided via the `node` arg, this\n     * value is ignored.\n     */\n    tag?: keyof HTMLElementTagNameMap;\n  }\n\n  /**\n   * The method for hiding the widget.\n   *\n   * The default is Display.\n   *\n   * Using `Scale` will often increase performance as most browsers will not\n   * trigger style computation for the `transform` action. This should be used\n   * sparingly and tested, since increasing the number of composition layers\n   * may slow things down.\n   *\n   * To ensure the transformation does not trigger style recomputation, you\n   * may need to set the widget CSS style `will-change: transform`. This\n   * should be used only when needed as it may overwhelm the browser with a\n   * high number of layers. See\n   * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n   */\n  export enum HiddenMode {\n    /**\n     * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n     * CSS from the standard Lumino CSS.\n     */\n    Display = 0,\n\n    /**\n     * Hide the widget by setting the `transform` to `'scale(0)'`.\n     */\n    Scale,\n\n    /**\n     *Hide the widget by setting the `content-visibility` to `'hidden'`.\n     */\n    ContentVisibility\n  }\n\n  /**\n   * An enum of widget bit flags.\n   */\n  export enum Flag {\n    /**\n     * The widget has been disposed.\n     */\n    IsDisposed = 0x1,\n\n    /**\n     * The widget is attached to the DOM.\n     */\n    IsAttached = 0x2,\n\n    /**\n     * The widget is hidden.\n     */\n    IsHidden = 0x4,\n\n    /**\n     * The widget is visible.\n     *\n     * @deprecated since 2.7.0, apply that flag consistently was not reliable\n     * so it was dropped in favor of a recursive check of the visibility of all parents.\n     */\n    IsVisible = 0x8,\n\n    /**\n     * A layout cannot be set on the widget.\n     */\n    DisallowLayout = 0x10\n  }\n\n  /**\n   * A collection of stateless messages related to widgets.\n   */\n  export namespace Msg {\n    /**\n     * A singleton `'before-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const BeforeShow = new Message('before-show');\n\n    /**\n     * A singleton `'after-show'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes visible.\n     *\n     * This message is **not** sent when the widget is being attached.\n     */\n    export const AfterShow = new Message('after-show');\n\n    /**\n     * A singleton `'before-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const BeforeHide = new Message('before-hide');\n\n    /**\n     * A singleton `'after-hide'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it becomes not-visible.\n     *\n     * This message is **not** sent when the widget is being detached.\n     */\n    export const AfterHide = new Message('after-hide');\n\n    /**\n     * A singleton `'before-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is attached.\n     */\n    export const BeforeAttach = new Message('before-attach');\n\n    /**\n     * A singleton `'after-attach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is attached.\n     */\n    export const AfterAttach = new Message('after-attach');\n\n    /**\n     * A singleton `'before-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget before it is detached.\n     */\n    export const BeforeDetach = new Message('before-detach');\n\n    /**\n     * A singleton `'after-detach'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget after it is detached.\n     */\n    export const AfterDetach = new Message('after-detach');\n\n    /**\n     * A singleton `'parent-changed'` message.\n     *\n     * #### Notes\n     * This message is sent to a widget when its parent has changed.\n     */\n    export const ParentChanged = new Message('parent-changed');\n\n    /**\n     * A singleton conflatable `'update-request'` message.\n     *\n     * #### Notes\n     * This message can be dispatched to supporting widgets in order to\n     * update their content based on the current widget state. Not all\n     * widgets will respond to messages of this type.\n     *\n     * For widgets with a layout, this message will inform the layout to\n     * update the position and size of its child widgets.\n     */\n    export const UpdateRequest = new ConflatableMessage('update-request');\n\n    /**\n     * A singleton conflatable `'fit-request'` message.\n     *\n     * #### Notes\n     * For widgets with a layout, this message will inform the layout to\n     * recalculate its size constraints to fit the space requirements of\n     * its child widgets, and to update their position and size. Not all\n     * layouts will respond to messages of this type.\n     */\n    export const FitRequest = new ConflatableMessage('fit-request');\n\n    /**\n     * A singleton conflatable `'activate-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should\n     * perform the actions necessary to activate the widget, which\n     * may include focusing its node or descendant node.\n     */\n    export const ActivateRequest = new ConflatableMessage('activate-request');\n\n    /**\n     * A singleton conflatable `'close-request'` message.\n     *\n     * #### Notes\n     * This message should be dispatched to a widget when it should close\n     * and remove itself from the widget hierarchy.\n     */\n    export const CloseRequest = new ConflatableMessage('close-request');\n  }\n\n  /**\n   * A message class for child related messages.\n   */\n  export class ChildMessage extends Message {\n    /**\n     * Construct a new child message.\n     *\n     * @param type - The message type.\n     *\n     * @param child - The child widget for the message.\n     */\n    constructor(type: string, child: Widget) {\n      super(type);\n      this.child = child;\n    }\n\n    /**\n     * The child widget for the message.\n     */\n    readonly child: Widget;\n  }\n\n  /**\n   * A message class for `'resize'` messages.\n   */\n  export class ResizeMessage extends Message {\n    /**\n     * Construct a new resize message.\n     *\n     * @param width - The **offset width** of the widget, or `-1` if\n     *   the width is not known.\n     *\n     * @param height - The **offset height** of the widget, or `-1` if\n     *   the height is not known.\n     */\n    constructor(width: number, height: number) {\n      super('resize');\n      this.width = width;\n      this.height = height;\n    }\n\n    /**\n     * The offset width of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the width is unknown.\n     */\n    readonly width: number;\n\n    /**\n     * The offset height of the widget.\n     *\n     * #### Notes\n     * This will be `-1` if the height is unknown.\n     */\n    readonly height: number;\n  }\n\n  /**\n   * The namespace for the `ResizeMessage` class statics.\n   */\n  export namespace ResizeMessage {\n    /**\n     * A singleton `'resize'` message with an unknown size.\n     */\n    export const UnknownSize = new ResizeMessage(-1, -1);\n  }\n\n  /**\n   * Attach a widget to a host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param host - The DOM node to use as the widget's host.\n   *\n   * @param ref - The child of `host` to use as the reference element.\n   *   If this is provided, the widget will be inserted before this\n   *   node in the host. The default is `null`, which will cause the\n   *   widget to be added as the last child of the host.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget, if\n   * the widget is already attached, or if the host is not attached\n   * to the DOM.\n   */\n  export function attach(\n    widget: Widget,\n    host: HTMLElement,\n    ref: HTMLElement | null = null\n  ): void {\n    if (widget.parent) {\n      throw new Error('Cannot attach a child widget.');\n    }\n    if (widget.isAttached || widget.node.isConnected) {\n      throw new Error('Widget is already attached.');\n    }\n    if (!host.isConnected) {\n      throw new Error('Host is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    host.insertBefore(widget.node, ref);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n  }\n\n  /**\n   * Detach the widget from its host DOM node.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will throw an error if the widget is not a root widget,\n   * or if the widget is not attached to the DOM.\n   */\n  export function detach(widget: Widget): void {\n    if (widget.parent) {\n      throw new Error('Cannot detach a child widget.');\n    }\n    if (!widget.isAttached || !widget.node.isConnected) {\n      throw new Error('Widget is not attached.');\n    }\n    MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    widget.node.parentNode!.removeChild(widget.node);\n    MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An attached property for the widget title object.\n   */\n  export const titleProperty = new AttachedProperty<Widget, Title<Widget>>({\n    name: 'title',\n    create: owner => new Title<Widget>({ owner })\n  });\n\n  /**\n   * Create a DOM node for the given widget options.\n   */\n  export function createNode(options: Widget.IOptions): HTMLElement {\n    return options.node || document.createElement(options.tag || 'div');\n  }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable<Widget>, IDisposable {\n  /**\n   * Construct a new layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: Layout.IOptions = {}) {\n    this._fitPolicy = options.fitPolicy || 'set-min-size';\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This should be reimplemented to clear and dispose of the widgets.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    this._parent = null;\n    this._disposed = true;\n    Signal.clearData(this);\n    AttachedProperty.clearData(this);\n  }\n\n  /**\n   * Test whether the layout is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Get the parent widget of the layout.\n   */\n  get parent(): Widget | null {\n    return this._parent;\n  }\n\n  /**\n   * Set the parent widget of the layout.\n   *\n   * #### Notes\n   * This is set automatically when installing the layout on the parent\n   * widget. The parent widget should not be set directly by user code.\n   */\n  set parent(value: Widget | null) {\n    if (this._parent === value) {\n      return;\n    }\n    if (this._parent) {\n      throw new Error('Cannot change parent widget.');\n    }\n    if (value!.layout !== this) {\n      throw new Error('Invalid parent widget.');\n    }\n    this._parent = value;\n    this.init();\n  }\n\n  /**\n   * Get the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  get fitPolicy(): Layout.FitPolicy {\n    return this._fitPolicy;\n  }\n\n  /**\n   * Set the fit policy for the layout.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   *\n   * Changing the fit policy will clear the current size constraint\n   * for the parent widget and then re-fit the parent.\n   */\n  set fitPolicy(value: Layout.FitPolicy) {\n    // Bail if the policy does not change\n    if (this._fitPolicy === value) {\n      return;\n    }\n\n    // Update the internal policy.\n    this._fitPolicy = value;\n\n    // Clear the size constraints and schedule a fit of the parent.\n    if (this._parent) {\n      let style = this._parent.node.style;\n      style.minWidth = '';\n      style.minHeight = '';\n      style.maxWidth = '';\n      style.maxHeight = '';\n      this._parent.fit();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This abstract method must be implemented by a subclass.\n   */\n  abstract [Symbol.iterator](): IterableIterator<Widget>;\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method should *not* modify the widget's `parent`.\n   */\n  abstract removeWidget(widget: Widget): void;\n\n  /**\n   * Process a message sent to the parent widget.\n   *\n   * @param msg - The message sent to the parent widget.\n   *\n   * #### Notes\n   * This method is called by the parent widget to process a message.\n   *\n   * Subclasses may reimplement this method as needed.\n   */\n  processParentMessage(msg: Message): void {\n    switch (msg.type) {\n      case 'resize':\n        this.onResize(msg as Widget.ResizeMessage);\n        break;\n      case 'update-request':\n        this.onUpdateRequest(msg);\n        break;\n      case 'fit-request':\n        this.onFitRequest(msg);\n        break;\n      case 'before-show':\n        this.onBeforeShow(msg);\n        break;\n      case 'after-show':\n        this.onAfterShow(msg);\n        break;\n      case 'before-hide':\n        this.onBeforeHide(msg);\n        break;\n      case 'after-hide':\n        this.onAfterHide(msg);\n        break;\n      case 'before-attach':\n        this.onBeforeAttach(msg);\n        break;\n      case 'after-attach':\n        this.onAfterAttach(msg);\n        break;\n      case 'before-detach':\n        this.onBeforeDetach(msg);\n        break;\n      case 'after-detach':\n        this.onAfterDetach(msg);\n        break;\n      case 'child-removed':\n        this.onChildRemoved(msg as Widget.ChildMessage);\n        break;\n      case 'child-shown':\n        this.onChildShown(msg as Widget.ChildMessage);\n        break;\n      case 'child-hidden':\n        this.onChildHidden(msg as Widget.ChildMessage);\n        break;\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   *\n   * #### Notes\n   * This method is invoked immediately after the layout is installed\n   * on the parent widget.\n   *\n   * The default implementation reparents all of the widgets to the\n   * layout parent widget.\n   *\n   * Subclasses should reimplement this method and attach the child\n   * widget nodes to the parent widget's node.\n   */\n  protected init(): void {\n    for (const widget of this) {\n      widget.parent = this.parent;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the specified layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   *\n   * #### Notes\n   * The layout should ensure that its widgets are resized according\n   * to the available layout space, and that they are sent a `'resize'`\n   * message if appropriate.\n   *\n   * The default implementation of this method sends an `UnknownSize`\n   * resize message to all widgets.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-attach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterAttach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message\n   * to all widgets. It assumes all widget nodes are attached to the\n   * parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterDetach(msg: Message): void {\n    for (const widget of this) {\n      MessageLoop.sendMessage(widget, msg);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterShow(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onBeforeHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'after-hide'` message.\n   *\n   * #### Notes\n   * The default implementation of this method forwards the message to\n   * all non-hidden widgets. It assumes all widget nodes are attached\n   * to the parent widget node.\n   *\n   * This may be reimplemented by subclasses as needed.\n   */\n  protected onAfterHide(msg: Message): void {\n    for (const widget of this) {\n      if (!widget.isHidden) {\n        MessageLoop.sendMessage(widget, msg);\n      }\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   *\n   * #### Notes\n   * This will remove the child widget from the layout.\n   *\n   * Subclasses should **not** typically reimplement this method.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    this.removeWidget(msg.child);\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onFitRequest(msg: Message): void {}\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {}\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   *\n   * #### Notes\n   * The default implementation of this handler is a no-op.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n  private _disposed = false;\n  private _fitPolicy: Layout.FitPolicy;\n  private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n  /**\n   * A type alias for the layout fit policy.\n   *\n   * #### Notes\n   * The fit policy controls the computed size constraints which are\n   * applied to the parent widget by the layout.\n   *\n   * Some layout implementations may ignore the fit policy.\n   */\n  export type FitPolicy =\n    | /**\n     * No size constraint will be applied to the parent widget.\n     */\n    'set-no-constraint'\n\n    /**\n     * The computed min size will be applied to the parent widget.\n     */\n    | 'set-min-size';\n\n  /**\n   * An options object for initializing a layout.\n   */\n  export interface IOptions {\n    /**\n     * The fit policy for the layout.\n     *\n     * The default is `'set-min-size'`.\n     */\n    fitPolicy?: FitPolicy;\n  }\n\n  /**\n   * A type alias for the horizontal alignment of a widget.\n   */\n  export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n  /**\n   * A type alias for the vertical alignment of a widget.\n   */\n  export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n  /**\n   * Get the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The horizontal alignment for the widget.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   */\n  export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n    return Private.horizontalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the horizontal alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the horizontal alignment.\n   *\n   * #### Notes\n   * If the layout width allocated to a widget is larger than its max\n   * width, the horizontal alignment controls how the widget is placed\n   * within the extra horizontal space.\n   *\n   * If the allocated width is less than the widget's max width, the\n   * horizontal alignment has no effect.\n   *\n   * Some layout implementations may ignore horizontal alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setHorizontalAlignment(\n    widget: Widget,\n    value: HorizontalAlignment\n  ): void {\n    Private.horizontalAlignmentProperty.set(widget, value);\n  }\n\n  /**\n   * Get the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The vertical alignment for the widget.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   */\n  export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n    return Private.verticalAlignmentProperty.get(widget);\n  }\n\n  /**\n   * Set the vertical alignment for a widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the vertical alignment.\n   *\n   * #### Notes\n   * If the layout height allocated to a widget is larger than its max\n   * height, the vertical alignment controls how the widget is placed\n   * within the extra vertical space.\n   *\n   * If the allocated height is less than the widget's max height, the\n   * vertical alignment has no effect.\n   *\n   * Some layout implementations may ignore vertical alignment.\n   *\n   * Changing the horizontal alignment will post an `update-request`\n   * message to widget's parent, provided the parent has a layout\n   * installed.\n   */\n  export function setVerticalAlignment(\n    widget: Widget,\n    value: VerticalAlignment\n  ): void {\n    Private.verticalAlignmentProperty.set(widget, value);\n  }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n  /**\n   * Construct a new layout item.\n   *\n   * @param widget - The widget to be managed by the item.\n   *\n   * #### Notes\n   * The widget will be set to absolute positioning.\n   * The widget will use strict CSS containment.\n   */\n  constructor(widget: Widget) {\n    this.widget = widget;\n    this.widget.node.style.position = 'absolute';\n    this.widget.node.style.contain = 'strict';\n  }\n\n  /**\n   * Dispose of the the layout item.\n   *\n   * #### Notes\n   * This will reset the positioning of the widget.\n   */\n  dispose(): void {\n    // Do nothing if the item is already disposed.\n    if (this._disposed) {\n      return;\n    }\n\n    // Mark the item as disposed.\n    this._disposed = true;\n\n    // Reset the widget style.\n    let style = this.widget.node.style;\n    style.position = '';\n    style.top = '';\n    style.left = '';\n    style.width = '';\n    style.height = '';\n    style.contain = '';\n  }\n\n  /**\n   * The widget managed by the layout item.\n   */\n  readonly widget: Widget;\n\n  /**\n   * The computed minimum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minWidth(): number {\n    return this._minWidth;\n  }\n\n  /**\n   * The computed minimum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get minHeight(): number {\n    return this._minHeight;\n  }\n\n  /**\n   * The computed maximum width of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxWidth(): number {\n    return this._maxWidth;\n  }\n\n  /**\n   * The computed maximum height of the widget.\n   *\n   * #### Notes\n   * This value can be updated by calling the `fit` method.\n   */\n  get maxHeight(): number {\n    return this._maxHeight;\n  }\n\n  /**\n   * Whether the layout item is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._disposed;\n  }\n\n  /**\n   * Whether the managed widget is hidden.\n   */\n  get isHidden(): boolean {\n    return this.widget.isHidden;\n  }\n\n  /**\n   * Whether the managed widget is visible.\n   */\n  get isVisible(): boolean {\n    return this.widget.isVisible;\n  }\n\n  /**\n   * Whether the managed widget is attached.\n   */\n  get isAttached(): boolean {\n    return this.widget.isAttached;\n  }\n\n  /**\n   * Update the computed size limits of the managed widget.\n   */\n  fit(): void {\n    let limits = ElementExt.sizeLimits(this.widget.node);\n    this._minWidth = limits.minWidth;\n    this._minHeight = limits.minHeight;\n    this._maxWidth = limits.maxWidth;\n    this._maxHeight = limits.maxHeight;\n  }\n\n  /**\n   * Update the position and size of the managed widget.\n   *\n   * @param left - The left edge position of the layout box.\n   *\n   * @param top - The top edge position of the layout box.\n   *\n   * @param width - The width of the layout box.\n   *\n   * @param height - The height of the layout box.\n   */\n  update(left: number, top: number, width: number, height: number): void {\n    // Clamp the size to the computed size limits.\n    let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n    let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n    // Adjust the left edge for the horizontal alignment, if needed.\n    if (clampW < width) {\n      switch (Layout.getHorizontalAlignment(this.widget)) {\n        case 'left':\n          break;\n        case 'center':\n          left += (width - clampW) / 2;\n          break;\n        case 'right':\n          left += width - clampW;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Adjust the top edge for the vertical alignment, if needed.\n    if (clampH < height) {\n      switch (Layout.getVerticalAlignment(this.widget)) {\n        case 'top':\n          break;\n        case 'center':\n          top += (height - clampH) / 2;\n          break;\n        case 'bottom':\n          top += height - clampH;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Set up the resize variables.\n    let resized = false;\n    let style = this.widget.node.style;\n\n    // Update the top edge of the widget if needed.\n    if (this._top !== top) {\n      this._top = top;\n      style.top = `${top}px`;\n    }\n\n    // Update the left edge of the widget if needed.\n    if (this._left !== left) {\n      this._left = left;\n      style.left = `${left}px`;\n    }\n\n    // Update the width of the widget if needed.\n    if (this._width !== clampW) {\n      resized = true;\n      this._width = clampW;\n      style.width = `${clampW}px`;\n    }\n\n    // Update the height of the widget if needed.\n    if (this._height !== clampH) {\n      resized = true;\n      this._height = clampH;\n      style.height = `${clampH}px`;\n    }\n\n    // Send a resize message to the widget if needed.\n    if (resized) {\n      let msg = new Widget.ResizeMessage(clampW, clampH);\n      MessageLoop.sendMessage(this.widget, msg);\n    }\n  }\n\n  private _top = NaN;\n  private _left = NaN;\n  private _width = NaN;\n  private _height = NaN;\n  private _minWidth = 0;\n  private _minHeight = 0;\n  private _maxWidth = Infinity;\n  private _maxHeight = Infinity;\n  private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The attached property for a widget horizontal alignment.\n   */\n  export const horizontalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.HorizontalAlignment\n  >({\n    name: 'horizontalAlignment',\n    create: () => 'center',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The attached property for a widget vertical alignment.\n   */\n  export const verticalAlignmentProperty = new AttachedProperty<\n    Widget,\n    Layout.VerticalAlignment\n  >({\n    name: 'verticalAlignment',\n    create: () => 'top',\n    changed: onAlignmentChanged\n  });\n\n  /**\n   * The change handler for the attached alignment properties.\n   */\n  function onAlignmentChanged(child: Widget): void {\n    if (child.parent && child.parent.layout) {\n      child.parent.update();\n    }\n  }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n  /**\n   * Clamp a dimension value to an integer >= 0.\n   */\n  export function clampDimension(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title<T> implements IDisposable {\n  /**\n   * Construct a new title.\n   *\n   * @param options - The options for initializing the title.\n   */\n  constructor(options: Title.IOptions<T>) {\n    this.owner = options.owner;\n    if (options.label !== undefined) {\n      this._label = options.label;\n    }\n    if (options.mnemonic !== undefined) {\n      this._mnemonic = options.mnemonic;\n    }\n    if (options.icon !== undefined) {\n      this._icon = options.icon;\n    }\n\n    if (options.iconClass !== undefined) {\n      this._iconClass = options.iconClass;\n    }\n    if (options.iconLabel !== undefined) {\n      this._iconLabel = options.iconLabel;\n    }\n    if (options.caption !== undefined) {\n      this._caption = options.caption;\n    }\n    if (options.className !== undefined) {\n      this._className = options.className;\n    }\n    if (options.closable !== undefined) {\n      this._closable = options.closable;\n    }\n    this._dataset = options.dataset || {};\n  }\n\n  /**\n   * A signal emitted when the state of the title changes.\n   */\n  get changed(): ISignal<this, void> {\n    return this._changed;\n  }\n\n  /**\n   * The object which owns the title.\n   */\n  readonly owner: T;\n\n  /**\n   * Get the label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get label(): string {\n    return this._label;\n  }\n\n  /**\n   * Set the label for the title.\n   */\n  set label(value: string) {\n    if (this._label === value) {\n      return;\n    }\n    this._label = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the mnemonic index for the title.\n   *\n   * #### Notes\n   * The default value is `-1`.\n   */\n  get mnemonic(): number {\n    return this._mnemonic;\n  }\n\n  /**\n   * Set the mnemonic index for the title.\n   */\n  set mnemonic(value: number) {\n    if (this._mnemonic === value) {\n      return;\n    }\n    this._mnemonic = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon renderer for the title.\n   *\n   * #### Notes\n   * The default value is undefined.\n   */\n  get icon(): VirtualElement.IRenderer | undefined {\n    return this._icon;\n  }\n\n  /**\n   * Set the icon renderer for the title.\n   *\n   * #### Notes\n   * A renderer is an object that supplies a render and unrender function.\n   */\n  set icon(value: VirtualElement.IRenderer | undefined) {\n    if (this._icon === value) {\n      return;\n    }\n    this._icon = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconClass(): string {\n    return this._iconClass;\n  }\n\n  /**\n   * Set the icon class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconClass(value: string) {\n    if (this._iconClass === value) {\n      return;\n    }\n    this._iconClass = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the icon label for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get iconLabel(): string {\n    return this._iconLabel;\n  }\n\n  /**\n   * Set the icon label for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set iconLabel(value: string) {\n    if (this._iconLabel === value) {\n      return;\n    }\n    this._iconLabel = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the caption for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get caption(): string {\n    return this._caption;\n  }\n\n  /**\n   * Set the caption for the title.\n   */\n  set caption(value: string) {\n    if (this._caption === value) {\n      return;\n    }\n    this._caption = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the extra class name for the title.\n   *\n   * #### Notes\n   * The default value is an empty string.\n   */\n  get className(): string {\n    return this._className;\n  }\n\n  /**\n   * Set the extra class name for the title.\n   *\n   * #### Notes\n   * Multiple class names can be separated with whitespace.\n   */\n  set className(value: string) {\n    if (this._className === value) {\n      return;\n    }\n    this._className = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the closable state for the title.\n   *\n   * #### Notes\n   * The default value is `false`.\n   */\n  get closable(): boolean {\n    return this._closable;\n  }\n\n  /**\n   * Set the closable state for the title.\n   *\n   * #### Notes\n   * This controls the presence of a close icon when applicable.\n   */\n  set closable(value: boolean) {\n    if (this._closable === value) {\n      return;\n    }\n    this._closable = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Get the dataset for the title.\n   *\n   * #### Notes\n   * The default value is an empty dataset.\n   */\n  get dataset(): Title.Dataset {\n    return this._dataset;\n  }\n\n  /**\n   * Set the dataset for the title.\n   *\n   * #### Notes\n   * This controls the data attributes when applicable.\n   */\n  set dataset(value: Title.Dataset) {\n    if (this._dataset === value) {\n      return;\n    }\n    this._dataset = value;\n    this._changed.emit(undefined);\n  }\n\n  /**\n   * Test whether the title has been disposed.\n   */\n  get isDisposed(): boolean {\n    return this._isDisposed;\n  }\n\n  /**\n   * Dispose of the resources held by the title.\n   *\n   * #### Notes\n   * It is the responsibility of the owner to call the title disposal.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n    this._isDisposed = true;\n\n    Signal.clearData(this);\n  }\n\n  private _label = '';\n  private _caption = '';\n  private _mnemonic = -1;\n  private _icon: VirtualElement.IRenderer | undefined = undefined;\n  private _iconClass = '';\n  private _iconLabel = '';\n  private _className = '';\n  private _closable = false;\n  private _dataset: Title.Dataset;\n  private _changed = new Signal<this, void>(this);\n  private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n  /**\n   * A type alias for a simple immutable string dataset.\n   */\n  export type Dataset = { readonly [key: string]: string };\n\n  /**\n   * An options object for initializing a title.\n   */\n  export interface IOptions<T> {\n    /**\n     * The object which owns the title.\n     */\n    owner: T;\n\n    /**\n     * The label for the title.\n     */\n    label?: string;\n\n    /**\n     * The mnemonic index for the title.\n     */\n    mnemonic?: number;\n\n    /**\n     * The icon renderer for the title.\n     */\n    icon?: VirtualElement.IRenderer;\n\n    /**\n     * The icon class name for the title.\n     */\n    iconClass?: string;\n\n    /**\n     * The icon label for the title.\n     */\n    iconLabel?: string;\n\n    /**\n     * The caption for the title.\n     */\n    caption?: string;\n\n    /**\n     * The extra class name for the title.\n     */\n    className?: string;\n\n    /**\n     * The closable state for the title.\n     */\n    closable?: boolean;\n\n    /**\n     * The dataset for the title.\n     */\n    dataset?: Dataset;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   *\n   * All reimplementations should call the superclass method.\n   *\n   * This method is called automatically when the parent is disposed.\n   */\n  dispose(): void {\n    while (this._widgets.length > 0) {\n      this._widgets.pop()!.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * A read-only array of the widgets in the layout.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this._widgets;\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    yield* this._widgets;\n  }\n\n  /**\n   * Add a widget to the end of the layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this._widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    widget.parent = this.parent;\n\n    // Look up the current index of the widget.\n    let i = this._widgets.indexOf(widget);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._widgets.length));\n\n    // If the widget is not in the array, insert it.\n    if (i === -1) {\n      // Insert the widget into the array.\n      ArrayExt.insert(this._widgets, j, widget);\n\n      // If the layout is parented, attach the widget to the DOM.\n      if (this.parent) {\n        this.attachWidget(j, widget);\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the widget exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._widgets.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the widget to the new location.\n    ArrayExt.move(this._widgets, i, j);\n\n    // If the layout is parented, move the widget in the DOM.\n    if (this.parent) {\n      this.moveWidget(i, j, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    this.removeWidgetAt(this._widgets.indexOf(widget));\n  }\n\n  /**\n   * Remove the widget at a given index from the layout.\n   *\n   * @param index - The index of the widget to remove.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  removeWidgetAt(index: number): void {\n    // Remove the widget from the array.\n    let widget = ArrayExt.removeAt(this._widgets, index);\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (widget && this.parent) {\n      this.detachWidget(index, widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    let index = 0;\n    for (const widget of this) {\n      this.attachWidget(index++, widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[index];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation moves the widget's node to the proper\n   * location in the parent's node and sends the appropriate attach and\n   * detach messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is moved in the parent's node.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` and  message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Look up the next sibling reference node.\n    let ref = this.parent!.node.children[toIndex];\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Insert the widget's node before the sibling.\n    this.parent!.node.insertBefore(widget.node, ref);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the panel layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widgets: Widget[] = [];\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n  /**\n   * Construct a new split layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: SplitLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.orientation !== undefined) {\n      this._orientation = options.orientation;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n    this._handles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the split layout.\n   */\n  readonly renderer: SplitLayout.IRenderer;\n\n  /**\n   * Get the layout orientation for the split layout.\n   */\n  get orientation(): SplitLayout.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split layout.\n   */\n  set orientation(value: SplitLayout.Orientation) {\n    if (this._orientation === value) {\n      return;\n    }\n    this._orientation = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['orientation'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  get alignment(): SplitLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the split layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand  to fill the\n   * entire split layout.\n   */\n  set alignment(value: SplitLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the split layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the split handles in the layout.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return this._handles;\n  }\n\n  /**\n   * Get the absolute sizes of the widgets in the layout.\n   *\n   * @returns A new array of the absolute sizes of the widgets.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  absoluteSizes(): number[] {\n    return this._sizers.map(sizer => sizer.size);\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the layout.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return Private.normalize(this._sizers.map(sizer => sizer.size));\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the layout.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    // Copy the sizes and pad with zeros as needed.\n    let n = this._sizers.length;\n    let temp = sizes.slice(0, n);\n    while (temp.length < n) {\n      temp.push(0);\n    }\n\n    // Normalize the padded sizes.\n    let normed = Private.normalize(temp);\n\n    // Apply the normalized sizes to the sizers.\n    for (let i = 0; i < n; ++i) {\n      let sizer = this._sizers[i];\n      sizer.sizeHint = normed[i];\n      sizer.size = normed[i];\n    }\n\n    // Set the flag indicating the sizes are normalized.\n    this._hasNormedSizes = true;\n\n    // Trigger an update of the parent widget.\n    if (update && this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Move the offset position of a split handle.\n   *\n   * @param index - The index of the handle of the interest.\n   *\n   * @param position - The desired offset position of the handle.\n   *\n   * #### Notes\n   * The position is relative to the offset parent.\n   *\n   * This will move the handle as close as possible to the desired\n   * position. The sibling widgets will be adjusted as necessary.\n   */\n  moveHandle(index: number, position: number): void {\n    // Bail if the index is invalid or the handle is hidden.\n    let handle = this._handles[index];\n    if (!handle || handle.classList.contains('lm-mod-hidden')) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (this._orientation === 'horizontal') {\n      delta = position - handle.offsetLeft;\n    } else {\n      delta = position - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent widget resizing unless needed.\n    for (let sizer of this._sizers) {\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(this._sizers, index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['orientation'] = this.orientation;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create the item, handle, and sizer for the new widget.\n    let item = new LayoutItem(widget);\n    let handle = Private.createHandle(this.renderer);\n    let average = Private.averageSize(this._sizers);\n    let sizer = Private.createSizer(average);\n\n    // Insert the item, handle, and sizer into the internal arrays.\n    ArrayExt.insert(this._items, index, item);\n    ArrayExt.insert(this._sizers, index, sizer);\n    ArrayExt.insert(this._handles, index, handle);\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget and handle nodes to the parent.\n    this.parent!.node.appendChild(widget.node);\n    this.parent!.node.appendChild(handle);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the item, sizer, and handle for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n    ArrayExt.move(this._handles, fromIndex, toIndex);\n\n    // Post a fit request to the parent to show/hide last handle.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the item, handle, and sizer for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n    let handle = ArrayExt.removeAt(this._handles, index);\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget and handle nodes from the parent.\n    this.parent!.node.removeChild(widget.node);\n    this.parent!.node.removeChild(handle!);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const item = this._items[i];\n    if (item.isHidden) {\n      return;\n    }\n\n    // Fetch the style for the handle.\n    let handleStyle = this._handles[i].style;\n\n    // Update the widget and handle, and advance the relevant edge.\n    if (isHorizontal) {\n      left += this.widgetOffset;\n      item.update(left, top, size, height);\n      left += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${this._spacing}px`;\n      handleStyle.height = `${height}px`;\n    } else {\n      top += this.widgetOffset;\n      item.update(left, top, width, size);\n      top += size;\n      handleStyle.top = `${top}px`;\n      handleStyle.left = `${left}px`;\n      handleStyle.width = `${width}px`;\n      handleStyle.height = `${this._spacing}px`;\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Update the handles and track the visible widget count.\n    let nVisible = 0;\n    let lastHandleIndex = -1;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      if (this._items[i].isHidden) {\n        this._handles[i].classList.add('lm-mod-hidden');\n      } else {\n        this._handles[i].classList.remove('lm-mod-hidden');\n        lastHandleIndex = i;\n        nVisible++;\n      }\n    }\n\n    // Hide the handle for the last visible widget.\n    if (lastHandleIndex !== -1) {\n      this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed =\n      this._spacing * Math.max(0, nVisible - 1) +\n      this.widgetOffset * this._items.length;\n\n    // Setup the computed minimum size.\n    let horz = this._orientation === 'horizontal';\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed size limits.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // Prevent resizing unless necessary.\n      if (sizer.size > 0) {\n        sizer.sizeHint = sizer.size;\n      }\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the stretch factor.\n      sizer.stretch = SplitLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0 && this.widgetOffset === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Set up the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n    let horz = this._orientation === 'horizontal';\n\n    if (nVisible > 0) {\n      // Compute the adjusted layout space.\n      let space: number;\n      if (horz) {\n        // left += this.widgetOffset;\n        space = Math.max(0, width - this._fixed);\n      } else {\n        // top += this.widgetOffset;\n        space = Math.max(0, height - this._fixed);\n      }\n\n      // Scale the size hints if they are normalized.\n      if (this._hasNormedSizes) {\n        for (let sizer of this._sizers) {\n          sizer.sizeHint *= space;\n        }\n        this._hasNormedSizes = false;\n      }\n\n      // Distribute the layout space to the box sizers.\n      let delta = BoxEngine.calc(this._sizers, space);\n\n      // Account for alignment if there is extra layout space.\n      if (delta > 0) {\n        switch (this._alignment) {\n          case 'start':\n            break;\n          case 'center':\n            extra = 0;\n            offset = delta / 2;\n            break;\n          case 'end':\n            extra = 0;\n            offset = delta;\n            break;\n          case 'justify':\n            extra = delta / nVisible;\n            offset = 0;\n            break;\n          default:\n            throw 'unreachable';\n        }\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      const item = this._items[i];\n\n      // Fetch the computed size for the widget.\n      const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n      this.updateItemPosition(\n        i,\n        horz,\n        horz ? left + offset : left,\n        horz ? top : top + offset,\n        height,\n        width,\n        size\n      );\n\n      const fullOffset =\n        this.widgetOffset +\n        (this._handles[i].classList.contains('lm-mod-hidden')\n          ? 0\n          : this._spacing);\n\n      if (horz) {\n        left += size + fullOffset;\n      } else {\n        top += size + fullOffset;\n      }\n    }\n  }\n\n  protected widgetOffset = 0;\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _hasNormedSizes = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _handles: HTMLDivElement[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: SplitLayout.Alignment = 'start';\n  private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n  /**\n   * A type alias for a split layout orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a split layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a split layout.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The orientation of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Orientation}.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * Possible values are documented in {@link SplitLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a split layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new handle for use with a split layout.\n     *\n     * @returns A new handle element.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * Get the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the split layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Create a new box sizer with the given size hint.\n   */\n  export function createSizer(size: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = Math.floor(size);\n    return sizer;\n  }\n\n  /**\n   * Create a new split handle node using the given renderer.\n   */\n  export function createHandle(\n    renderer: SplitLayout.IRenderer\n  ): HTMLDivElement {\n    let handle = renderer.createHandle();\n    handle.style.position = 'absolute';\n    // Do not use size containment to allow the handle to fill the available space\n    handle.style.contain = 'style';\n    return handle;\n  }\n\n  /**\n   * Compute the average size of an array of box sizers.\n   */\n  export function averageSize(sizers: BoxSizer[]): number {\n    return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n  }\n\n  /**\n   * Normalize an array of values.\n   */\n  export function normalize(values: number[]): number[] {\n    let n = values.length;\n    if (n === 0) {\n      return [];\n    }\n    let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n    return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof SplitLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n  /**\n   * Construct a new accordion layout.\n   *\n   * @param options - The options for initializing the layout.\n   *\n   * #### Notes\n   * The default orientation will be vertical.\n   *\n   * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n   */\n  constructor(options: AccordionLayout.IOptions) {\n    super({ ...options, orientation: options.orientation || 'vertical' });\n    this.titleSpace = options.titleSpace || 22;\n  }\n\n  /**\n   * The section title height or width depending on the orientation.\n   */\n  get titleSpace(): number {\n    return this.widgetOffset;\n  }\n  set titleSpace(value: number) {\n    value = Utils.clampDimension(value);\n    if (this.widgetOffset === value) {\n      return;\n    }\n    this.widgetOffset = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return this._titles;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this.isDisposed) {\n      return;\n    }\n\n    // Clear the layout state.\n    this._titles.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the accordion layout.\n   */\n  readonly renderer: AccordionLayout.IRenderer;\n\n  public updateTitle(index: number, widget: Widget): void {\n    const oldTitle = this._titles[index];\n    const expanded = oldTitle.classList.contains('lm-mod-expanded');\n    const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n    this._titles[index] = newTitle;\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.replaceChild(newTitle, oldTitle);\n  }\n\n  /**\n   * Insert a widget into the layout at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into the layout.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the widgets.\n   *\n   * If the widget is already added to the layout, it will be moved.\n   *\n   * #### Undefined Behavior\n   * An `index` which is non-integral.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (!widget.id) {\n      widget.id = `id-${UUID.uuid4()}`;\n    }\n    super.insertWidget(index, widget);\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    const title = Private.createTitle(this.renderer, widget.title);\n\n    ArrayExt.insert(this._titles, index, title);\n\n    // Add the title node to the parent before the widget.\n    this.parent!.node.appendChild(title);\n\n    widget.node.setAttribute('role', 'region');\n    widget.node.setAttribute('aria-labelledby', title.id);\n\n    super.attachWidget(index, widget);\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    ArrayExt.move(this._titles, fromIndex, toIndex);\n    super.moveWidget(fromIndex, toIndex, widget);\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    const title = ArrayExt.removeAt(this._titles, index);\n\n    this.parent!.node.removeChild(title!);\n\n    super.detachWidget(index, widget);\n  }\n\n  /**\n   * Update the item position.\n   *\n   * @param i Item index\n   * @param isHorizontal Whether the layout is horizontal or not\n   * @param left Left position in pixels\n   * @param top Top position in pixels\n   * @param height Item height\n   * @param width Item width\n   * @param size Item size\n   */\n  protected updateItemPosition(\n    i: number,\n    isHorizontal: boolean,\n    left: number,\n    top: number,\n    height: number,\n    width: number,\n    size: number\n  ): void {\n    const titleStyle = this._titles[i].style;\n\n    // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n    titleStyle.top = `${top}px`;\n    titleStyle.left = `${left}px`;\n    titleStyle.height = `${this.widgetOffset}px`;\n    if (isHorizontal) {\n      titleStyle.width = `${height}px`;\n    } else {\n      titleStyle.width = `${width}px`;\n    }\n\n    super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n  }\n\n  private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n  /**\n   * A type alias for a accordion layout orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion layout alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * An options object for initializing a accordion layout.\n   */\n  export interface IOptions extends SplitLayout.IOptions {\n    /**\n     * The renderer to use for the accordion layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The section title height or width depending on the orientation.\n     *\n     * The default is `22`.\n     */\n    titleSpace?: number;\n  }\n\n  /**\n   * A renderer for use with an accordion layout.\n   */\n  export interface IRenderer extends SplitLayout.IRenderer {\n    /**\n     * Common class name for all accordion titles.\n     */\n    readonly titleClassName: string;\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param title - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(title: Title<Widget>): HTMLElement;\n  }\n}\n\nnamespace Private {\n  /**\n   * Create the title HTML element.\n   *\n   * @param renderer Accordion renderer\n   * @param data Widget title\n   * @returns Title HTML element\n   */\n  export function createTitle(\n    renderer: AccordionLayout.IRenderer,\n    data: Title<Widget>,\n    expanded: boolean = true\n  ): HTMLElement {\n    const title = renderer.createSectionTitle(data);\n    title.style.position = 'absolute';\n    title.style.contain = 'strict';\n    title.setAttribute('aria-label', `${data.label} Section`);\n    title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n    title.setAttribute('aria-controls', data.owner.id);\n    if (expanded) {\n      title.classList.add('lm-mod-expanded');\n    }\n    return title;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n  /**\n   * Construct a new panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: Panel.IOptions = {}) {\n    super();\n    this.addClass('lm-Panel');\n    this.layout = Private.createLayout(options);\n  }\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return (this.layout as PanelLayout).widgets;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    (this.layout as PanelLayout).addWidget(widget);\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    (this.layout as PanelLayout).insertWidget(index, widget);\n  }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n  /**\n   * An options object for creating a panel.\n   */\n  export interface IOptions {\n    /**\n     * The panel layout to use for the panel.\n     *\n     * The default is a new `PanelLayout`.\n     */\n    layout?: PanelLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a panel layout for the given panel options.\n   */\n  export function createLayout(options: Panel.IOptions): PanelLayout {\n    return options.layout || new PanelLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n  /**\n   * Construct a new split panel.\n   *\n   * @param options - The options for initializing the split panel.\n   */\n  constructor(options: SplitPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-SplitPanel');\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    super.dispose();\n  }\n\n  /**\n   * Get the layout orientation for the split panel.\n   */\n  get orientation(): SplitPanel.Orientation {\n    return (this.layout as SplitLayout).orientation;\n  }\n\n  /**\n   * Set the layout orientation for the split panel.\n   */\n  set orientation(value: SplitPanel.Orientation) {\n    (this.layout as SplitLayout).orientation = value;\n  }\n\n  /**\n   * Get the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  get alignment(): SplitPanel.Alignment {\n    return (this.layout as SplitLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the split panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire split panel.\n   */\n  set alignment(value: SplitPanel.Alignment) {\n    (this.layout as SplitLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the split panel.\n   */\n  get spacing(): number {\n    return (this.layout as SplitLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the split panel.\n   */\n  set spacing(value: number) {\n    (this.layout as SplitLayout).spacing = value;\n  }\n\n  /**\n   * The renderer used by the split panel.\n   */\n  get renderer(): SplitPanel.IRenderer {\n    return (this.layout as SplitLayout).renderer;\n  }\n\n  /**\n   * A signal emitted when a split handle has moved.\n   */\n  get handleMoved(): ISignal<this, void> {\n    return this._handleMoved;\n  }\n\n  /**\n   * A read-only array of the split handles in the panel.\n   */\n  get handles(): ReadonlyArray<HTMLDivElement> {\n    return (this.layout as SplitLayout).handles;\n  }\n\n  /**\n   * Get the relative sizes of the widgets in the panel.\n   *\n   * @returns A new array of the relative sizes of the widgets.\n   *\n   * #### Notes\n   * The returned sizes reflect the sizes of the widgets normalized\n   * relative to their siblings.\n   *\n   * This method **does not** measure the DOM nodes.\n   */\n  relativeSizes(): number[] {\n    return (this.layout as SplitLayout).relativeSizes();\n  }\n\n  /**\n   * Set the relative sizes for the widgets in the panel.\n   *\n   * @param sizes - The relative sizes for the widgets in the panel.\n   * @param update - Update the layout after setting relative sizes.\n   * Default is True.\n   *\n   * #### Notes\n   * Extra values are ignored, too few will yield an undefined layout.\n   *\n   * The actual geometry of the DOM nodes is updated asynchronously.\n   */\n  setRelativeSizes(sizes: number[], update = true): void {\n    (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n  }\n\n  /**\n   * Handle the DOM events for the split panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-SplitPanel-child');\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the `'keydown'` event for the split panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    if (this._pressData) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the split panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the primary button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the target, if any.\n    let layout = this.layout as SplitLayout;\n    let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n      return handle.contains(event.target as HTMLElement);\n    });\n\n    // Bail early if the mouse press was not on a handle.\n    if (index === -1) {\n      return;\n    }\n\n    // Stop the event when a split handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    document.addEventListener('pointerup', this, true);\n    document.addEventListener('pointermove', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset delta for the handle press.\n    let delta: number;\n    let handle = layout.handles[index];\n    let rect = handle.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      delta = event.clientX - rect.left;\n    } else {\n      delta = event.clientY - rect.top;\n    }\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!);\n    this._pressData = { index, delta, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the split panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Stop the event when dragging a split handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let pos: number;\n    let layout = this.layout as SplitLayout;\n    let rect = this.node.getBoundingClientRect();\n    if (layout.orientation === 'horizontal') {\n      pos = event.clientX - rect.left - this._pressData!.delta;\n    } else {\n      pos = event.clientY - rect.top - this._pressData!.delta;\n    }\n\n    // Move the handle as close to the desired position as possible.\n    layout.moveHandle(this._pressData!.index, pos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the split panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the primary button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse grab for the split panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Emit the handle moved signal.\n    this._handleMoved.emit();\n\n    // Remove the extra document listeners.\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('pointerup', this, true);\n    document.removeEventListener('pointermove', this, true);\n    document.removeEventListener('contextmenu', this, true);\n  }\n\n  private _handleMoved = new Signal<any, void>(this);\n  private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n  /**\n   * A type alias for a split panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a split panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a split panel renderer.\n   */\n  export type IRenderer = SplitLayout.IRenderer;\n\n  /**\n   * An options object for initializing a split panel.\n   */\n  export interface IOptions {\n    /**\n     * The renderer to use for the split panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The layout orientation of the panel.\n     *\n     * The default is `'horizontal'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The split layout to use for the split panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `SplitLayout`.\n     */\n    layout?: SplitLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new handle for use with a split panel.\n     *\n     * @returns A new handle element for a split panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-SplitPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * Get the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The split panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return SplitLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the split panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    SplitLayout.setStretch(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The index of the pressed handle.\n     */\n    index: number;\n\n    /**\n     * The offset of the press in handle coordinates.\n     */\n    delta: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * Create a split layout for the given panel options.\n   */\n  export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n    return (\n      options.layout ||\n      new SplitLayout({\n        renderer: options.renderer || SplitPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n  /**\n   * Construct a new accordion panel.\n   *\n   * @param options - The options for initializing the accordion panel.\n   *\n   */\n  constructor(options: AccordionPanel.IOptions = {}) {\n    super({ ...options, layout: Private.createLayout(options) });\n    this.addClass('lm-AccordionPanel');\n  }\n\n  /**\n   * The renderer used by the accordion panel.\n   */\n  get renderer(): AccordionPanel.IRenderer {\n    return (this.layout as AccordionLayout).renderer;\n  }\n\n  /**\n   * The section title space.\n   *\n   * This is the height if the panel is vertical and the width if it is\n   * horizontal.\n   */\n  get titleSpace(): number {\n    return (this.layout as AccordionLayout).titleSpace;\n  }\n  set titleSpace(value: number) {\n    (this.layout as AccordionLayout).titleSpace = value;\n  }\n\n  /**\n   * A read-only array of the section titles in the panel.\n   */\n  get titles(): ReadonlyArray<HTMLElement> {\n    return (this.layout as AccordionLayout).titles;\n  }\n\n  /**\n   * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n   */\n  get expansionToggled(): ISignal<this, number> {\n    return this._expansionToggled;\n  }\n\n  /**\n   * Add a widget to the end of the panel.\n   *\n   * @param widget - The widget to add to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  addWidget(widget: Widget): void {\n    super.addWidget(widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Collapse the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  collapse(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && !widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Expand the widget at position `index`.\n   *\n   * #### Notes\n   * If no widget is found for `index`, this will bail.\n   *\n   * @param index Widget index\n   */\n  expand(index: number): void {\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    if (widget && widget.isHidden) {\n      this._toggleExpansion(index);\n    }\n  }\n\n  /**\n   * Insert a widget at the specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    super.insertWidget(index, widget);\n    widget.title.changed.connect(this._onTitleChanged, this);\n  }\n\n  /**\n   * Handle the DOM events for the accordion panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    super.handleEvent(event);\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._eventKeyDown(event as KeyboardEvent);\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    super.onBeforeAttach(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    super.onAfterDetach(msg);\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<Widget>): void {\n    const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n      return widget.contains(sender.owner);\n    });\n\n    if (index >= 0) {\n      (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n      this.update();\n    }\n  }\n\n  /**\n   * Compute the size of widgets in this panel on the title click event.\n   * On closing, the size of the widget is cached and we will try to expand\n   * the last opened widget.\n   * On opening, we will use the cached size if it is available to restore the\n   * widget.\n   * In both cases, if we can not compute the size of widgets, we will let\n   * `SplitLayout` decide.\n   *\n   * @param index - The index of widget to be opened of closed\n   *\n   * @returns Relative size of widgets in this panel, if this size can\n   * not be computed, return `undefined`\n   */\n  private _computeWidgetSize(index: number): number[] | undefined {\n    const layout = this.layout as AccordionLayout;\n\n    const widget = layout.widgets[index];\n    if (!widget) {\n      return undefined;\n    }\n    const isHidden = widget.isHidden;\n    const widgetSizes = layout.absoluteSizes();\n    const delta = (isHidden ? -1 : 1) * this.spacing;\n    const totalSize = widgetSizes.reduce(\n      (prev: number, curr: number) => prev + curr\n    );\n\n    let newSize = [...widgetSizes];\n\n    if (!isHidden) {\n      // Hide the widget\n      const currentSize = widgetSizes[index];\n\n      this._widgetSizesCache.set(widget, currentSize);\n      newSize[index] = 0;\n\n      const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // All widget are closed, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n\n      newSize[widgetToCollapse] =\n        widgetSizes[widgetToCollapse] + currentSize + delta;\n    } else {\n      // Show the widget\n      const previousSize = this._widgetSizesCache.get(widget);\n      if (!previousSize) {\n        // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n        return undefined;\n      }\n      newSize[index] += previousSize;\n\n      const widgetToCollapse = newSize\n        .map(sz => sz - previousSize > 0)\n        .lastIndexOf(true);\n      if (widgetToCollapse === -1) {\n        // Can not reduce the size of one widget, reduce all opened widgets\n        // proportionally with its size.\n        newSize.forEach((_, idx) => {\n          if (idx !== index) {\n            newSize[idx] -=\n              (widgetSizes[idx] / totalSize) * (previousSize - delta);\n          }\n        });\n      } else {\n        newSize[widgetToCollapse] -= previousSize - delta;\n      }\n    }\n    return newSize.map(sz => sz / (totalSize + delta));\n  }\n  /**\n   * Handle the `'click'` event for the accordion panel\n   */\n  private _evtClick(event: MouseEvent): void {\n    const target = event.target as HTMLElement | null;\n\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._toggleExpansion(index);\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the accordion panel.\n   */\n  private _eventKeyDown(event: KeyboardEvent): void {\n    if (event.defaultPrevented) {\n      return;\n    }\n\n    const target = event.target as HTMLElement | null;\n    let handled = false;\n    if (target) {\n      const index = ArrayExt.findFirstIndex(this.titles, title => {\n        return title.contains(target);\n      });\n\n      if (index >= 0) {\n        const keyCode = event.keyCode.toString();\n\n        // If Space or Enter is pressed on title, emulate click event\n        if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n          target.click();\n          handled = true;\n        } else if (\n          this.orientation === 'horizontal'\n            ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n            : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n        ) {\n          // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n          const direction =\n            event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n              ? -1\n              : 1;\n          const length = this.titles.length;\n          const newIndex = (index + length + direction) % length;\n\n          this.titles[newIndex].focus();\n          handled = true;\n        } else if (event.key === 'End' || keyCode === '35') {\n          // If End is pressed on title, focus on the last title\n          this.titles[this.titles.length - 1].focus();\n          handled = true;\n        } else if (event.key === 'Home' || keyCode === '36') {\n          // If Home is pressed on title, focus on the first title\n          this.titles[0].focus();\n          handled = true;\n        }\n      }\n\n      if (handled) {\n        event.preventDefault();\n      }\n    }\n  }\n\n  private _toggleExpansion(index: number) {\n    const title = this.titles[index];\n    const widget = (this.layout as AccordionLayout).widgets[index];\n\n    const newSize = this._computeWidgetSize(index);\n    if (newSize) {\n      this.setRelativeSizes(newSize, false);\n    }\n\n    if (widget.isHidden) {\n      title.classList.add('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'true');\n      widget.show();\n    } else {\n      title.classList.remove('lm-mod-expanded');\n      title.setAttribute('aria-expanded', 'false');\n      widget.hide();\n    }\n\n    // Emit the expansion state signal.\n    this._expansionToggled.emit(index);\n  }\n\n  private _widgetSizesCache: WeakMap<Widget, number> = new WeakMap();\n  private _expansionToggled = new Signal<this, number>(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n  /**\n   * A type alias for a accordion panel orientation.\n   */\n  export type Orientation = SplitLayout.Orientation;\n\n  /**\n   * A type alias for a accordion panel alignment.\n   */\n  export type Alignment = SplitLayout.Alignment;\n\n  /**\n   * A type alias for a accordion panel renderer.\n   */\n  export type IRenderer = AccordionLayout.IRenderer;\n\n  /**\n   * An options object for initializing a accordion panel.\n   */\n  export interface IOptions extends Partial<AccordionLayout.IOptions> {\n    /**\n     * The accordion layout to use for the accordion panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `AccordionLayout`.\n     */\n    layout?: AccordionLayout;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer extends SplitPanel.Renderer implements IRenderer {\n    constructor() {\n      super();\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches any title node in the accordion.\n     */\n    readonly titleClassName = 'lm-AccordionPanel-title';\n\n    /**\n     * Render the collapse indicator for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the collapse indicator.\n     */\n    createCollapseIcon(data: Title<Widget>): HTMLElement {\n      return document.createElement('span');\n    }\n\n    /**\n     * Render the element for a section title.\n     *\n     * @param data - The data to use for rendering the section title.\n     *\n     * @returns A element representing the section title.\n     */\n    createSectionTitle(data: Title<Widget>): HTMLElement {\n      const handle = document.createElement('h3');\n      handle.setAttribute('tabindex', '0');\n      handle.id = this.createTitleKey(data);\n      handle.className = this.titleClassName;\n      for (const aData in data.dataset) {\n        handle.dataset[aData] = data.dataset[aData];\n      }\n\n      const collapser = handle.appendChild(this.createCollapseIcon(data));\n      collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n      const label = handle.appendChild(document.createElement('span'));\n      label.className = 'lm-AccordionPanel-titleLabel';\n      label.textContent = data.label;\n      label.title = data.caption || data.label;\n\n      return handle;\n    }\n\n    /**\n     * Create a unique render key for the title.\n     *\n     * @param data - The data to use for the title.\n     *\n     * @returns The unique render key for the title.\n     *\n     * #### Notes\n     * This method caches the key against the section title the first time\n     * the key is generated.\n     */\n    createTitleKey(data: Title<Widget>): string {\n      let key = this._titleKeys.get(data);\n      if (key === undefined) {\n        key = `title-key-${this._uuid}-${this._titleID++}`;\n        this._titleKeys.set(data, key);\n      }\n      return key;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _titleID = 0;\n    private _titleKeys = new WeakMap<Title<Widget>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n  /**\n   * Create an accordion layout for the given panel options.\n   *\n   * @param options Panel options\n   * @returns Panel layout\n   */\n  export function createLayout(\n    options: AccordionPanel.IOptions\n  ): AccordionLayout {\n    return (\n      options.layout ||\n      new AccordionLayout({\n        renderer: options.renderer || AccordionPanel.defaultRenderer,\n        orientation: options.orientation,\n        alignment: options.alignment,\n        spacing: options.spacing,\n        titleSpace: options.titleSpace\n      })\n    );\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n  /**\n   * Construct a new box layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: BoxLayout.IOptions = {}) {\n    super();\n    if (options.direction !== undefined) {\n      this._direction = options.direction;\n    }\n    if (options.alignment !== undefined) {\n      this._alignment = options.alignment;\n    }\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._sizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the layout direction for the box layout.\n   */\n  get direction(): BoxLayout.Direction {\n    return this._direction;\n  }\n\n  /**\n   * Set the layout direction for the box layout.\n   */\n  set direction(value: BoxLayout.Direction) {\n    if (this._direction === value) {\n      return;\n    }\n    this._direction = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['direction'] = value;\n    this.parent.fit();\n  }\n\n  /**\n   * Get the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxLayout.Alignment {\n    return this._alignment;\n  }\n\n  /**\n   * Set the content alignment for the box layout.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxLayout.Alignment) {\n    if (this._alignment === value) {\n      return;\n    }\n    this._alignment = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.dataset['alignment'] = value;\n    this.parent.update();\n  }\n\n  /**\n   * Get the inter-element spacing for the box layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    this.parent!.dataset['direction'] = this.direction;\n    this.parent!.dataset['alignment'] = this.alignment;\n    super.init();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Create and add a new sizer for the widget.\n    ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Move the sizer for the widget.\n    ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Remove the sizer for the widget.\n    ArrayExt.removeAt(this._sizers, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Update the fixed space for the visible items.\n    this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n    // Setup the computed minimum size.\n    let horz = Private.isHorizontal(this._direction);\n    let minW = horz ? this._fixed : 0;\n    let minH = horz ? 0 : this._fixed;\n\n    // Update the sizers and computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item and corresponding box sizer.\n      let item = this._items[i];\n      let sizer = this._sizers[i];\n\n      // If the item is hidden, it should consume zero size.\n      if (item.isHidden) {\n        sizer.minSize = 0;\n        sizer.maxSize = 0;\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the size basis and stretch factor.\n      sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n      sizer.stretch = BoxLayout.getStretch(item.widget);\n\n      // Update the sizer limits and computed min size.\n      if (horz) {\n        sizer.minSize = item.minWidth;\n        sizer.maxSize = item.maxWidth;\n        minW += item.minWidth;\n        minH = Math.max(minH, item.minHeight);\n      } else {\n        sizer.minSize = item.minHeight;\n        sizer.maxSize = item.maxHeight;\n        minH += item.minHeight;\n        minW = Math.max(minW, item.minWidth);\n      }\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Distribute the layout space and adjust the start position.\n    let delta: number;\n    switch (this._direction) {\n      case 'left-to-right':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        break;\n      case 'top-to-bottom':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        break;\n      case 'right-to-left':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n        left += width;\n        break;\n      case 'bottom-to-top':\n        delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n        top += height;\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Setup the variables for justification and alignment offset.\n    let extra = 0;\n    let offset = 0;\n\n    // Account for alignment if there is extra layout space.\n    if (delta > 0) {\n      switch (this._alignment) {\n        case 'start':\n          break;\n        case 'center':\n          extra = 0;\n          offset = delta / 2;\n          break;\n        case 'end':\n          extra = 0;\n          offset = delta;\n          break;\n        case 'justify':\n          extra = delta / nVisible;\n          offset = 0;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Layout the items using the computed box sizes.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the computed size for the widget.\n      let size = this._sizers[i].size;\n\n      // Update the widget geometry and advance the relevant edge.\n      switch (this._direction) {\n        case 'left-to-right':\n          item.update(left + offset, top, size + extra, height);\n          left += size + extra + this._spacing;\n          break;\n        case 'top-to-bottom':\n          item.update(left, top + offset, width, size + extra);\n          top += size + extra + this._spacing;\n          break;\n        case 'right-to-left':\n          item.update(left - offset - size - extra, top, size + extra, height);\n          left -= size + extra + this._spacing;\n          break;\n        case 'bottom-to-top':\n          item.update(left, top - offset - size - extra, width, size + extra);\n          top -= size + extra + this._spacing;\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n  }\n\n  private _fixed = 0;\n  private _spacing = 4;\n  private _dirty = false;\n  private _sizers: BoxSizer[] = [];\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _alignment: BoxLayout.Alignment = 'start';\n  private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n  /**\n   * A type alias for a box layout direction.\n   */\n  export type Direction =\n    | 'left-to-right'\n    | 'right-to-left'\n    | 'top-to-bottom'\n    | 'bottom-to-top';\n\n  /**\n   * A type alias for a box layout alignment.\n   */\n  export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n  /**\n   * An options object for initializing a box layout.\n   */\n  export interface IOptions {\n    /**\n     * The direction of the layout.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the layout.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * Get the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return Private.stretchProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    Private.stretchProperty.set(widget, value);\n  }\n\n  /**\n   * Get the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box layout size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return Private.sizeBasisProperty.get(widget);\n  }\n\n  /**\n   * Set the box layout size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    Private.sizeBasisProperty.set(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for a widget stretch factor.\n   */\n  export const stretchProperty = new AttachedProperty<Widget, number>({\n    name: 'stretch',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * The property descriptor for a widget size basis.\n   */\n  export const sizeBasisProperty = new AttachedProperty<Widget, number>({\n    name: 'sizeBasis',\n    create: () => 0,\n    coerce: (owner, value) => Math.max(0, Math.floor(value)),\n    changed: onChildSizingChanged\n  });\n\n  /**\n   * Test whether a direction has horizontal orientation.\n   */\n  export function isHorizontal(dir: BoxLayout.Direction): boolean {\n    return dir === 'left-to-right' || dir === 'right-to-left';\n  }\n\n  /**\n   * Clamp a spacing value to an integer >= 0.\n   */\n  export function clampSpacing(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * The change handler for the attached sizing properties.\n   */\n  function onChildSizingChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof BoxLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n  /**\n   * Construct a new box panel.\n   *\n   * @param options - The options for initializing the box panel.\n   */\n  constructor(options: BoxPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-BoxPanel');\n  }\n\n  /**\n   * Get the layout direction for the box panel.\n   */\n  get direction(): BoxPanel.Direction {\n    return (this.layout as BoxLayout).direction;\n  }\n\n  /**\n   * Set the layout direction for the box panel.\n   */\n  set direction(value: BoxPanel.Direction) {\n    (this.layout as BoxLayout).direction = value;\n  }\n\n  /**\n   * Get the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  get alignment(): BoxPanel.Alignment {\n    return (this.layout as BoxLayout).alignment;\n  }\n\n  /**\n   * Set the content alignment for the box panel.\n   *\n   * #### Notes\n   * This is the alignment of the widgets in the layout direction.\n   *\n   * The alignment has no effect if the widgets can expand to fill the\n   * entire box layout.\n   */\n  set alignment(value: BoxPanel.Alignment) {\n    (this.layout as BoxLayout).alignment = value;\n  }\n\n  /**\n   * Get the inter-element spacing for the box panel.\n   */\n  get spacing(): number {\n    return (this.layout as BoxLayout).spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the box panel.\n   */\n  set spacing(value: number) {\n    (this.layout as BoxLayout).spacing = value;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-BoxPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-BoxPanel-child');\n  }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n  /**\n   * A type alias for a box panel direction.\n   */\n  export type Direction = BoxLayout.Direction;\n\n  /**\n   * A type alias for a box panel alignment.\n   */\n  export type Alignment = BoxLayout.Alignment;\n\n  /**\n   * An options object for initializing a box panel.\n   */\n  export interface IOptions {\n    /**\n     * The layout direction of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Direction}.\n     *\n     * The default is `'top-to-bottom'`.\n     */\n    direction?: Direction;\n\n    /**\n     * The content alignment of the panel.\n     *\n     * Possible values are documented in {@link BoxLayout.Alignment}.\n     *\n     * The default is `'start'`.\n     */\n    alignment?: Alignment;\n\n    /**\n     * The spacing between items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The box layout to use for the box panel.\n     *\n     * If this is provided, the other options are ignored.\n     *\n     * The default is a new `BoxLayout`.\n     */\n    layout?: BoxLayout;\n  }\n\n  /**\n   * Get the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel stretch factor for the widget.\n   */\n  export function getStretch(widget: Widget): number {\n    return BoxLayout.getStretch(widget);\n  }\n\n  /**\n   * Set the box panel stretch factor for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the stretch factor.\n   */\n  export function setStretch(widget: Widget, value: number): void {\n    BoxLayout.setStretch(widget, value);\n  }\n\n  /**\n   * Get the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The box panel size basis for the widget.\n   */\n  export function getSizeBasis(widget: Widget): number {\n    return BoxLayout.getSizeBasis(widget);\n  }\n\n  /**\n   * Set the box panel size basis for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the size basis.\n   */\n  export function setSizeBasis(widget: Widget, value: number): void {\n    BoxLayout.setSizeBasis(widget, value);\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a box layout for the given panel options.\n   */\n  export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n    return options.layout || new BoxLayout(options);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n  /**\n   * Construct a new command palette.\n   *\n   * @param options - The options for initializing the palette.\n   */\n  constructor(options: CommandPalette.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-CommandPalette');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || CommandPalette.defaultRenderer;\n    this.commands.commandChanged.connect(this._onGenericChange, this);\n    this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._items.length = 0;\n    this._results = null;\n    super.dispose();\n  }\n\n  /**\n   * The command registry used by the command palette.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the command palette.\n   */\n  readonly renderer: CommandPalette.IRenderer;\n\n  /**\n   * The command palette search node.\n   *\n   * #### Notes\n   * This is the node which contains the search-related elements.\n   */\n  get searchNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-search'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The command palette input node.\n   *\n   * #### Notes\n   * This is the actual input node for the search area.\n   */\n  get inputNode(): HTMLInputElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-input'\n    )[0] as HTMLInputElement;\n  }\n\n  /**\n   * The command palette content node.\n   *\n   * #### Notes\n   * This is the node which holds the command item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-CommandPalette-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * A read-only array of the command items in the palette.\n   */\n  get items(): ReadonlyArray<CommandPalette.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Add a command item to the command palette.\n   *\n   * @param options - The options for creating the command item.\n   *\n   * @returns The command item added to the palette.\n   */\n  addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n    // Create a new command item for the options.\n    let item = Private.createItem(this.commands, options);\n\n    // Add the item to the array.\n    this._items.push(item);\n\n    // Refresh the search results.\n    this.refresh();\n\n    // Return the item added to the palette.\n    return item;\n  }\n\n  /**\n   * Adds command items to the command palette.\n   *\n   * @param items - An array of options for creating each command item.\n   *\n   * @returns The command items added to the palette.\n   */\n  addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n    const newItems = items.map(item => Private.createItem(this.commands, item));\n    newItems.forEach(item => this._items.push(item));\n    this.refresh();\n    return newItems;\n  }\n\n  /**\n   * Remove an item from the command palette.\n   *\n   * @param item - The item to remove from the palette.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the palette.\n   */\n  removeItem(item: CommandPalette.IItem): void {\n    this.removeItemAt(this._items.indexOf(item));\n  }\n\n  /**\n   * Remove the item at a given index from the command palette.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Remove all items from the command palette.\n   */\n  clearItems(): void {\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the array of items.\n    this._items.length = 0;\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Clear the search results and schedule an update.\n   *\n   * #### Notes\n   * This should be called whenever the search results of the palette\n   * should be updated.\n   *\n   * This is typically called automatically by the palette as needed,\n   * but can be called manually if the input text is programatically\n   * changed.\n   *\n   * The rendered results are updated asynchronously.\n   */\n  refresh(): void {\n    this._results = null;\n    if (this.inputNode.value !== '') {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'inherit';\n    } else {\n      let clear = this.node.getElementsByClassName(\n        'lm-close-icon'\n      )[0] as HTMLInputElement;\n      clear.style.display = 'none';\n    }\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the command palette.\n   *\n   * @param event - The DOM event sent to the command palette.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the command palette's DOM node.\n   * It should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'click':\n        this._evtClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'input':\n        this.refresh();\n        break;\n      case 'focus':\n      case 'blur':\n        this._toggleFocused();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('click', this);\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('input', this);\n    this.node.addEventListener('focus', this, true);\n    this.node.addEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('click', this);\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('input', this);\n    this.node.removeEventListener('focus', this, true);\n    this.node.removeEventListener('blur', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'after-show'` message.\n   */\n  protected onAfterShow(msg: Message): void {\n    this.update();\n    super.onAfterShow(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      let input = this.inputNode;\n      input.focus();\n      input.select();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (!this.isVisible) {\n      // Ensure to clear the content if the widget is hidden\n      VirtualDOM.render(null, this.contentNode);\n      return;\n    }\n\n    // Fetch the current query text and content node.\n    let query = this.inputNode.value;\n    let contentNode = this.contentNode;\n\n    // Ensure the search results are generated.\n    let results = this._results;\n    if (!results) {\n      // Generate and store the new search results.\n      results = this._results = Private.search(this._items, query);\n\n      // Reset the active index.\n      this._activeIndex = query\n        ? ArrayExt.findFirstIndex(results, Private.canActivate)\n        : -1;\n    }\n\n    // If there is no query and no results, clear the content.\n    if (!query && results.length === 0) {\n      VirtualDOM.render(null, contentNode);\n      return;\n    }\n\n    // If the is a query but no results, render the empty message.\n    if (query && results.length === 0) {\n      let content = this.renderer.renderEmptyMessage({ query });\n      VirtualDOM.render(content, contentNode);\n      return;\n    }\n\n    // Create the render content for the search results.\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let content = new Array<VirtualElement>(results.length);\n    for (let i = 0, n = results.length; i < n; ++i) {\n      let result = results[i];\n      if (result.type === 'header') {\n        let indices = result.indices;\n        let category = result.category;\n        content[i] = renderer.renderHeader({ category, indices });\n      } else {\n        let item = result.item;\n        let indices = result.indices;\n        let active = i === activeIndex;\n        content[i] = renderer.renderItem({ item, indices, active });\n      }\n    }\n\n    // Render the search result content.\n    VirtualDOM.render(content, contentNode);\n\n    // Adjust the scroll position as needed.\n    if (activeIndex < 0 || activeIndex >= results.length) {\n      contentNode.scrollTop = 0;\n    } else {\n      let element = contentNode.children[activeIndex];\n      ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n    }\n  }\n\n  /**\n   * Handle the `'click'` event for the command palette.\n   */\n  private _evtClick(event: MouseEvent): void {\n    // Bail if the click is not the left button.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Clear input if the target is clear button\n    if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n      this.inputNode.value = '';\n      this.refresh();\n      return;\n    }\n\n    // Find the index of the item which was clicked.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return node.contains(event.target as HTMLElement);\n    });\n\n    // Bail if the click was not on an item.\n    if (index === -1) {\n      return;\n    }\n\n    // Kill the event when a content item is clicked.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Execute the item if possible.\n    this._execute(index);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the command palette.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n      return;\n    }\n    switch (event.keyCode) {\n      case 13: // Enter\n        event.preventDefault();\n        event.stopPropagation();\n        this._execute(this._activeIndex);\n        break;\n      case 38: // Up Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activatePreviousItem();\n        break;\n      case 40: // Down Arrow\n        event.preventDefault();\n        event.stopPropagation();\n        this._activateNextItem();\n        break;\n    }\n  }\n\n  /**\n   * Activate the next enabled command item.\n   */\n  private _activateNextItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the next enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this._activeIndex = ArrayExt.findFirstIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Activate the previous enabled command item.\n   */\n  private _activatePreviousItem(): void {\n    // Bail if there are no search results.\n    if (!this._results || this._results.length === 0) {\n      return;\n    }\n\n    // Find the previous enabled item index.\n    let ai = this._activeIndex;\n    let n = this._results.length;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this._activeIndex = ArrayExt.findLastIndex(\n      this._results,\n      Private.canActivate,\n      start,\n      stop\n    );\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Execute the command item at the given index, if possible.\n   */\n  private _execute(index: number): void {\n    // Bail if there are no search results.\n    if (!this._results) {\n      return;\n    }\n\n    // Bail if the index is out of range.\n    let part = this._results[index];\n    if (!part) {\n      return;\n    }\n\n    // Update the search text if the item is a header.\n    if (part.type === 'header') {\n      let input = this.inputNode;\n      input.value = `${part.category.toLowerCase()} `;\n      input.focus();\n      this.refresh();\n      return;\n    }\n\n    // Bail if item is not enabled.\n    if (!part.item.isEnabled) {\n      return;\n    }\n\n    // Execute the item.\n    this.commands.execute(part.item.command, part.item.args);\n\n    // Clear the query text.\n    this.inputNode.value = '';\n\n    // Refresh the search results.\n    this.refresh();\n  }\n\n  /**\n   * Toggle the focused modifier based on the input node focus state.\n   */\n  private _toggleFocused(): void {\n    let focused = document.activeElement === this.inputNode;\n    this.toggleClass('lm-mod-focused', focused);\n  }\n\n  /**\n   * A signal handler for generic command changes.\n   */\n  private _onGenericChange(): void {\n    this.refresh();\n  }\n\n  private _activeIndex = -1;\n  private _items: CommandPalette.IItem[] = [];\n  private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n  /**\n   * An options object for creating a command palette.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the command palette.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the command palette.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for creating a command item.\n   */\n  export interface IItemOptions {\n    /**\n     * The category for the item.\n     */\n    category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    command: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     *\n     * The rank is used as a tie-breaker when ordering command items\n     * for display. Items are sorted in the following order:\n     *   1. Text match (lower is better)\n     *   2. Category (locale order)\n     *   3. Rank (lower is better)\n     *   4. Label (locale order)\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n\n  /**\n   * An object which represents an item in a command palette.\n   *\n   * #### Notes\n   * Item objects are created automatically by a command palette.\n   */\n  export interface IItem {\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    readonly label: string;\n\n    /**\n     * The display caption for the command item.\n     */\n    readonly caption: string;\n\n    /**\n     * The icon renderer for the command item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the command item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the command item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The extra class name for the command item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the command item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the command item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the command item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    readonly isToggleable: boolean;\n\n    /**\n     * Whether the command item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the command item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * The render data for a command palette header.\n   */\n  export interface IHeaderRenderData {\n    /**\n     * The category of the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched characters in the category.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * The render data for a command palette item.\n   */\n  export interface IItemRenderData {\n    /**\n     * The command palette item to render.\n     */\n    readonly item: IItem;\n\n    /**\n     * The indices of the matched characters in the label.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n  }\n\n  /**\n   * The render data for a command palette empty message.\n   */\n  export interface IEmptyMessageRenderData {\n    /**\n     * The query which failed to match any commands.\n     */\n    query: string;\n  }\n\n  /**\n   * A renderer for use with a command palette.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement;\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     *\n     * #### Notes\n     * The command palette will not render invisible items.\n     */\n    renderItem(data: IItemRenderData): VirtualElement;\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a command palette header.\n     *\n     * @param data - The data to use for rendering the header.\n     *\n     * @returns A virtual element representing the header.\n     */\n    renderHeader(data: IHeaderRenderData): VirtualElement {\n      let content = this.formatHeader(data);\n      return h.li({ className: 'lm-CommandPalette-header' }, content);\n    }\n\n    /**\n     * Render the virtual element for a command palette item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IItemRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      if (data.item.isToggleable) {\n        return h.li(\n          {\n            className,\n            dataset,\n            role: 'menuitemcheckbox',\n            'aria-checked': `${data.item.isToggled}`\n          },\n          this.renderItemIcon(data),\n          this.renderItemContent(data),\n          this.renderItemShortcut(data)\n        );\n      }\n      return h.li(\n        {\n          className,\n          dataset,\n          role: 'menuitem'\n        },\n        this.renderItemIcon(data),\n        this.renderItemContent(data),\n        this.renderItemShortcut(data)\n      );\n    }\n\n    /**\n     * Render the empty results message for a command palette.\n     *\n     * @param data - The data to use for rendering the message.\n     *\n     * @returns A virtual element representing the message.\n     */\n    renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n      let content = this.formatEmptyMessage(data);\n      return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n    }\n\n    /**\n     * Render the icon for a command palette item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the icon.\n     */\n    renderItemIcon(data: IItemRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the content for a command palette item.\n     *\n     * @param data - The data to use for rendering the content.\n     *\n     * @returns A virtual element representing the content.\n     */\n    renderItemContent(data: IItemRenderData): VirtualElement {\n      return h.div(\n        { className: 'lm-CommandPalette-itemContent' },\n        this.renderItemLabel(data),\n        this.renderItemCaption(data)\n      );\n    }\n\n    /**\n     * Render the label for a command palette item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the label.\n     */\n    renderItemLabel(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemLabel(data);\n      return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n    }\n\n    /**\n     * Render the caption for a command palette item.\n     *\n     * @param data - The data to use for rendering the caption.\n     *\n     * @returns A virtual element representing the caption.\n     */\n    renderItemCaption(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemCaption(data);\n      return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n    }\n\n    /**\n     * Render the shortcut for a command palette item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the shortcut.\n     */\n    renderItemShortcut(data: IItemRenderData): VirtualElement {\n      let content = this.formatItemShortcut(data);\n      return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n    }\n\n    /**\n     * Create the class name for the command palette item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the command palette item.\n     */\n    createItemClass(data: IItemRenderData): string {\n      // Set up the initial class name.\n      let name = 'lm-CommandPalette-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the command palette item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the command palette item.\n     */\n    createItemDataset(data: IItemRenderData): ElementDataset {\n      return { ...data.item.dataset, command: data.item.command };\n    }\n\n    /**\n     * Create the class name for the command item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IItemRenderData): string {\n      let name = 'lm-CommandPalette-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the header node.\n     *\n     * @param data - The data to use for the header content.\n     *\n     * @returns The content to add to the header node.\n     */\n    formatHeader(data: IHeaderRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.category;\n      }\n      return StringExt.highlight(data.category, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the empty message node.\n     *\n     * @param data - The data to use for the empty message content.\n     *\n     * @returns The content to add to the empty message node.\n     */\n    formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n      return `No commands found that match '${data.query}'`;\n    }\n\n    /**\n     * Create the render content for the item shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatItemShortcut(data: IItemRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n\n    /**\n     * Create the render content for the item label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatItemLabel(data: IItemRenderData): h.Child {\n      if (!data.indices || data.indices.length === 0) {\n        return data.item.label;\n      }\n      return StringExt.highlight(data.item.label, data.indices, h.mark);\n    }\n\n    /**\n     * Create the render content for the item caption node.\n     *\n     * @param data - The data to use for the caption content.\n     *\n     * @returns The content to add to the caption node.\n     */\n    formatItemCaption(data: IItemRenderData): h.Child {\n      return data.item.caption;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a command palette.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let search = document.createElement('div');\n    let wrapper = document.createElement('div');\n    let input = document.createElement('input');\n    let content = document.createElement('ul');\n    let clear = document.createElement('button');\n    search.className = 'lm-CommandPalette-search';\n    wrapper.className = 'lm-CommandPalette-wrapper';\n    input.className = 'lm-CommandPalette-input';\n    clear.className = 'lm-close-icon';\n\n    content.className = 'lm-CommandPalette-content';\n    content.setAttribute('role', 'menu');\n    input.spellcheck = false;\n    wrapper.appendChild(input);\n    wrapper.appendChild(clear);\n    search.appendChild(wrapper);\n    node.appendChild(search);\n    node.appendChild(content);\n    return node;\n  }\n\n  /**\n   * Create a new command item from a command registry and options.\n   */\n  export function createItem(\n    commands: CommandRegistry,\n    options: CommandPalette.IItemOptions\n  ): CommandPalette.IItem {\n    return new CommandItem(commands, options);\n  }\n\n  /**\n   * A search result object for a header label.\n   */\n  export interface IHeaderResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'header';\n\n    /**\n     * The category for the header.\n     */\n    readonly category: string;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A search result object for a command item.\n   */\n  export interface IItemResult {\n    /**\n     * The discriminated type of the object.\n     */\n    readonly type: 'item';\n\n    /**\n     * The command item which was matched.\n     */\n    readonly item: CommandPalette.IItem;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    readonly indices: ReadonlyArray<number> | null;\n  }\n\n  /**\n   * A type alias for a search result item.\n   */\n  export type SearchResult = IHeaderResult | IItemResult;\n\n  /**\n   * Search an array of command items for fuzzy matches.\n   */\n  export function search(\n    items: CommandPalette.IItem[],\n    query: string\n  ): SearchResult[] {\n    // Fuzzy match the items for the query.\n    let scores = matchItems(items, query);\n\n    // Sort the items based on their score.\n    scores.sort(scoreCmp);\n\n    // Create the results for the search.\n    return createResults(scores);\n  }\n\n  /**\n   * Test whether a result item can be activated.\n   */\n  export function canActivate(result: SearchResult): boolean {\n    return result.type === 'item' && result.item.isEnabled;\n  }\n\n  /**\n   * Normalize a category for a command item.\n   */\n  function normalizeCategory(category: string): string {\n    return category.trim().replace(/\\s+/g, ' ');\n  }\n\n  /**\n   * Normalize the query text for a fuzzy search.\n   */\n  function normalizeQuery(text: string): string {\n    return text.replace(/\\s+/g, '').toLowerCase();\n  }\n\n  /**\n   * An enum of the supported match types.\n   */\n  const enum MatchType {\n    Label,\n    Category,\n    Split,\n    Default\n  }\n\n  /**\n   * A text match score with associated command item.\n   */\n  interface IScore {\n    /**\n     * The numerical type for the text match.\n     */\n    matchType: MatchType;\n\n    /**\n     * The numerical score for the text match.\n     */\n    score: number;\n\n    /**\n     * The indices of the matched category characters.\n     */\n    categoryIndices: number[] | null;\n\n    /**\n     * The indices of the matched label characters.\n     */\n    labelIndices: number[] | null;\n\n    /**\n     * The command item associated with the match.\n     */\n    item: CommandPalette.IItem;\n  }\n\n  /**\n   * Perform a fuzzy match on an array of command items.\n   */\n  function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n    // Normalize the query text to lower case with no whitespace.\n    query = normalizeQuery(query);\n\n    // Create the array to hold the scores.\n    let scores: IScore[] = [];\n\n    // Iterate over the items and match against the query.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Ignore items which are not visible.\n      let item = items[i];\n      if (!item.isVisible) {\n        continue;\n      }\n\n      // If the query is empty, all items are matched by default.\n      if (!query) {\n        scores.push({\n          matchType: MatchType.Default,\n          categoryIndices: null,\n          labelIndices: null,\n          score: 0,\n          item\n        });\n        continue;\n      }\n\n      // Run the fuzzy search for the item and query.\n      let score = fuzzySearch(item, query);\n\n      // Ignore the item if it is not a match.\n      if (!score) {\n        continue;\n      }\n\n      // Penalize disabled items.\n      // TODO - push disabled items all the way down in sort cmp?\n      if (!item.isEnabled) {\n        score.score += 1000;\n      }\n\n      // Add the score to the results.\n      scores.push(score);\n    }\n\n    // Return the final array of scores.\n    return scores;\n  }\n\n  /**\n   * Perform a fuzzy search on a single command item.\n   */\n  function fuzzySearch(\n    item: CommandPalette.IItem,\n    query: string\n  ): IScore | null {\n    // Create the source text to be searched.\n    let category = item.category.toLowerCase();\n    let label = item.label.toLowerCase();\n    let source = `${category} ${label}`;\n\n    // Set up the match score and indices array.\n    let score = Infinity;\n    let indices: number[] | null = null;\n\n    // The regex for search word boundaries\n    let rgx = /\\b\\w/g;\n\n    // Search the source by word boundary.\n    // eslint-disable-next-line no-constant-condition\n    while (true) {\n      // Find the next word boundary in the source.\n      let rgxMatch = rgx.exec(source);\n\n      // Break if there is no more source context.\n      if (!rgxMatch) {\n        break;\n      }\n\n      // Run the string match on the relevant substring.\n      let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n      // Break if there is no match.\n      if (!match) {\n        break;\n      }\n\n      // Update the match if the score is better.\n      if (match.score <= score) {\n        score = match.score;\n        indices = match.indices;\n      }\n    }\n\n    // Bail if there was no match.\n    if (!indices || score === Infinity) {\n      return null;\n    }\n\n    // Compute the pivot index between category and label text.\n    let pivot = category.length + 1;\n\n    // Find the slice index to separate matched indices.\n    let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n    // Extract the matched category and label indices.\n    let categoryIndices = indices.slice(0, j);\n    let labelIndices = indices.slice(j);\n\n    // Adjust the label indices for the pivot offset.\n    for (let i = 0, n = labelIndices.length; i < n; ++i) {\n      labelIndices[i] -= pivot;\n    }\n\n    // Handle a pure label match.\n    if (categoryIndices.length === 0) {\n      return {\n        matchType: MatchType.Label,\n        categoryIndices: null,\n        labelIndices,\n        score,\n        item\n      };\n    }\n\n    // Handle a pure category match.\n    if (labelIndices.length === 0) {\n      return {\n        matchType: MatchType.Category,\n        categoryIndices,\n        labelIndices: null,\n        score,\n        item\n      };\n    }\n\n    // Handle a split match.\n    return {\n      matchType: MatchType.Split,\n      categoryIndices,\n      labelIndices,\n      score,\n      item\n    };\n  }\n\n  /**\n   * A sort comparison function for a match score.\n   */\n  function scoreCmp(a: IScore, b: IScore): number {\n    // First compare based on the match type\n    let m1 = a.matchType - b.matchType;\n    if (m1 !== 0) {\n      return m1;\n    }\n\n    // Otherwise, compare based on the match score.\n    let d1 = a.score - b.score;\n    if (d1 !== 0) {\n      return d1;\n    }\n\n    // Find the match index based on the match type.\n    let i1 = 0;\n    let i2 = 0;\n    switch (a.matchType) {\n      case MatchType.Label:\n        i1 = a.labelIndices![0];\n        i2 = b.labelIndices![0];\n        break;\n      case MatchType.Category:\n      case MatchType.Split:\n        i1 = a.categoryIndices![0];\n        i2 = b.categoryIndices![0];\n        break;\n    }\n\n    // Compare based on the match index.\n    if (i1 !== i2) {\n      return i1 - i2;\n    }\n\n    // Otherwise, compare by category.\n    let d2 = a.item.category.localeCompare(b.item.category);\n    if (d2 !== 0) {\n      return d2;\n    }\n\n    // Otherwise, compare by rank.\n    let r1 = a.item.rank;\n    let r2 = b.item.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity safe\n    }\n\n    // Finally, compare by label.\n    return a.item.label.localeCompare(b.item.label);\n  }\n\n  /**\n   * Create the results from an array of sorted scores.\n   */\n  function createResults(scores: IScore[]): SearchResult[] {\n    // Set up the search results array.\n    let results: SearchResult[] = [];\n\n    // Iterate over each score in the array.\n    for (let i = 0, n = scores.length; i < n; ++i) {\n      // Extract the current item and indices.\n      let { item, categoryIndices, labelIndices } = scores[i];\n\n      // Extract the category for the current item.\n      let category = item.category;\n\n      // Is this the same category as the preceding result?\n      if (i === 0 || category !== scores[i - 1].item.category) {\n        // Add the header result for the category.\n        results.push({ type: 'header', category, indices: categoryIndices });\n      }\n\n      // Create the item result for the score.\n      results.push({ type: 'item', item, indices: labelIndices });\n    }\n\n    // Return the final results.\n    return results;\n  }\n\n  /**\n   * A concrete implementation of `CommandPalette.IItem`.\n   */\n  class CommandItem implements CommandPalette.IItem {\n    /**\n     * Construct a new command item.\n     */\n    constructor(\n      commands: CommandRegistry,\n      options: CommandPalette.IItemOptions\n    ) {\n      this._commands = commands;\n      this.category = normalizeCategory(options.category);\n      this.command = options.command;\n      this.args = options.args || JSONExt.emptyObject;\n      this.rank = options.rank !== undefined ? options.rank : Infinity;\n    }\n\n    /**\n     * The category for the command item.\n     */\n    readonly category: string;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The rank for the command item.\n     */\n    readonly rank: number;\n\n    /**\n     * The display label for the command item.\n     */\n    get label(): string {\n      return this._commands.label(this.command, this.args);\n    }\n\n    /**\n     * The icon renderer for the command item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      return this._commands.icon(this.command, this.args);\n    }\n\n    /**\n     * The icon class for the command item.\n     */\n    get iconClass(): string {\n      return this._commands.iconClass(this.command, this.args);\n    }\n\n    /**\n     * The icon label for the command item.\n     */\n    get iconLabel(): string {\n      return this._commands.iconLabel(this.command, this.args);\n    }\n\n    /**\n     * The display caption for the command item.\n     */\n    get caption(): string {\n      return this._commands.caption(this.command, this.args);\n    }\n\n    /**\n     * The extra class name for the command item.\n     */\n    get className(): string {\n      return this._commands.className(this.command, this.args);\n    }\n\n    /**\n     * The dataset for the command item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      return this._commands.dataset(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is enabled.\n     */\n    get isEnabled(): boolean {\n      return this._commands.isEnabled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggled.\n     */\n    get isToggled(): boolean {\n      return this._commands.isToggled(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is toggleable.\n     */\n    get isToggleable(): boolean {\n      return this._commands.isToggleable(this.command, this.args);\n    }\n\n    /**\n     * Whether the command item is visible.\n     */\n    get isVisible(): boolean {\n      return this._commands.isVisible(this.command, this.args);\n    }\n\n    /**\n     * The key binding for the command item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      let { command, args } = this;\n      return (\n        ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n          return kb.command === command && JSONExt.deepEqual(kb.args, args);\n        }) || null\n      );\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ARIAAttrNames,\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n  pageXOffset: number;\n  pageYOffset: number;\n  clientWidth: number;\n  clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n  /**\n   * Construct a new menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: Menu.IOptions) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-Menu');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.commands = options.commands;\n    this.renderer = options.renderer || Menu.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the menu.\n   */\n  dispose(): void {\n    this.close();\n    this._items.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted just before the menu is closed.\n   *\n   * #### Notes\n   * This signal is emitted when the menu receives a `'close-request'`\n   * message, just before it removes itself from the DOM.\n   *\n   * This signal is not emitted if the menu is already detached from\n   * the DOM when it receives the `'close-request'` message.\n   */\n  get aboutToClose(): ISignal<this, void> {\n    return this._aboutToClose;\n  }\n\n  /**\n   * A signal emitted when a new menu is requested by the user.\n   *\n   * #### Notes\n   * This signal is emitted whenever the user presses the right or left\n   * arrow keys, and a submenu cannot be opened or closed in response.\n   *\n   * This signal is useful when implementing menu bars in order to open\n   * the next or previous menu in response to a user key press.\n   *\n   * This signal is only emitted for the root menu in a hierarchy.\n   */\n  get menuRequested(): ISignal<this, 'next' | 'previous'> {\n    return this._menuRequested;\n  }\n\n  /**\n   * The command registry used by the menu.\n   */\n  readonly commands: CommandRegistry;\n\n  /**\n   * The renderer used by the menu.\n   */\n  readonly renderer: Menu.IRenderer;\n\n  /**\n   * The parent menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu is an open submenu.\n   */\n  get parentMenu(): Menu | null {\n    return this._parentMenu;\n  }\n\n  /**\n   * The child menu of the menu.\n   *\n   * #### Notes\n   * This is `null` unless the menu has an open submenu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The root menu of the menu hierarchy.\n   */\n  get rootMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._parentMenu) {\n      menu = menu._parentMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The leaf menu of the menu hierarchy.\n   */\n  get leafMenu(): Menu {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    let menu: Menu = this;\n    while (menu._childMenu) {\n      menu = menu._childMenu;\n    }\n    return menu;\n  }\n\n  /**\n   * The menu content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu item nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-Menu-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu item.\n   */\n  get activeItem(): Menu.IItem | null {\n    return this._items[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the item will be set to `null`.\n   */\n  set activeItem(value: Menu.IItem | null) {\n    this.activeIndex = value ? this._items.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu item.\n   *\n   * #### Notes\n   * This will be `-1` if no menu item is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu item.\n   *\n   * #### Notes\n   * If the item cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._items.length) {\n      value = -1;\n    }\n\n    // Ensure the item can be activated.\n    if (value !== -1 && !Private.canActivate(this._items[value])) {\n      value = -1;\n    }\n\n    // Bail if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Make active element in focus\n    if (\n      this._activeIndex >= 0 &&\n      this.contentNode.childNodes[this._activeIndex]\n    ) {\n      (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n    }\n\n    // schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menu items in the menu.\n   */\n  get items(): ReadonlyArray<Menu.IItem> {\n    return this._items;\n  }\n\n  /**\n   * Activate the next selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activateNextItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai < n - 1 ? ai + 1 : 0;\n    let stop = start === 0 ? n - 1 : start - 1;\n    this.activeIndex = ArrayExt.findFirstIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Activate the previous selectable item in the menu.\n   *\n   * #### Notes\n   * If no item is selectable, the index will be set to `-1`.\n   */\n  activatePreviousItem(): void {\n    let n = this._items.length;\n    let ai = this._activeIndex;\n    let start = ai <= 0 ? n - 1 : ai - 1;\n    let stop = start === n - 1 ? 0 : start + 1;\n    this.activeIndex = ArrayExt.findLastIndex(\n      this._items,\n      Private.canActivate,\n      start,\n      stop\n    );\n  }\n\n  /**\n   * Trigger the active menu item.\n   *\n   * #### Notes\n   * If the active item is a submenu, it will be opened and the first\n   * item will be activated.\n   *\n   * If the active item is a command, the command will be executed.\n   *\n   * If the menu is not attached, this is a no-op.\n   *\n   * If there is no active item, this is a no-op.\n   */\n  triggerActiveItem(): void {\n    // Bail if the menu is not attached.\n    if (!this.isAttached) {\n      return;\n    }\n\n    // Bail if there is no active item.\n    let item = this.activeItem;\n    if (!item) {\n      return;\n    }\n\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // If the item is a submenu, open it.\n    if (item.type === 'submenu') {\n      this._openChildMenu(true);\n      return;\n    }\n\n    // Close the root menu before executing the command.\n    this.rootMenu.close();\n\n    // Execute the command for the item.\n    let { command, args } = item;\n    if (this.commands.isEnabled(command, args)) {\n      this.commands.execute(command, args);\n    } else {\n      console.log(`Command '${command}' is disabled.`);\n    }\n  }\n\n  /**\n   * Add a menu item to the end of the menu.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   */\n  addItem(options: Menu.IItemOptions): Menu.IItem {\n    return this.insertItem(this._items.length, options);\n  }\n\n  /**\n   * Insert a menu item into the menu at the specified index.\n   *\n   * @param index - The index at which to insert the item.\n   *\n   * @param options - The options for creating the menu item.\n   *\n   * @returns The menu item added to the menu.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the items.\n   */\n  insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Clamp the insert index to the array bounds.\n    let i = Math.max(0, Math.min(index, this._items.length));\n\n    // Create the item for the options.\n    let item = Private.createItem(this, options);\n\n    // Insert the item into the array.\n    ArrayExt.insert(this._items, i, item);\n\n    // Schedule an update of the items.\n    this.update();\n\n    // Return the item added to the menu.\n    return item;\n  }\n\n  /**\n   * Remove an item from the menu.\n   *\n   * @param item - The item to remove from the menu.\n   *\n   * #### Notes\n   * This is a no-op if the item is not in the menu.\n   */\n  removeItem(item: Menu.IItem): void {\n    this.removeItemAt(this._items.indexOf(item));\n  }\n\n  /**\n   * Remove the item at a given index from the menu.\n   *\n   * @param index - The index of the item to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeItemAt(index: number): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Remove the item from the array.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Bail if the index is out of range.\n    if (!item) {\n      return;\n    }\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Remove all menu items from the menu.\n   */\n  clearItems(): void {\n    // Close the menu if it's attached.\n    if (this.isAttached) {\n      this.close();\n    }\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Bail if there is nothing to remove.\n    if (this._items.length === 0) {\n      return;\n    }\n\n    // Clear the items.\n    this._items.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Open the menu at the specified location.\n   *\n   * @param x - The client X coordinate of the menu location.\n   *\n   * @param y - The client Y coordinate of the menu location.\n   *\n   * @param options - The additional options for opening the menu.\n   *\n   * #### Notes\n   * The menu will be opened at the given location unless it will not\n   * fully fit on the screen. If it will not fit, it will be adjusted\n   * to fit naturally on the screen.\n   *\n   * The menu will be attached under the `host` element in the DOM\n   * (or `document.body` if `host` is `null`) and before the `ref`\n   * element (or as the last child of `host` if `ref` is `null`).\n   * The menu may be displayed outside of the `host` element\n   * following the rules of CSS absolute positioning.\n   *\n   * This is a no-op if the menu is already attached to the DOM.\n   */\n  open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n    // Bail early if the menu is already attached.\n    if (this.isAttached) {\n      return;\n    }\n\n    // Extract the menu options.\n    let forceX = options.forceX || false;\n    let forceY = options.forceY || false;\n    const host = options.host ?? null;\n    const ref = options.ref ?? null;\n    const horizontalAlignment =\n      options.horizontalAlignment ??\n      (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n    // Open the menu as a root menu.\n    Private.openRootMenu(\n      this,\n      x,\n      y,\n      forceX,\n      forceY,\n      horizontalAlignment,\n      host,\n      ref\n    );\n\n    // Activate the menu to accept keyboard input.\n    this.activate();\n  }\n\n  /**\n   * Handle the DOM events for the menu.\n   *\n   * @param event - The DOM event sent to the menu.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu's DOM nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseenter':\n        this._evtMouseEnter(event as MouseEvent);\n        break;\n      case 'mouseleave':\n        this._evtMouseLeave(event as MouseEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'after-attach'` message.\n   */\n  protected override onAfterAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mouseup', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseenter', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('contextmenu', this);\n    this.node.ownerDocument.addEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'before-detach'` message.\n   */\n  protected override onBeforeDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mouseup', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseenter', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('contextmenu', this);\n    this.node.ownerDocument.removeEventListener('mousedown', this, true);\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this.node.focus();\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let items = this._items;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let collapsedFlags = Private.computeCollapsed(items);\n    let content = new Array<VirtualElement>(items.length);\n    for (let i = 0, n = items.length; i < n; ++i) {\n      let item = items[i];\n      let active = i === activeIndex;\n      let collapsed = collapsedFlags[i];\n      content[i] = renderer.renderItem({\n        item,\n        active,\n        collapsed,\n        onfocus: () => {\n          this.activeIndex = i;\n        }\n      });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * A message handler invoked on a `'close-request'` message.\n   */\n  protected onCloseRequest(msg: Message): void {\n    // Cancel the pending timers.\n    this._cancelOpenTimer();\n    this._cancelCloseTimer();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n\n    // Close any open child menu.\n    let childMenu = this._childMenu;\n    if (childMenu) {\n      this._childIndex = -1;\n      this._childMenu = null;\n      childMenu._parentMenu = null;\n      childMenu.close();\n    }\n\n    // Remove this menu from its parent and activate the parent.\n    let parentMenu = this._parentMenu;\n    if (parentMenu) {\n      this._parentMenu = null;\n      parentMenu._childIndex = -1;\n      parentMenu._childMenu = null;\n      parentMenu.activate();\n    }\n\n    // Emit the `aboutToClose` signal if the menu is attached.\n    if (this.isAttached) {\n      this._aboutToClose.emit(undefined);\n    }\n\n    // Finish closing the menu.\n    super.onCloseRequest(msg);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // A menu handles all keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Enter\n    if (kc === 13) {\n      this.triggerActiveItem();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this.close();\n      return;\n    }\n\n    // Left Arrow\n    if (kc === 37) {\n      if (this._parentMenu) {\n        this.close();\n      } else {\n        this._menuRequested.emit('previous');\n      }\n      return;\n    }\n\n    // Up Arrow\n    if (kc === 38) {\n      this.activatePreviousItem();\n      return;\n    }\n\n    // Right Arrow\n    if (kc === 39) {\n      let item = this.activeItem;\n      if (item && item.type === 'submenu') {\n        this.triggerActiveItem();\n      } else {\n        this.rootMenu._menuRequested.emit('next');\n      }\n      return;\n    }\n\n    // Down Arrow\n    if (kc === 40) {\n      this.activateNextItem();\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._items, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that item is triggered.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.triggerActiveItem();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n    }\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    if (event.button !== 0) {\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n    this.triggerActiveItem();\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Hit test the item nodes for the item under the mouse.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the mouse is already over the active index.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Update and coerce the active index.\n    this.activeIndex = index;\n    index = this.activeIndex;\n\n    // If the index is the current child index, cancel the timers.\n    if (index === this._childIndex) {\n      this._cancelOpenTimer();\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // If a child menu is currently open, start the close timer.\n    if (this._childIndex !== -1) {\n      this._startCloseTimer();\n    }\n\n    // Cancel the open timer to give a full delay for opening.\n    this._cancelOpenTimer();\n\n    // Bail if the active item is not a valid submenu item.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      return;\n    }\n\n    // Start the open timer to open the active item submenu.\n    this._startOpenTimer();\n  }\n\n  /**\n   * Handle the `'mouseenter'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseEnter(event: MouseEvent): void {\n    // Synchronize the active ancestor items.\n    for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n      menu._cancelOpenTimer();\n      menu._cancelCloseTimer();\n      menu.activeIndex = menu._childIndex;\n    }\n  }\n\n  /**\n   * Handle the `'mouseleave'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the menu node.\n   */\n  private _evtMouseLeave(event: MouseEvent): void {\n    // Cancel any pending submenu opening.\n    this._cancelOpenTimer();\n\n    // If there is no open child menu, just reset the active index.\n    if (!this._childMenu) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // If the mouse is over the child menu, cancel the close timer.\n    let { clientX, clientY } = event;\n    if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n      this._cancelCloseTimer();\n      return;\n    }\n\n    // Otherwise, reset the active index and start the close timer.\n    this.activeIndex = -1;\n    this._startCloseTimer();\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu.\n   *\n   * #### Notes\n   * This listener is attached to the document node.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the menu is not a root menu.\n    if (this._parentMenu) {\n      return;\n    }\n\n    // The mouse button which is pressed is irrelevant. If the press\n    // is not on a menu, the entire hierarchy is closed and the event\n    // is allowed to propagate. This allows other code to act on the\n    // event, such as focusing the clicked element.\n    if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n      event.preventDefault();\n      event.stopPropagation();\n    } else {\n      this.close();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if the active item is not a valid submenu.\n   */\n  private _openChildMenu(activateFirst = false): void {\n    // If the item is not a valid submenu, close the child menu.\n    let item = this.activeItem;\n    if (!item || item.type !== 'submenu' || !item.submenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Do nothing if the child menu will not change.\n    let submenu = item.submenu;\n    if (submenu === this._childMenu) {\n      return;\n    }\n\n    // Prior to any DOM modifications save window data\n    Menu.saveWindowData();\n\n    // Ensure the current child menu is closed.\n    this._closeChildMenu();\n\n    // Update the private child state.\n    this._childMenu = submenu;\n    this._childIndex = this._activeIndex;\n\n    // Set the parent menu reference for the child.\n    submenu._parentMenu = this;\n\n    // Ensure the menu is updated and lookup the item node.\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    let itemNode = this.contentNode.children[this._activeIndex];\n\n    // Open the submenu at the active node.\n    Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n    // Activate the first item if desired.\n    if (activateFirst) {\n      submenu.activeIndex = -1;\n      submenu.activateNextItem();\n    }\n\n    // Activate the child menu.\n    submenu.activate();\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    if (this._childMenu) {\n      this._childMenu.close();\n    }\n  }\n\n  /**\n   * Start the open timer, unless it is already pending.\n   */\n  private _startOpenTimer(): void {\n    if (this._openTimerID === 0) {\n      this._openTimerID = window.setTimeout(() => {\n        this._openTimerID = 0;\n        this._openChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Start the close timer, unless it is already pending.\n   */\n  private _startCloseTimer(): void {\n    if (this._closeTimerID === 0) {\n      this._closeTimerID = window.setTimeout(() => {\n        this._closeTimerID = 0;\n        this._closeChildMenu();\n      }, Private.TIMER_DELAY);\n    }\n  }\n\n  /**\n   * Cancel the open timer, if the timer is pending.\n   */\n  private _cancelOpenTimer(): void {\n    if (this._openTimerID !== 0) {\n      clearTimeout(this._openTimerID);\n      this._openTimerID = 0;\n    }\n  }\n\n  /**\n   * Cancel the close timer, if the timer is pending.\n   */\n  private _cancelCloseTimer(): void {\n    if (this._closeTimerID !== 0) {\n      clearTimeout(this._closeTimerID);\n      this._closeTimerID = 0;\n    }\n  }\n\n  /**\n   * Save window data used for menu positioning in transient cache.\n   *\n   * In order to avoid layout trashing it is recommended to invoke this\n   * method immediately prior to opening the menu and any DOM modifications\n   * (like closing previously visible menu, or adding a class to menu widget).\n   *\n   * The transient cache will be released upon `open()` call.\n   */\n  static saveWindowData(): void {\n    Private.saveWindowData();\n  }\n\n  private _childIndex = -1;\n  private _activeIndex = -1;\n  private _openTimerID = 0;\n  private _closeTimerID = 0;\n  private _items: Menu.IItem[] = [];\n  private _childMenu: Menu | null = null;\n  private _parentMenu: Menu | null = null;\n  private _aboutToClose = new Signal<this, void>(this);\n  private _menuRequested = new Signal<this, 'next' | 'previous'>(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n  /**\n   * An options object for creating a menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry for use with the menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the menu.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n  }\n\n  /**\n   * An options object for the `open` method on a menu.\n   */\n  export interface IOpenOptions {\n    /**\n     * Whether to force the X position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * X coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceX?: boolean;\n\n    /**\n     * Whether to force the Y position of the menu.\n     *\n     * Setting to `true` will disable the logic which repositions the\n     * Y coordinate of the menu if it will not fit entirely on screen.\n     *\n     * The default is `false`.\n     */\n    forceY?: boolean;\n\n    /**\n     * The DOM node to use as the menu's host.\n     *\n     * If not specified then uses `document.body`.\n     */\n    host?: HTMLElement;\n\n    /**\n     * The child of `host` to use as the reference element.\n     * If this is provided, the menu will be inserted before this\n     * node in the host. The default is `null`, which will cause the\n     * menu to be added as the last child of the host.\n     */\n    ref?: HTMLElement;\n\n    /**\n     * The alignment of the menu.\n     *\n     * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n     */\n    horizontalAlignment?: 'left' | 'right';\n  }\n\n  /**\n   * A type alias for a menu item type.\n   */\n  export type ItemType = 'command' | 'submenu' | 'separator';\n\n  /**\n   * An options object for creating a menu item.\n   */\n  export interface IItemOptions {\n    /**\n     * The type of the menu item.\n     *\n     * The default value is `'command'`.\n     */\n    type?: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     *\n     * The default value is an empty string.\n     */\n    command?: string;\n\n    /**\n     * The arguments for the command.\n     *\n     * The default value is an empty object.\n     */\n    args?: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     *\n     * The default value is `null`.\n     */\n    submenu?: Menu | null;\n  }\n\n  /**\n   * An object which represents a menu item.\n   *\n   * #### Notes\n   * Item objects are created automatically by a menu.\n   */\n  export interface IItem {\n    /**\n     * The type of the menu item.\n     */\n    readonly type: ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    readonly label: string;\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    readonly mnemonic: number;\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    readonly icon: VirtualElement.IRenderer | undefined;\n\n    /**\n     * The icon class for the menu item.\n     */\n    readonly iconClass: string;\n\n    /**\n     * The icon label for the menu item.\n     */\n    readonly iconLabel: string;\n\n    /**\n     * The display caption for the menu item.\n     */\n    readonly caption: string;\n\n    /**\n     * The extra class name for the menu item.\n     */\n    readonly className: string;\n\n    /**\n     * The dataset for the menu item.\n     */\n    readonly dataset: CommandRegistry.Dataset;\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    readonly isEnabled: boolean;\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    readonly isToggled: boolean;\n\n    /**\n     * Whether the menu item is visible.\n     */\n    readonly isVisible: boolean;\n\n    /**\n     * The key binding for the menu item.\n     */\n    readonly keyBinding: CommandRegistry.IKeyBinding | null;\n  }\n\n  /**\n   * An object which holds the data to render a menu item.\n   */\n  export interface IRenderData {\n    /**\n     * The item to be rendered.\n     */\n    readonly item: IItem;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the item should be collapsed.\n     */\n    readonly collapsed: boolean;\n\n    /**\n     * Handler for when element is in focus.\n     */\n    readonly onfocus?: () => void;\n  }\n\n  /**\n   * A renderer for use with a menu.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          tabindex: '0',\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data),\n        this.renderShortcut(data),\n        this.renderSubmenu(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.item.icon is undefined, it will be ignored.\n      return h.div({ className }, data.item.icon!, data.item.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-Menu-itemLabel' }, content);\n    }\n\n    /**\n     * Render the shortcut element for a menu item.\n     *\n     * @param data - The data to use for rendering the shortcut.\n     *\n     * @returns A virtual element representing the item shortcut.\n     */\n    renderShortcut(data: IRenderData): VirtualElement {\n      let content = this.formatShortcut(data);\n      return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n    }\n\n    /**\n     * Render the submenu icon element for a menu item.\n     *\n     * @param data - The data to use for rendering the submenu icon.\n     *\n     * @returns A virtual element representing the submenu icon.\n     */\n    renderSubmenu(data: IRenderData): VirtualElement {\n      return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n    }\n\n    /**\n     * Create the class name for the menu item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      // Setup the initial class name.\n      let name = 'lm-Menu-item';\n\n      // Add the boolean state classes.\n      if (!data.item.isEnabled) {\n        name += ' lm-mod-disabled';\n      }\n      if (data.item.isToggled) {\n        name += ' lm-mod-toggled';\n      }\n      if (!data.item.isVisible) {\n        name += ' lm-mod-hidden';\n      }\n      if (data.active) {\n        name += ' lm-mod-active';\n      }\n      if (data.collapsed) {\n        name += ' lm-mod-collapsed';\n      }\n\n      // Add the extra class.\n      let extra = data.item.className;\n      if (extra) {\n        name += ` ${extra}`;\n      }\n\n      // Return the complete class name.\n      return name;\n    }\n\n    /**\n     * Create the dataset for the menu item.\n     *\n     * @param data - The data to use for creating the dataset.\n     *\n     * @returns The dataset for the menu item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      let result: ElementDataset;\n      let { type, command, dataset } = data.item;\n      if (type === 'command') {\n        result = { ...dataset, type, command };\n      } else {\n        result = { ...dataset, type };\n      }\n      return result;\n    }\n\n    /**\n     * Create the class name for the menu item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-Menu-itemIcon';\n      let extra = data.item.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the aria attributes for menu item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      let aria: { [T in ARIAAttrNames]?: string } = {};\n      switch (data.item.type) {\n        case 'separator':\n          aria.role = 'presentation';\n          break;\n        case 'submenu':\n          aria['aria-haspopup'] = 'true';\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          break;\n        default:\n          if (!data.item.isEnabled) {\n            aria['aria-disabled'] = 'true';\n          }\n          if (data.item.isToggled) {\n            aria.role = 'menuitemcheckbox';\n            aria['aria-checked'] = 'true';\n          } else {\n            aria.role = 'menuitem';\n          }\n      }\n      return aria;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.item;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n\n    /**\n     * Create the render content for the shortcut node.\n     *\n     * @param data - The data to use for the shortcut content.\n     *\n     * @returns The content to add to the shortcut node.\n     */\n    formatShortcut(data: IRenderData): h.Child {\n      let kb = data.item.keyBinding;\n      return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The ms delay for opening and closing a submenu.\n   */\n  export const TIMER_DELAY = 300;\n\n  /**\n   * The horizontal pixel overlap for an open submenu.\n   */\n  export const SUBMENU_OVERLAP = 3;\n\n  function getWindowData(element: HTMLElement): IWindowData {\n\n    return _getWindowData(element);\n  }\n\n  /**\n   * Store window data in transient cache.\n   *\n   * The transient cache will be released upon `getWindowData()` call.\n   * If this function is called multiple times, the cache will be\n   * retained until as many calls to `getWindowData()` were made.\n   *\n   * Note: should be called before any DOM modifications.\n   */\n  export function saveWindowData(): void {\n  }\n\n  /**\n   * Create the DOM node for a menu.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-Menu-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menu');\n    node.tabIndex = 0;\n    return node;\n  }\n\n  /**\n   * Test whether a menu item can be activated.\n   */\n  export function canActivate(item: Menu.IItem): boolean {\n    return item.type !== 'separator' && item.isEnabled && item.isVisible;\n  }\n\n  /**\n   * Create a new menu item for an owner menu.\n   */\n  export function createItem(\n    owner: Menu,\n    options: Menu.IItemOptions\n  ): Menu.IItem {\n    return new MenuItem(owner.commands, options);\n  }\n\n  /**\n   * Hit test a menu hierarchy starting at the given root.\n   */\n  export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n    for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n      if (ElementExt.hitTest(temp.node, x, y)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Compute which extra separator items should be collapsed.\n   */\n  export function computeCollapsed(\n    items: ReadonlyArray<Menu.IItem>\n  ): boolean[] {\n    // Allocate the return array and fill it with `false`.\n    let result = new Array<boolean>(items.length);\n    ArrayExt.fill(result, false);\n\n    // Collapse the leading separators.\n    let k1 = 0;\n    let n = items.length;\n    for (; k1 < n; ++k1) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k1] = true;\n    }\n\n    // Hide the trailing separators.\n    let k2 = n - 1;\n    for (; k2 >= 0; --k2) {\n      let item = items[k2];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        break;\n      }\n      result[k2] = true;\n    }\n\n    // Hide the remaining consecutive separators.\n    let hide = false;\n    while (++k1 < k2) {\n      let item = items[k1];\n      if (!item.isVisible) {\n        continue;\n      }\n      if (item.type !== 'separator') {\n        hide = false;\n      } else if (hide) {\n        result[k1] = true;\n      } else {\n        hide = true;\n      }\n    }\n\n    // Return the resulting flags.\n    return result;\n  }\n\n  function _getWindowData(element: HTMLElement): IWindowData {\n    return {\n      pageXOffset: element.ownerDocument.defaultView?.window.scrollX || 0,\n      pageYOffset: element.ownerDocument.defaultView?.window.scrollY || 0,\n      clientWidth: element.ownerDocument.documentElement.clientWidth,\n      clientHeight: element.ownerDocument.documentElement.clientHeight\n    };\n  }\n\n  /**\n   * Open a menu as a root menu at the target location.\n   */\n  export function openRootMenu(\n    menu: Menu,\n    x: number,\n    y: number,\n    forceX: boolean,\n    forceY: boolean,\n    horizontalAlignment: 'left' | 'right',\n    host: HTMLElement | null,\n    ref: HTMLElement | null\n  ): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData(host || menu.node);\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before attaching and measuring.\n    MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch - (forceY ? y : 0);\n\n    // Fetch common variables.\n    let node = menu.node;\n    let style = node.style;\n    style.top = '0';\n    style.left = '0';\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(menu, host || document.body, ref);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // align the menu to the right of the target if requested or language is RTL\n    if (horizontalAlignment === 'right') {\n      x -= width;\n    }\n\n    // Adjust the X position of the menu to fit on-screen.\n    if (!forceX && x + width > px + cw) {\n      x = px + cw - width;\n    }\n\n    // Adjust the Y position of the menu to fit on-screen.\n    if (!forceY && y + height > py + ch) {\n      if (y > py + ch) {\n        y = py + ch - height;\n      } else {\n        y = y - height;\n      }\n    }\n\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * Open a menu as a submenu using an item node for positioning.\n   */\n  export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n    // Get the current position and size of the main viewport.\n    const windowData = getWindowData(itemNode);\n    let px = windowData.pageXOffset;\n    let py = windowData.pageYOffset;\n    let cw = windowData.clientWidth;\n    let ch = windowData.clientHeight;\n\n    // Ensure the menu is updated before opening.\n    MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n    // Compute the maximum allowed height for the menu.\n    let maxHeight = ch;\n\n    // Fetch common variables.\n    let node = submenu.node;\n    let style = node.style;\n\n    // Clear the menu geometry and prepare it for measuring.\n    style.opacity = '0';\n    style.maxHeight = `${maxHeight}px`;\n\n    // Attach the menu to the document.\n    Widget.attach(submenu, itemNode.ownerDocument.body);\n\n    // Measure the size of the menu.\n    let { width, height } = node.getBoundingClientRect();\n\n    // Compute the box sizing for the menu.\n    let box = ElementExt.boxSizing(submenu.node);\n\n    // Get the bounding rect for the target item node.\n    let itemRect = itemNode.getBoundingClientRect();\n\n    // Compute the target X position.\n    let x = itemRect.right - SUBMENU_OVERLAP;\n\n    // Adjust the X position to fit on the screen.\n    if (x + width > px + cw) {\n      x = itemRect.left + SUBMENU_OVERLAP - width;\n    }\n\n    // Compute the target Y position.\n    let y = itemRect.top - box.borderTop - box.paddingTop;\n\n    // Adjust the Y position to fit on the screen.\n    if (y + height > py + ch) {\n      y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n    }\n\n    style.top = '0';\n    style.left = '0';\n    // Update the position of the menu to the computed position.\n    style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n    // Finally, make the menu visible on the screen.\n    style.opacity = '1';\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    items: ReadonlyArray<Menu.IItem>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Lookup the item\n      let item = items[k];\n\n      // Ignore items which cannot be activated.\n      if (!canActivate(item)) {\n        continue;\n      }\n\n      // Ignore items with an empty label.\n      let label = item.label;\n      if (label.length === 0) {\n        continue;\n      }\n\n      // Lookup the mnemonic index for the label.\n      let mn = item.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < label.length) {\n        if (label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n\n  /**\n   * A concrete implementation of `Menu.IItem`.\n   */\n  class MenuItem implements Menu.IItem {\n    /**\n     * Construct a new menu item.\n     */\n    constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n      this._commands = commands;\n      this.type = options.type || 'command';\n      this.command = options.command || '';\n      this.args = options.args || JSONExt.emptyObject;\n      this.submenu = options.submenu || null;\n    }\n\n    /**\n     * The type of the menu item.\n     */\n    readonly type: Menu.ItemType;\n\n    /**\n     * The command to execute when the item is triggered.\n     */\n    readonly command: string;\n\n    /**\n     * The arguments for the command.\n     */\n    readonly args: ReadonlyJSONObject;\n\n    /**\n     * The submenu for a `'submenu'` type item.\n     */\n    readonly submenu: Menu | null;\n\n    /**\n     * The display label for the menu item.\n     */\n    get label(): string {\n      if (this.type === 'command') {\n        return this._commands.label(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.label;\n      }\n      return '';\n    }\n\n    /**\n     * The mnemonic index for the menu item.\n     */\n    get mnemonic(): number {\n      if (this.type === 'command') {\n        return this._commands.mnemonic(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.mnemonic;\n      }\n      return -1;\n    }\n\n    /**\n     * The icon renderer for the menu item.\n     */\n    get icon(): VirtualElement.IRenderer | undefined {\n      if (this.type === 'command') {\n        return this._commands.icon(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.icon;\n      }\n      return undefined;\n    }\n\n    /**\n     * The icon class for the menu item.\n     */\n    get iconClass(): string {\n      if (this.type === 'command') {\n        return this._commands.iconClass(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconClass;\n      }\n      return '';\n    }\n\n    /**\n     * The icon label for the menu item.\n     */\n    get iconLabel(): string {\n      if (this.type === 'command') {\n        return this._commands.iconLabel(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.iconLabel;\n      }\n      return '';\n    }\n\n    /**\n     * The display caption for the menu item.\n     */\n    get caption(): string {\n      if (this.type === 'command') {\n        return this._commands.caption(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.caption;\n      }\n      return '';\n    }\n\n    /**\n     * The extra class name for the menu item.\n     */\n    get className(): string {\n      if (this.type === 'command') {\n        return this._commands.className(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.className;\n      }\n      return '';\n    }\n\n    /**\n     * The dataset for the menu item.\n     */\n    get dataset(): CommandRegistry.Dataset {\n      if (this.type === 'command') {\n        return this._commands.dataset(this.command, this.args);\n      }\n      if (this.type === 'submenu' && this.submenu) {\n        return this.submenu.title.dataset;\n      }\n      return {};\n    }\n\n    /**\n     * Whether the menu item is enabled.\n     */\n    get isEnabled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isEnabled(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * Whether the menu item is toggled.\n     */\n    get isToggled(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isToggled(this.command, this.args);\n      }\n      return false;\n    }\n\n    /**\n     * Whether the menu item is visible.\n     */\n    get isVisible(): boolean {\n      if (this.type === 'command') {\n        return this._commands.isVisible(this.command, this.args);\n      }\n      if (this.type === 'submenu') {\n        return this.submenu !== null;\n      }\n      return true;\n    }\n\n    /**\n     * The key binding for the menu item.\n     */\n    get keyBinding(): CommandRegistry.IKeyBinding | null {\n      if (this.type === 'command') {\n        let { command, args } = this;\n        return (\n          ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n            return kb.command === command && JSONExt.deepEqual(kb.args, args);\n          }) || null\n        );\n      }\n      return null;\n    }\n\n    private _commands: CommandRegistry;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n  /**\n   * Construct a new context menu.\n   *\n   * @param options - The options for initializing the menu.\n   */\n  constructor(options: ContextMenu.IOptions) {\n    const { groupByTarget, sortBySelector, ...others } = options;\n    this.menu = new Menu(others);\n    this._groupByTarget = groupByTarget !== false;\n    this._sortBySelector = sortBySelector !== false;\n  }\n\n  /**\n   * The menu widget which displays the matched context items.\n   */\n  readonly menu: Menu;\n\n  /**\n   * Add an item to the context menu.\n   *\n   * @param options - The options for creating the item.\n   *\n   * @returns A disposable which will remove the item from the menu.\n   */\n  addItem(options: ContextMenu.IItemOptions): IDisposable {\n    // Create an item from the given options.\n    let item = Private.createItem(options, this._idTick++);\n\n    // Add the item to the internal array.\n    this._items.push(item);\n\n    // Return a disposable which will remove the item.\n    return new DisposableDelegate(() => {\n      ArrayExt.removeFirstOf(this._items, item);\n    });\n  }\n\n  /**\n   * Open the context menu in response to a `'contextmenu'` event.\n   *\n   * @param event - The `'contextmenu'` event of interest.\n   *\n   * @returns `true` if the menu was opened, or `false` if no items\n   *   matched the event and the menu was not opened.\n   *\n   * #### Notes\n   * This method will populate the context menu with items which match\n   * the propagation path of the event, then open the menu at the mouse\n   * position indicated by the event.\n   */\n  open(event: MouseEvent): boolean {\n    // Prior to any DOM modifications update the window data.\n    Menu.saveWindowData();\n\n    // Clear the current contents of the context menu.\n    this.menu.clearItems();\n\n    // Bail early if there are no items to match.\n    if (this._items.length === 0) {\n      return false;\n    }\n\n    // Find the matching items for the event.\n    let items = Private.matchItems(\n      this._items,\n      event,\n      this._groupByTarget,\n      this._sortBySelector\n    );\n\n    // Bail if there are no matching items.\n    if (!items || items.length === 0) {\n      return false;\n    }\n\n    // Add the filtered items to the menu.\n    for (const item of items) {\n      this.menu.addItem(item);\n    }\n\n    // Open the context menu at the current mouse position.\n    this.menu.open(event.clientX, event.clientY);\n\n    // Indicate success.\n    return true;\n  }\n\n  private _groupByTarget: boolean = true;\n  private _idTick = 0;\n  private _items: Private.IItem[] = [];\n  private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n  /**\n   * An options object for initializing a context menu.\n   */\n  export interface IOptions {\n    /**\n     * The command registry to use with the context menu.\n     */\n    commands: CommandRegistry;\n\n    /**\n     * A custom renderer for use with the context menu.\n     */\n    renderer?: Menu.IRenderer;\n\n    /**\n     * Whether to sort by selector and rank or only rank.\n     *\n     * Default true.\n     */\n    sortBySelector?: boolean;\n\n    /**\n     * Whether to group items following the DOM hierarchy.\n     *\n     * Default true.\n     *\n     * #### Note\n     * If true, when the mouse event occurs on element `span` within `div.top`,\n     * the items matching `div.top` will be shown before the ones matching `body`.\n     */\n    groupByTarget?: boolean;\n  }\n\n  /**\n   * An options object for creating a context menu item.\n   */\n  export interface IItemOptions extends Menu.IItemOptions {\n    /**\n     * The CSS selector for the context menu item.\n     *\n     * The context menu item will only be displayed in the context menu\n     * when the selector matches a node on the propagation path of the\n     * contextmenu event. This allows the menu item to be restricted to\n     * user-defined contexts.\n     *\n     * The selector must not contain commas.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     *\n     * The rank is used as a tie-breaker when ordering context menu\n     * items for display. Items are sorted in the following order:\n     *   1. Depth in the DOM tree (deeper is better)\n     *   2. Selector specificity (higher is better)\n     *   3. Rank (lower is better)\n     *   4. Insertion order\n     *\n     * The default rank is `Infinity`.\n     */\n    rank?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A normalized item for a context menu.\n   */\n  export interface IItem extends Menu.IItemOptions {\n    /**\n     * The selector for the item.\n     */\n    selector: string;\n\n    /**\n     * The rank for the item.\n     */\n    rank: number;\n\n    /**\n     * The tie-breaking id for the item.\n     */\n    id: number;\n  }\n\n  /**\n   * Create a normalized context menu item from an options object.\n   */\n  export function createItem(\n    options: ContextMenu.IItemOptions,\n    id: number\n  ): IItem {\n    let selector = validateSelector(options.selector);\n    let rank = options.rank !== undefined ? options.rank : Infinity;\n    return { ...options, selector, rank, id };\n  }\n\n  /**\n   * Find the items which match a context menu event.\n   *\n   * The results are sorted by DOM level, specificity, and rank.\n   */\n  export function matchItems(\n    items: IItem[],\n    event: MouseEvent,\n    groupByTarget: boolean,\n    sortBySelector: boolean\n  ): IItem[] | null {\n    // Look up the target of the event.\n    let target = event.target as Element | null;\n\n    // Bail if there is no target.\n    if (!target) {\n      return null;\n    }\n\n    // Look up the current target of the event.\n    let currentTarget = event.currentTarget as Element | null;\n\n    // Bail if there is no current target.\n    if (!currentTarget) {\n      return null;\n    }\n\n    // There are some third party libraries that cause the `target` to\n    // be detached from the DOM before lumino can process the event.\n    // If that happens, search for a new target node by point. If that\n    // node is still dangling, bail.\n    if (!currentTarget.contains(target)) {\n      target = document.elementFromPoint(event.clientX, event.clientY);\n      if (!target || !currentTarget.contains(target)) {\n        return null;\n      }\n    }\n\n    // Set up the result array.\n    let result: IItem[] = [];\n\n    // Copy the items array to allow in-place modification.\n    let availableItems: Array<IItem | null> = items.slice();\n\n    // Walk up the DOM hierarchy searching for matches.\n    while (target !== null) {\n      // Set up the match array for this DOM level.\n      let matches: IItem[] = [];\n\n      // Search the remaining items for matches.\n      for (let i = 0, n = availableItems.length; i < n; ++i) {\n        // Fetch the item.\n        let item = availableItems[i];\n\n        // Skip items which are already consumed.\n        if (!item) {\n          continue;\n        }\n\n        // Skip items which do not match the element.\n        if (!Selector.matches(target, item.selector)) {\n          continue;\n        }\n\n        // Add the matched item to the result for this DOM level.\n        matches.push(item);\n\n        // Mark the item as consumed.\n        availableItems[i] = null;\n      }\n\n      // Sort the matches for this level and add them to the results.\n      if (matches.length !== 0) {\n        if (groupByTarget) {\n          matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n        }\n        result.push(...matches);\n      }\n\n      // Stop searching at the limits of the DOM range.\n      if (target === currentTarget) {\n        break;\n      }\n\n      // Step to the parent DOM level.\n      target = target.parentElement;\n    }\n\n    if (!groupByTarget) {\n      result.sort(sortBySelector ? itemCmp : itemCmpRank);\n    }\n\n    // Return the matched and sorted results.\n    return result;\n  }\n\n  /**\n   * Validate the selector for a menu item.\n   *\n   * This returns the validated selector, or throws if the selector is\n   * invalid or contains commas.\n   */\n  function validateSelector(selector: string): string {\n    if (selector.indexOf(',') !== -1) {\n      throw new Error(`Selector cannot contain commas: ${selector}`);\n    }\n    if (!Selector.isValid(selector)) {\n      throw new Error(`Invalid selector: ${selector}`);\n    }\n    return selector;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by ranks.\n   */\n  function itemCmpRank(a: IItem, b: IItem): number {\n    // Sort based on rank.\n    let r1 = a.rank;\n    let r2 = b.rank;\n    if (r1 !== r2) {\n      return r1 < r2 ? -1 : 1; // Infinity-safe\n    }\n\n    // When all else fails, sort by item id.\n    return a.id - b.id;\n  }\n\n  /**\n   * A sort comparison function for a context menu item by selectors and ranks.\n   */\n  function itemCmp(a: IItem, b: IItem): number {\n    // Sort first based on selector specificity.\n    let s1 = Selector.calculateSpecificity(a.selector);\n    let s2 = Selector.calculateSpecificity(b.selector);\n    if (s1 !== s2) {\n      return s2 - s1;\n    }\n\n    // If specificities are equal\n    return itemCmpRank(a, b);\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n  ElementARIAAttrs,\n  ElementBaseAttrs,\n  ElementDataset,\n  ElementInlineStyle,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n  'ArrowLeft',\n  'ArrowUp',\n  'ArrowRight',\n  'ArrowDown',\n  'Home',\n  'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar<T> extends Widget {\n  /**\n   * Construct a new tab bar.\n   *\n   * @param options - The options for initializing the tab bar.\n   */\n  constructor(options: TabBar.IOptions<T> = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-TabBar');\n    this.contentNode.setAttribute('role', 'tablist');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this._document = options.document || document;\n    this.tabsMovable = options.tabsMovable || false;\n    this.titlesEditable = options.titlesEditable || false;\n    this.allowDeselect = options.allowDeselect || false;\n    this.addButtonEnabled = options.addButtonEnabled || false;\n    this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n    this.name = options.name || '';\n    this.orientation = options.orientation || 'horizontal';\n    this.removeBehavior = options.removeBehavior || 'select-tab-after';\n    this.renderer = options.renderer || TabBar.defaultRenderer;\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._releaseMouse();\n    this._titles.length = 0;\n    this._previousTitle = null;\n    super.dispose();\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabBar.ICurrentChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when a tab is moved by the user.\n   *\n   * #### Notes\n   * This signal is emitted when a tab is moved by user interaction.\n   *\n   * This signal is not emitted when a tab is moved programmatically.\n   */\n  get tabMoved(): ISignal<this, TabBar.ITabMovedArgs<T>> {\n    return this._tabMoved;\n  }\n\n  /**\n   * A signal emitted when a tab is clicked by the user.\n   *\n   * #### Notes\n   * If the clicked tab is not the current tab, the clicked tab will be\n   * made current and the `currentChanged` signal will be emitted first.\n   *\n   * This signal is emitted even if the clicked tab is the current tab.\n   */\n  get tabActivateRequested(): ISignal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  > {\n    return this._tabActivateRequested;\n  }\n\n  /**\n   * A signal emitted when the tab bar add button is clicked.\n   */\n  get addRequested(): ISignal<this, void> {\n    return this._addRequested;\n  }\n\n  /**\n   * A signal emitted when a tab close icon is clicked.\n   *\n   * #### Notes\n   * This signal is not emitted unless the tab title is `closable`.\n   */\n  get tabCloseRequested(): ISignal<this, TabBar.ITabCloseRequestedArgs<T>> {\n    return this._tabCloseRequested;\n  }\n\n  /**\n   * A signal emitted when a tab is dragged beyond the detach threshold.\n   *\n   * #### Notes\n   * This signal is emitted when the user drags a tab with the mouse,\n   * and mouse is dragged beyond the detach threshold.\n   *\n   * The consumer of the signal should call `releaseMouse` and remove\n   * the tab in order to complete the detach.\n   *\n   * This signal is only emitted once per drag cycle.\n   */\n  get tabDetachRequested(): ISignal<this, TabBar.ITabDetachRequestedArgs<T>> {\n    return this._tabDetachRequested;\n  }\n\n  /**\n   * The renderer used by the tab bar.\n   */\n  readonly renderer: TabBar.IRenderer<T>;\n\n  /**\n   * The document to use with the tab bar.\n   *\n   * The default is the global `document` instance.\n   */\n  get document(): Document | ShadowRoot {\n    return this._document;\n  }\n\n  /**\n   * Whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  tabsMovable: boolean;\n\n  /**\n   * Whether the titles can be user-edited.\n   *\n   */\n  get titlesEditable(): boolean {\n    return this._titlesEditable;\n  }\n\n  /**\n   * Set whether titles can be user edited.\n   *\n   */\n  set titlesEditable(value: boolean) {\n    this._titlesEditable = value;\n  }\n\n  /**\n   * Whether a tab can be deselected by the user.\n   *\n   * #### Notes\n   * Tabs can be always be deselected programmatically.\n   */\n  allowDeselect: boolean;\n\n  /**\n   * The selection behavior when inserting a tab.\n   */\n  insertBehavior: TabBar.InsertBehavior;\n\n  /**\n   * The selection behavior when removing a tab.\n   */\n  removeBehavior: TabBar.RemoveBehavior;\n\n  /**\n   * Get the currently selected title.\n   *\n   * #### Notes\n   * This will be `null` if no tab is selected.\n   */\n  get currentTitle(): Title<T> | null {\n    return this._titles[this._currentIndex] || null;\n  }\n\n  /**\n   * Set the currently selected title.\n   *\n   * #### Notes\n   * If the title does not exist, the title will be set to `null`.\n   */\n  set currentTitle(value: Title<T> | null) {\n    this.currentIndex = value ? this._titles.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this._currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the value is out of range, the index will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    // Adjust for an out of range index.\n    if (value < 0 || value >= this._titles.length) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._currentIndex === value) {\n      return;\n    }\n\n    // Look up the previous index and title.\n    let pi = this._currentIndex;\n    let pt = this._titles[pi] || null;\n\n    // Look up the current index and title.\n    let ci = value;\n    let ct = this._titles[ci] || null;\n\n    // Update the current index and previous title.\n    this._currentIndex = ci;\n    this._previousTitle = pt;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: ci,\n      currentTitle: ct\n    });\n  }\n\n  /**\n   * Get the name of the tab bar.\n   */\n  get name(): string {\n    return this._name;\n  }\n\n  /**\n   * Set the name of the tab bar.\n   */\n  set name(value: string) {\n    this._name = value;\n    if (value) {\n      this.contentNode.setAttribute('aria-label', value);\n    } else {\n      this.contentNode.removeAttribute('aria-label');\n    }\n  }\n\n  /**\n   * Get the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  get orientation(): TabBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the tab bar.\n   *\n   * #### Notes\n   * This controls whether the tabs are arranged in a row or column.\n   */\n  set orientation(value: TabBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Toggle the orientation values.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n    this.contentNode.setAttribute('aria-orientation', value);\n  }\n\n  /**\n   * Whether the add button is enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add button is enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    // Do nothing if the value does not change.\n    if (this._addButtonEnabled === value) {\n      return;\n    }\n\n    this._addButtonEnabled = value;\n    if (value) {\n      this.addButtonNode.classList.remove('lm-mod-hidden');\n    } else {\n      this.addButtonNode.classList.add('lm-mod-hidden');\n    }\n  }\n\n  /**\n   * A read-only array of the titles in the tab bar.\n   */\n  get titles(): ReadonlyArray<Title<T>> {\n    return this._titles;\n  }\n\n  /**\n   * The tab bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the tab nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * The tab bar add button node.\n   *\n   * #### Notes\n   * This is the node which holds the add button.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get addButtonNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-TabBar-addButton'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Add a tab to the end of the tab bar.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  addTab(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return this.insertTab(this._titles.length, value);\n  }\n\n  /**\n   * Insert a tab into the tab bar at the specified index.\n   *\n   * @param index - The index at which to insert the tab.\n   *\n   * @param value - The title which holds the data for the tab,\n   *   or an options object to convert to a title.\n   *\n   * @returns The title object added to the tab bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the tabs.\n   *\n   * If the title is already added to the tab bar, it will be moved.\n   */\n  insertTab(index: number, value: Title<T> | Title.IOptions<T>): Title<T> {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Coerce the value to a title.\n    let title = Private.asTitle(value);\n\n    // Look up the index of the title.\n    let i = this._titles.indexOf(title);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._titles.length));\n\n    // If the title is not in the array, insert it.\n    if (i === -1) {\n      // Insert the title into the array.\n      ArrayExt.insert(this._titles, j, title);\n\n      // Connect to the title changed signal.\n      title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the tabs.\n      this.update();\n\n      // Adjust the current index for the insert.\n      this._adjustCurrentForInsert(j, title);\n\n      // Return the title added to the tab bar.\n      return title;\n    }\n\n    // Otherwise, the title exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._titles.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return title;\n    }\n\n    // Move the title to the new location.\n    ArrayExt.move(this._titles, i, j);\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the move.\n    this._adjustCurrentForMove(i, j);\n\n    // Return the title added to the tab bar.\n    return title;\n  }\n\n  /**\n   * Remove a tab from the tab bar.\n   *\n   * @param title - The title for the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the title is not in the tab bar.\n   */\n  removeTab(title: Title<T>): void {\n    this.removeTabAt(this._titles.indexOf(title));\n  }\n\n  /**\n   * Remove the tab at a given index from the tab bar.\n   *\n   * @param index - The index of the tab to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeTabAt(index: number): void {\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Remove the title from the array.\n    let title = ArrayExt.removeAt(this._titles, index);\n\n    // Bail if the index is out of range.\n    if (!title) {\n      return;\n    }\n\n    // Disconnect from the title changed signal.\n    title.changed.disconnect(this._onTitleChanged, this);\n\n    // Clear the previous title if it's being removed.\n    if (title === this._previousTitle) {\n      this._previousTitle = null;\n    }\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // Adjust the current index for the remove.\n    this._adjustCurrentForRemove(index, title);\n  }\n\n  /**\n   * Remove all tabs from the tab bar.\n   */\n  clearTabs(): void {\n    // Bail if there is nothing to remove.\n    if (this._titles.length === 0) {\n      return;\n    }\n\n    // Release the mouse before making any changes.\n    this._releaseMouse();\n\n    // Disconnect from the title changed signals.\n    for (let title of this._titles) {\n      title.changed.disconnect(this._onTitleChanged, this);\n    }\n\n    // Get the current index and title.\n    let pi = this.currentIndex;\n    let pt = this.currentTitle;\n\n    // Reset the current index and previous title.\n    this._currentIndex = -1;\n    this._previousTitle = null;\n\n    // Clear the title array.\n    this._titles.length = 0;\n\n    // Schedule an update of the tabs.\n    this.update();\n\n    // If no tab was selected, there's nothing else to do.\n    if (pi === -1) {\n      return;\n    }\n\n    // Emit the current changed signal.\n    this._currentChanged.emit({\n      previousIndex: pi,\n      previousTitle: pt,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   *\n   * #### Notes\n   * This will cause the tab bar to stop handling mouse events and to\n   * restore the tabs to their non-dragged positions.\n   */\n  releaseMouse(): void {\n    this._releaseMouse();\n  }\n\n  /**\n   * Handle the DOM events for the tab bar.\n   *\n   * @param event - The DOM event sent to the tab bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tab bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'dblclick':\n        this._evtDblClick(event as MouseEvent);\n        break;\n      case 'keydown':\n        event.eventPhase === Event.CAPTURING_PHASE\n          ? this._evtKeyDownCapturing(event as KeyboardEvent)\n          : this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('pointerdown', this);\n    this.node.addEventListener('dblclick', this);\n    this.node.addEventListener('keydown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('pointerdown', this);\n    this.node.removeEventListener('dblclick', this);\n    this.node.removeEventListener('keydown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let titles = this._titles;\n    let renderer = this.renderer;\n    let currentTitle = this.currentTitle;\n    let content = new Array<VirtualElement>(titles.length);\n    // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n    // If the add button handles it, no need to do anything. If no element of the tab\n    // bar handles it, set it on the current or the first tab to ensure one element\n    // handles it after update.\n    const tabHandlingTabindex =\n      this._getCurrentTabindex() ??\n      (this._currentIndex > -1 ? this._currentIndex : 0);\n\n    for (let i = 0, n = titles.length; i < n; ++i) {\n      let title = titles[i];\n      let current = title === currentTitle;\n      let zIndex = current ? n : n - i - 1;\n      let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n      content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n    }\n    VirtualDOM.render(content, this.contentNode);\n  }\n\n  /**\n   * Get the index of the tab which handles tabindex=\"0\".\n   * If the add button handles tabindex=\"0\", -1 is returned.\n   * If none of the previous handles tabindex=\"0\", null is returned.\n   */\n  private _getCurrentTabindex(): number | null {\n    let index = null;\n    const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n    if (elemTabindex) {\n      index = [...this.contentNode.children].indexOf(elemTabindex);\n    } else if (\n      this._addButtonEnabled &&\n      this.addButtonNode.getAttribute('tabindex') === '0'\n    ) {\n      index = -1;\n    }\n    return index;\n  }\n\n  /**\n   * Handle the `'dblclick'` event for the tab bar.\n   */\n  private _evtDblClick(event: MouseEvent): void {\n    // Do nothing if titles are not editable\n    if (!this.titlesEditable) {\n      return;\n    }\n\n    let tabs = this.contentNode.children;\n\n    // Find the index of the targeted tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab.\n    if (index === -1) {\n      return;\n    }\n\n    let title = this.titles[index];\n    let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n    if (label && label.contains(event.target as HTMLElement)) {\n      let value = title.label || '';\n\n      // Clear the label element\n      let oldValue = label.innerHTML;\n      label.innerHTML = '';\n\n      let input = document.createElement('input');\n      input.classList.add('lm-TabBar-tabInput');\n      input.value = value;\n      label.appendChild(input);\n\n      let onblur = () => {\n        input.removeEventListener('blur', onblur);\n        label.innerHTML = oldValue;\n        this.node.addEventListener('keydown', this);\n      };\n\n      input.addEventListener('dblclick', (event: Event) =>\n        event.stopPropagation()\n      );\n      input.addEventListener('blur', onblur);\n      input.addEventListener('keydown', (event: KeyboardEvent) => {\n        if (event.key === 'Enter') {\n          if (input.value !== '') {\n            title.label = title.caption = input.value;\n          }\n          onblur();\n        } else if (event.key === 'Escape') {\n          onblur();\n        }\n      });\n      this.node.removeEventListener('keydown', this);\n      input.select();\n      input.focus();\n\n      if (label.children.length > 0) {\n        (label.children[0] as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at capturing phase.\n   */\n  private _evtKeyDownCapturing(event: KeyboardEvent): void {\n    if (event.eventPhase !== Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.key === 'Escape') {\n      this._releaseMouse();\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the tab bar at target phase.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Allow for navigation using tab key\n    if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n      return;\n    }\n\n    // Check if Enter or Spacebar key has been pressed and open that tab\n    if (\n      event.key === 'Enter' ||\n      event.key === 'Spacebar' ||\n      event.key === ' '\n    ) {\n      // Get focus element that is in focus by the tab key\n      const focusedElement = document.activeElement;\n\n      // Test first if the focus is on the add button node\n      if (\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(focusedElement)\n      ) {\n        event.preventDefault();\n        event.stopPropagation();\n        this._addRequested.emit();\n      } else {\n        const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n          tab.contains(focusedElement)\n        );\n        if (index >= 0) {\n          event.preventDefault();\n          event.stopPropagation();\n          this.currentIndex = index;\n        }\n      }\n      // Handle the arrow keys to switch tabs.\n    } else if (ARROW_KEYS.includes(event.key)) {\n      // Create a list of all focusable elements in the tab bar.\n      const focusable: Element[] = [...this.contentNode.children];\n      if (this.addButtonEnabled) {\n        focusable.push(this.addButtonNode);\n      }\n      // If the tab bar contains only one element, nothing to do.\n      if (focusable.length <= 1) {\n        return;\n      }\n      event.preventDefault();\n      event.stopPropagation();\n\n      // Get the current focused element.\n      let focusedIndex = focusable.indexOf(document.activeElement as Element);\n      if (focusedIndex === -1) {\n        focusedIndex = this._currentIndex;\n      }\n\n      // Find the next element to focus on.\n      let nextFocused: Element | null | undefined;\n      if (\n        (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowDown' && this._orientation === 'vertical')\n      ) {\n        nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n      } else if (\n        (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n        (event.key === 'ArrowUp' && this._orientation === 'vertical')\n      ) {\n        nextFocused =\n          focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n      } else if (event.key === 'Home') {\n        nextFocused = focusable[0];\n      } else if (event.key === 'End') {\n        nextFocused = focusable[focusable.length - 1];\n      }\n\n      // Change the focused element and the tabindex value.\n      if (nextFocused) {\n        focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n        nextFocused?.setAttribute('tabindex', '0');\n        (nextFocused as HTMLElement).focus();\n      }\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the tab bar.\n   */\n  private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse press.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if a drag is in progress.\n    if (this._dragData) {\n      return;\n    }\n\n    // Do nothing if a title editable input was clicked.\n    if (\n      (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n    ) {\n      return;\n    }\n\n    // Check if the add button was clicked.\n    let addButtonClicked =\n      this.addButtonEnabled &&\n      this.addButtonNode.contains(event.target as HTMLElement);\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Find the index of the pressed tab.\n    let index = ArrayExt.findFirstIndex(tabs, tab => {\n      return ElementExt.hitTest(tab, event.clientX, event.clientY);\n    });\n\n    // Do nothing if the press is not on a tab or the add button.\n    if (index === -1 && !addButtonClicked) {\n      return;\n    }\n\n    // Pressing on a tab stops the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Initialize the non-measured parts of the drag data.\n    this._dragData = {\n      tab: tabs[index] as HTMLElement,\n      index: index,\n      pressX: event.clientX,\n      pressY: event.clientY,\n      tabPos: -1,\n      tabSize: -1,\n      tabPressPos: -1,\n      targetIndex: -1,\n      tabLayout: null,\n      contentRect: null,\n      override: null,\n      dragActive: false,\n      dragAborted: false,\n      detachRequested: false\n    };\n\n    // Add the document pointer up listener.\n    this.document.addEventListener('pointerup', this, true);\n\n    // Do nothing else if the middle button or add button is clicked.\n    if (event.button === 1 || addButtonClicked) {\n      return;\n    }\n\n    // Do nothing else if the close icon is clicked.\n    let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n    if (icon && icon.contains(event.target as HTMLElement)) {\n      return;\n    }\n\n    // Add the extra listeners if the tabs are movable.\n    if (this.tabsMovable) {\n      this.document.addEventListener('pointermove', this, true);\n      this.document.addEventListener('keydown', this, true);\n      this.document.addEventListener('contextmenu', this, true);\n    }\n\n    // Update the current index as appropriate.\n    if (this.allowDeselect && this.currentIndex === index) {\n      this.currentIndex = -1;\n    } else {\n      this.currentIndex = index;\n    }\n\n    // Do nothing else if there is no current tab.\n    if (this.currentIndex === -1) {\n      return;\n    }\n\n    // Emit the tab activate request signal.\n    this._tabActivateRequested.emit({\n      index: this.currentIndex,\n      title: this.currentTitle!\n    });\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the tab bar.\n   */\n  private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Suppress the event during a drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Lookup the tab nodes.\n    let tabs = this.contentNode.children;\n\n    // Bail early if the drag threshold has not been met.\n    if (!data.dragActive && !Private.dragExceeded(data, event)) {\n      return;\n    }\n\n    // Activate the drag if necessary.\n    if (!data.dragActive) {\n      // Fill in the rest of the drag data measurements.\n      let tabRect = data.tab.getBoundingClientRect();\n      if (this._orientation === 'horizontal') {\n        data.tabPos = data.tab.offsetLeft;\n        data.tabSize = tabRect.width;\n        data.tabPressPos = data.pressX - tabRect.left;\n      } else {\n        data.tabPos = data.tab.offsetTop;\n        data.tabSize = tabRect.height;\n        data.tabPressPos = data.pressY - tabRect.top;\n      }\n      data.tabPressOffset = {\n        x: data.pressX - tabRect.left,\n        y: data.pressY - tabRect.top\n      };\n      data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n      data.contentRect = this.contentNode.getBoundingClientRect();\n      data.override = Drag.overrideCursor('default');\n\n      // Add the dragging style classes.\n      data.tab.classList.add('lm-mod-dragging');\n      this.addClass('lm-mod-dragging');\n\n      // Mark the drag as active.\n      data.dragActive = true;\n    }\n\n    // Emit the detach requested signal if the threshold is exceeded.\n    if (!data.detachRequested && Private.detachExceeded(data, event)) {\n      // Only emit the signal once per drag cycle.\n      data.detachRequested = true;\n\n      // Setup the arguments for the signal.\n      let index = data.index;\n      let clientX = event.clientX;\n      let clientY = event.clientY;\n      let tab = tabs[index] as HTMLElement;\n      let title = this._titles[index];\n\n      // Emit the tab detach requested signal.\n      this._tabDetachRequested.emit({\n        index,\n        title,\n        tab,\n        clientX,\n        clientY,\n        offset: data.tabPressOffset\n      });\n\n      // Bail if the signal handler aborted the drag.\n      if (data.dragAborted) {\n        return;\n      }\n    }\n\n    // Update the positions of the tabs.\n    Private.layoutTabs(tabs, data, event, this._orientation);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the document.\n   */\n  private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n    // Do nothing if it's not a left or middle mouse release.\n    if (event.button !== 0 && event.button !== 1) {\n      return;\n    }\n\n    // Do nothing if no drag is in progress.\n    const data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Remove the extra mouse event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Handle a release when the drag is not active.\n    if (!data.dragActive) {\n      // Clear the drag data.\n      this._dragData = null;\n\n      // Handle clicking the add button.\n      let addButtonClicked =\n        this.addButtonEnabled &&\n        this.addButtonNode.contains(event.target as HTMLElement);\n      if (addButtonClicked) {\n        this._addRequested.emit(undefined);\n        return;\n      }\n\n      // Lookup the tab nodes.\n      let tabs = this.contentNode.children;\n\n      // Find the index of the released tab.\n      let index = ArrayExt.findFirstIndex(tabs, tab => {\n        return ElementExt.hitTest(tab, event.clientX, event.clientY);\n      });\n\n      // Do nothing if the release is not on the original pressed tab.\n      if (index !== data.index) {\n        return;\n      }\n\n      // Ignore the release if the title is not closable.\n      let title = this._titles[index];\n      if (!title.closable) {\n        return;\n      }\n\n      // Emit the close requested signal if the middle button is released.\n      if (event.button === 1) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Emit the close requested signal if the close icon was released.\n      let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n      if (icon && icon.contains(event.target as HTMLElement)) {\n        this._tabCloseRequested.emit({ index, title });\n        return;\n      }\n\n      // Otherwise, there is nothing left to do.\n      return;\n    }\n\n    // Do nothing if the left button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Position the tab at its final resting position.\n    Private.finalizeTabPosition(data, this._orientation);\n\n    // Remove the dragging class from the tab so it can be transitioned.\n    data.tab.classList.remove('lm-mod-dragging');\n\n    // Parse the transition duration for releasing the tab.\n    let duration = Private.parseTransitionDuration(data.tab);\n\n    // Complete the release on a timer to allow the tab to transition.\n    setTimeout(() => {\n      // Do nothing if the drag has been aborted.\n      if (data.dragAborted) {\n        return;\n      }\n\n      // Clear the drag data reference.\n      this._dragData = null;\n\n      // Reset the positions of the tabs.\n      Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n      // Clear the cursor grab.\n      data.override!.dispose();\n\n      // Remove the remaining dragging style.\n      this.removeClass('lm-mod-dragging');\n\n      // If the tab was not moved, there is nothing else to do.\n      let i = data.index;\n      let j = data.targetIndex;\n      if (j === -1 || i === j) {\n        return;\n      }\n\n      // Move the title to the new locations.\n      ArrayExt.move(this._titles, i, j);\n\n      // Adjust the current index for the move.\n      this._adjustCurrentForMove(i, j);\n\n      // Emit the tab moved signal.\n      this._tabMoved.emit({\n        fromIndex: i,\n        toIndex: j,\n        title: this._titles[j]\n      });\n\n      // Update the tabs immediately to prevent flicker.\n      MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n    }, duration);\n  }\n\n  /**\n   * Release the mouse and restore the non-dragged tab positions.\n   */\n  private _releaseMouse(): void {\n    // Do nothing if no drag is in progress.\n    let data = this._dragData;\n    if (!data) {\n      return;\n    }\n\n    // Clear the drag data reference.\n    this._dragData = null;\n\n    // Remove the extra document event listeners.\n    this.document.removeEventListener('pointermove', this, true);\n    this.document.removeEventListener('pointerup', this, true);\n    this.document.removeEventListener('keydown', this, true);\n    this.document.removeEventListener('contextmenu', this, true);\n\n    // Indicate the drag has been aborted. This allows the mouse\n    // event handlers to return early when the drag is canceled.\n    data.dragAborted = true;\n\n    // If the drag is not active, there's nothing more to do.\n    if (!data.dragActive) {\n      return;\n    }\n\n    // Reset the tabs to their non-dragged positions.\n    Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n    // Clear the cursor override.\n    data.override!.dispose();\n\n    // Clear the dragging style classes.\n    data.tab.classList.remove('lm-mod-dragging');\n    this.removeClass('lm-mod-dragging');\n  }\n\n  /**\n   * Adjust the current index for a tab insert operation.\n   *\n   * This method accounts for the tab bar's insertion behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForInsert(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ct = this.currentTitle;\n    let ci = this._currentIndex;\n    let bh = this.insertBehavior;\n\n    // TODO: do we need to do an update to update the aria-selected attribute?\n\n    // Handle the behavior where the new tab is always selected,\n    // or the behavior where the new tab is selected if needed.\n    if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n      this._currentIndex = i;\n      this._previousTitle = ct;\n      this._currentChanged.emit({\n        previousIndex: ci,\n        previousTitle: ct,\n        currentIndex: i,\n        currentTitle: title\n      });\n      return;\n    }\n\n    // Otherwise, silently adjust the current index if needed.\n    if (ci >= i) {\n      this._currentIndex++;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab move operation.\n   *\n   * This method will not cause the actual current tab to change.\n   * It silently adjusts the index to account for the given move.\n   */\n  private _adjustCurrentForMove(i: number, j: number): void {\n    if (this._currentIndex === i) {\n      this._currentIndex = j;\n    } else if (this._currentIndex < i && this._currentIndex >= j) {\n      this._currentIndex++;\n    } else if (this._currentIndex > i && this._currentIndex <= j) {\n      this._currentIndex--;\n    }\n  }\n\n  /**\n   * Adjust the current index for a tab remove operation.\n   *\n   * This method accounts for the tab bar's remove behavior when\n   * adjusting the current index and emitting the changed signal.\n   */\n  private _adjustCurrentForRemove(i: number, title: Title<T>): void {\n    // Lookup commonly used variables.\n    let ci = this._currentIndex;\n    let bh = this.removeBehavior;\n\n    // Silently adjust the index if the current tab is not removed.\n    if (ci !== i) {\n      if (ci > i) {\n        this._currentIndex--;\n      }\n      return;\n    }\n\n    // TODO: do we need to do an update to adjust the aria-selected value?\n\n    // No tab gets selected if the tab bar is empty.\n    if (this._titles.length === 0) {\n      this._currentIndex = -1;\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: -1,\n        currentTitle: null\n      });\n      return;\n    }\n\n    // Handle behavior where the next sibling tab is selected.\n    if (bh === 'select-tab-after') {\n      this._currentIndex = Math.min(i, this._titles.length - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous sibling tab is selected.\n    if (bh === 'select-tab-before') {\n      this._currentIndex = Math.max(0, i - 1);\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Handle behavior where the previous history tab is selected.\n    if (bh === 'select-previous-tab') {\n      if (this._previousTitle) {\n        this._currentIndex = this._titles.indexOf(this._previousTitle);\n        this._previousTitle = null;\n      } else {\n        this._currentIndex = Math.min(i, this._titles.length - 1);\n      }\n      this._currentChanged.emit({\n        previousIndex: i,\n        previousTitle: title,\n        currentIndex: this._currentIndex,\n        currentTitle: this.currentTitle\n      });\n      return;\n    }\n\n    // Otherwise, no tab gets selected.\n    this._currentIndex = -1;\n    this._currentChanged.emit({\n      previousIndex: i,\n      previousTitle: title,\n      currentIndex: -1,\n      currentTitle: null\n    });\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(sender: Title<T>): void {\n    this.update();\n  }\n\n  private _name: string;\n  private _currentIndex = -1;\n  private _titles: Title<T>[] = [];\n  private _orientation: TabBar.Orientation;\n  private _document: Document | ShadowRoot;\n  private _titlesEditable: boolean = false;\n  private _previousTitle: Title<T> | null = null;\n  private _dragData: Private.IDragData | null = null;\n  private _addButtonEnabled: boolean = false;\n  private _tabMoved = new Signal<this, TabBar.ITabMovedArgs<T>>(this);\n  private _currentChanged = new Signal<this, TabBar.ICurrentChangedArgs<T>>(\n    this\n  );\n  private _addRequested = new Signal<this, void>(this);\n  private _tabCloseRequested = new Signal<\n    this,\n    TabBar.ITabCloseRequestedArgs<T>\n  >(this);\n  private _tabDetachRequested = new Signal<\n    this,\n    TabBar.ITabDetachRequestedArgs<T>\n  >(this);\n  private _tabActivateRequested = new Signal<\n    this,\n    TabBar.ITabActivateRequestedArgs<T>\n  >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n  /**\n   * A type alias for a tab bar orientation.\n   */\n  export type Orientation =\n    | /**\n     * The tabs are arranged in a single row, left-to-right.\n     *\n     * The tab text orientation is horizontal.\n     */\n    'horizontal'\n\n    /**\n     * The tabs are arranged in a single column, top-to-bottom.\n     *\n     * The tab text orientation is horizontal.\n     */\n    | 'vertical';\n\n  /**\n   * A type alias for the selection behavior on tab insert.\n   */\n  export type InsertBehavior =\n    | /**\n     * The selected tab will not be changed.\n     */\n    'none'\n\n    /**\n     * The inserted tab will be selected.\n     */\n    | 'select-tab'\n\n    /**\n     * The inserted tab will be selected if the current tab is null.\n     */\n    | 'select-tab-if-needed';\n\n  /**\n   * A type alias for the selection behavior on tab remove.\n   */\n  export type RemoveBehavior =\n    | /**\n     * No tab will be selected.\n     */\n    'none'\n\n    /**\n     * The tab after the removed tab will be selected if possible.\n     */\n    | 'select-tab-after'\n\n    /**\n     * The tab before the removed tab will be selected if possible.\n     */\n    | 'select-tab-before'\n\n    /**\n     * The previously selected tab will be selected if possible.\n     */\n    | 'select-previous-tab';\n\n  /**\n   * An options object for creating a tab bar.\n   */\n  export interface IOptions<T> {\n    /**\n     * The document to use with the tab bar.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n\n    /**\n     * Name of the tab bar.\n     *\n     * This is used for accessibility reasons. The default is the empty string.\n     */\n    name?: string;\n\n    /**\n     * The layout orientation of the tab bar.\n     *\n     * The default is `horizontal`.\n     */\n    orientation?: TabBar.Orientation;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether a tab can be deselected by the user.\n     *\n     * The default is `false`.\n     */\n    allowDeselect?: boolean;\n\n    /**\n     * Whether the titles can be directly edited by the user.\n     *\n     * The default is `false`.\n     */\n    titlesEditable?: boolean;\n\n    /**\n     * Whether the add button is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The selection behavior when inserting a tab.\n     *\n     * The default is `'select-tab-if-needed'`.\n     */\n    insertBehavior?: TabBar.InsertBehavior;\n\n    /**\n     * The selection behavior when removing a tab.\n     *\n     * The default is `'select-tab-after'`.\n     */\n    removeBehavior?: TabBar.RemoveBehavior;\n\n    /**\n     * A renderer to use with the tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer<T>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs<T> {\n    /**\n     * The previously selected index.\n     */\n    readonly previousIndex: number;\n\n    /**\n     * The previously selected title.\n     */\n    readonly previousTitle: Title<T> | null;\n\n    /**\n     * The currently selected index.\n     */\n    readonly currentIndex: number;\n\n    /**\n     * The currently selected title.\n     */\n    readonly currentTitle: Title<T> | null;\n  }\n\n  /**\n   * The arguments object for the `tabMoved` signal.\n   */\n  export interface ITabMovedArgs<T> {\n    /**\n     * The previous index of the tab.\n     */\n    readonly fromIndex: number;\n\n    /**\n     * The current index of the tab.\n     */\n    readonly toIndex: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabActivateRequested` signal.\n   */\n  export interface ITabActivateRequestedArgs<T> {\n    /**\n     * The index of the tab to activate.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabCloseRequested` signal.\n   */\n  export interface ITabCloseRequestedArgs<T> {\n    /**\n     * The index of the tab to close.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n  }\n\n  /**\n   * The arguments object for the `tabDetachRequested` signal.\n   */\n  export interface ITabDetachRequestedArgs<T> {\n    /**\n     * The index of the tab to detach.\n     */\n    readonly index: number;\n\n    /**\n     * The title for the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * The node representing the tab.\n     */\n    readonly tab: HTMLElement;\n\n    /**\n     * The current client X position of the mouse.\n     */\n    readonly clientX: number;\n\n    /**\n     * The current client Y position of the mouse.\n     */\n    readonly clientY: number;\n\n    /**\n     * The mouse position in the tab coordinate.\n     */\n    readonly offset?: { x: number; y: number };\n  }\n\n  /**\n   * An object which holds the data to render a tab.\n   */\n  export interface IRenderData<T> {\n    /**\n     * The title associated with the tab.\n     */\n    readonly title: Title<T>;\n\n    /**\n     * Whether the tab is the current tab.\n     */\n    readonly current: boolean;\n\n    /**\n     * The z-index for the tab.\n     */\n    readonly zIndex: number;\n\n    /**\n     * The tabindex value for the tab.\n     */\n    readonly tabIndex?: number;\n  }\n\n  /**\n   * A renderer for use with a tab bar.\n   */\n  export interface IRenderer<T> {\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector: string;\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<T>): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer<any> {\n    constructor() {\n      this._uuid = ++Renderer._nInstance;\n    }\n    /**\n     * A selector which matches the close icon node in a tab.\n     */\n    readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n    /**\n     * Render the virtual element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab.\n     */\n    renderTab(data: IRenderData<any>): VirtualElement {\n      let title = data.title.caption;\n      let key = this.createTabKey(data);\n      let id = key;\n      let style = this.createTabStyle(data);\n      let className = this.createTabClass(data);\n      let dataset = this.createTabDataset(data);\n      let aria = this.createTabARIA(data);\n      if (data.title.closable) {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data),\n          this.renderCloseIcon(data)\n        );\n      } else {\n        return h.li(\n          { id, key, className, title, style, dataset, ...aria },\n          this.renderIcon(data),\n          this.renderLabel(data)\n        );\n      }\n    }\n\n    /**\n     * Render the icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab icon.\n     */\n    renderIcon(data: IRenderData<any>): VirtualElement {\n      const { title } = data;\n      let className = this.createIconClass(data);\n\n      // If title.icon is undefined, it will be ignored.\n      return h.div({ className }, title.icon!, title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab label.\n     */\n    renderLabel(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n    }\n\n    /**\n     * Render the close icon element for a tab.\n     *\n     * @param data - The data to use for rendering the tab.\n     *\n     * @returns A virtual element representing the tab close icon.\n     */\n    renderCloseIcon(data: IRenderData<any>): VirtualElement {\n      return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n    }\n\n    /**\n     * Create a unique render key for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The unique render key for the tab.\n     *\n     * #### Notes\n     * This method caches the key against the tab title the first time\n     * the key is generated. This enables efficient rendering of moved\n     * tabs and avoids subtle hover style artifacts.\n     */\n    createTabKey(data: IRenderData<any>): string {\n      let key = this._tabKeys.get(data.title);\n      if (key === undefined) {\n        key = `tab-key-${this._uuid}-${this._tabID++}`;\n        this._tabKeys.set(data.title, key);\n      }\n      return key;\n    }\n\n    /**\n     * Create the inline style object for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The inline style data for the tab.\n     */\n    createTabStyle(data: IRenderData<any>): ElementInlineStyle {\n      return { zIndex: `${data.zIndex}` };\n    }\n\n    /**\n     * Create the class name for the tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab.\n     */\n    createTabClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tab';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.title.closable) {\n        name += ' lm-mod-closable';\n      }\n      if (data.current) {\n        name += ' lm-mod-current';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The dataset for the tab.\n     */\n    createTabDataset(data: IRenderData<any>): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the ARIA attributes for a tab.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The ARIA attributes for the tab.\n     */\n    createTabARIA(data: IRenderData<any>): ElementARIAAttrs | ElementBaseAttrs {\n      return {\n        role: 'tab',\n        'aria-selected': data.current.toString(),\n        tabindex: `${data.tabIndex ?? '-1'}`\n      };\n    }\n\n    /**\n     * Create the class name for the tab icon.\n     *\n     * @param data - The data to use for the tab.\n     *\n     * @returns The full class name for the tab icon.\n     */\n    createIconClass(data: IRenderData<any>): string {\n      let name = 'lm-TabBar-tabIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    private static _nInstance = 0;\n    private readonly _uuid: number;\n    private _tabID = 0;\n    private _tabKeys = new WeakMap<Title<any>, string>();\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n\n  /**\n   * A selector which matches the add button node in the tab bar.\n   */\n  export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The start drag distance threshold.\n   */\n  export const DRAG_THRESHOLD = 5;\n\n  /**\n   * The detach distance threshold.\n   */\n  export const DETACH_THRESHOLD = 20;\n\n  /**\n   * A struct which holds the drag data for a tab bar.\n   */\n  export interface IDragData {\n    /**\n     * The tab node being dragged.\n     */\n    tab: HTMLElement;\n\n    /**\n     * The index of the tab being dragged.\n     */\n    index: number;\n\n    /**\n     * The mouse press client X position.\n     */\n    pressX: number;\n\n    /**\n     * The mouse press client Y position.\n     */\n    pressY: number;\n\n    /**\n     * The offset left/top of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPos: number;\n\n    /**\n     * The offset width/height of the tab being dragged.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabSize: number;\n\n    /**\n     * The original mouse X/Y position in tab coordinates.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    tabPressPos: number;\n\n    /**\n     * The original mouse position in tab coordinates.\n     *\n     * This is undefined if the drag is not active.\n     */\n    tabPressOffset?: { x: number; y: number };\n\n    /**\n     * The tab target index upon mouse release.\n     *\n     * This will be `-1` if the drag is not active.\n     */\n    targetIndex: number;\n\n    /**\n     * The array of tab layout objects snapped at drag start.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    tabLayout: ITabLayout[] | null;\n\n    /**\n     * The bounding client rect of the tab bar content node.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    contentRect: DOMRect | null;\n\n    /**\n     * The disposable to clean up the cursor override.\n     *\n     * This will be `null` if the drag is not active.\n     */\n    override: IDisposable | null;\n\n    /**\n     * Whether the drag is currently active.\n     */\n    dragActive: boolean;\n\n    /**\n     * Whether the drag has been aborted.\n     */\n    dragAborted: boolean;\n\n    /**\n     * Whether a detach request as been made.\n     */\n    detachRequested: boolean;\n  }\n\n  /**\n   * An object which holds layout data for a tab.\n   */\n  export interface ITabLayout {\n    /**\n     * The left/top margin value for the tab.\n     */\n    margin: number;\n\n    /**\n     * The offset left/top position of the tab.\n     */\n    pos: number;\n\n    /**\n     * The offset width/height of the tab.\n     */\n    size: number;\n  }\n\n  /**\n   * Create the DOM node for a tab bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.setAttribute('role', 'tablist');\n    content.className = 'lm-TabBar-content';\n    node.appendChild(content);\n\n    let add = document.createElement('div');\n    add.className = 'lm-TabBar-addButton lm-mod-hidden';\n    add.setAttribute('tabindex', '-1');\n    add.setAttribute('role', 'button');\n    node.appendChild(add);\n    return node;\n  }\n\n  /**\n   * Coerce a title or options into a real title.\n   */\n  export function asTitle<T>(value: Title<T> | Title.IOptions<T>): Title<T> {\n    return value instanceof Title ? value : new Title<T>(value);\n  }\n\n  /**\n   * Parse the transition duration for a tab node.\n   */\n  export function parseTransitionDuration(tab: HTMLElement): number {\n    let style = window.getComputedStyle(tab);\n    return 1000 * (parseFloat(style.transitionDuration!) || 0);\n  }\n\n  /**\n   * Get a snapshot of the current tab layout values.\n   */\n  export function snapTabLayout(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): ITabLayout[] {\n    let layout = new Array<ITabLayout>(tabs.length);\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let node = tabs[i] as HTMLElement;\n      let style = window.getComputedStyle(node);\n      if (orientation === 'horizontal') {\n        layout[i] = {\n          pos: node.offsetLeft,\n          size: node.offsetWidth,\n          margin: parseFloat(style.marginLeft!) || 0\n        };\n      } else {\n        layout[i] = {\n          pos: node.offsetTop,\n          size: node.offsetHeight,\n          margin: parseFloat(style.marginTop!) || 0\n        };\n      }\n    }\n    return layout;\n  }\n\n  /**\n   * Test if the event exceeds the drag threshold.\n   */\n  export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n    let dx = Math.abs(event.clientX - data.pressX);\n    let dy = Math.abs(event.clientY - data.pressY);\n    return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n  }\n\n  /**\n   * Test if the event exceeds the drag detach threshold.\n   */\n  export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n    let rect = data.contentRect!;\n    return (\n      event.clientX < rect.left - DETACH_THRESHOLD ||\n      event.clientX >= rect.right + DETACH_THRESHOLD ||\n      event.clientY < rect.top - DETACH_THRESHOLD ||\n      event.clientY >= rect.bottom + DETACH_THRESHOLD\n    );\n  }\n\n  /**\n   * Update the relative tab positions and computed target index.\n   */\n  export function layoutTabs(\n    tabs: HTMLCollection,\n    data: IDragData,\n    event: MouseEvent,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive values.\n    let pressPos: number;\n    let localPos: number;\n    let clientPos: number;\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      pressPos = data.pressX;\n      localPos = event.clientX - data.contentRect!.left;\n      clientPos = event.clientX;\n      clientSize = data.contentRect!.width;\n    } else {\n      pressPos = data.pressY;\n      localPos = event.clientY - data.contentRect!.top;\n      clientPos = event.clientY;\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the target data.\n    let targetIndex = data.index;\n    let targetPos = localPos - data.tabPressPos;\n    let targetEnd = targetPos + data.tabSize;\n\n    // Update the relative tab positions.\n    for (let i = 0, n = tabs.length; i < n; ++i) {\n      let pxPos: string;\n      let layout = data.tabLayout![i];\n      let threshold = layout.pos + (layout.size >> 1);\n      if (i < data.index && targetPos < threshold) {\n        pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n        targetIndex = Math.min(targetIndex, i);\n      } else if (i > data.index && targetEnd > threshold) {\n        pxPos = `${-data.tabSize - layout.margin}px`;\n        targetIndex = Math.max(targetIndex, i);\n      } else if (i === data.index) {\n        let ideal = clientPos - pressPos;\n        let limit = clientSize - (data.tabPos + data.tabSize);\n        pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n      } else {\n        pxPos = '';\n      }\n      if (orientation === 'horizontal') {\n        (tabs[i] as HTMLElement).style.left = pxPos;\n      } else {\n        (tabs[i] as HTMLElement).style.top = pxPos;\n      }\n    }\n\n    // Update the computed target index.\n    data.targetIndex = targetIndex;\n  }\n\n  /**\n   * Position the drag tab at its final resting relative position.\n   */\n  export function finalizeTabPosition(\n    data: IDragData,\n    orientation: TabBar.Orientation\n  ): void {\n    // Compute the orientation-sensitive client size.\n    let clientSize: number;\n    if (orientation === 'horizontal') {\n      clientSize = data.contentRect!.width;\n    } else {\n      clientSize = data.contentRect!.height;\n    }\n\n    // Compute the ideal final tab position.\n    let ideal: number;\n    if (data.targetIndex === data.index) {\n      ideal = 0;\n    } else if (data.targetIndex > data.index) {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n    } else {\n      let tgt = data.tabLayout![data.targetIndex];\n      ideal = tgt.pos - data.tabPos;\n    }\n\n    // Compute the tab position limit.\n    let limit = clientSize - (data.tabPos + data.tabSize);\n    let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n    // Set the final orientation-sensitive position.\n    if (orientation === 'horizontal') {\n      data.tab.style.left = `${final}px`;\n    } else {\n      data.tab.style.top = `${final}px`;\n    }\n  }\n\n  /**\n   * Reset the relative positions of the given tabs.\n   */\n  export function resetTabPositions(\n    tabs: HTMLCollection,\n    orientation: TabBar.Orientation\n  ): void {\n    for (const tab of tabs) {\n      if (orientation === 'horizontal') {\n        (tab as HTMLElement).style.left = '';\n      } else {\n        (tab as HTMLElement).style.top = '';\n      }\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n  /**\n   * Construct a new dock layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: DockLayout.IOptions) {\n    super();\n    this.renderer = options.renderer;\n    if (options.spacing !== undefined) {\n      this._spacing = Utils.clampDimension(options.spacing);\n    }\n    this._document = options.document || document;\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   *\n   * #### Notes\n   * This will clear and dispose all widgets in the layout.\n   */\n  dispose(): void {\n    // Get an iterator over the widgets in the layout.\n    let widgets = this[Symbol.iterator]();\n\n    // Dispose of the layout items.\n    this._items.forEach(item => {\n      item.dispose();\n    });\n\n    // Clear the layout state before disposing the widgets.\n    this._box = null;\n    this._root = null;\n    this._items.clear();\n\n    // Dispose of the widgets contained in the old layout root.\n    for (const widget of widgets) {\n      widget.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the dock layout.\n   */\n  readonly renderer: DockLayout.IRenderer;\n\n  /**\n   * The method for hiding child widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    for (const bar of this.tabBars()) {\n      if (bar.titles.length > 1) {\n        for (const title of bar.titles) {\n          title.owner.hiddenMode = this._hiddenMode;\n        }\n      }\n    }\n  }\n\n  /**\n   * Get the inter-element spacing for the dock layout.\n   */\n  get spacing(): number {\n    return this._spacing;\n  }\n\n  /**\n   * Set the inter-element spacing for the dock layout.\n   */\n  set spacing(value: number) {\n    value = Utils.clampDimension(value);\n    if (this._spacing === value) {\n      return;\n    }\n    this._spacing = value;\n    if (!this.parent) {\n      return;\n    }\n    this.parent.fit();\n  }\n\n  /**\n   * Whether the dock layout is empty.\n   */\n  get isEmpty(): boolean {\n    return this._root === null;\n  }\n\n  /**\n   * Create an iterator over all widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   *\n   * #### Notes\n   * This iterator includes the generated tab bars.\n   */\n  [Symbol.iterator](): IterableIterator<Widget> {\n    return this._root ? this._root.iterAllWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the user widgets in the layout.\n   *\n   * @returns A new iterator over the user widgets in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  widgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterUserWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the layout.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the layout.\n   */\n  selectedWidgets(): IterableIterator<Widget> {\n    return this._root ? this._root.iterSelectedWidgets() : empty();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the layout.\n   *\n   * @returns A new iterator over the tab bars in the layout.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  tabBars(): IterableIterator<TabBar<Widget>> {\n    return this._root ? this._root.iterTabBars() : empty();\n  }\n\n  /**\n   * Create an iterator over the handles in the layout.\n   *\n   * @returns A new iterator over the handles in the layout.\n   */\n  handles(): IterableIterator<HTMLDivElement> {\n    return this._root ? this._root.iterHandles() : empty();\n  }\n\n  /**\n   * Move a handle to the given offset position.\n   *\n   * @param handle - The handle to move.\n   *\n   * @param offsetX - The desired offset X position of the handle.\n   *\n   * @param offsetY - The desired offset Y position of the handle.\n   *\n   * #### Notes\n   * If the given handle is not contained in the layout, this is no-op.\n   *\n   * The handle will be moved as close as possible to the desired\n   * position without violating any of the layout constraints.\n   *\n   * Only one of the coordinates is used depending on the orientation\n   * of the handle. This method accepts both coordinates to make it\n   * easy to invoke from a mouse move event without needing to know\n   * the handle orientation.\n   */\n  moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n    // Bail early if there is no root or if the handle is hidden.\n    let hidden = handle.classList.contains('lm-mod-hidden');\n    if (!this._root || hidden) {\n      return;\n    }\n\n    // Lookup the split node for the handle.\n    let data = this._root.findSplitNode(handle);\n    if (!data) {\n      return;\n    }\n\n    // Compute the desired delta movement for the handle.\n    let delta: number;\n    if (data.node.orientation === 'horizontal') {\n      delta = offsetX - handle.offsetLeft;\n    } else {\n      delta = offsetY - handle.offsetTop;\n    }\n\n    // Bail if there is no handle movement.\n    if (delta === 0) {\n      return;\n    }\n\n    // Prevent sibling resizing unless needed.\n    data.node.holdSizes();\n\n    // Adjust the sizers to reflect the handle movement.\n    BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n    // Update the layout of the widgets.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Save the current configuration of the dock layout.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockLayout.ILayoutConfig {\n    // Bail early if there is no root.\n    if (!this._root) {\n      return { main: null };\n    }\n\n    // Hold the current sizes in the layout tree.\n    this._root.holdAllSizes();\n\n    // Return the layout config.\n    return { main: this._root.createConfig() };\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   */\n  restoreLayout(config: DockLayout.ILayoutConfig): void {\n    // Create the widget set for validating the config.\n    let widgetSet = new Set<Widget>();\n\n    // Normalize the main area config and collect the widgets.\n    let mainConfig: DockLayout.AreaConfig | null;\n    if (config.main) {\n      mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n    } else {\n      mainConfig = null;\n    }\n\n    // Create iterators over the old content.\n    let oldWidgets = this.widgets();\n    let oldTabBars = this.tabBars();\n    let oldHandles = this.handles();\n\n    // Clear the root before removing the old content.\n    this._root = null;\n\n    // Unparent the old widgets which are not in the new config.\n    for (const widget of oldWidgets) {\n      if (!widgetSet.has(widget)) {\n        widget.parent = null;\n      }\n    }\n\n    // Dispose of the old tab bars.\n    for (const tabBar of oldTabBars) {\n      tabBar.dispose();\n    }\n\n    // Remove the old handles.\n    for (const handle of oldHandles) {\n      if (handle.parentNode) {\n        handle.parentNode.removeChild(handle);\n      }\n    }\n\n    // Reparent the new widgets to the current parent.\n    for (const widget of widgetSet) {\n      widget.parent = this.parent;\n    }\n\n    // Create the root node for the new config.\n    if (mainConfig) {\n      this._root = Private.realizeAreaConfig(\n        mainConfig,\n        {\n          // Ignoring optional `document` argument as we must reuse `this._document`\n          createTabBar: (document?: Document | ShadowRoot) =>\n            this._createTabBar(),\n          createHandle: () => this._createHandle()\n        },\n        this._document\n      );\n    } else {\n      this._root = null;\n    }\n\n    // If there is no parent, there is nothing more to do.\n    if (!this.parent) {\n      return;\n    }\n\n    // Attach the new widgets to the parent.\n    widgetSet.forEach(widget => {\n      this.attachWidget(widget);\n    });\n\n    // Post a fit request to the parent.\n    this.parent.fit();\n  }\n\n  /**\n   * Add a widget to the dock layout.\n   *\n   * @param widget - The widget to add to the dock layout.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * The widget will be moved if it is already contained in the layout.\n   *\n   * An error will be thrown if the reference widget is invalid.\n   */\n  addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n    // Parse the options.\n    let ref = options.ref || null;\n    let mode = options.mode || 'tab-after';\n\n    // Find the tab node which holds the reference widget.\n    let refNode: Private.TabLayoutNode | null = null;\n    if (this._root && ref) {\n      refNode = this._root.findTabNode(ref);\n    }\n\n    // Throw an error if the reference widget is invalid.\n    if (ref && !refNode) {\n      throw new Error('Reference widget is not in the layout.');\n    }\n\n    // Reparent the widget to the current layout parent.\n    widget.parent = this.parent;\n\n    // Insert the widget according to the insert mode.\n    switch (mode) {\n      case 'tab-after':\n        this._insertTab(widget, ref, refNode, true);\n        break;\n      case 'tab-before':\n        this._insertTab(widget, ref, refNode, false);\n        break;\n      case 'split-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false);\n        break;\n      case 'split-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false);\n        break;\n      case 'split-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true);\n        break;\n      case 'split-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true);\n        break;\n      case 'merge-top':\n        this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n        break;\n      case 'merge-left':\n        this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n        break;\n      case 'merge-right':\n        this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n        break;\n      case 'merge-bottom':\n        this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n        break;\n    }\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Ensure the widget is attached to the parent widget.\n    this.attachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Remove the widget from its current layout location.\n    this._removeWidget(widget);\n\n    // Do nothing else if there is no parent widget.\n    if (!this.parent) {\n      return;\n    }\n\n    // Detach the widget from the parent widget.\n    this.detachWidget(widget);\n\n    // Post a fit request for the parent widget.\n    this.parent.fit();\n  }\n\n  /**\n   * Find the tab area which contains the given client position.\n   *\n   * @param clientX - The client X position of interest.\n   *\n   * @param clientY - The client Y position of interest.\n   *\n   * @returns The geometry of the tab area at the given position, or\n   *   `null` if there is no tab area at the given position.\n   */\n  hitTestTabAreas(\n    clientX: number,\n    clientY: number\n  ): DockLayout.ITabAreaGeometry | null {\n    // Bail early if hit testing cannot produce valid results.\n    if (!this._root || !this.parent || !this.parent.isVisible) {\n      return null;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent.node);\n    }\n\n    // Convert from client to local coordinates.\n    let rect = this.parent.node.getBoundingClientRect();\n    let x = clientX - rect.left - this._box.borderLeft;\n    let y = clientY - rect.top - this._box.borderTop;\n\n    // Find the tab layout node at the local position.\n    let tabNode = this._root.hitTestTabNodes(x, y);\n\n    // Bail if a tab layout node was not found.\n    if (!tabNode) {\n      return null;\n    }\n\n    // Extract the data from the tab node.\n    let { tabBar, top, left, width, height } = tabNode;\n\n    // Compute the right and bottom edges of the tab area.\n    let borderWidth = this._box.borderLeft + this._box.borderRight;\n    let borderHeight = this._box.borderTop + this._box.borderBottom;\n    let right = rect.width - borderWidth - (left + width);\n    let bottom = rect.height - borderHeight - (top + height);\n\n    // Return the hit test results.\n    return { tabBar, x, y, top, left, right, bottom, width, height };\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    // Perform superclass initialization.\n    super.init();\n\n    // Attach each widget to the parent.\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n\n    // Attach each handle to the parent.\n    for (const handle of this.handles()) {\n      this.parent!.node.appendChild(handle);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Attach the widget to the layout parent widget.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is already attached.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Do nothing if the widget is already attached.\n    if (this.parent!.node === widget.node.parentNode) {\n      return;\n    }\n\n    // Create the layout item for the widget.\n    this._items.set(widget, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach the widget from the layout parent widget.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not attached.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Do nothing if the widget is not attached.\n    if (this.parent!.node !== widget.node.parentNode) {\n      return;\n    }\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Delete the layout item for the widget.\n    let item = this._items.get(widget);\n    if (item) {\n      this._items.delete(widget);\n      item.dispose();\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Remove the specified widget from the layout structure.\n   *\n   * #### Notes\n   * This is a no-op if the widget is not in the layout tree.\n   *\n   * This does not detach the widget from the parent node.\n   */\n  private _removeWidget(widget: Widget): void {\n    // Bail early if there is no layout root.\n    if (!this._root) {\n      return;\n    }\n\n    // Find the tab node which contains the given widget.\n    let tabNode = this._root.findTabNode(widget);\n\n    // Bail early if the tab node is not found.\n    if (!tabNode) {\n      return;\n    }\n\n    Private.removeAria(widget);\n\n    // If there are multiple tabs, just remove the widget's tab.\n    if (tabNode.tabBar.titles.length > 1) {\n      tabNode.tabBar.removeTab(widget.title);\n      if (\n        this._hiddenMode === Widget.HiddenMode.Scale &&\n        tabNode.tabBar.titles.length == 1\n      ) {\n        const existingWidget = tabNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Display;\n      }\n      return;\n    }\n\n    // Otherwise, the tab node needs to be removed...\n\n    // Dispose the tab bar.\n    tabNode.tabBar.dispose();\n\n    // Handle the case where the tab node is the root.\n    if (this._root === tabNode) {\n      this._root = null;\n      return;\n    }\n\n    // Otherwise, remove the tab node from its parent...\n\n    // Prevent widget resizing unless needed.\n    this._root.holdAllSizes();\n\n    // Clear the parent reference on the tab node.\n    let splitNode = tabNode.parent!;\n    tabNode.parent = null;\n\n    // Remove the tab node from its parent split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n    let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n    ArrayExt.removeAt(splitNode.sizers, i);\n\n    // Remove the handle from its parent DOM node.\n    if (handle.parentNode) {\n      handle.parentNode.removeChild(handle);\n    }\n\n    // If there are multiple children, just update the handles.\n    if (splitNode.children.length > 1) {\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Otherwise, the split node also needs to be removed...\n\n    // Clear the parent reference on the split node.\n    let maybeParent = splitNode.parent;\n    splitNode.parent = null;\n\n    // Lookup the remaining child node and handle.\n    let childNode = splitNode.children[0];\n    let childHandle = splitNode.handles[0];\n\n    // Clear the split node data.\n    splitNode.children.length = 0;\n    splitNode.handles.length = 0;\n    splitNode.sizers.length = 0;\n\n    // Remove the child handle from its parent node.\n    if (childHandle.parentNode) {\n      childHandle.parentNode.removeChild(childHandle);\n    }\n\n    // Handle the case where the split node is the root.\n    if (this._root === splitNode) {\n      childNode.parent = null;\n      this._root = childNode;\n      return;\n    }\n\n    // Otherwise, move the child node to the parent node...\n    let parentNode = maybeParent!;\n\n    // Lookup the index of the split node.\n    let j = parentNode.children.indexOf(splitNode);\n\n    // Handle the case where the child node is a tab node.\n    if (childNode instanceof Private.TabLayoutNode) {\n      childNode.parent = parentNode;\n      parentNode.children[j] = childNode;\n      return;\n    }\n\n    // Remove the split data from the parent.\n    let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n    ArrayExt.removeAt(parentNode.children, j);\n    ArrayExt.removeAt(parentNode.sizers, j);\n\n    // Remove the handle from its parent node.\n    if (splitHandle.parentNode) {\n      splitHandle.parentNode.removeChild(splitHandle);\n    }\n\n    // The child node and the split parent node will have the same\n    // orientation. Merge the grand-children with the parent node.\n    for (let i = 0, n = childNode.children.length; i < n; ++i) {\n      let gChild = childNode.children[i];\n      let gHandle = childNode.handles[i];\n      let gSizer = childNode.sizers[i];\n      ArrayExt.insert(parentNode.children, j + i, gChild);\n      ArrayExt.insert(parentNode.handles, j + i, gHandle);\n      ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n      gChild.parent = parentNode;\n    }\n\n    // Clear the child node.\n    childNode.children.length = 0;\n    childNode.handles.length = 0;\n    childNode.sizers.length = 0;\n    childNode.parent = null;\n\n    // Sync the handles on the parent node.\n    parentNode.syncHandles();\n  }\n\n  /**\n   * Create the tab layout node to hold the widget.\n   */\n  private _createTabNode(widget: Widget): Private.TabLayoutNode {\n    let tabNode = new Private.TabLayoutNode(this._createTabBar());\n    tabNode.tabBar.addTab(widget.title);\n    Private.addAria(widget, tabNode.tabBar);\n    return tabNode;\n  }\n\n  /**\n   * Insert a widget next to an existing tab.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertTab(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    after: boolean\n  ): void {\n    // Do nothing if the tab is inserted next to itself.\n    if (widget === ref) {\n      return;\n    }\n\n    // Create the root if it does not exist.\n    if (!this._root) {\n      let tabNode = new Private.TabLayoutNode(this._createTabBar());\n      tabNode.tabBar.addTab(widget.title);\n      this._root = tabNode;\n      Private.addAria(widget, tabNode.tabBar);\n      return;\n    }\n\n    // Use the first tab node as the ref node if needed.\n    if (!refNode) {\n      refNode = this._root.findFirstTabNode()!;\n    }\n\n    // If the widget is not contained in the ref node, ensure it is\n    // removed from the layout and hidden before being added again.\n    if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n      this._removeWidget(widget);\n      widget.hide();\n    }\n\n    // Lookup the target index for inserting the tab.\n    let index: number;\n    if (ref) {\n      index = refNode.tabBar.titles.indexOf(ref.title);\n    } else {\n      index = refNode.tabBar.currentIndex;\n    }\n\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      if (refNode.tabBar.titles.length === 0) {\n        // Singular tab should use display mode to limit number of layers.\n        widget.hiddenMode = Widget.HiddenMode.Display;\n      } else if (refNode.tabBar.titles.length == 1) {\n        // If we are adding a second tab, switch the existing tab back to scale.\n        const existingWidget = refNode.tabBar.titles[0].owner;\n        existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n      } else {\n        // For the third and subsequent tabs no special action is needed.\n        widget.hiddenMode = Widget.HiddenMode.Scale;\n      }\n    } else {\n      // For all other modes just propagate the current mode.\n      widget.hiddenMode = this._hiddenMode;\n    }\n\n    // Insert the widget's tab relative to the target index.\n    refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n    Private.addAria(widget, refNode.tabBar);\n  }\n\n  /**\n   * Insert a widget as a new split area.\n   *\n   * #### Notes\n   * This does not attach the widget to the parent widget.\n   */\n  private _insertSplit(\n    widget: Widget,\n    ref: Widget | null,\n    refNode: Private.TabLayoutNode | null,\n    orientation: Private.Orientation,\n    after: boolean,\n    merge: boolean = false\n  ): void {\n    // Do nothing if there is no effective split.\n    if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n      return;\n    }\n\n    // Ensure the widget is removed from the current layout.\n    this._removeWidget(widget);\n\n    // Set the root if it does not exist.\n    if (!this._root) {\n      this._root = this._createTabNode(widget);\n      return;\n    }\n\n    // If the ref node parent is null, split the root.\n    if (!refNode || !refNode.parent) {\n      // Ensure the root is split with the correct orientation.\n      let root = this._splitRoot(orientation);\n\n      // Determine the insert index for the new tab node.\n      let i = after ? root.children.length : 0;\n\n      // Normalize the split node.\n      root.normalizeSizes();\n\n      // Create the sizer for new tab node.\n      let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n      // Insert the tab node sized to the golden ratio.\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(root.children, i, tabNode);\n      ArrayExt.insert(root.sizers, i, sizer);\n      ArrayExt.insert(root.handles, i, this._createHandle());\n      tabNode.parent = root;\n\n      // Re-normalize the split node to maintain the ratios.\n      root.normalizeSizes();\n\n      // Finally, synchronize the visibility of the handles.\n      root.syncHandles();\n      return;\n    }\n\n    // Lookup the split node for the ref widget.\n    let splitNode = refNode.parent;\n\n    // If the split node already had the correct orientation,\n    // the widget can be inserted into the split node directly.\n    if (splitNode.orientation === orientation) {\n      // Find the index of the ref node.\n      let i = splitNode.children.indexOf(refNode);\n\n      // Conditionally reuse a tab layout found in the wanted position.\n      if (merge) {\n        let j = i + (after ? 1 : -1);\n        let sibling = splitNode.children[j];\n        if (sibling instanceof Private.TabLayoutNode) {\n          this._insertTab(widget, null, sibling, true);\n          ++sibling.tabBar.currentIndex;\n          return;\n        }\n      }\n\n      // Normalize the split node.\n      splitNode.normalizeSizes();\n\n      // Consume half the space for the insert location.\n      let s = (splitNode.sizers[i].sizeHint /= 2);\n\n      // Insert the tab node sized to the other half.\n      let j = i + (after ? 1 : 0);\n      let tabNode = this._createTabNode(widget);\n      ArrayExt.insert(splitNode.children, j, tabNode);\n      ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n      ArrayExt.insert(splitNode.handles, j, this._createHandle());\n      tabNode.parent = splitNode;\n\n      // Finally, synchronize the visibility of the handles.\n      splitNode.syncHandles();\n      return;\n    }\n\n    // Remove the ref node from the split node.\n    let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n    // Create a new normalized split node for the children.\n    let childNode = new Private.SplitLayoutNode(orientation);\n    childNode.normalized = true;\n\n    // Add the ref node sized to half the space.\n    childNode.children.push(refNode);\n    childNode.sizers.push(Private.createSizer(0.5));\n    childNode.handles.push(this._createHandle());\n    refNode.parent = childNode;\n\n    // Add the tab node sized to the other half.\n    let j = after ? 1 : 0;\n    let tabNode = this._createTabNode(widget);\n    ArrayExt.insert(childNode.children, j, tabNode);\n    ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n    ArrayExt.insert(childNode.handles, j, this._createHandle());\n    tabNode.parent = childNode;\n\n    // Synchronize the visibility of the handles.\n    childNode.syncHandles();\n\n    // Finally, add the new child node to the original split node.\n    ArrayExt.insert(splitNode.children, i, childNode);\n    childNode.parent = splitNode;\n  }\n\n  /**\n   * Ensure the root is a split node with the given orientation.\n   */\n  private _splitRoot(\n    orientation: Private.Orientation\n  ): Private.SplitLayoutNode {\n    // Bail early if the root already meets the requirements.\n    let oldRoot = this._root;\n    if (oldRoot instanceof Private.SplitLayoutNode) {\n      if (oldRoot.orientation === orientation) {\n        return oldRoot;\n      }\n    }\n\n    // Create a new root node with the specified orientation.\n    let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n    // Add the old root to the new root.\n    if (oldRoot) {\n      newRoot.children.push(oldRoot);\n      newRoot.sizers.push(Private.createSizer(0));\n      newRoot.handles.push(this._createHandle());\n      oldRoot.parent = newRoot;\n    }\n\n    // Return the new root as a convenience.\n    return newRoot;\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the size limits for the layout tree.\n    if (this._root) {\n      let limits = this._root.fit(this._spacing, this._items);\n      minW = limits.minWidth;\n      minH = limits.minHeight;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Bail early if there is no root layout node.\n    if (!this._root) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let x = this._box.paddingTop;\n    let y = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the geometry of the layout tree.\n    this._root.update(x, y, width, height, this._spacing, this._items);\n  }\n\n  /**\n   * Create a new tab bar for use by the dock layout.\n   *\n   * #### Notes\n   * The tab bar will be attached to the parent if it exists.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar using the renderer.\n    let tabBar = this.renderer.createTabBar(this._document);\n\n    // Enforce necessary tab bar behavior.\n    tabBar.orientation = 'horizontal';\n\n    // Attach the tab bar to the parent if possible.\n    if (this.parent) {\n      this.attachWidget(tabBar);\n    }\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for the dock layout.\n   *\n   * #### Notes\n   * The handle will be attached to the parent if it exists.\n   */\n  private _createHandle(): HTMLDivElement {\n    // Create the handle using the renderer.\n    let handle = this.renderer.createHandle();\n\n    // Initialize the handle layout behavior.\n    let style = handle.style;\n    style.position = 'absolute';\n    style.contain = 'strict';\n    style.top = '0';\n    style.left = '0';\n    style.width = '0';\n    style.height = '0';\n\n    // Attach the handle to the parent if it exists.\n    if (this.parent) {\n      this.parent.node.appendChild(handle);\n    }\n\n    // Return the initialized handle.\n    return handle;\n  }\n\n  private _spacing = 4;\n  private _dirty = false;\n  private _root: Private.LayoutNode | null = null;\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _document: Document | ShadowRoot;\n  private _hiddenMode: Widget.HiddenMode;\n  private _items: Private.ItemMap = new Map<Widget, LayoutItem>();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n  /**\n   * An options object for creating a dock layout.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * The renderer to use for the dock layout.\n     */\n    renderer: IRenderer;\n\n    /**\n     * The spacing between items in the layout.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n  }\n\n  /**\n   * A renderer for use with a dock layout.\n   */\n  export interface IRenderer {\n    /**\n     * Create a new tab bar for use with a dock layout.\n     *\n     * @returns A new tab bar for a dock layout.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget>;\n\n    /**\n     * Create a new handle node for use with a dock layout.\n     *\n     * @returns A new handle node for a dock layout.\n     */\n    createHandle(): HTMLDivElement;\n  }\n\n  /**\n   * A type alias for the supported insertion modes.\n   *\n   * An insert mode is used to specify how a widget should be added\n   * to the dock layout relative to a reference widget.\n   */\n  export type InsertMode =\n    | /**\n     * The area to the top of the reference widget.\n     *\n     * The widget will be inserted just above the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the top edge of the dock layout.\n     */\n    'split-top'\n\n    /**\n     * The area to the left of the reference widget.\n     *\n     * The widget will be inserted just left of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the left edge of the dock layout.\n     */\n    | 'split-left'\n\n    /**\n     * The area to the right of the reference widget.\n     *\n     * The widget will be inserted just right of the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted  at the right edge of the dock layout.\n     */\n    | 'split-right'\n\n    /**\n     * The area to the bottom of the reference widget.\n     *\n     * The widget will be inserted just below the reference widget.\n     *\n     * If the reference widget is null or invalid, the widget will be\n     * inserted at the bottom edge of the dock layout.\n     */\n    | 'split-bottom'\n\n    /**\n     * Like `split-top` but if a tab layout exists above the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-top'\n\n    /**\n     * Like `split-left` but if a tab layout exists left of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-left'\n\n    /**\n     * Like `split-right` but if a tab layout exists right of the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-right'\n\n    /**\n     * Like `split-bottom` but if a tab layout exists below the reference widget,\n     * it behaves like `tab-after` with reference to that instead.\n     */\n    | 'merge-bottom'\n\n    /**\n     * The tab position before the reference widget.\n     *\n     * The widget will be added as a tab before the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-before'\n\n    /**\n     * The tab position after the reference widget.\n     *\n     * The widget will be added as a tab after the reference widget.\n     *\n     * If the reference widget is null or invalid, a sensible default\n     * will be used.\n     */\n    | 'tab-after';\n\n  /**\n   * An options object for adding a widget to the dock layout.\n   */\n  export interface IAddOptions {\n    /**\n     * The insertion mode for adding the widget.\n     *\n     * The default is `'tab-after'`.\n     */\n    mode?: InsertMode;\n\n    /**\n     * The reference widget for the insert location.\n     *\n     * The default is `null`.\n     */\n    ref?: Widget | null;\n  }\n\n  /**\n   * A layout config object for a tab area.\n   */\n  export interface ITabAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'tab-area';\n\n    /**\n     * The widgets contained in the tab area.\n     */\n    widgets: Widget[];\n\n    /**\n     * The index of the selected tab.\n     */\n    currentIndex: number;\n  }\n\n  /**\n   * A layout config object for a split area.\n   */\n  export interface ISplitAreaConfig {\n    /**\n     * The discriminated type of the config object.\n     */\n    type: 'split-area';\n\n    /**\n     * The orientation of the split area.\n     */\n    orientation: 'horizontal' | 'vertical';\n\n    /**\n     * The children in the split area.\n     */\n    children: AreaConfig[];\n\n    /**\n     * The relative sizes of the children.\n     */\n    sizes: number[];\n  }\n\n  /**\n   * A type alias for a general area config.\n   */\n  export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n  /**\n   * A dock layout configuration object.\n   */\n  export interface ILayoutConfig {\n    /**\n     * The layout config for the main dock area.\n     */\n    main: AreaConfig | null;\n  }\n\n  /**\n   * An object which represents the geometry of a tab area.\n   */\n  export interface ITabAreaGeometry {\n    /**\n     * The tab bar for the tab area.\n     */\n    tabBar: TabBar<Widget>;\n\n    /**\n     * The local X position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the local X coordinate of the hit test query.\n     */\n    x: number;\n\n    /**\n     * The local Y position of the hit test in the dock area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the local Y coordinate of the hit test query.\n     */\n    y: number;\n\n    /**\n     * The local coordinate of the top edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the top edge of the layout parent\n     * widget, to the top edge of the tab area.\n     */\n    top: number;\n\n    /**\n     * The local coordinate of the left edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the left edge of the layout parent\n     * widget, to the left edge of the tab area.\n     */\n    left: number;\n\n    /**\n     * The local coordinate of the right edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the right edge of the layout parent\n     * widget, to the right edge of the tab area.\n     */\n    right: number;\n\n    /**\n     * The local coordinate of the bottom edge of the tab area.\n     *\n     * #### Notes\n     * This is the distance from the bottom edge of the layout parent\n     * widget, to the bottom edge of the tab area.\n     */\n    bottom: number;\n\n    /**\n     * The width of the tab area.\n     *\n     * #### Notes\n     * This is total width allocated for the tab area.\n     */\n    width: number;\n\n    /**\n     * The height of the tab area.\n     *\n     * #### Notes\n     * This is total height allocated for the tab area.\n     */\n    height: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * A type alias for a dock layout node.\n   */\n  export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n  /**\n   * A type alias for the orientation of a split layout node.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * A type alias for a layout item map.\n   */\n  export type ItemMap = Map<Widget, LayoutItem>;\n\n  /**\n   * Create a box sizer with an initial size hint.\n   */\n  export function createSizer(hint: number): BoxSizer {\n    let sizer = new BoxSizer();\n    sizer.sizeHint = hint;\n    sizer.size = hint;\n    return sizer;\n  }\n\n  /**\n   * Normalize an area config object and collect the visited widgets.\n   */\n  export function normalizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    let result: DockLayout.AreaConfig | null;\n    if (config.type === 'tab-area') {\n      result = normalizeTabAreaConfig(config, widgetSet);\n    } else {\n      result = normalizeSplitAreaConfig(config, widgetSet);\n    }\n    return result;\n  }\n\n  /**\n   * Convert a normalized area config into a layout tree.\n   */\n  export function realizeAreaConfig(\n    config: DockLayout.AreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): LayoutNode {\n    let node: LayoutNode;\n    if (config.type === 'tab-area') {\n      node = realizeTabAreaConfig(config, renderer, document);\n    } else {\n      node = realizeSplitAreaConfig(config, renderer, document);\n    }\n    return node;\n  }\n\n  /**\n   * A layout node which holds the data for a tabbed area.\n   */\n  export class TabLayoutNode {\n    /**\n     * Construct a new tab layout node.\n     *\n     * @param tabBar - The tab bar to use for the layout node.\n     */\n    constructor(tabBar: TabBar<Widget>) {\n      let tabSizer = new BoxSizer();\n      let widgetSizer = new BoxSizer();\n      tabSizer.stretch = 0;\n      widgetSizer.stretch = 1;\n      this.tabBar = tabBar;\n      this.sizers = [tabSizer, widgetSizer];\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * The tab bar for the layout node.\n     */\n    readonly tabBar: TabBar<Widget>;\n\n    /**\n     * The sizers for the layout node.\n     */\n    readonly sizers: [BoxSizer, BoxSizer];\n\n    /**\n     * The most recent value for the `top` edge of the layout box.\n     */\n    get top(): number {\n      return this._top;\n    }\n\n    /**\n     * The most recent value for the `left` edge of the layout box.\n     */\n    get left(): number {\n      return this._left;\n    }\n\n    /**\n     * The most recent value for the `width` of the layout box.\n     */\n    get width(): number {\n      return this._width;\n    }\n\n    /**\n     * The most recent value for the `height` of the layout box.\n     */\n    get height(): number {\n      return this._height;\n    }\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      yield this.tabBar;\n      yield* this.iterUserWidgets();\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const title of this.tabBar.titles) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      let title = this.tabBar.currentTitle;\n      if (title) {\n        yield title.owner;\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      yield this.tabBar;\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    // eslint-disable-next-line require-yield\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      return;\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      return this;\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      if (x < this._left || x >= this._left + this._width) {\n        return null;\n      }\n      if (y < this._top || y >= this._top + this._height) {\n        return null;\n      }\n      return this;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ITabAreaConfig {\n      let widgets = this.tabBar.titles.map(title => title.owner);\n      let currentIndex = this.tabBar.currentIndex;\n      return { type: 'tab-area', widgets, currentIndex };\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      return;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Set up the limit variables.\n      let minWidth = 0;\n      let minHeight = 0;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Lookup the tab bar and widget sizers.\n      let [tabBarSizer, widgetSizer] = this.sizers;\n\n      // Update the tab bar limits.\n      if (tabBarItem) {\n        tabBarItem.fit();\n      }\n\n      // Update the widget limits.\n      if (widgetItem) {\n        widgetItem.fit();\n      }\n\n      // Update the results and sizer for the tab bar.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        minWidth = Math.max(minWidth, tabBarItem.minWidth);\n        minHeight += tabBarItem.minHeight;\n        tabBarSizer.minSize = tabBarItem.minHeight;\n        tabBarSizer.maxSize = tabBarItem.maxHeight;\n      } else {\n        tabBarSizer.minSize = 0;\n        tabBarSizer.maxSize = 0;\n      }\n\n      // Update the results and sizer for the current widget.\n      if (widgetItem && !widgetItem.isHidden) {\n        minWidth = Math.max(minWidth, widgetItem.minWidth);\n        minHeight += widgetItem.minHeight;\n        widgetSizer.minSize = widgetItem.minHeight;\n        widgetSizer.maxSize = Infinity;\n      } else {\n        widgetSizer.minSize = 0;\n        widgetSizer.maxSize = Infinity;\n      }\n\n      // Return the computed size limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Update the layout box values.\n      this._top = top;\n      this._left = left;\n      this._width = width;\n      this._height = height;\n\n      // Lookup the tab bar layout item.\n      let tabBarItem = items.get(this.tabBar);\n\n      // Lookup the widget layout item.\n      let current = this.tabBar.currentTitle;\n      let widgetItem = current ? items.get(current.owner) : undefined;\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, height);\n\n      // Update the tab bar item using the computed size.\n      if (tabBarItem && !tabBarItem.isHidden) {\n        let size = this.sizers[0].size;\n        tabBarItem.update(left, top, width, size);\n        top += size;\n      }\n\n      // Layout the widget using the computed size.\n      if (widgetItem && !widgetItem.isHidden) {\n        let size = this.sizers[1].size;\n        widgetItem.update(left, top, width, size);\n      }\n    }\n\n    private _top = 0;\n    private _left = 0;\n    private _width = 0;\n    private _height = 0;\n  }\n\n  /**\n   * A layout node which holds the data for a split area.\n   */\n  export class SplitLayoutNode {\n    /**\n     * Construct a new split layout node.\n     *\n     * @param orientation - The orientation of the node.\n     */\n    constructor(orientation: Orientation) {\n      this.orientation = orientation;\n    }\n\n    /**\n     * The parent of the layout node.\n     */\n    parent: SplitLayoutNode | null = null;\n\n    /**\n     * Whether the sizers have been normalized.\n     */\n    normalized = false;\n\n    /**\n     * The orientation of the node.\n     */\n    readonly orientation: Orientation;\n\n    /**\n     * The child nodes for the split node.\n     */\n    readonly children: LayoutNode[] = [];\n\n    /**\n     * The box sizers for the layout children.\n     */\n    readonly sizers: BoxSizer[] = [];\n\n    /**\n     * The handles for the layout children.\n     */\n    readonly handles: HTMLDivElement[] = [];\n\n    /**\n     * Create an iterator for all widgets in the layout tree.\n     */\n    *iterAllWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterAllWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the user widgets in the layout tree.\n     */\n    *iterUserWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterUserWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the selected widgets in the layout tree.\n     */\n    *iterSelectedWidgets(): IterableIterator<Widget> {\n      for (const child of this.children) {\n        yield* child.iterSelectedWidgets();\n      }\n    }\n\n    /**\n     * Create an iterator for the tab bars in the layout tree.\n     */\n    *iterTabBars(): IterableIterator<TabBar<Widget>> {\n      for (const child of this.children) {\n        yield* child.iterTabBars();\n      }\n    }\n\n    /**\n     * Create an iterator for the handles in the layout tree.\n     */\n    *iterHandles(): IterableIterator<HTMLDivElement> {\n      yield* this.handles;\n      for (const child of this.children) {\n        yield* child.iterHandles();\n      }\n    }\n\n    /**\n     * Find the tab layout node which contains the given widget.\n     */\n    findTabNode(widget: Widget): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findTabNode(widget);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the split layout node which contains the given handle.\n     */\n    findSplitNode(\n      handle: HTMLDivElement\n    ): { index: number; node: SplitLayoutNode } | null {\n      let index = this.handles.indexOf(handle);\n      if (index !== -1) {\n        return { index, node: this };\n      }\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].findSplitNode(handle);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Find the first tab layout node in a layout tree.\n     */\n    findFirstTabNode(): TabLayoutNode | null {\n      if (this.children.length === 0) {\n        return null;\n      }\n      return this.children[0].findFirstTabNode();\n    }\n\n    /**\n     * Find the tab layout node which contains the local point.\n     */\n    hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let result = this.children[i].hitTestTabNodes(x, y);\n        if (result) {\n          return result;\n        }\n      }\n      return null;\n    }\n\n    /**\n     * Create a configuration object for the layout tree.\n     */\n    createConfig(): DockLayout.ISplitAreaConfig {\n      let orientation = this.orientation;\n      let sizes = this.createNormalizedSizes();\n      let children = this.children.map(child => child.createConfig());\n      return { type: 'split-area', orientation, children, sizes };\n    }\n\n    /**\n     * Sync the visibility and orientation of the handles.\n     */\n    syncHandles(): void {\n      this.handles.forEach((handle, i) => {\n        handle.setAttribute('data-orientation', this.orientation);\n        if (i === this.handles.length - 1) {\n          handle.classList.add('lm-mod-hidden');\n        } else {\n          handle.classList.remove('lm-mod-hidden');\n        }\n      });\n    }\n\n    /**\n     * Hold the current sizes of the box sizers.\n     *\n     * This sets the size hint of each sizer to its current size.\n     */\n    holdSizes(): void {\n      for (const sizer of this.sizers) {\n        sizer.sizeHint = sizer.size;\n      }\n    }\n\n    /**\n     * Recursively hold all of the sizes in the layout tree.\n     *\n     * This ignores the sizers of tab layout nodes.\n     */\n    holdAllSizes(): void {\n      for (const child of this.children) {\n        child.holdAllSizes();\n      }\n      this.holdSizes();\n    }\n\n    /**\n     * Normalize the sizes of the split layout node.\n     */\n    normalizeSizes(): void {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return;\n      }\n\n      // Hold the current sizes of the sizers.\n      this.holdSizes();\n\n      // Compute the sum of the sizes.\n      let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint = 1 / n;\n        }\n      } else {\n        for (const sizer of this.sizers) {\n          sizer.size = sizer.sizeHint /= sum;\n        }\n      }\n\n      // Mark the sizes as normalized.\n      this.normalized = true;\n    }\n\n    /**\n     * Snap the normalized sizes of the split layout node.\n     */\n    createNormalizedSizes(): number[] {\n      // Bail early if the sizers are empty.\n      let n = this.sizers.length;\n      if (n === 0) {\n        return [];\n      }\n\n      // Grab the current sizes of the sizers.\n      let sizes = this.sizers.map(sizer => sizer.size);\n\n      // Compute the sum of the sizes.\n      let sum = sizes.reduce((v, size) => v + size, 0);\n\n      // Normalize the sizes based on the sum.\n      if (sum === 0) {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] = 1 / n;\n        }\n      } else {\n        for (let i = sizes.length - 1; i > -1; i--) {\n          sizes[i] /= sum;\n        }\n      }\n\n      // Return the normalized sizes.\n      return sizes;\n    }\n\n    /**\n     * Fit the layout tree.\n     */\n    fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n      // Compute the required fixed space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n      // Set up the limit variables.\n      let minWidth = horizontal ? fixed : 0;\n      let minHeight = horizontal ? 0 : fixed;\n      let maxWidth = Infinity;\n      let maxHeight = Infinity;\n\n      // Fit the children and update the limits.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let limits = this.children[i].fit(spacing, items);\n        if (horizontal) {\n          minHeight = Math.max(minHeight, limits.minHeight);\n          minWidth += limits.minWidth;\n          this.sizers[i].minSize = limits.minWidth;\n        } else {\n          minWidth = Math.max(minWidth, limits.minWidth);\n          minHeight += limits.minHeight;\n          this.sizers[i].minSize = limits.minHeight;\n        }\n      }\n\n      // Return the computed limits for the layout node.\n      return { minWidth, minHeight, maxWidth, maxHeight };\n    }\n\n    /**\n     * Update the layout tree.\n     */\n    update(\n      left: number,\n      top: number,\n      width: number,\n      height: number,\n      spacing: number,\n      items: ItemMap\n    ): void {\n      // Compute the available layout space.\n      let horizontal = this.orientation === 'horizontal';\n      let fixed = Math.max(0, this.children.length - 1) * spacing;\n      let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n      // De-normalize the sizes if needed.\n      if (this.normalized) {\n        for (const sizer of this.sizers) {\n          sizer.sizeHint *= space;\n        }\n        this.normalized = false;\n      }\n\n      // Distribute the layout space to the sizers.\n      BoxEngine.calc(this.sizers, space);\n\n      // Update the geometry of the child nodes and handles.\n      for (let i = 0, n = this.children.length; i < n; ++i) {\n        let child = this.children[i];\n        let size = this.sizers[i].size;\n        let handleStyle = this.handles[i].style;\n        if (horizontal) {\n          child.update(left, top, size, height, spacing, items);\n          left += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${spacing}px`;\n          handleStyle.height = `${height}px`;\n          left += spacing;\n        } else {\n          child.update(left, top, width, size, spacing, items);\n          top += size;\n          handleStyle.top = `${top}px`;\n          handleStyle.left = `${left}px`;\n          handleStyle.width = `${width}px`;\n          handleStyle.height = `${spacing}px`;\n          top += spacing;\n        }\n      }\n    }\n  }\n\n  export function addAria(widget: Widget, tabBar: TabBar<Widget>): void {\n    widget.node.setAttribute('role', 'tabpanel');\n    let renderer = tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  export function removeAria(widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n  }\n\n  /**\n   * Normalize a tab area config and collect the visited widgets.\n   */\n  function normalizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.ITabAreaConfig | null {\n    // Bail early if there is no content.\n    if (config.widgets.length === 0) {\n      return null;\n    }\n\n    // Setup the filtered widgets array.\n    let widgets: Widget[] = [];\n\n    // Filter the config for unique widgets.\n    for (const widget of config.widgets) {\n      if (!widgetSet.has(widget)) {\n        widgetSet.add(widget);\n        widgets.push(widget);\n      }\n    }\n\n    // Bail if there are no effective widgets.\n    if (widgets.length === 0) {\n      return null;\n    }\n\n    // Normalize the current index.\n    let index = config.currentIndex;\n    if (index !== -1 && (index < 0 || index >= widgets.length)) {\n      index = 0;\n    }\n\n    // Return a normalized config object.\n    return { type: 'tab-area', widgets, currentIndex: index };\n  }\n\n  /**\n   * Normalize a split area config and collect the visited widgets.\n   */\n  function normalizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    widgetSet: Set<Widget>\n  ): DockLayout.AreaConfig | null {\n    // Set up the result variables.\n    let orientation = config.orientation;\n    let children: DockLayout.AreaConfig[] = [];\n    let sizes: number[] = [];\n\n    // Normalize the config children.\n    for (let i = 0, n = config.children.length; i < n; ++i) {\n      // Normalize the child config.\n      let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n      // Ignore an empty child.\n      if (!child) {\n        continue;\n      }\n\n      // Add the child or hoist its content as appropriate.\n      if (child.type === 'tab-area' || child.orientation !== orientation) {\n        children.push(child);\n        sizes.push(Math.abs(config.sizes[i] || 0));\n      } else {\n        children.push(...child.children);\n        sizes.push(...child.sizes);\n      }\n    }\n\n    // Bail if there are no effective children.\n    if (children.length === 0) {\n      return null;\n    }\n\n    // If there is only one effective child, return that child.\n    if (children.length === 1) {\n      return children[0];\n    }\n\n    // Return a normalized config object.\n    return { type: 'split-area', orientation, children, sizes };\n  }\n\n  /**\n   * Convert a normalized tab area config into a layout tree.\n   */\n  function realizeTabAreaConfig(\n    config: DockLayout.ITabAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): TabLayoutNode {\n    // Create the tab bar for the layout node.\n    let tabBar = renderer.createTabBar(document);\n\n    // Hide each widget and add it to the tab bar.\n    for (const widget of config.widgets) {\n      widget.hide();\n      tabBar.addTab(widget.title);\n      Private.addAria(widget, tabBar);\n    }\n\n    // Set the current index of the tab bar.\n    tabBar.currentIndex = config.currentIndex;\n\n    // Return the new tab layout node.\n    return new TabLayoutNode(tabBar);\n  }\n\n  /**\n   * Convert a normalized split area config into a layout tree.\n   */\n  function realizeSplitAreaConfig(\n    config: DockLayout.ISplitAreaConfig,\n    renderer: DockLayout.IRenderer,\n    document: Document | ShadowRoot\n  ): SplitLayoutNode {\n    // Create the split layout node.\n    let node = new SplitLayoutNode(config.orientation);\n\n    // Add each child to the layout node.\n    config.children.forEach((child, i) => {\n      // Create the child data for the layout node.\n      let childNode = realizeAreaConfig(child, renderer, document);\n      let sizer = createSizer(config.sizes[i]);\n      let handle = renderer.createHandle();\n\n      // Add the child data to the layout node.\n      node.children.push(childNode);\n      node.handles.push(handle);\n      node.sizers.push(sizer);\n\n      // Update the parent for the child node.\n      childNode.parent = node;\n    });\n\n    // Synchronize the handle state for the layout node.\n    node.syncHandles();\n\n    // Normalize the sizes for the layout node.\n    node.normalizeSizes();\n\n    // Return the new layout node.\n    return node;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n  /**\n   * Construct a new dock panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: DockPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-DockPanel');\n    this._document = options.document || document;\n    this._mode = options.mode || 'multiple-document';\n    this._renderer = options.renderer || DockPanel.defaultRenderer;\n    this._edges = options.edges || Private.DEFAULT_EDGES;\n    if (options.tabsMovable !== undefined) {\n      this._tabsMovable = options.tabsMovable;\n    }\n    if (options.tabsConstrained !== undefined) {\n      this._tabsConstrained = options.tabsConstrained;\n    }\n    if (options.addButtonEnabled !== undefined) {\n      this._addButtonEnabled = options.addButtonEnabled;\n    }\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = this._mode;\n\n    // Create the delegate renderer for the layout.\n    let renderer: DockPanel.IRenderer = {\n      createTabBar: () => this._createTabBar(),\n      createHandle: () => this._createHandle()\n    };\n\n    // Set up the dock layout for the panel.\n    this.layout = new DockLayout({\n      document: this._document,\n      renderer,\n      spacing: options.spacing,\n      hiddenMode: options.hiddenMode\n    });\n\n    // Set up the overlay drop indicator.\n    this.overlay = options.overlay || new DockPanel.Overlay();\n    this.node.appendChild(this.overlay.node);\n  }\n\n  /**\n   * Dispose of the resources held by the panel.\n   */\n  dispose(): void {\n    // Ensure the mouse is released.\n    this._releaseMouse();\n\n    // Hide the overlay.\n    this.overlay.hide(0);\n\n    // Cancel a drag if one is in progress.\n    if (this._drag) {\n      this._drag.dispose();\n    }\n\n    // Dispose of the base class.\n    super.dispose();\n  }\n\n  /**\n   * The method for hiding widgets.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as DockLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as DockLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when the layout configuration is modified.\n   *\n   * #### Notes\n   * This signal is emitted whenever the current layout configuration\n   * may have changed.\n   *\n   * This signal is emitted asynchronously in a collapsed fashion, so\n   * that multiple synchronous modifications results in only a single\n   * emit of the signal.\n   */\n  get layoutModified(): ISignal<this, void> {\n    return this._layoutModified;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The overlay used by the dock panel.\n   */\n  readonly overlay: DockPanel.IOverlay;\n\n  /**\n   * The renderer used by the dock panel.\n   */\n  get renderer(): DockPanel.IRenderer {\n    return (this.layout as DockLayout).renderer;\n  }\n\n  /**\n   * Get the spacing between the widgets.\n   */\n  get spacing(): number {\n    return (this.layout as DockLayout).spacing;\n  }\n\n  /**\n   * Set the spacing between the widgets.\n   */\n  set spacing(value: number) {\n    (this.layout as DockLayout).spacing = value;\n  }\n\n  /**\n   * Get the mode for the dock panel.\n   */\n  get mode(): DockPanel.Mode {\n    return this._mode;\n  }\n\n  /**\n   * Set the mode for the dock panel.\n   *\n   * #### Notes\n   * Changing the mode is a destructive operation with respect to the\n   * panel's layout configuration. If layout state must be preserved,\n   * save the current layout config before changing the mode.\n   */\n  set mode(value: DockPanel.Mode) {\n    // Bail early if the mode does not change.\n    if (this._mode === value) {\n      return;\n    }\n\n    // Update the internal mode.\n    this._mode = value;\n\n    // Toggle the CSS mode attribute.\n    this.dataset['mode'] = value;\n\n    // Get the layout for the panel.\n    let layout = this.layout as DockLayout;\n\n    // Configure the layout for the specified mode.\n    switch (value) {\n      case 'multiple-document':\n        for (const tabBar of layout.tabBars()) {\n          tabBar.show();\n        }\n        break;\n      case 'single-document':\n        layout.restoreLayout(Private.createSingleDocumentConfig(this));\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Whether the tabs can be dragged / moved at runtime.\n   */\n  get tabsMovable(): boolean {\n    return this._tabsMovable;\n  }\n\n  /**\n   * Enable / Disable draggable / movable tabs.\n   */\n  set tabsMovable(value: boolean) {\n    this._tabsMovable = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.tabsMovable = value;\n    }\n  }\n\n  /**\n   * Whether the tabs are constrained to their source dock panel\n   */\n  get tabsConstrained(): boolean {\n    return this._tabsConstrained;\n  }\n\n  /**\n   * Constrain/Allow tabs to be dragged outside of this dock panel\n   */\n  set tabsConstrained(value: boolean) {\n    this._tabsConstrained = value;\n  }\n\n  /**\n   * Whether the add buttons for each tab bar are enabled.\n   */\n  get addButtonEnabled(): boolean {\n    return this._addButtonEnabled;\n  }\n\n  /**\n   * Set whether the add buttons for each tab bar are enabled.\n   */\n  set addButtonEnabled(value: boolean) {\n    this._addButtonEnabled = value;\n    for (const tabBar of this.tabBars()) {\n      tabBar.addButtonEnabled = value;\n    }\n  }\n\n  /**\n   * Whether the dock panel is empty.\n   */\n  get isEmpty(): boolean {\n    return (this.layout as DockLayout).isEmpty;\n  }\n\n  /**\n   * Create an iterator over the user widgets in the panel.\n   *\n   * @returns A new iterator over the user widgets in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the generated tab bars.\n   */\n  *widgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).widgets();\n  }\n\n  /**\n   * Create an iterator over the selected widgets in the panel.\n   *\n   * @returns A new iterator over the selected user widgets.\n   *\n   * #### Notes\n   * This iterator yields the widgets corresponding to the current tab\n   * of each tab bar in the panel.\n   */\n  *selectedWidgets(): IterableIterator<Widget> {\n    yield* (this.layout as DockLayout).selectedWidgets();\n  }\n\n  /**\n   * Create an iterator over the tab bars in the panel.\n   *\n   * @returns A new iterator over the tab bars in the panel.\n   *\n   * #### Notes\n   * This iterator does not include the user widgets.\n   */\n  *tabBars(): IterableIterator<TabBar<Widget>> {\n    yield* (this.layout as DockLayout).tabBars();\n  }\n\n  /**\n   * Create an iterator over the handles in the panel.\n   *\n   * @returns A new iterator over the handles in the panel.\n   */\n  *handles(): IterableIterator<HTMLDivElement> {\n    yield* (this.layout as DockLayout).handles();\n  }\n\n  /**\n   * Select a specific widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will make the widget the current widget in its tab area.\n   */\n  selectWidget(widget: Widget): void {\n    // Find the tab bar which contains the widget.\n    let tabBar = find(this.tabBars(), bar => {\n      return bar.titles.indexOf(widget.title) !== -1;\n    });\n\n    // Throw an error if no tab bar is found.\n    if (!tabBar) {\n      throw new Error('Widget is not contained in the dock panel.');\n    }\n\n    // Ensure the widget is the current widget.\n    tabBar.currentTitle = widget.title;\n  }\n\n  /**\n   * Activate a specified widget in the dock panel.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * This will select and activate the given widget.\n   */\n  activateWidget(widget: Widget): void {\n    this.selectWidget(widget);\n    widget.activate();\n  }\n\n  /**\n   * Save the current layout configuration of the dock panel.\n   *\n   * @returns A new config object for the current layout state.\n   *\n   * #### Notes\n   * The return value can be provided to the `restoreLayout` method\n   * in order to restore the layout to its current configuration.\n   */\n  saveLayout(): DockPanel.ILayoutConfig {\n    return (this.layout as DockLayout).saveLayout();\n  }\n\n  /**\n   * Restore the layout to a previously saved configuration.\n   *\n   * @param config - The layout configuration to restore.\n   *\n   * #### Notes\n   * Widgets which currently belong to the layout but which are not\n   * contained in the config will be unparented.\n   *\n   * The dock panel automatically reverts to `'multiple-document'`\n   * mode when a layout config is restored.\n   */\n  restoreLayout(config: DockPanel.ILayoutConfig): void {\n    // Reset the mode.\n    this._mode = 'multiple-document';\n\n    // Restore the layout.\n    (this.layout as DockLayout).restoreLayout(config);\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Add a widget to the dock panel.\n   *\n   * @param widget - The widget to add to the dock panel.\n   *\n   * @param options - The additional options for adding the widget.\n   *\n   * #### Notes\n   * If the panel is in single document mode, the options are ignored\n   * and the widget is always added as tab in the hidden tab bar.\n   */\n  addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n    // Add the widget to the layout.\n    if (this._mode === 'single-document') {\n      (this.layout as DockLayout).addWidget(widget);\n    } else {\n      (this.layout as DockLayout).addWidget(widget, options);\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Process a message sent to the widget.\n   *\n   * @param msg - The message sent to the widget.\n   */\n  processMessage(msg: Message): void {\n    if (msg.type === 'layout-modified') {\n      this._layoutModified.emit(undefined);\n    } else {\n      super.processMessage(msg);\n    }\n  }\n\n  /**\n   * Handle the DOM events for the dock panel.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the panel's DOM node. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'lm-dragenter':\n        this._evtDragEnter(event as Drag.Event);\n        break;\n      case 'lm-dragleave':\n        this._evtDragLeave(event as Drag.Event);\n        break;\n      case 'lm-dragover':\n        this._evtDragOver(event as Drag.Event);\n        break;\n      case 'lm-drop':\n        this._evtDrop(event as Drag.Event);\n        break;\n      case 'pointerdown':\n        this._evtPointerDown(event as PointerEvent);\n        break;\n      case 'pointermove':\n        this._evtPointerMove(event as PointerEvent);\n        break;\n      case 'pointerup':\n        this._evtPointerUp(event as PointerEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('lm-dragenter', this);\n    this.node.addEventListener('lm-dragleave', this);\n    this.node.addEventListener('lm-dragover', this);\n    this.node.addEventListener('lm-drop', this);\n    this.node.addEventListener('pointerdown', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('lm-dragenter', this);\n    this.node.removeEventListener('lm-dragleave', this);\n    this.node.removeEventListener('lm-dragover', this);\n    this.node.removeEventListener('lm-drop', this);\n    this.node.removeEventListener('pointerdown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Add the widget class to the child.\n    msg.child.addClass('lm-DockPanel-widget');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    // Ignore the generated tab bars.\n    if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n      return;\n    }\n\n    // Remove the widget class from the child.\n    msg.child.removeClass('lm-DockPanel-widget');\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `'lm-dragenter'` event for the dock panel.\n   */\n  private _evtDragEnter(event: Drag.Event): void {\n    // If the factory mime type is present, mark the event as\n    // handled in order to get the rest of the drag events.\n    if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n  }\n\n  /**\n   * Handle the `'lm-dragleave'` event for the dock panel.\n   */\n  private _evtDragLeave(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    if (this._tabsConstrained && event.source !== this) return;\n\n    event.stopPropagation();\n\n    // The new target might be a descendant, so we might still handle the drop.\n    // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n    // hide is cancelled by the lm-dragover handler's show overlay logic.\n    this.overlay.hide(1);\n  }\n\n  /**\n   * Handle the `'lm-dragover'` event for the dock panel.\n   */\n  private _evtDragOver(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Show the drop indicator overlay and update the drop\n    // action based on the drop target zone under the mouse.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      this._showOverlay(event.clientX, event.clientY) === 'invalid'\n    ) {\n      event.dropAction = 'none';\n    } else {\n      event.stopPropagation();\n      event.dropAction = event.proposedAction;\n    }\n  }\n\n  /**\n   * Handle the `'lm-drop'` event for the dock panel.\n   */\n  private _evtDrop(event: Drag.Event): void {\n    // Mark the event as handled.\n    event.preventDefault();\n\n    // Hide the drop indicator overlay.\n    this.overlay.hide(0);\n\n    // Bail if the proposed action is to do nothing.\n    if (event.proposedAction === 'none') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the drop target under the mouse.\n    let { clientX, clientY } = event;\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // Bail if the drop zone is invalid.\n    if (\n      (this._tabsConstrained && event.source !== this) ||\n      zone === 'invalid'\n    ) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory mime type has invalid data.\n    let mimeData = event.mimeData;\n    let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n    if (typeof factory !== 'function') {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the factory does not produce a widget.\n    let widget = factory();\n    if (!(widget instanceof Widget)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Bail if the widget is an ancestor of the dock panel.\n    if (widget.contains(this)) {\n      event.dropAction = 'none';\n      return;\n    }\n\n    // Find the reference widget for the drop target.\n    let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n    // Add the widget according to the indicated drop zone.\n    switch (zone) {\n      case 'root-all':\n        this.addWidget(widget);\n        break;\n      case 'root-top':\n        this.addWidget(widget, { mode: 'split-top' });\n        break;\n      case 'root-left':\n        this.addWidget(widget, { mode: 'split-left' });\n        break;\n      case 'root-right':\n        this.addWidget(widget, { mode: 'split-right' });\n        break;\n      case 'root-bottom':\n        this.addWidget(widget, { mode: 'split-bottom' });\n        break;\n      case 'widget-all':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      case 'widget-top':\n        this.addWidget(widget, { mode: 'split-top', ref });\n        break;\n      case 'widget-left':\n        this.addWidget(widget, { mode: 'split-left', ref });\n        break;\n      case 'widget-right':\n        this.addWidget(widget, { mode: 'split-right', ref });\n        break;\n      case 'widget-bottom':\n        this.addWidget(widget, { mode: 'split-bottom', ref });\n        break;\n      case 'widget-tab':\n        this.addWidget(widget, { mode: 'tab-after', ref });\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Accept the proposed drop action.\n    event.dropAction = event.proposedAction;\n\n    // Stop propagation if we have not bailed so far.\n    event.stopPropagation();\n\n    // Activate the dropped widget.\n    this.activateWidget(widget);\n  }\n\n  /**\n   * Handle the `'keydown'` event for the dock panel.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse if `Escape` is pressed.\n    if (event.keyCode === 27) {\n      // Finalize the mouse release.\n      this._releaseMouse();\n\n      // Schedule an emit of the layout modified signal.\n      MessageLoop.postMessage(this, Private.LayoutModified);\n    }\n  }\n\n  /**\n   * Handle the `'pointerdown'` event for the dock panel.\n   */\n  private _evtPointerDown(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not pressed.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Find the handle which contains the mouse target, if any.\n    let layout = this.layout as DockLayout;\n    let target = event.target as HTMLElement;\n    let handle = find(layout.handles(), handle => handle.contains(target));\n    if (!handle) {\n      return;\n    }\n\n    // Stop the event when a handle is pressed.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Add the extra document listeners.\n    this._document.addEventListener('keydown', this, true);\n    this._document.addEventListener('pointerup', this, true);\n    this._document.addEventListener('pointermove', this, true);\n    this._document.addEventListener('contextmenu', this, true);\n\n    // Compute the offset deltas for the handle press.\n    let rect = handle.getBoundingClientRect();\n    let deltaX = event.clientX - rect.left;\n    let deltaY = event.clientY - rect.top;\n\n    // Override the cursor and store the press data.\n    let style = window.getComputedStyle(handle);\n    let override = Drag.overrideCursor(style.cursor!, this._document);\n    this._pressData = { handle, deltaX, deltaY, override };\n  }\n\n  /**\n   * Handle the `'pointermove'` event for the dock panel.\n   */\n  private _evtPointerMove(event: PointerEvent): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event when dragging a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Compute the desired offset position for the handle.\n    let rect = this.node.getBoundingClientRect();\n    let xPos = event.clientX - rect.left - this._pressData.deltaX;\n    let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n    // Set the handle as close to the desired position as possible.\n    let layout = this.layout as DockLayout;\n    layout.moveHandle(this._pressData.handle, xPos, yPos);\n  }\n\n  /**\n   * Handle the `'pointerup'` event for the dock panel.\n   */\n  private _evtPointerUp(event: PointerEvent): void {\n    // Do nothing if the left mouse button is not released.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event when releasing a handle.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Finalize the mouse release.\n    this._releaseMouse();\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Release the mouse grab for the dock panel.\n   */\n  private _releaseMouse(): void {\n    // Bail early if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the override cursor.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra document listeners.\n    this._document.removeEventListener('keydown', this, true);\n    this._document.removeEventListener('pointerup', this, true);\n    this._document.removeEventListener('pointermove', this, true);\n    this._document.removeEventListener('contextmenu', this, true);\n  }\n\n  /**\n   * Show the overlay indicator at the given client position.\n   *\n   * Returns the drop zone at the specified client position.\n   *\n   * #### Notes\n   * If the position is not over a valid zone, the overlay is hidden.\n   */\n  private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n    // Find the dock target for the given client position.\n    let { zone, target } = Private.findDropTarget(\n      this,\n      clientX,\n      clientY,\n      this._edges\n    );\n\n    // If the drop zone is invalid, hide the overlay and bail.\n    if (zone === 'invalid') {\n      this.overlay.hide(100);\n      return zone;\n    }\n\n    // Setup the variables needed to compute the overlay geometry.\n    let top: number;\n    let left: number;\n    let right: number;\n    let bottom: number;\n    let box = ElementExt.boxSizing(this.node); // TODO cache this?\n    let rect = this.node.getBoundingClientRect();\n\n    // Compute the overlay geometry based on the dock zone.\n    switch (zone) {\n      case 'root-all':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-top':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = rect.height * Private.GOLDEN_RATIO;\n        break;\n      case 'root-left':\n        top = box.paddingTop;\n        left = box.paddingLeft;\n        right = rect.width * Private.GOLDEN_RATIO;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-right':\n        top = box.paddingTop;\n        left = rect.width * Private.GOLDEN_RATIO;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'root-bottom':\n        top = rect.height * Private.GOLDEN_RATIO;\n        left = box.paddingLeft;\n        right = box.paddingRight;\n        bottom = box.paddingBottom;\n        break;\n      case 'widget-all':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-top':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height / 2;\n        break;\n      case 'widget-left':\n        top = target!.top;\n        left = target!.left;\n        right = target!.right + target!.width / 2;\n        bottom = target!.bottom;\n        break;\n      case 'widget-right':\n        top = target!.top;\n        left = target!.left + target!.width / 2;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-bottom':\n        top = target!.top + target!.height / 2;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom;\n        break;\n      case 'widget-tab': {\n        const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n        top = target!.top;\n        left = target!.left;\n        right = target!.right;\n        bottom = target!.bottom + target!.height - tabHeight;\n        break;\n      }\n      default:\n        throw 'unreachable';\n    }\n\n    // Show the overlay with the computed geometry.\n    this.overlay.show({ top, left, right, bottom });\n\n    // Finally, return the computed drop zone.\n    return zone;\n  }\n\n  /**\n   * Create a new tab bar for use by the panel.\n   */\n  private _createTabBar(): TabBar<Widget> {\n    // Create the tab bar.\n    let tabBar = this._renderer.createTabBar(this._document);\n\n    // Set the generated tab bar property for the tab bar.\n    Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n    // Hide the tab bar when in single document mode.\n    if (this._mode === 'single-document') {\n      tabBar.hide();\n    }\n\n    // Enforce necessary tab bar behavior.\n    // TODO do we really want to enforce *all* of these?\n    tabBar.tabsMovable = this._tabsMovable;\n    tabBar.allowDeselect = false;\n    tabBar.addButtonEnabled = this._addButtonEnabled;\n    tabBar.removeBehavior = 'select-previous-tab';\n    tabBar.insertBehavior = 'select-tab-if-needed';\n\n    // Connect the signal handlers for the tab bar.\n    tabBar.tabMoved.connect(this._onTabMoved, this);\n    tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n    tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n    tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Return the initialized tab bar.\n    return tabBar;\n  }\n\n  /**\n   * Create a new handle for use by the panel.\n   */\n  private _createHandle(): HTMLDivElement {\n    return this._renderer.createHandle();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from a tab bar.\n   */\n  private _onTabMoved(): void {\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `currentChanged` signal from a tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousTitle, currentTitle } = args;\n\n    // Hide the previous widget.\n    if (previousTitle) {\n      previousTitle.owner.hide();\n    }\n\n    // Show the current widget.\n    if (currentTitle) {\n      currentTitle.owner.show();\n    }\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n\n    // Schedule an emit of the layout modified signal.\n    MessageLoop.postMessage(this, Private.LayoutModified);\n  }\n\n  /**\n   * Handle the `addRequested` signal from a tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from a tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from a tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabDetachRequested` signal from a tab bar.\n   */\n  private _onTabDetachRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabDetachRequestedArgs<Widget>\n  ): void {\n    // Do nothing if a drag is already in progress.\n    if (this._drag) {\n      return;\n    }\n\n    // Release the tab bar's hold on the mouse.\n    sender.releaseMouse();\n\n    // Extract the data from the args.\n    let { title, tab, clientX, clientY, offset } = args;\n\n    // Setup the mime data for the drag operation.\n    let mimeData = new MimeData();\n    let factory = () => title.owner;\n    mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n    // Create the drag image for the drag operation.\n    let dragImage = tab.cloneNode(true) as HTMLElement;\n    if (offset) {\n      dragImage.style.top = `-${offset.y}px`;\n      dragImage.style.left = `-${offset.x}px`;\n    }\n\n    // Create the drag object to manage the drag-drop operation.\n    this._drag = new Drag({\n      document: this._document,\n      mimeData,\n      dragImage,\n      proposedAction: 'move',\n      supportedActions: 'move',\n      source: this\n    });\n\n    // Hide the tab node in the original tab.\n    tab.classList.add('lm-mod-hidden');\n    let cleanup = () => {\n      this._drag = null;\n      tab.classList.remove('lm-mod-hidden');\n    };\n\n    // Start the drag operation and cleanup when done.\n    this._drag.start(clientX, clientY).then(cleanup);\n  }\n\n  private _edges: DockPanel.IEdges;\n  private _document: Document | ShadowRoot;\n  private _mode: DockPanel.Mode;\n  private _drag: Drag | null = null;\n  private _renderer: DockPanel.IRenderer;\n  private _tabsMovable: boolean = true;\n  private _tabsConstrained: boolean = false;\n  private _addButtonEnabled: boolean = false;\n  private _pressData: Private.IPressData | null = null;\n  private _layoutModified = new Signal<this, void>(this);\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n  /**\n   * An options object for creating a dock panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the dock panel.\n     *\n     * The default is the global `document` instance.\n     */\n\n    document?: Document | ShadowRoot;\n    /**\n     * The overlay to use with the dock panel.\n     *\n     * The default is a new `Overlay` instance.\n     */\n    overlay?: IOverlay;\n\n    /**\n     * The renderer to use for the dock panel.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n\n    /**\n     * The spacing between the items in the panel.\n     *\n     * The default is `4`.\n     */\n    spacing?: number;\n\n    /**\n     * The mode for the dock panel.\n     *\n     * The default is `'multiple-document'`.\n     */\n    mode?: DockPanel.Mode;\n\n    /**\n     * The sizes of the edge drop zones, in pixels.\n     * If not given, default values will be used.\n     */\n    edges?: IEdges;\n\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n\n    /**\n     * Allow tabs to be draggable / movable by user.\n     *\n     * The default is `'true'`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Constrain tabs to this dock panel\n     *\n     * The default is `'false'`.\n     */\n    tabsConstrained?: boolean;\n\n    /**\n     * Enable add buttons in each of the dock panel's tab bars.\n     *\n     * The default is `'false'`.\n     */\n    addButtonEnabled?: boolean;\n  }\n\n  /**\n   * The sizes of the edge drop zones, in pixels.\n   */\n  export interface IEdges {\n    /**\n     * The size of the top edge drop zone.\n     */\n    top: number;\n\n    /**\n     * The size of the right edge drop zone.\n     */\n    right: number;\n\n    /**\n     * The size of the bottom edge drop zone.\n     */\n    bottom: number;\n\n    /**\n     * The size of the left edge drop zone.\n     */\n    left: number;\n  }\n\n  /**\n   * A type alias for the supported dock panel modes.\n   */\n  export type Mode =\n    | /**\n     * The single document mode.\n     *\n     * In this mode, only a single widget is visible at a time, and that\n     * widget fills the available layout space. No tab bars are visible.\n     */\n    'single-document'\n\n    /**\n     * The multiple document mode.\n     *\n     * In this mode, multiple documents are displayed in separate tab\n     * areas, and those areas can be individually resized by the user.\n     */\n    | 'multiple-document';\n\n  /**\n   * A type alias for a layout configuration object.\n   */\n  export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n  /**\n   * A type alias for the supported insertion modes.\n   */\n  export type InsertMode = DockLayout.InsertMode;\n\n  /**\n   * A type alias for the add widget options.\n   */\n  export type IAddOptions = DockLayout.IAddOptions;\n\n  /**\n   * An object which holds the geometry for overlay positioning.\n   */\n  export interface IOverlayGeometry {\n    /**\n     * The distance between the overlay and parent top edges.\n     */\n    top: number;\n\n    /**\n     * The distance between the overlay and parent left edges.\n     */\n    left: number;\n\n    /**\n     * The distance between the overlay and parent right edges.\n     */\n    right: number;\n\n    /**\n     * The distance between the overlay and parent bottom edges.\n     */\n    bottom: number;\n  }\n\n  /**\n   * An object which manages the overlay node for a dock panel.\n   */\n  export interface IOverlay {\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     *\n     * #### Notes\n     * The given geometry values assume the node will use absolute\n     * positioning.\n     *\n     * This is called on every mouse move event during a drag in order\n     * to update the position of the overlay. It should be efficient.\n     */\n    show(geo: IOverlayGeometry): void;\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 should hide the overlay immediately.\n     *\n     * #### Notes\n     * This is called whenever the overlay node should been hidden.\n     */\n    hide(delay: number): void;\n  }\n\n  /**\n   * A concrete implementation of `IOverlay`.\n   *\n   * This is the default overlay implementation for a dock panel.\n   */\n  export class Overlay implements IOverlay {\n    /**\n     * Construct a new overlay.\n     */\n    constructor() {\n      this.node = document.createElement('div');\n      this.node.classList.add('lm-DockPanel-overlay');\n      this.node.classList.add('lm-mod-hidden');\n      this.node.style.position = 'absolute';\n      this.node.style.contain = 'strict';\n    }\n\n    /**\n     * The DOM node for the overlay.\n     */\n    readonly node: HTMLDivElement;\n\n    /**\n     * Show the overlay using the given overlay geometry.\n     *\n     * @param geo - The desired geometry for the overlay.\n     */\n    show(geo: IOverlayGeometry): void {\n      // Update the position of the overlay.\n      let style = this.node.style;\n      style.top = `${geo.top}px`;\n      style.left = `${geo.left}px`;\n      style.right = `${geo.right}px`;\n      style.bottom = `${geo.bottom}px`;\n\n      // Clear any pending hide timer.\n      clearTimeout(this._timer);\n      this._timer = -1;\n\n      // If the overlay is already visible, we're done.\n      if (!this._hidden) {\n        return;\n      }\n\n      // Clear the hidden flag.\n      this._hidden = false;\n\n      // Finally, show the overlay.\n      this.node.classList.remove('lm-mod-hidden');\n    }\n\n    /**\n     * Hide the overlay node.\n     *\n     * @param delay - The delay (in ms) before hiding the overlay.\n     *   A delay value <= 0 will hide the overlay immediately.\n     */\n    hide(delay: number): void {\n      // Do nothing if the overlay is already hidden.\n      if (this._hidden) {\n        return;\n      }\n\n      // Hide immediately if the delay is <= 0.\n      if (delay <= 0) {\n        clearTimeout(this._timer);\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n        return;\n      }\n\n      // Do nothing if a hide is already pending.\n      if (this._timer !== -1) {\n        return;\n      }\n\n      // Otherwise setup the hide timer.\n      this._timer = window.setTimeout(() => {\n        this._timer = -1;\n        this._hidden = true;\n        this.node.classList.add('lm-mod-hidden');\n      }, delay);\n    }\n\n    private _timer = -1;\n    private _hidden = true;\n  }\n\n  /**\n   * A type alias for a dock panel renderer;\n   */\n  export type IRenderer = DockLayout.IRenderer;\n\n  /**\n   * The default implementation of `IRenderer`.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Create a new tab bar for use with a dock panel.\n     *\n     * @returns A new tab bar for a dock panel.\n     */\n    createTabBar(document?: Document | ShadowRoot): TabBar<Widget> {\n      let bar = new TabBar<Widget>({ document });\n      bar.addClass('lm-DockPanel-tabBar');\n      return bar;\n    }\n\n    /**\n     * Create a new handle node for use with a dock panel.\n     *\n     * @returns A new handle node for a dock panel.\n     */\n    createHandle(): HTMLDivElement {\n      let handle = document.createElement('div');\n      handle.className = 'lm-DockPanel-handle';\n      return handle;\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n   */\n  export const GOLDEN_RATIO = 0.618;\n\n  /**\n   * The default sizes for the edge drop zones, in pixels.\n   */\n  export const DEFAULT_EDGES = {\n    /**\n     * The size of the top edge dock zone for the root panel, in pixels.\n     * This is different from the others to distinguish between the top\n     * tab bar and the top root zone.\n     */\n    top: 12,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    right: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    bottom: 40,\n\n    /**\n     * The size of the edge dock zone for the root panel, in pixels.\n     */\n    left: 40\n  };\n\n  /**\n   * A singleton `'layout-modified'` conflatable message.\n   */\n  export const LayoutModified = new ConflatableMessage('layout-modified');\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The handle which was pressed.\n     */\n    handle: HTMLDivElement;\n\n    /**\n     * The X offset of the press in handle coordinates.\n     */\n    deltaX: number;\n\n    /**\n     * The Y offset of the press in handle coordinates.\n     */\n    deltaY: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n  }\n\n  /**\n   * A type alias for a drop zone.\n   */\n  export type DropZone =\n    | /**\n     * An invalid drop zone.\n     */\n    'invalid'\n\n    /**\n     * The entirety of the root dock area.\n     */\n    | 'root-all'\n\n    /**\n     * The top portion of the root dock area.\n     */\n    | 'root-top'\n\n    /**\n     * The left portion of the root dock area.\n     */\n    | 'root-left'\n\n    /**\n     * The right portion of the root dock area.\n     */\n    | 'root-right'\n\n    /**\n     * The bottom portion of the root dock area.\n     */\n    | 'root-bottom'\n\n    /**\n     * The entirety of a tabbed widget area.\n     */\n    | 'widget-all'\n\n    /**\n     * The top portion of tabbed widget area.\n     */\n    | 'widget-top'\n\n    /**\n     * The left portion of tabbed widget area.\n     */\n    | 'widget-left'\n\n    /**\n     * The right portion of tabbed widget area.\n     */\n    | 'widget-right'\n\n    /**\n     * The bottom portion of tabbed widget area.\n     */\n    | 'widget-bottom'\n\n    /**\n     * The the bar of a tabbed widget area.\n     */\n    | 'widget-tab';\n\n  /**\n   * An object which holds the drop target zone and widget.\n   */\n  export interface IDropTarget {\n    /**\n     * The semantic zone for the mouse position.\n     */\n    zone: DropZone;\n\n    /**\n     * The tab area geometry for the drop zone, or `null`.\n     */\n    target: DockLayout.ITabAreaGeometry | null;\n  }\n\n  /**\n   * An attached property used to track generated tab bars.\n   */\n  export const isGeneratedTabBarProperty = new AttachedProperty<\n    Widget,\n    boolean\n  >({\n    name: 'isGeneratedTabBar',\n    create: () => false\n  });\n\n  /**\n   * Create a single document config for the widgets in a dock panel.\n   */\n  export function createSingleDocumentConfig(\n    panel: DockPanel\n  ): DockPanel.ILayoutConfig {\n    // Return an empty config if the panel is empty.\n    if (panel.isEmpty) {\n      return { main: null };\n    }\n\n    // Get a flat array of the widgets in the panel.\n    let widgets = Array.from(panel.widgets());\n\n    // Get the first selected widget in the panel.\n    let selected = panel.selectedWidgets().next().value;\n\n    // Compute the current index for the new config.\n    let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n    // Return the single document config.\n    return { main: { type: 'tab-area', widgets, currentIndex } };\n  }\n\n  /**\n   * Find the drop target at the given client position.\n   */\n  export function findDropTarget(\n    panel: DockPanel,\n    clientX: number,\n    clientY: number,\n    edges: DockPanel.IEdges\n  ): IDropTarget {\n    // Bail if the mouse is not over the dock panel.\n    if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Look up the layout for the panel.\n    let layout = panel.layout as DockLayout;\n\n    // If the layout is empty, indicate the entire root drop zone.\n    if (layout.isEmpty) {\n      return { zone: 'root-all', target: null };\n    }\n\n    // Test the edge zones when in multiple document mode.\n    if (panel.mode === 'multiple-document') {\n      // Get the client rect for the dock panel.\n      let panelRect = panel.node.getBoundingClientRect();\n\n      // Compute the distance to each edge of the panel.\n      let pl = clientX - panelRect.left + 1;\n      let pt = clientY - panelRect.top + 1;\n      let pr = panelRect.right - clientX;\n      let pb = panelRect.bottom - clientY;\n\n      // Find the minimum distance to an edge.\n      let pd = Math.min(pt, pr, pb, pl);\n\n      // Return a root zone if the mouse is within an edge.\n      switch (pd) {\n        case pt:\n          if (pt < edges.top) {\n            return { zone: 'root-top', target: null };\n          }\n          break;\n        case pr:\n          if (pr < edges.right) {\n            return { zone: 'root-right', target: null };\n          }\n          break;\n        case pb:\n          if (pb < edges.bottom) {\n            return { zone: 'root-bottom', target: null };\n          }\n          break;\n        case pl:\n          if (pl < edges.left) {\n            return { zone: 'root-left', target: null };\n          }\n          break;\n        default:\n          throw 'unreachable';\n      }\n    }\n\n    // Hit test the dock layout at the given client position.\n    let target = layout.hitTestTabAreas(clientX, clientY);\n\n    // Bail if no target area was found.\n    if (!target) {\n      return { zone: 'invalid', target: null };\n    }\n\n    // Return the whole tab area when in single document mode.\n    if (panel.mode === 'single-document') {\n      return { zone: 'widget-all', target };\n    }\n\n    // Compute the distance to each edge of the tab area.\n    let al = target.x - target.left + 1;\n    let at = target.y - target.top + 1;\n    let ar = target.left + target.width - target.x;\n    let ab = target.top + target.height - target.y;\n\n    const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n    if (at < tabHeight) {\n      return { zone: 'widget-tab', target };\n    }\n\n    // Get the X and Y edge sizes for the area.\n    let rx = Math.round(target.width / 3);\n    let ry = Math.round(target.height / 3);\n\n    // If the mouse is not within an edge, indicate the entire area.\n    if (al > rx && ar > rx && at > ry && ab > ry) {\n      return { zone: 'widget-all', target };\n    }\n\n    // Scale the distances by the slenderness ratio.\n    al /= rx;\n    at /= ry;\n    ar /= rx;\n    ab /= ry;\n\n    // Find the minimum distance to the area edge.\n    let ad = Math.min(al, at, ar, ab);\n\n    // Find the widget zone for the area edge.\n    let zone: DropZone;\n    switch (ad) {\n      case al:\n        zone = 'widget-left';\n        break;\n      case at:\n        zone = 'widget-top';\n        break;\n      case ar:\n        zone = 'widget-right';\n        break;\n      case ab:\n        zone = 'widget-bottom';\n        break;\n      default:\n        throw 'unreachable';\n    }\n\n    // Return the final drop target.\n    return { zone, target };\n  }\n\n  /**\n   * Get the drop reference widget for a tab bar.\n   */\n  export function getDropRef(tabBar: TabBar<Widget>): Widget | null {\n    if (tabBar.titles.length === 0) {\n      return null;\n    }\n    if (tabBar.currentTitle) {\n      return tabBar.currentTitle.owner;\n    }\n    return tabBar.titles[tabBar.titles.length - 1].owner;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n  /**\n   * Construct a new grid layout.\n   *\n   * @param options - The options for initializing the layout.\n   */\n  constructor(options: GridLayout.IOptions = {}) {\n    super(options);\n    if (options.rowCount !== undefined) {\n      Private.reallocSizers(this._rowSizers, options.rowCount);\n    }\n    if (options.columnCount !== undefined) {\n      Private.reallocSizers(this._columnSizers, options.columnCount);\n    }\n    if (options.rowSpacing !== undefined) {\n      this._rowSpacing = Private.clampValue(options.rowSpacing);\n    }\n    if (options.columnSpacing !== undefined) {\n      this._columnSpacing = Private.clampValue(options.columnSpacing);\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the widgets and layout items.\n    for (const item of this._items) {\n      let widget = item.widget;\n      item.dispose();\n      widget.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n    this._rowStarts.length = 0;\n    this._rowSizers.length = 0;\n    this._columnStarts.length = 0;\n    this._columnSizers.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Get the number of rows in the layout.\n   */\n  get rowCount(): number {\n    return this._rowSizers.length;\n  }\n\n  /**\n   * Set the number of rows in the layout.\n   *\n   * #### Notes\n   * The minimum row count is `1`.\n   */\n  set rowCount(value: number) {\n    // Do nothing if the row count does not change.\n    if (value === this.rowCount) {\n      return;\n    }\n\n    // Reallocate the row sizers.\n    Private.reallocSizers(this._rowSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the number of columns in the layout.\n   */\n  get columnCount(): number {\n    return this._columnSizers.length;\n  }\n\n  /**\n   * Set the number of columns in the layout.\n   *\n   * #### Notes\n   * The minimum column count is `1`.\n   */\n  set columnCount(value: number) {\n    // Do nothing if the column count does not change.\n    if (value === this.columnCount) {\n      return;\n    }\n\n    // Reallocate the column sizers.\n    Private.reallocSizers(this._columnSizers, value);\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the row spacing for the layout.\n   */\n  get rowSpacing(): number {\n    return this._rowSpacing;\n  }\n\n  /**\n   * Set the row spacing for the layout.\n   */\n  set rowSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._rowSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._rowSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the column spacing for the layout.\n   */\n  get columnSpacing(): number {\n    return this._columnSpacing;\n  }\n\n  /**\n   * Set the col spacing for the layout.\n   */\n  set columnSpacing(value: number) {\n    // Clamp the spacing to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the spacing does not change\n    if (this._columnSpacing === value) {\n      return;\n    }\n\n    // Update the internal spacing.\n    this._columnSpacing = value;\n\n    // Schedule a fit of the parent.\n    if (this.parent) {\n      this.parent.fit();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @returns The stretch factor for the row.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  rowStretch(index: number): number {\n    let sizer = this._rowSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific row.\n   *\n   * @param index - The row index of interest.\n   *\n   * @param value - The stretch factor for the row.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setRowStretch(index: number, value: number): void {\n    // Look up the row sizer.\n    let sizer = this._rowSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Get the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @returns The stretch factor for the column.\n   *\n   * #### Notes\n   * This returns `-1` if the index is out of range.\n   */\n  columnStretch(index: number): number {\n    let sizer = this._columnSizers[index];\n    return sizer ? sizer.stretch : -1;\n  }\n\n  /**\n   * Set the stretch factor for a specific column.\n   *\n   * @param index - The column index of interest.\n   *\n   * @param value - The stretch factor for the column.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  setColumnStretch(index: number, value: number): void {\n    // Look up the column sizer.\n    let sizer = this._columnSizers[index];\n\n    // Bail if the index is out of range.\n    if (!sizer) {\n      return;\n    }\n\n    // Clamp the value to the allowed range.\n    value = Private.clampValue(value);\n\n    // Bail if the stretch does not change.\n    if (sizer.stretch === value) {\n      return;\n    }\n\n    // Update the sizer stretch.\n    sizer.stretch = value;\n\n    // Schedule an update of the parent.\n    if (this.parent) {\n      this.parent.update();\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    for (const item of this._items) {\n      yield item.widget;\n    }\n  }\n\n  /**\n   * Add a widget to the grid layout.\n   *\n   * @param widget - The widget to add to the layout.\n   *\n   * #### Notes\n   * If the widget is already contained in the layout, this is no-op.\n   */\n  addWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is already in the layout.\n    if (i !== -1) {\n      return;\n    }\n\n    // Add the widget to the layout.\n    this._items.push(new LayoutItem(widget));\n\n    // Attach the widget to the parent.\n    if (this.parent) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the grid layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Look up the index for the widget.\n    let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n    // Bail if the widget is not in the layout.\n    if (i === -1) {\n      return;\n    }\n\n    // Remove the widget from the layout.\n    let item = ArrayExt.removeAt(this._items, i)!;\n\n    // Detach the widget from the parent.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n\n    // Dispose the layout item.\n    item.dispose();\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Reset the min sizes of the sizers.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      this._rowSizers[i].minSize = 0;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      this._columnSizers[i].minSize = 0;\n    }\n\n    // Filter for the visible layout items.\n    let items = this._items.filter(it => !it.isHidden);\n\n    // Fit the layout items.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      items[i].fit();\n    }\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Sort the items by row span.\n    items.sort(Private.rowSpanCmp);\n\n    // Update the min sizes of the row sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the row bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n      // Distribute the minimum height to the sizers as needed.\n      Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n    }\n\n    // Sort the items by column span.\n    items.sort(Private.columnSpanCmp);\n\n    // Update the min sizes of the column sizers.\n    for (let i = 0, n = items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = items[i];\n\n      // Get the column bounds for the item.\n      let config = GridLayout.getCellConfig(item.widget);\n      let c1 = Math.min(config.column, maxCol);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Distribute the minimum width to the sizers as needed.\n      Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n    }\n\n    // If no size constraint is needed, just update the parent.\n    if (this.fitPolicy === 'set-no-constraint') {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n      return;\n    }\n\n    // Set up the computed min size.\n    let minH = maxRow * this._rowSpacing;\n    let minW = maxCol * this._columnSpacing;\n\n    // Add the sizer minimums to the computed min size.\n    for (let i = 0, n = this.rowCount; i < n; ++i) {\n      minH += this._rowSizers[i].minSize;\n    }\n    for (let i = 0, n = this.columnCount; i < n; ++i) {\n      minW += this._columnSizers[i].minSize;\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the layout area adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Get the max row and column index.\n    let maxRow = this.rowCount - 1;\n    let maxCol = this.columnCount - 1;\n\n    // Compute the total fixed row and column space.\n    let fixedRowSpace = maxRow * this._rowSpacing;\n    let fixedColSpace = maxCol * this._columnSpacing;\n\n    // Distribute the available space to the box sizers.\n    BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n    BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n    // Update the row start positions.\n    for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n      this._rowStarts[i] = pos;\n      pos += this._rowSizers[i].size + this._rowSpacing;\n    }\n\n    // Update the column start positions.\n    for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n      this._columnStarts[i] = pos;\n      pos += this._columnSizers[i].size + this._columnSpacing;\n    }\n\n    // Update the geometry of the layout items.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Fetch the cell bounds for the widget.\n      let config = GridLayout.getCellConfig(item.widget);\n      let r1 = Math.min(config.row, maxRow);\n      let c1 = Math.min(config.column, maxCol);\n      let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n      let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n      // Compute the cell geometry.\n      let x = this._columnStarts[c1];\n      let y = this._rowStarts[r1];\n      let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n      let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n      // Update the geometry of the layout item.\n      item.update(x, y, w, h);\n    }\n  }\n\n  private _dirty = false;\n  private _rowSpacing = 4;\n  private _columnSpacing = 4;\n  private _items: LayoutItem[] = [];\n  private _rowStarts: number[] = [];\n  private _columnStarts: number[] = [];\n  private _rowSizers: BoxSizer[] = [new BoxSizer()];\n  private _columnSizers: BoxSizer[] = [new BoxSizer()];\n  private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n  /**\n   * An options object for initializing a grid layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The initial row count for the layout.\n     *\n     * The default is `1`.\n     */\n    rowCount?: number;\n\n    /**\n     * The initial column count for the layout.\n     *\n     * The default is `1`.\n     */\n    columnCount?: number;\n\n    /**\n     * The spacing between rows in the layout.\n     *\n     * The default is `4`.\n     */\n    rowSpacing?: number;\n\n    /**\n     * The spacing between columns in the layout.\n     *\n     * The default is `4`.\n     */\n    columnSpacing?: number;\n  }\n\n  /**\n   * An object which holds the cell configuration for a widget.\n   */\n  export interface ICellConfig {\n    /**\n     * The row index for the widget.\n     */\n    readonly row: number;\n\n    /**\n     * The column index for the widget.\n     */\n    readonly column: number;\n\n    /**\n     * The row span for the widget.\n     */\n    readonly rowSpan: number;\n\n    /**\n     * The column span for the widget.\n     */\n    readonly columnSpan: number;\n  }\n\n  /**\n   * Get the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The cell config for the widget.\n   */\n  export function getCellConfig(widget: Widget): ICellConfig {\n    return Private.cellConfigProperty.get(widget);\n  }\n\n  /**\n   * Set the cell config for the given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @param value - The value for the cell config.\n   */\n  export function setCellConfig(\n    widget: Widget,\n    value: Partial<ICellConfig>\n  ): void {\n    Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * The property descriptor for the widget cell config.\n   */\n  export const cellConfigProperty = new AttachedProperty<\n    Widget,\n    GridLayout.ICellConfig\n  >({\n    name: 'cellConfig',\n    create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n    changed: onChildCellConfigChanged\n  });\n\n  /**\n   * Normalize a partial cell config object.\n   */\n  export function normalizeConfig(\n    config: Partial<GridLayout.ICellConfig>\n  ): GridLayout.ICellConfig {\n    let row = Math.max(0, Math.floor(config.row || 0));\n    let column = Math.max(0, Math.floor(config.column || 0));\n    let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n    let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n    return { row, column, rowSpan, columnSpan };\n  }\n\n  /**\n   * Clamp a value to an integer >= 0.\n   */\n  export function clampValue(value: number): number {\n    return Math.max(0, Math.floor(value));\n  }\n\n  /**\n   * A sort comparison function for row spans.\n   */\n  export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.rowSpan - c2.rowSpan;\n  }\n\n  /**\n   * A sort comparison function for column spans.\n   */\n  export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n    let c1 = cellConfigProperty.get(a.widget);\n    let c2 = cellConfigProperty.get(b.widget);\n    return c1.columnSpan - c2.columnSpan;\n  }\n\n  /**\n   * Reallocate the box sizers for the given grid dimensions.\n   */\n  export function reallocSizers(sizers: BoxSizer[], count: number): void {\n    // Coerce the count to the valid range.\n    count = Math.max(1, Math.floor(count));\n\n    // Add the missing sizers.\n    while (sizers.length < count) {\n      sizers.push(new BoxSizer());\n    }\n\n    // Remove the extra sizers.\n    if (sizers.length > count) {\n      sizers.length = count;\n    }\n  }\n\n  /**\n   * Distribute a min size constraint across a range of sizers.\n   */\n  export function distributeMin(\n    sizers: BoxSizer[],\n    i1: number,\n    i2: number,\n    minSize: number\n  ): void {\n    // Sanity check the indices.\n    if (i2 < i1) {\n      return;\n    }\n\n    // Handle the simple case of no cell span.\n    if (i1 === i2) {\n      let sizer = sizers[i1];\n      sizer.minSize = Math.max(sizer.minSize, minSize);\n      return;\n    }\n\n    // Compute the total current min size of the span.\n    let totalMin = 0;\n    for (let i = i1; i <= i2; ++i) {\n      totalMin += sizers[i].minSize;\n    }\n\n    // Do nothing if the total is greater than the required.\n    if (totalMin >= minSize) {\n      return;\n    }\n\n    // Compute the portion of the space to allocate to each sizer.\n    let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n    // Add the portion to each sizer.\n    for (let i = i1; i <= i2; ++i) {\n      sizers[i].minSize += portion;\n    }\n  }\n\n  /**\n   * The change handler for the child cell config property.\n   */\n  function onChildCellConfigChanged(child: Widget): void {\n    if (child.parent && child.parent.layout instanceof GridLayout) {\n      child.parent.fit();\n    }\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n  ElementARIAAttrs,\n  ElementDataset,\n  h,\n  VirtualDOM,\n  VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n  /**\n   * Construct a new menu bar.\n   *\n   * @param options - The options for initializing the menu bar.\n   */\n  constructor(options: MenuBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-MenuBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n    this.renderer = options.renderer || MenuBar.defaultRenderer;\n    this._forceItemsPosition = options.forceItemsPosition || {\n      forceX: true,\n      forceY: true\n    };\n    this._overflowMenuOptions = options.overflowMenuOptions || {\n      isVisible: true\n    };\n  }\n\n  /**\n   * Dispose of the resources held by the widget.\n   */\n  dispose(): void {\n    this._closeChildMenu();\n    this._menus.length = 0;\n    super.dispose();\n  }\n\n  /**\n   * The renderer used by the menu bar.\n   */\n  readonly renderer: MenuBar.IRenderer;\n\n  /**\n   * The child menu of the menu bar.\n   *\n   * #### Notes\n   * This will be `null` if the menu bar does not have an open menu.\n   */\n  get childMenu(): Menu | null {\n    return this._childMenu;\n  }\n\n  /**\n   * The overflow index of the menu bar.\n   */\n  get overflowIndex(): number {\n    return this._overflowIndex;\n  }\n\n  /**\n   * The overflow menu of the menu bar.\n   */\n  get overflowMenu(): Menu | null {\n    return this._overflowMenu;\n  }\n\n  /**\n   * Get the menu bar content node.\n   *\n   * #### Notes\n   * This is the node which holds the menu title nodes.\n   *\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get contentNode(): HTMLUListElement {\n    return this.node.getElementsByClassName(\n      'lm-MenuBar-content'\n    )[0] as HTMLUListElement;\n  }\n\n  /**\n   * Get the currently active menu.\n   */\n  get activeMenu(): Menu | null {\n    return this._menus[this._activeIndex] || null;\n  }\n\n  /**\n   * Set the currently active menu.\n   *\n   * #### Notes\n   * If the menu does not exist, the menu will be set to `null`.\n   */\n  set activeMenu(value: Menu | null) {\n    this.activeIndex = value ? this._menus.indexOf(value) : -1;\n  }\n\n  /**\n   * Get the index of the currently active menu.\n   *\n   * #### Notes\n   * This will be `-1` if no menu is active.\n   */\n  get activeIndex(): number {\n    return this._activeIndex;\n  }\n\n  /**\n   * Set the index of the currently active menu.\n   *\n   * #### Notes\n   * If the menu cannot be activated, the index will be set to `-1`.\n   */\n  set activeIndex(value: number) {\n    // Adjust the value for an out of range index.\n    if (value < 0 || value >= this._menus.length) {\n      value = -1;\n    }\n\n    // An empty menu cannot be active\n    if (value > -1 && this._menus[value].items.length === 0) {\n      value = -1;\n    }\n\n    // Bail early if the index will not change.\n    if (this._activeIndex === value) {\n      return;\n    }\n\n    // Update the active index.\n    this._activeIndex = value;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * A read-only array of the menus in the menu bar.\n   */\n  get menus(): ReadonlyArray<Menu> {\n    return this._menus;\n  }\n\n  /**\n   * Open the active menu and activate its first menu item.\n   *\n   * #### Notes\n   * If there is no active menu, this is a no-op.\n   */\n  openActiveMenu(): void {\n    // Bail early if there is no active item.\n    if (this._activeIndex === -1) {\n      return;\n    }\n\n    // Open the child menu.\n    this._openChildMenu();\n\n    // Activate the first item in the child menu.\n    if (this._childMenu) {\n      this._childMenu.activeIndex = -1;\n      this._childMenu.activateNextItem();\n    }\n  }\n\n  /**\n   * Add a menu to the end of the menu bar.\n   *\n   * @param menu - The menu to add to the menu bar.\n   *\n   * #### Notes\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  addMenu(menu: Menu, update: boolean = true): void {\n    this.insertMenu(this._menus.length, menu, update);\n  }\n\n  /**\n   * Insert a menu into the menu bar at the specified index.\n   *\n   * @param index - The index at which to insert the menu.\n   *\n   * @param menu - The menu to insert into the menu bar.\n   *\n   * #### Notes\n   * The index will be clamped to the bounds of the menus.\n   *\n   * If the menu is already added to the menu bar, it will be moved.\n   */\n  insertMenu(index: number, menu: Menu, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Look up the index of the menu.\n    let i = this._menus.indexOf(menu);\n\n    // Clamp the insert index to the array bounds.\n    let j = Math.max(0, Math.min(index, this._menus.length));\n\n    // If the menu is not in the array, insert it.\n    if (i === -1) {\n      // Insert the menu into the array.\n      ArrayExt.insert(this._menus, j, menu);\n\n      // Add the styling class to the menu.\n      menu.addClass('lm-MenuBar-menu');\n\n      // Connect to the menu signals.\n      menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n      menu.menuRequested.connect(this._onMenuMenuRequested, this);\n      menu.title.changed.connect(this._onTitleChanged, this);\n\n      // Schedule an update of the items.\n      if (update) {\n        this.update();\n      }\n\n      // There is nothing more to do.\n      return;\n    }\n\n    // Otherwise, the menu exists in the array and should be moved.\n\n    // Adjust the index if the location is at the end of the array.\n    if (j === this._menus.length) {\n      j--;\n    }\n\n    // Bail if there is no effective move.\n    if (i === j) {\n      return;\n    }\n\n    // Move the menu to the new locations.\n    ArrayExt.move(this._menus, i, j);\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove a menu from the menu bar.\n   *\n   * @param menu - The menu to remove from the menu bar.\n   *\n   * #### Notes\n   * This is a no-op if the menu is not in the menu bar.\n   */\n  removeMenu(menu: Menu, update: boolean = true): void {\n    this.removeMenuAt(this._menus.indexOf(menu), update);\n  }\n\n  /**\n   * Remove the menu at a given index from the menu bar.\n   *\n   * @param index - The index of the menu to remove.\n   *\n   * #### Notes\n   * This is a no-op if the index is out of range.\n   */\n  removeMenuAt(index: number, update: boolean = true): void {\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Remove the menu from the array.\n    let menu = ArrayExt.removeAt(this._menus, index);\n\n    // Bail if the index is out of range.\n    if (!menu) {\n      return;\n    }\n\n    // Disconnect from the menu signals.\n    menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n    menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n    menu.title.changed.disconnect(this._onTitleChanged, this);\n\n    // Remove the styling class from the menu.\n    menu.removeClass('lm-MenuBar-menu');\n\n    // Schedule an update of the items.\n    if (update) {\n      this.update();\n    }\n  }\n\n  /**\n   * Remove all menus from the menu bar.\n   */\n  clearMenus(): void {\n    // Bail if there is nothing to remove.\n    if (this._menus.length === 0) {\n      return;\n    }\n\n    // Close the child menu before making changes.\n    this._closeChildMenu();\n\n    // Disconnect from the menu signals and remove the styling class.\n    for (let menu of this._menus) {\n      menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n      menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n      menu.title.changed.disconnect(this._onTitleChanged, this);\n      menu.removeClass('lm-MenuBar-menu');\n    }\n\n    // Clear the menus array.\n    this._menus.length = 0;\n\n    // Schedule an update of the items.\n    this.update();\n  }\n\n  /**\n   * Handle the DOM events for the menu bar.\n   *\n   * @param event - The DOM event sent to the menu bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the menu bar's DOM nodes. It\n   * should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n      case 'mouseleave':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'focusout':\n        this._evtFocusOut(event as FocusEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('keydown', this);\n    this.node.addEventListener('mousedown', this);\n    this.node.addEventListener('mousemove', this);\n    this.node.addEventListener('mouseleave', this);\n    this.node.addEventListener('focusout', this);\n    this.node.addEventListener('contextmenu', this);\n  }\n\n  /**\n   * A message handler invoked on an `'after-detach'` message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('keydown', this);\n    this.node.removeEventListener('mousedown', this);\n    this.node.removeEventListener('mousemove', this);\n    this.node.removeEventListener('mouseleave', this);\n    this.node.removeEventListener('focusout', this);\n    this.node.removeEventListener('contextmenu', this);\n    this._closeChildMenu();\n  }\n\n  /**\n   * A message handler invoked on an `'activate-request'` message.\n   */\n  protected onActivateRequest(msg: Message): void {\n    if (this.isAttached) {\n      this._focusItemAt(0);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    this.update();\n    super.onResize(msg);\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    let menus = this._menus;\n    let renderer = this.renderer;\n    let activeIndex = this._activeIndex;\n    let tabFocusIndex =\n      this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n        ? this._tabFocusIndex\n        : 0;\n    let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n    let totalMenuSize = 0;\n    let isVisible = false;\n\n    // Check that the overflow menu doesn't count\n    length = this._overflowMenu !== null ? length - 1 : length;\n    let content = new Array<VirtualElement>(length);\n\n    // Render visible menus\n    for (let i = 0; i < length; ++i) {\n      content[i] = renderer.renderItem({\n        title: menus[i].title,\n        active: i === activeIndex,\n        tabbable: i === tabFocusIndex,\n        disabled: menus[i].items.length === 0,\n        onfocus: () => {\n          this._tabFocusIndex = i;\n          this.activeIndex = i;\n        }\n      });\n      // Calculate size of current menu\n      totalMenuSize += this._menuItemSizes[i];\n      // Check if overflow menu is already rendered\n      if (menus[i].title.label === this._overflowMenuOptions.title) {\n        isVisible = true;\n        length--;\n      }\n    }\n    // Render overflow menu if needed and active\n    if (this._overflowMenuOptions.isVisible) {\n      if (this._overflowIndex > -1 && !isVisible) {\n        // Create overflow menu\n        if (this._overflowMenu === null) {\n          const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n          this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n          this._overflowMenu.title.label = overflowMenuTitle;\n          this._overflowMenu.title.mnemonic = 0;\n          this.addMenu(this._overflowMenu, false);\n        }\n        // Move menus to overflow menu\n        for (let i = menus.length - 2; i >= length; i--) {\n          const submenu = this.menus[i];\n          submenu.title.mnemonic = 0;\n          this._overflowMenu.insertItem(0, {\n            type: 'submenu',\n            submenu: submenu\n          });\n          this.removeMenu(submenu, false);\n        }\n        content[length] = renderer.renderItem({\n          title: this._overflowMenu.title,\n          active: length === activeIndex && menus[length].items.length !== 0,\n          tabbable: length === tabFocusIndex,\n          disabled: menus[length].items.length === 0,\n          onfocus: () => {\n            this._tabFocusIndex = length;\n            this.activeIndex = length;\n          }\n        });\n        length++;\n      } else if (this._overflowMenu !== null) {\n        // Remove submenus from overflow menu\n        let overflowMenuItems = this._overflowMenu.items;\n        let screenSize = this.node.offsetWidth;\n        let n = this._overflowMenu.items.length;\n        for (let i = 0; i < n; ++i) {\n          let index = menus.length - 1 - i;\n          if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n            let menu = overflowMenuItems[0].submenu as Menu;\n            this._overflowMenu.removeItemAt(0);\n            this.insertMenu(length, menu, false);\n            content[length] = renderer.renderItem({\n              title: menu.title,\n              active: false,\n              tabbable: length === tabFocusIndex,\n              disabled: menus[length].items.length === 0,\n              onfocus: () => {\n                this._tabFocusIndex = length;\n                this.activeIndex = length;\n              }\n            });\n            length++;\n          }\n        }\n        if (this._overflowMenu.items.length === 0) {\n          this.removeMenu(this._overflowMenu, false);\n          content.pop();\n          this._overflowMenu = null;\n          this._overflowIndex = -1;\n        }\n      }\n    }\n    VirtualDOM.render(content, this.contentNode);\n    this._updateOverflowIndex();\n  }\n\n  /**\n   * Calculate and update the current overflow index.\n   */\n  private _updateOverflowIndex(): void {\n    if (!this._overflowMenuOptions.isVisible) {\n      return;\n    }\n\n    // Get elements visible in the main menu bar\n    const itemMenus = this.contentNode.childNodes;\n    let screenSize = this.node.offsetWidth;\n    let totalMenuSize = 0;\n    let index = -1;\n    let n = itemMenus.length;\n\n    if (this._menuItemSizes.length == 0) {\n      // Check if it is the first resize and get info about menu items sizes\n      for (let i = 0; i < n; i++) {\n        let item = itemMenus[i] as HTMLLIElement;\n        // Add sizes to array\n        totalMenuSize += item.offsetWidth;\n        this._menuItemSizes.push(item.offsetWidth);\n        if (totalMenuSize > screenSize && index === -1) {\n          index = i;\n        }\n      }\n    } else {\n      // Calculate current menu size\n      for (let i = 0; i < this._menuItemSizes.length; i++) {\n        totalMenuSize += this._menuItemSizes[i];\n        if (totalMenuSize > screenSize) {\n          index = i;\n          break;\n        }\n      }\n    }\n    this._overflowIndex = index;\n  }\n\n  /**\n   * Handle the `'keydown'` event for the menu bar.\n   *\n   * #### Notes\n   * All keys are trapped except the tab key that is ignored.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Fetch the key code for the event.\n    let kc = event.keyCode;\n\n    // Reset the active index on tab, but do not trap the tab key.\n    if (kc === 9) {\n      this.activeIndex = -1;\n      return;\n    }\n\n    // A menu bar handles all other keydown events.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Enter, Space, Up Arrow, Down Arrow\n    if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n      // The active index may have changed (for example, user hovers over an\n      // item with the mouse), so be sure to use the focus index.\n      this.activeIndex = this._tabFocusIndex;\n      if (this.activeIndex !== this._tabFocusIndex) {\n        // Bail if the setter refused to set activeIndex to tabFocusIndex\n        // because it means that the item at tabFocusIndex cannot be opened (for\n        // example, it has an empty menu)\n        return;\n      }\n      this.openActiveMenu();\n      return;\n    }\n\n    // Escape\n    if (kc === 27) {\n      this._closeChildMenu();\n      this._focusItemAt(this.activeIndex);\n      return;\n    }\n\n    // Left or Right Arrow\n    if (kc === 37 || kc === 39) {\n      let direction = kc === 37 ? -1 : 1;\n      let start = this._tabFocusIndex + direction;\n      let n = this._menus.length;\n      for (let i = 0; i < n; i++) {\n        let index = (n + start + direction * i) % n;\n        if (this._menus[index].items.length) {\n          this._focusItemAt(index);\n          return;\n        }\n      }\n      return;\n    }\n\n    // Get the pressed key character.\n    let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n    // Bail if the key is not valid.\n    if (!key) {\n      return;\n    }\n\n    // Search for the next best matching mnemonic item.\n    let start = this._activeIndex + 1;\n    let result = Private.findMnemonic(this._menus, key, start);\n\n    // Handle the requested mnemonic based on the search results.\n    // If exactly one mnemonic is matched, that menu is opened.\n    // Otherwise, the next mnemonic is activated if available,\n    // followed by the auto mnemonic if available.\n    if (result.index !== -1 && !result.multiple) {\n      this.activeIndex = result.index;\n      this.openActiveMenu();\n    } else if (result.index !== -1) {\n      this.activeIndex = result.index;\n      this._focusItemAt(this.activeIndex);\n    } else if (result.auto !== -1) {\n      this.activeIndex = result.auto;\n      this._focusItemAt(this.activeIndex);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the menu bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Bail if the mouse press was not on the menu bar. This can occur\n    // when the document listener is installed for an active menu bar.\n    if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n      return;\n    }\n\n    // Stop the propagation of the event. Immediate propagation is\n    // also stopped so that an open menu does not handle the event.\n    event.stopPropagation();\n    event.stopImmediatePropagation();\n\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // If the press was not on an item, close the child menu.\n    if (index === -1) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // If the press was not the left mouse button, do nothing further.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Otherwise, toggle the open state of the child menu.\n    if (this._childMenu) {\n      this._closeChildMenu();\n      this.activeIndex = index;\n    } else {\n      // If we don't call preventDefault() here, then the item in the menu\n      // bar will take focus over the menu that is being opened.\n      event.preventDefault();\n      const position = this._positionForMenu(index);\n      Menu.saveWindowData();\n      // Begin DOM modifications.\n      this.activeIndex = index;\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the menu bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Check if the mouse is over one of the menu items.\n    let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n      return ElementExt.hitTest(node, event.clientX, event.clientY);\n    });\n\n    // Bail early if the active index will not change.\n    if (index === this._activeIndex) {\n      return;\n    }\n\n    // Bail early if a child menu is open and the mouse is not over\n    // an item. This allows the child menu to be kept open when the\n    // mouse is over the empty part of the menu bar.\n    if (index === -1 && this._childMenu) {\n      return;\n    }\n\n    // Get position for the new menu >before< updating active index.\n    const position =\n      index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n    // Before any modification, update window data.\n    Menu.saveWindowData();\n\n    // Begin DOM modifications.\n\n    // Update the active index to the hovered item.\n    this.activeIndex = index;\n\n    // Open the new menu if a menu is already open.\n    if (position) {\n      this._openChildMenu(position);\n    }\n  }\n\n  /**\n   * Find initial position for the menu based on menubar item position.\n   *\n   * NOTE: this should be called before updating active index to avoid\n   * an additional layout and style invalidation as changing active\n   * index modifies DOM.\n   */\n  private _positionForMenu(index: number): Private.IPosition {\n    let itemNode = this.contentNode.children[index];\n    let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n    return {\n      top: bottom,\n      left\n    };\n  }\n\n  /**\n   * Handle the `'focusout'` event for the menu bar.\n   */\n  private _evtFocusOut(event: FocusEvent): void {\n    // Reset the active index if there is no open menu and the menubar is losing focus.\n    if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n      this.activeIndex = -1;\n    }\n  }\n\n  /**\n   * Focus an item in the menu bar.\n   *\n   * #### Notes\n   * Does not open the associated menu.\n   */\n  private _focusItemAt(index: number): void {\n    const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n    if (itemNode) {\n      itemNode.focus();\n    }\n  }\n\n  /**\n   * Open the child menu at the active index immediately.\n   *\n   * If a different child menu is already open, it will be closed,\n   * even if there is no active menu.\n   */\n  private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n    // If there is no active menu, close the current menu.\n    let newMenu = this.activeMenu;\n    if (!newMenu) {\n      this._closeChildMenu();\n      return;\n    }\n\n    // Bail if there is no effective menu change.\n    let oldMenu = this._childMenu;\n    if (oldMenu === newMenu) {\n      return;\n    }\n\n    // Swap the internal menu reference.\n    this._childMenu = newMenu;\n\n    // Close the current menu, or setup for the new menu.\n    if (oldMenu) {\n      oldMenu.close();\n    } else {\n      document.addEventListener('mousedown', this, true);\n    }\n\n    // Update the tab focus index and ensure the menu bar is updated.\n    this._tabFocusIndex = this.activeIndex;\n    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n    // Get the positioning data for the new menu.\n    let { left, top } = options;\n    if (typeof left === 'undefined' || typeof top === 'undefined') {\n      ({ left, top } = this._positionForMenu(this._activeIndex));\n    }\n    // Begin DOM modifications\n\n    if (!oldMenu) {\n      // Continue setup for new menu\n      this.addClass('lm-mod-active');\n    }\n\n    // Open the new menu at the computed location.\n    if (newMenu.items.length > 0) {\n      newMenu.open(left, top, this._forceItemsPosition);\n    }\n  }\n\n  /**\n   * Close the child menu immediately.\n   *\n   * This is a no-op if a child menu is not open.\n   */\n  private _closeChildMenu(): void {\n    // Bail if no child menu is open.\n    if (!this._childMenu) {\n      return;\n    }\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    let menu = this._childMenu;\n    this._childMenu = null;\n\n    // Close the menu.\n    menu.close();\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `aboutToClose` signal of a menu.\n   */\n  private _onMenuAboutToClose(sender: Menu): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Remove the active class from the menu bar.\n    this.removeClass('lm-mod-active');\n\n    // Remove the document listeners.\n    document.removeEventListener('mousedown', this, true);\n\n    // Clear the internal menu reference.\n    this._childMenu = null;\n\n    // Reset the active index.\n    this.activeIndex = -1;\n  }\n\n  /**\n   * Handle the `menuRequested` signal of a child menu.\n   */\n  private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n    // Bail if the sender is not the child menu.\n    if (sender !== this._childMenu) {\n      return;\n    }\n\n    // Look up the active index and menu count.\n    let i = this._activeIndex;\n    let n = this._menus.length;\n\n    // Active the next requested index.\n    switch (args) {\n      case 'next':\n        this.activeIndex = i === n - 1 ? 0 : i + 1;\n        break;\n      case 'previous':\n        this.activeIndex = i === 0 ? n - 1 : i - 1;\n        break;\n    }\n\n    // Open the active menu.\n    this.openActiveMenu();\n  }\n\n  /**\n   * Handle the `changed` signal of a title object.\n   */\n  private _onTitleChanged(): void {\n    this.update();\n  }\n\n  // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n  private _activeIndex = -1;\n  // Track which item can be focused using the TAB key. Unlike _activeIndex will\n  // always point to a menuitem. Whenever you update this value, it's important\n  // to follow it with an \"update-request\" message so that the `tabindex`\n  // attribute on each menubar item gets properly updated.\n  private _tabFocusIndex = 0;\n  private _forceItemsPosition: Menu.IOpenOptions;\n  private _overflowMenuOptions: IOverflowMenuOptions;\n  private _menus: Menu[] = [];\n  private _childMenu: Menu | null = null;\n  private _overflowMenu: Menu | null = null;\n  private _menuItemSizes: number[] = [];\n  private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n  /**\n   * An options object for creating a menu bar.\n   */\n  export interface IOptions {\n    /**\n     * A custom renderer for creating menu bar content.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: IRenderer;\n    /**\n     * Whether to force the position of the menu. The MenuBar forces the\n     * coordinates of its menus by default. With this option you can disable it.\n     *\n     * Setting to `false` will enable the logic which repositions the\n     * coordinates of the menu if it will not fit entirely on screen.\n     *\n     * The default is `true`.\n     */\n    forceItemsPosition?: Menu.IOpenOptions;\n    /**\n     * Whether to add a overflow menu if there's overflow.\n     *\n     * Setting to `true` will enable the logic that creates an overflow menu\n     * to show the menu items that don't fit entirely on the screen.\n     *\n     * The default is `true`.\n     */\n    overflowMenuOptions?: IOverflowMenuOptions;\n  }\n\n  /**\n   * An object which holds the data to render a menu bar item.\n   */\n  export interface IRenderData {\n    /**\n     * The title to be rendered.\n     */\n    readonly title: Title<Widget>;\n\n    /**\n     * Whether the item is the active item.\n     */\n    readonly active: boolean;\n\n    /**\n     * Whether the user can tab to the item.\n     */\n    readonly tabbable: boolean;\n\n    /**\n     * Whether the item is disabled.\n     *\n     * #### Notes\n     * A disabled item cannot be active.\n     * A disabled item cannot be focussed.\n     */\n    readonly disabled?: boolean;\n\n    readonly onfocus?: (event: FocusEvent) => void;\n  }\n\n  /**\n   * A renderer for use with a menu bar.\n   */\n  export interface IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement;\n  }\n\n  /**\n   * The default implementation of `IRenderer`.\n   *\n   * #### Notes\n   * Subclasses are free to reimplement rendering methods as needed.\n   */\n  export class Renderer implements IRenderer {\n    /**\n     * Render the virtual element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the item.\n     *\n     * @returns A virtual element representing the item.\n     */\n    renderItem(data: IRenderData): VirtualElement {\n      let className = this.createItemClass(data);\n      let dataset = this.createItemDataset(data);\n      let aria = this.createItemARIA(data);\n      return h.li(\n        {\n          className,\n          dataset,\n          ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n          onfocus: data.onfocus,\n          ...aria\n        },\n        this.renderIcon(data),\n        this.renderLabel(data)\n      );\n    }\n\n    /**\n     * Render the icon element for a menu bar item.\n     *\n     * @param data - The data to use for rendering the icon.\n     *\n     * @returns A virtual element representing the item icon.\n     */\n    renderIcon(data: IRenderData): VirtualElement {\n      let className = this.createIconClass(data);\n\n      // If data.title.icon is undefined, it will be ignored.\n      return h.div({ className }, data.title.icon!, data.title.iconLabel);\n    }\n\n    /**\n     * Render the label element for a menu item.\n     *\n     * @param data - The data to use for rendering the label.\n     *\n     * @returns A virtual element representing the item label.\n     */\n    renderLabel(data: IRenderData): VirtualElement {\n      let content = this.formatLabel(data);\n      return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n    }\n\n    /**\n     * Create the class name for the menu bar item.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the menu item.\n     */\n    createItemClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-item';\n      if (data.title.className) {\n        name += ` ${data.title.className}`;\n      }\n      if (data.active && !data.disabled) {\n        name += ' lm-mod-active';\n      }\n      return name;\n    }\n\n    /**\n     * Create the dataset for a menu bar item.\n     *\n     * @param data - The data to use for the item.\n     *\n     * @returns The dataset for the menu bar item.\n     */\n    createItemDataset(data: IRenderData): ElementDataset {\n      return data.title.dataset;\n    }\n\n    /**\n     * Create the aria attributes for menu bar item.\n     *\n     * @param data - The data to use for the aria attributes.\n     *\n     * @returns The aria attributes object for the item.\n     */\n    createItemARIA(data: IRenderData): ElementARIAAttrs {\n      return {\n        role: 'menuitem',\n        'aria-haspopup': 'true',\n        'aria-disabled': data.disabled ? 'true' : 'false'\n      };\n    }\n\n    /**\n     * Create the class name for the menu bar item icon.\n     *\n     * @param data - The data to use for the class name.\n     *\n     * @returns The full class name for the item icon.\n     */\n    createIconClass(data: IRenderData): string {\n      let name = 'lm-MenuBar-itemIcon';\n      let extra = data.title.iconClass;\n      return extra ? `${name} ${extra}` : name;\n    }\n\n    /**\n     * Create the render content for the label node.\n     *\n     * @param data - The data to use for the label content.\n     *\n     * @returns The content to add to the label node.\n     */\n    formatLabel(data: IRenderData): h.Child {\n      // Fetch the label text and mnemonic index.\n      let { label, mnemonic } = data.title;\n\n      // If the index is out of range, do not modify the label.\n      if (mnemonic < 0 || mnemonic >= label.length) {\n        return label;\n      }\n\n      // Split the label into parts.\n      let prefix = label.slice(0, mnemonic);\n      let suffix = label.slice(mnemonic + 1);\n      let char = label[mnemonic];\n\n      // Wrap the mnemonic character in a span.\n      let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n      // Return the content parts.\n      return [prefix, span, suffix];\n    }\n  }\n\n  /**\n   * The default `Renderer` instance.\n   */\n  export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n  /**\n   * Determines if a overflow menu appears when the menu items overflow.\n   *\n   * Defaults to `true`.\n   */\n  isVisible: boolean;\n  /**\n   * Determines the title of the overflow menu.\n   *\n   * Default: `...`.\n   */\n  title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create the DOM node for a menu bar.\n   */\n  export function createNode(): HTMLDivElement {\n    let node = document.createElement('div');\n    let content = document.createElement('ul');\n    content.className = 'lm-MenuBar-content';\n    node.appendChild(content);\n    content.setAttribute('role', 'menubar');\n    return node;\n  }\n\n  /**\n   * Position for the menu relative to top-left screen corner.\n   */\n  export interface IPosition {\n    /**\n     * Pixels right from screen origin.\n     */\n    left: number;\n    /**\n     * Pixels down from screen origin.\n     */\n    top: number;\n  }\n\n  /**\n   * The results of a mnemonic search.\n   */\n  export interface IMnemonicResult {\n    /**\n     * The index of the first matching mnemonic item, or `-1`.\n     */\n    index: number;\n\n    /**\n     * Whether multiple mnemonic items matched.\n     */\n    multiple: boolean;\n\n    /**\n     * The index of the first auto matched non-mnemonic item.\n     */\n    auto: number;\n  }\n\n  /**\n   * Find the best matching mnemonic item.\n   *\n   * The search starts at the given index and wraps around.\n   */\n  export function findMnemonic(\n    menus: ReadonlyArray<Menu>,\n    key: string,\n    start: number\n  ): IMnemonicResult {\n    // Setup the result variables.\n    let index = -1;\n    let auto = -1;\n    let multiple = false;\n\n    // Normalize the key to upper case.\n    let upperKey = key.toUpperCase();\n\n    // Search the items from the given start index.\n    for (let i = 0, n = menus.length; i < n; ++i) {\n      // Compute the wrapped index.\n      let k = (i + start) % n;\n\n      // Look up the menu title.\n      let title = menus[k].title;\n\n      // Ignore titles with an empty label.\n      if (title.label.length === 0) {\n        continue;\n      }\n\n      // Look up the mnemonic index for the label.\n      let mn = title.mnemonic;\n\n      // Handle a valid mnemonic index.\n      if (mn >= 0 && mn < title.label.length) {\n        if (title.label[mn].toUpperCase() === upperKey) {\n          if (index === -1) {\n            index = k;\n          } else {\n            multiple = true;\n          }\n        }\n        continue;\n      }\n\n      // Finally, handle the auto index if possible.\n      if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n        auto = k;\n      }\n    }\n\n    // Return the search results.\n    return { index, multiple, auto };\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n  /**\n   * Construct a new scroll bar.\n   *\n   * @param options - The options for initializing the scroll bar.\n   */\n  constructor(options: ScrollBar.IOptions = {}) {\n    super({ node: Private.createNode() });\n    this.addClass('lm-ScrollBar');\n    this.setFlag(Widget.Flag.DisallowLayout);\n\n    // Set the orientation.\n    this._orientation = options.orientation || 'vertical';\n    this.dataset['orientation'] = this._orientation;\n\n    // Parse the rest of the options.\n    if (options.maximum !== undefined) {\n      this._maximum = Math.max(0, options.maximum);\n    }\n    if (options.page !== undefined) {\n      this._page = Math.max(0, options.page);\n    }\n    if (options.value !== undefined) {\n      this._value = Math.max(0, Math.min(options.value, this._maximum));\n    }\n  }\n\n  /**\n   * A signal emitted when the user moves the scroll thumb.\n   *\n   * #### Notes\n   * The payload is the current value of the scroll bar.\n   */\n  get thumbMoved(): ISignal<this, number> {\n    return this._thumbMoved;\n  }\n\n  /**\n   * A signal emitted when the user clicks a step button.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get stepRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._stepRequested;\n  }\n\n  /**\n   * A signal emitted when the user clicks the scroll track.\n   *\n   * #### Notes\n   * The payload is whether a decrease or increase is requested.\n   */\n  get pageRequested(): ISignal<this, 'decrement' | 'increment'> {\n    return this._pageRequested;\n  }\n\n  /**\n   * Get the orientation of the scroll bar.\n   */\n  get orientation(): ScrollBar.Orientation {\n    return this._orientation;\n  }\n\n  /**\n   * Set the orientation of the scroll bar.\n   */\n  set orientation(value: ScrollBar.Orientation) {\n    // Do nothing if the orientation does not change.\n    if (this._orientation === value) {\n      return;\n    }\n\n    // Release the mouse before making changes.\n    this._releaseMouse();\n\n    // Update the internal orientation.\n    this._orientation = value;\n    this.dataset['orientation'] = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the current value of the scroll bar.\n   */\n  get value(): number {\n    return this._value;\n  }\n\n  /**\n   * Set the current value of the scroll bar.\n   *\n   * #### Notes\n   * The value will be clamped to the range `[0, maximum]`.\n   */\n  set value(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Do nothing if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size is the amount of visible content in the scrolled\n   * region, expressed in data units. It determines the size of the\n   * scroll bar thumb.\n   */\n  get page(): number {\n    return this._page;\n  }\n\n  /**\n   * Set the page size of the scroll bar.\n   *\n   * #### Notes\n   * The page size will be clamped to the range `[0, Infinity]`.\n   */\n  set page(value: number) {\n    // Clamp the page size to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._page === value) {\n      return;\n    }\n\n    // Update the internal page size.\n    this._page = value;\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * Get the maximum value of the scroll bar.\n   */\n  get maximum(): number {\n    return this._maximum;\n  }\n\n  /**\n   * Set the maximum value of the scroll bar.\n   *\n   * #### Notes\n   * The max size will be clamped to the range `[0, Infinity]`.\n   */\n  set maximum(value: number) {\n    // Clamp the value to the allowable range.\n    value = Math.max(0, value);\n\n    // Do nothing if the value does not change.\n    if (this._maximum === value) {\n      return;\n    }\n\n    // Update the internal values.\n    this._maximum = value;\n\n    // Clamp the current value to the new range.\n    this._value = Math.min(this._value, value);\n\n    // Schedule an update the scroll bar.\n    this.update();\n  }\n\n  /**\n   * The scroll bar decrement button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get decrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar increment button node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get incrementNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-button'\n    )[1] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar track node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get trackNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-track'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * The scroll bar thumb node.\n   *\n   * #### Notes\n   * Modifying this node directly can lead to undefined behavior.\n   */\n  get thumbNode(): HTMLDivElement {\n    return this.node.getElementsByClassName(\n      'lm-ScrollBar-thumb'\n    )[0] as HTMLDivElement;\n  }\n\n  /**\n   * Handle the DOM events for the scroll bar.\n   *\n   * @param event - The DOM event sent to the scroll bar.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the scroll bar's DOM node.\n   *\n   * This should not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'mousedown':\n        this._evtMouseDown(event as MouseEvent);\n        break;\n      case 'mousemove':\n        this._evtMouseMove(event as MouseEvent);\n        break;\n      case 'mouseup':\n        this._evtMouseUp(event as MouseEvent);\n        break;\n      case 'keydown':\n        this._evtKeyDown(event as KeyboardEvent);\n        break;\n      case 'contextmenu':\n        event.preventDefault();\n        event.stopPropagation();\n        break;\n    }\n  }\n\n  /**\n   * A method invoked on a 'before-attach' message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    this.node.addEventListener('mousedown', this);\n    this.update();\n  }\n\n  /**\n   * A method invoked on an 'after-detach' message.\n   */\n  protected onAfterDetach(msg: Message): void {\n    this.node.removeEventListener('mousedown', this);\n    this._releaseMouse();\n  }\n\n  /**\n   * A method invoked on an 'update-request' message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    // Convert the value and page into percentages.\n    let value = (this._value * 100) / this._maximum;\n    let page = (this._page * 100) / (this._page + this._maximum);\n\n    // Clamp the value and page to the relevant range.\n    value = Math.max(0, Math.min(value, 100));\n    page = Math.max(0, Math.min(page, 100));\n\n    // Fetch the thumb style.\n    let thumbStyle = this.thumbNode.style;\n\n    // Update the thumb style for the current orientation.\n    if (this._orientation === 'horizontal') {\n      thumbStyle.top = '';\n      thumbStyle.height = '';\n      thumbStyle.left = `${value}%`;\n      thumbStyle.width = `${page}%`;\n      thumbStyle.transform = `translate(${-value}%, 0%)`;\n    } else {\n      thumbStyle.left = '';\n      thumbStyle.width = '';\n      thumbStyle.top = `${value}%`;\n      thumbStyle.height = `${page}%`;\n      thumbStyle.transform = `translate(0%, ${-value}%)`;\n    }\n  }\n\n  /**\n   * Handle the `'keydown'` event for the scroll bar.\n   */\n  private _evtKeyDown(event: KeyboardEvent): void {\n    // Stop all input events during drag.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Ignore anything except the `Escape` key.\n    if (event.keyCode !== 27) {\n      return;\n    }\n\n    // Fetch the previous scroll value.\n    let value = this._pressData ? this._pressData.value : -1;\n\n    // Release the mouse.\n    this._releaseMouse();\n\n    // Restore the old scroll value if possible.\n    if (value !== -1) {\n      this._moveThumb(value);\n    }\n  }\n\n  /**\n   * Handle the `'mousedown'` event for the scroll bar.\n   */\n  private _evtMouseDown(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse press.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Send an activate request to the scroll bar. This can be\n    // used by message hooks to activate something relevant.\n    this.activate();\n\n    // Do nothing if the mouse is already captured.\n    if (this._pressData) {\n      return;\n    }\n\n    // Find the pressed scroll bar part.\n    let part = Private.findPart(this, event.target as HTMLElement);\n\n    // Do nothing if the part is not of interest.\n    if (!part) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Override the mouse cursor.\n    let override = Drag.overrideCursor('default');\n\n    // Set up the press data.\n    this._pressData = {\n      part,\n      override,\n      delta: -1,\n      value: -1,\n      mouseX: event.clientX,\n      mouseY: event.clientY\n    };\n\n    // Add the extra event listeners.\n    document.addEventListener('mousemove', this, true);\n    document.addEventListener('mouseup', this, true);\n    document.addEventListener('keydown', this, true);\n    document.addEventListener('contextmenu', this, true);\n\n    // Handle a thumb press.\n    if (part === 'thumb') {\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Update the press data delta for the current orientation.\n      if (this._orientation === 'horizontal') {\n        this._pressData.delta = event.clientX - thumbRect.left;\n      } else {\n        this._pressData.delta = event.clientY - thumbRect.top;\n      }\n\n      // Add the active class to the thumb node.\n      thumbNode.classList.add('lm-mod-active');\n\n      // Store the current value in the press data.\n      this._pressData.value = this._value;\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track press.\n    if (part === 'track') {\n      // Fetch the client rect for the thumb.\n      let thumbRect = this.thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n\n    // Handle a decrement button press.\n    if (part === 'decrement') {\n      // Add the active class to the decrement node.\n      this.decrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button press.\n    if (part === 'increment') {\n      // Add the active class to the increment node.\n      this.incrementNode.classList.add('lm-mod-active');\n\n      // Start the repeat timer.\n      this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n  }\n\n  /**\n   * Handle the `'mousemove'` event for the scroll bar.\n   */\n  private _evtMouseMove(event: MouseEvent): void {\n    // Do nothing if no drag is in progress.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Update the mouse position.\n    this._pressData.mouseX = event.clientX;\n    this._pressData.mouseY = event.clientY;\n\n    // Bail if the thumb is not being dragged.\n    if (this._pressData.part !== 'thumb') {\n      return;\n    }\n\n    // Get the client rect for the thumb and track.\n    let thumbRect = this.thumbNode.getBoundingClientRect();\n    let trackRect = this.trackNode.getBoundingClientRect();\n\n    // Fetch the scroll geometry based on the orientation.\n    let trackPos: number;\n    let trackSpan: number;\n    if (this._orientation === 'horizontal') {\n      trackPos = event.clientX - trackRect.left - this._pressData.delta;\n      trackSpan = trackRect.width - thumbRect.width;\n    } else {\n      trackPos = event.clientY - trackRect.top - this._pressData.delta;\n      trackSpan = trackRect.height - thumbRect.height;\n    }\n\n    // Compute the desired value from the scroll geometry.\n    let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n    // Move the thumb to the computed value.\n    this._moveThumb(value);\n  }\n\n  /**\n   * Handle the `'mouseup'` event for the scroll bar.\n   */\n  private _evtMouseUp(event: MouseEvent): void {\n    // Do nothing if it's not a left mouse release.\n    if (event.button !== 0) {\n      return;\n    }\n\n    // Stop the event propagation.\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Release the mouse.\n    this._releaseMouse();\n  }\n\n  /**\n   * Release the mouse and restore the node states.\n   */\n  private _releaseMouse(): void {\n    // Bail if there is no press data.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Clear the repeat timer.\n    clearTimeout(this._repeatTimer);\n    this._repeatTimer = -1;\n\n    // Clear the press data.\n    this._pressData.override.dispose();\n    this._pressData = null;\n\n    // Remove the extra event listeners.\n    document.removeEventListener('mousemove', this, true);\n    document.removeEventListener('mouseup', this, true);\n    document.removeEventListener('keydown', this, true);\n    document.removeEventListener('contextmenu', this, true);\n\n    // Remove the active classes from the nodes.\n    this.thumbNode.classList.remove('lm-mod-active');\n    this.decrementNode.classList.remove('lm-mod-active');\n    this.incrementNode.classList.remove('lm-mod-active');\n  }\n\n  /**\n   * Move the thumb to the specified position.\n   */\n  private _moveThumb(value: number): void {\n    // Clamp the value to the allowed range.\n    value = Math.max(0, Math.min(value, this._maximum));\n\n    // Bail if the value does not change.\n    if (this._value === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._value = value;\n\n    // Schedule an update of the scroll bar.\n    this.update();\n\n    // Emit the thumb moved signal.\n    this._thumbMoved.emit(value);\n  }\n\n  /**\n   * A timeout callback for repeating the mouse press.\n   */\n  private _onRepeat = () => {\n    // Clear the repeat timer id.\n    this._repeatTimer = -1;\n\n    // Bail if the mouse has been released.\n    if (!this._pressData) {\n      return;\n    }\n\n    // Look up the part that was pressed.\n    let part = this._pressData.part;\n\n    // Bail if the thumb was pressed.\n    if (part === 'thumb') {\n      return;\n    }\n\n    // Schedule the timer for another repeat.\n    this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n    // Get the current mouse position.\n    let mouseX = this._pressData.mouseX;\n    let mouseY = this._pressData.mouseY;\n\n    // Handle a decrement button repeat.\n    if (part === 'decrement') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('decrement');\n\n      // Finished.\n      return;\n    }\n\n    // Handle an increment button repeat.\n    if (part === 'increment') {\n      // Bail if the mouse is not over the button.\n      if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Emit the step requested signal.\n      this._stepRequested.emit('increment');\n\n      // Finished.\n      return;\n    }\n\n    // Handle a track repeat.\n    if (part === 'track') {\n      // Bail if the mouse is not over the track.\n      if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the thumb node.\n      let thumbNode = this.thumbNode;\n\n      // Bail if the mouse is over the thumb.\n      if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n        return;\n      }\n\n      // Fetch the client rect for the thumb.\n      let thumbRect = thumbNode.getBoundingClientRect();\n\n      // Determine the direction for the page request.\n      let dir: 'decrement' | 'increment';\n      if (this._orientation === 'horizontal') {\n        dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n      } else {\n        dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n      }\n\n      // Emit the page requested signal.\n      this._pageRequested.emit(dir);\n\n      // Finished.\n      return;\n    }\n  };\n\n  private _value = 0;\n  private _page = 10;\n  private _maximum = 100;\n  private _repeatTimer = -1;\n  private _orientation: ScrollBar.Orientation;\n  private _pressData: Private.IPressData | null = null;\n  private _thumbMoved = new Signal<this, number>(this);\n  private _stepRequested = new Signal<this, 'decrement' | 'increment'>(this);\n  private _pageRequested = new Signal<this, 'decrement' | 'increment'>(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n  /**\n   * A type alias for a scroll bar orientation.\n   */\n  export type Orientation = 'horizontal' | 'vertical';\n\n  /**\n   * An options object for creating a scroll bar.\n   */\n  export interface IOptions {\n    /**\n     * The orientation of the scroll bar.\n     *\n     * The default is `'vertical'`.\n     */\n    orientation?: Orientation;\n\n    /**\n     * The value for the scroll bar.\n     *\n     * The default is `0`.\n     */\n    value?: number;\n\n    /**\n     * The page size for the scroll bar.\n     *\n     * The default is `10`.\n     */\n    page?: number;\n\n    /**\n     * The maximum value for the scroll bar.\n     *\n     * The default is `100`.\n     */\n    maximum?: number;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * A type alias for the parts of a scroll bar.\n   */\n  export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n  /**\n   * An object which holds mouse press data.\n   */\n  export interface IPressData {\n    /**\n     * The scroll bar part which was pressed.\n     */\n    part: ScrollBarPart;\n\n    /**\n     * The offset of the press in thumb coordinates, or -1.\n     */\n    delta: number;\n\n    /**\n     * The scroll value at the time the thumb was pressed, or -1.\n     */\n    value: number;\n\n    /**\n     * The disposable which will clear the override cursor.\n     */\n    override: IDisposable;\n\n    /**\n     * The current X position of the mouse.\n     */\n    mouseX: number;\n\n    /**\n     * The current Y position of the mouse.\n     */\n    mouseY: number;\n  }\n\n  /**\n   * Create the DOM node for a scroll bar.\n   */\n  export function createNode(): HTMLElement {\n    let node = document.createElement('div');\n    let decrement = document.createElement('div');\n    let increment = document.createElement('div');\n    let track = document.createElement('div');\n    let thumb = document.createElement('div');\n    decrement.className = 'lm-ScrollBar-button';\n    increment.className = 'lm-ScrollBar-button';\n    decrement.dataset['action'] = 'decrement';\n    increment.dataset['action'] = 'increment';\n    track.className = 'lm-ScrollBar-track';\n    thumb.className = 'lm-ScrollBar-thumb';\n    track.appendChild(thumb);\n    node.appendChild(decrement);\n    node.appendChild(track);\n    node.appendChild(increment);\n    return node;\n  }\n\n  /**\n   * Find the scroll bar part which contains the given target.\n   */\n  export function findPart(\n    scrollBar: ScrollBar,\n    target: HTMLElement\n  ): ScrollBarPart | null {\n    // Test the thumb.\n    if (scrollBar.thumbNode.contains(target)) {\n      return 'thumb';\n    }\n\n    // Test the track.\n    if (scrollBar.trackNode.contains(target)) {\n      return 'track';\n    }\n\n    // Test the decrement button.\n    if (scrollBar.decrementNode.contains(target)) {\n      return 'decrement';\n    }\n\n    // Test the increment button.\n    if (scrollBar.incrementNode.contains(target)) {\n      return 'increment';\n    }\n\n    // Indicate no match.\n    return null;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n  /**\n   * Construct a new stacked panel.\n   *\n   * @param options - The options for initializing the panel.\n   */\n  constructor(options: StackedPanel.IOptions = {}) {\n    super({ layout: Private.createLayout(options) });\n    this.addClass('lm-StackedPanel');\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return (this.layout as StackedLayout).hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    (this.layout as StackedLayout).hiddenMode = v;\n  }\n\n  /**\n   * A signal emitted when a widget is removed from a stacked panel.\n   */\n  get widgetRemoved(): ISignal<this, Widget> {\n    return this._widgetRemoved;\n  }\n\n  /**\n   * A message handler invoked on a `'child-added'` message.\n   */\n  protected onChildAdded(msg: Widget.ChildMessage): void {\n    msg.child.addClass('lm-StackedPanel-child');\n  }\n\n  /**\n   * A message handler invoked on a `'child-removed'` message.\n   */\n  protected onChildRemoved(msg: Widget.ChildMessage): void {\n    msg.child.removeClass('lm-StackedPanel-child');\n    this._widgetRemoved.emit(msg.child);\n  }\n\n  private _widgetRemoved = new Signal<this, Widget>(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n  /**\n   * An options object for creating a stacked panel.\n   */\n  export interface IOptions {\n    /**\n     * The stacked layout to use for the stacked panel.\n     *\n     * The default is a new `StackedLayout`.\n     */\n    layout?: StackedLayout;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Create a stacked layout for the given panel options.\n   */\n  export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n    return options.layout || new StackedLayout();\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n  /**\n   * Construct a new tab panel.\n   *\n   * @param options - The options for initializing the tab panel.\n   */\n  constructor(options: TabPanel.IOptions = {}) {\n    super();\n    this.addClass('lm-TabPanel');\n\n    // Create the tab bar and stacked panel.\n    this.tabBar = new TabBar<Widget>(options);\n    this.tabBar.addClass('lm-TabPanel-tabBar');\n    this.stackedPanel = new StackedPanel();\n    this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n    // Connect the tab bar signal handlers.\n    this.tabBar.tabMoved.connect(this._onTabMoved, this);\n    this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n    this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n    this.tabBar.tabActivateRequested.connect(\n      this._onTabActivateRequested,\n      this\n    );\n    this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n    // Connect the stacked panel signal handlers.\n    this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n    // Get the data related to the placement.\n    this._tabPlacement = options.tabPlacement || 'top';\n    let direction = Private.directionFromPlacement(this._tabPlacement);\n    let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = this._tabPlacement;\n\n    // Create the box layout.\n    let layout = new BoxLayout({ direction, spacing: 0 });\n\n    // Set the stretch factors for the child widgets.\n    BoxLayout.setStretch(this.tabBar, 0);\n    BoxLayout.setStretch(this.stackedPanel, 1);\n\n    // Add the child widgets to the layout.\n    layout.addWidget(this.tabBar);\n    layout.addWidget(this.stackedPanel);\n\n    // Install the layout on the tab panel.\n    this.layout = layout;\n  }\n\n  /**\n   * A signal emitted when the current tab is changed.\n   *\n   * #### Notes\n   * This signal is emitted when the currently selected tab is changed\n   * either through user or programmatic interaction.\n   *\n   * Notably, this signal is not emitted when the index of the current\n   * tab changes due to tabs being inserted, removed, or moved. It is\n   * only emitted when the actual current tab node is changed.\n   */\n  get currentChanged(): ISignal<this, TabPanel.ICurrentChangedArgs> {\n    return this._currentChanged;\n  }\n\n  /**\n   * Get the index of the currently selected tab.\n   *\n   * #### Notes\n   * This will be `-1` if no tab is selected.\n   */\n  get currentIndex(): number {\n    return this.tabBar.currentIndex;\n  }\n\n  /**\n   * Set the index of the currently selected tab.\n   *\n   * #### Notes\n   * If the index is out of range, it will be set to `-1`.\n   */\n  set currentIndex(value: number) {\n    this.tabBar.currentIndex = value;\n  }\n\n  /**\n   * Get the currently selected widget.\n   *\n   * #### Notes\n   * This will be `null` if there is no selected tab.\n   */\n  get currentWidget(): Widget | null {\n    let title = this.tabBar.currentTitle;\n    return title ? title.owner : null;\n  }\n\n  /**\n   * Set the currently selected widget.\n   *\n   * #### Notes\n   * If the widget is not in the panel, it will be set to `null`.\n   */\n  set currentWidget(value: Widget | null) {\n    this.tabBar.currentTitle = value ? value.title : null;\n  }\n\n  /**\n   * Get the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  get tabsMovable(): boolean {\n    return this.tabBar.tabsMovable;\n  }\n\n  /**\n   * Set the whether the tabs are movable by the user.\n   *\n   * #### Notes\n   * Tabs can always be moved programmatically.\n   */\n  set tabsMovable(value: boolean) {\n    this.tabBar.tabsMovable = value;\n  }\n\n  /**\n   * Get the whether the add button is enabled.\n   *\n   */\n  get addButtonEnabled(): boolean {\n    return this.tabBar.addButtonEnabled;\n  }\n\n  /**\n   * Set the whether the add button is enabled.\n   *\n   */\n  set addButtonEnabled(value: boolean) {\n    this.tabBar.addButtonEnabled = value;\n  }\n\n  /**\n   * Get the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  get tabPlacement(): TabPanel.TabPlacement {\n    return this._tabPlacement;\n  }\n\n  /**\n   * Set the tab placement for the tab panel.\n   *\n   * #### Notes\n   * This controls the position of the tab bar relative to the content.\n   */\n  set tabPlacement(value: TabPanel.TabPlacement) {\n    // Bail if the placement does not change.\n    if (this._tabPlacement === value) {\n      return;\n    }\n\n    // Update the internal value.\n    this._tabPlacement = value;\n\n    // Get the values related to the placement.\n    let direction = Private.directionFromPlacement(value);\n    let orientation = Private.orientationFromPlacement(value);\n\n    // Configure the tab bar for the placement.\n    this.tabBar.orientation = orientation;\n    this.tabBar.dataset['placement'] = value;\n\n    // Update the layout direction.\n    (this.layout as BoxLayout).direction = direction;\n  }\n\n  /**\n   * A signal emitted when the add button on a tab bar is clicked.\n   *\n   */\n  get addRequested(): ISignal<this, TabBar<Widget>> {\n    return this._addRequested;\n  }\n\n  /**\n   * The tab bar used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the tab bar directly can lead to undefined behavior.\n   */\n  readonly tabBar: TabBar<Widget>;\n\n  /**\n   * The stacked panel used by the tab panel.\n   *\n   * #### Notes\n   * Modifying the panel directly can lead to undefined behavior.\n   */\n  readonly stackedPanel: StackedPanel;\n\n  /**\n   * A read-only array of the widgets in the panel.\n   */\n  get widgets(): ReadonlyArray<Widget> {\n    return this.stackedPanel.widgets;\n  }\n\n  /**\n   * Add a widget to the end of the tab panel.\n   *\n   * @param widget - The widget to add to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  addWidget(widget: Widget): void {\n    this.insertWidget(this.widgets.length, widget);\n  }\n\n  /**\n   * Insert a widget into the tab panel at a specified index.\n   *\n   * @param index - The index at which to insert the widget.\n   *\n   * @param widget - The widget to insert into to the tab panel.\n   *\n   * #### Notes\n   * If the widget is already contained in the panel, it will be moved.\n   *\n   * The widget's `title` is used to populate the tab.\n   */\n  insertWidget(index: number, widget: Widget): void {\n    if (widget !== this.currentWidget) {\n      widget.hide();\n    }\n    this.stackedPanel.insertWidget(index, widget);\n    this.tabBar.insertTab(index, widget.title);\n\n    widget.node.setAttribute('role', 'tabpanel');\n\n    let renderer = this.tabBar.renderer;\n    if (renderer instanceof TabBar.Renderer) {\n      let tabId = renderer.createTabKey({\n        title: widget.title,\n        current: false,\n        zIndex: 0\n      });\n      widget.node.setAttribute('aria-labelledby', tabId);\n    }\n  }\n\n  /**\n   * Handle the `currentChanged` signal from the tab bar.\n   */\n  private _onCurrentChanged(\n    sender: TabBar<Widget>,\n    args: TabBar.ICurrentChangedArgs<Widget>\n  ): void {\n    // Extract the previous and current title from the args.\n    let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n    // Extract the widgets from the titles.\n    let previousWidget = previousTitle ? previousTitle.owner : null;\n    let currentWidget = currentTitle ? currentTitle.owner : null;\n\n    // Hide the previous widget.\n    if (previousWidget) {\n      previousWidget.hide();\n    }\n\n    // Show the current widget.\n    if (currentWidget) {\n      currentWidget.show();\n    }\n\n    // Emit the `currentChanged` signal for the tab panel.\n    this._currentChanged.emit({\n      previousIndex,\n      previousWidget,\n      currentIndex,\n      currentWidget\n    });\n\n    // Flush the message loop on IE and Edge to prevent flicker.\n    if (Platform.IS_EDGE || Platform.IS_IE) {\n      MessageLoop.flush();\n    }\n  }\n\n  /**\n   * Handle the `tabAddRequested` signal from the tab bar.\n   */\n  private _onTabAddRequested(sender: TabBar<Widget>, args: void): void {\n    this._addRequested.emit(sender);\n  }\n\n  /**\n   * Handle the `tabActivateRequested` signal from the tab bar.\n   */\n  private _onTabActivateRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabActivateRequestedArgs<Widget>\n  ): void {\n    args.title.owner.activate();\n  }\n\n  /**\n   * Handle the `tabCloseRequested` signal from the tab bar.\n   */\n  private _onTabCloseRequested(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabCloseRequestedArgs<Widget>\n  ): void {\n    args.title.owner.close();\n  }\n\n  /**\n   * Handle the `tabMoved` signal from the tab bar.\n   */\n  private _onTabMoved(\n    sender: TabBar<Widget>,\n    args: TabBar.ITabMovedArgs<Widget>\n  ): void {\n    this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n  }\n\n  /**\n   * Handle the `widgetRemoved` signal from the stacked panel.\n   */\n  private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n    widget.node.removeAttribute('role');\n    widget.node.removeAttribute('aria-labelledby');\n    this.tabBar.removeTab(widget.title);\n  }\n\n  private _tabPlacement: TabPanel.TabPlacement;\n  private _currentChanged = new Signal<this, TabPanel.ICurrentChangedArgs>(\n    this\n  );\n\n  private _addRequested = new Signal<this, TabBar<Widget>>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n  /**\n   * A type alias for tab placement in a tab bar.\n   */\n  export type TabPlacement =\n    | /**\n     * The tabs are placed as a row above the content.\n     */\n    'top'\n\n    /**\n     * The tabs are placed as a column to the left of the content.\n     */\n    | 'left'\n\n    /**\n     * The tabs are placed as a column to the right of the content.\n     */\n    | 'right'\n\n    /**\n     * The tabs are placed as a row below the content.\n     */\n    | 'bottom';\n\n  /**\n   * An options object for initializing a tab panel.\n   */\n  export interface IOptions {\n    /**\n     * The document to use with the tab panel.\n     *\n     * The default is the global `document` instance.\n     */\n    document?: Document | ShadowRoot;\n\n    /**\n     * Whether the tabs are movable by the user.\n     *\n     * The default is `false`.\n     */\n    tabsMovable?: boolean;\n\n    /**\n     * Whether the button to add new tabs is enabled.\n     *\n     * The default is `false`.\n     */\n    addButtonEnabled?: boolean;\n\n    /**\n     * The placement of the tab bar relative to the content.\n     *\n     * The default is `'top'`.\n     */\n    tabPlacement?: TabPlacement;\n\n    /**\n     * The renderer for the panel's tab bar.\n     *\n     * The default is a shared renderer instance.\n     */\n    renderer?: TabBar.IRenderer<Widget>;\n  }\n\n  /**\n   * The arguments object for the `currentChanged` signal.\n   */\n  export interface ICurrentChangedArgs {\n    /**\n     * The previously selected index.\n     */\n    previousIndex: number;\n\n    /**\n     * The previously selected widget.\n     */\n    previousWidget: Widget | null;\n\n    /**\n     * The currently selected index.\n     */\n    currentIndex: number;\n\n    /**\n     * The currently selected widget.\n     */\n    currentWidget: Widget | null;\n  }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n  /**\n   * Convert a tab placement to tab bar orientation.\n   */\n  export function orientationFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): TabBar.Orientation {\n    return placementToOrientationMap[plc];\n  }\n\n  /**\n   * Convert a tab placement to a box layout direction.\n   */\n  export function directionFromPlacement(\n    plc: TabPanel.TabPlacement\n  ): BoxLayout.Direction {\n    return placementToDirectionMap[plc];\n  }\n\n  /**\n   * A mapping of tab placement to tab bar orientation.\n   */\n  const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n    top: 'horizontal',\n    left: 'vertical',\n    right: 'vertical',\n    bottom: 'horizontal'\n  };\n\n  /**\n   * A mapping of tab placement to box layout direction.\n   */\n  const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n    top: 'top-to-bottom',\n    left: 'left-to-right',\n    right: 'right-to-left',\n    bottom: 'bottom-to-top'\n  };\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    if (this._widget) {\n      let widget = this._widget;\n      this._widget = null;\n      widget.dispose();\n    }\n    super.dispose();\n  }\n\n  /**\n   * Get the child widget for the layout.\n   */\n  get widget(): Widget | null {\n    return this._widget;\n  }\n\n  /**\n   * Set the child widget for the layout.\n   *\n   * #### Notes\n   * Setting the child widget will cause the old child widget to be\n   * automatically disposed. If that is not desired, set the parent\n   * of the old child to `null` before assigning a new child.\n   */\n  set widget(widget: Widget | null) {\n    // Remove the widget from its current parent. This is a no-op\n    // if the widget's parent is already the layout parent widget.\n    if (widget) {\n      widget.parent = this.parent;\n    }\n\n    // Bail early if the widget does not change.\n    if (this._widget === widget) {\n      return;\n    }\n\n    // Dispose of the old child widget.\n    if (this._widget) {\n      this._widget.dispose();\n    }\n\n    // Update the internal widget.\n    this._widget = widget;\n\n    // Attach the new child widget if needed.\n    if (this.parent && widget) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Create an iterator over the widgets in the layout.\n   *\n   * @returns A new iterator over the widgets in the layout.\n   */\n  *[Symbol.iterator](): IterableIterator<Widget> {\n    if (this._widget) {\n      yield this._widget;\n    }\n  }\n\n  /**\n   * Remove a widget from the layout.\n   *\n   * @param widget - The widget to remove from the layout.\n   *\n   * #### Notes\n   * A widget is automatically removed from the layout when its `parent`\n   * is set to `null`. This method should only be invoked directly when\n   * removing a widget from a layout which has yet to be installed on a\n   * parent widget.\n   *\n   * This method does *not* modify the widget's `parent`.\n   */\n  removeWidget(widget: Widget): void {\n    // Bail early if the widget does not exist in the layout.\n    if (this._widget !== widget) {\n      return;\n    }\n\n    // Clear the internal widget.\n    this._widget = null;\n\n    // If the layout is parented, detach the widget from the DOM.\n    if (this.parent) {\n      this.detachWidget(widget);\n    }\n  }\n\n  /**\n   * Perform layout initialization which requires the parent widget.\n   */\n  protected init(): void {\n    super.init();\n    for (const widget of this) {\n      this.attachWidget(widget);\n    }\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation adds the widgets's node to the parent's\n   * node at the proper location, and sends the appropriate attach\n   * messages to the widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is added to the parent's node.\n   */\n  protected attachWidget(widget: Widget): void {\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This method is called automatically by the single layout at the\n   * appropriate time. It should not be called directly by user code.\n   *\n   * The default implementation removes the widget's node from the\n   * parent's node, and sends the appropriate detach messages to the\n   * widget if the parent is attached to the DOM.\n   *\n   * Subclasses may reimplement this method to control how the widget's\n   * node is removed from the parent's node.\n   */\n  protected detachWidget(widget: Widget): void {\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n  }\n\n  private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n  constructor(options: StackedLayout.IOptions = {}) {\n    super(options);\n    this._hiddenMode =\n      options.hiddenMode !== undefined\n        ? options.hiddenMode\n        : Widget.HiddenMode.Display;\n  }\n\n  /**\n   * The method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  get hiddenMode(): Widget.HiddenMode {\n    return this._hiddenMode;\n  }\n\n  /**\n   * Set the method for hiding widgets.\n   *\n   * #### Notes\n   * If there is only one child widget, `Display` hiding mode will be used\n   * regardless of this setting.\n   */\n  set hiddenMode(v: Widget.HiddenMode) {\n    if (this._hiddenMode === v) {\n      return;\n    }\n    this._hiddenMode = v;\n    if (this.widgets.length > 1) {\n      this.widgets.forEach(w => {\n        w.hiddenMode = this._hiddenMode;\n      });\n    }\n  }\n\n  /**\n   * Dispose of the resources held by the layout.\n   */\n  dispose(): void {\n    // Dispose of the layout items.\n    for (const item of this._items) {\n      item.dispose();\n    }\n\n    // Clear the layout state.\n    this._box = null;\n    this._items.length = 0;\n\n    // Dispose of the rest of the layout.\n    super.dispose();\n  }\n\n  /**\n   * Attach a widget to the parent's DOM node.\n   *\n   * @param index - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to attach to the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected attachWidget(index: number, widget: Widget): void {\n    // Using transform create an additional layer in the pixel pipeline\n    // to limit the number of layer, it is set only if there is more than one widget.\n    if (\n      this._hiddenMode === Widget.HiddenMode.Scale &&\n      this._items.length > 0\n    ) {\n      if (this._items.length === 1) {\n        this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n      }\n      widget.hiddenMode = Widget.HiddenMode.Scale;\n    } else {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n    }\n\n    // Create and add a new layout item for the widget.\n    ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n    // Send a `'before-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n    }\n\n    // Add the widget's node to the parent.\n    this.parent!.node.appendChild(widget.node);\n\n    // Send an `'after-attach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n    }\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * Move a widget in the parent's DOM node.\n   *\n   * @param fromIndex - The previous index of the widget in the layout.\n   *\n   * @param toIndex - The current index of the widget in the layout.\n   *\n   * @param widget - The widget to move in the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected moveWidget(\n    fromIndex: number,\n    toIndex: number,\n    widget: Widget\n  ): void {\n    // Move the layout item for the widget.\n    ArrayExt.move(this._items, fromIndex, toIndex);\n\n    // Post an update request for the parent widget.\n    this.parent!.update();\n  }\n\n  /**\n   * Detach a widget from the parent's DOM node.\n   *\n   * @param index - The previous index of the widget in the layout.\n   *\n   * @param widget - The widget to detach from the parent.\n   *\n   * #### Notes\n   * This is a reimplementation of the superclass method.\n   */\n  protected detachWidget(index: number, widget: Widget): void {\n    // Remove the layout item for the widget.\n    let item = ArrayExt.removeAt(this._items, index);\n\n    // Send a `'before-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n    }\n\n    // Remove the widget's node from the parent.\n    this.parent!.node.removeChild(widget.node);\n\n    // Send an `'after-detach'` message if the parent is attached.\n    if (this.parent!.isAttached) {\n      MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n    }\n\n    // Reset the z-index for the widget.\n    item!.widget.node.style.zIndex = '';\n\n    // Reset the hidden mode for the widget.\n    if (this._hiddenMode === Widget.HiddenMode.Scale) {\n      widget.hiddenMode = Widget.HiddenMode.Display;\n\n      // Reset the hidden mode for the first widget if necessary.\n      if (this._items.length === 1) {\n        this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n      }\n    }\n\n    // Dispose of the layout item.\n    item!.dispose();\n\n    // Post a fit request for the parent widget.\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'before-show'` message.\n   */\n  protected onBeforeShow(msg: Message): void {\n    super.onBeforeShow(msg);\n    this.parent!.update();\n  }\n\n  /**\n   * A message handler invoked on a `'before-attach'` message.\n   */\n  protected onBeforeAttach(msg: Message): void {\n    super.onBeforeAttach(msg);\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-shown'` message.\n   */\n  protected onChildShown(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'child-hidden'` message.\n   */\n  protected onChildHidden(msg: Widget.ChildMessage): void {\n    this.parent!.fit();\n  }\n\n  /**\n   * A message handler invoked on a `'resize'` message.\n   */\n  protected onResize(msg: Widget.ResizeMessage): void {\n    if (this.parent!.isVisible) {\n      this._update(msg.width, msg.height);\n    }\n  }\n\n  /**\n   * A message handler invoked on an `'update-request'` message.\n   */\n  protected onUpdateRequest(msg: Message): void {\n    if (this.parent!.isVisible) {\n      this._update(-1, -1);\n    }\n  }\n\n  /**\n   * A message handler invoked on a `'fit-request'` message.\n   */\n  protected onFitRequest(msg: Message): void {\n    if (this.parent!.isAttached) {\n      this._fit();\n    }\n  }\n\n  /**\n   * Fit the layout to the total size required by the widgets.\n   */\n  private _fit(): void {\n    // Set up the computed minimum size.\n    let minW = 0;\n    let minH = 0;\n\n    // Update the computed minimum size.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Update the size limits for the item.\n      item.fit();\n\n      // Update the computed minimum size.\n      minW = Math.max(minW, item.minWidth);\n      minH = Math.max(minH, item.minHeight);\n    }\n\n    // Update the box sizing and add it to the computed min size.\n    let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n    minW += box.horizontalSum;\n    minH += box.verticalSum;\n\n    // Update the parent's min size constraints.\n    let style = this.parent!.node.style;\n    style.minWidth = `${minW}px`;\n    style.minHeight = `${minH}px`;\n\n    // Set the dirty flag to ensure only a single update occurs.\n    this._dirty = true;\n\n    // Notify the ancestor that it should fit immediately. This may\n    // cause a resize of the parent, fulfilling the required update.\n    if (this.parent!.parent) {\n      MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n    }\n\n    // If the dirty flag is still set, the parent was not resized.\n    // Trigger the required update on the parent widget immediately.\n    if (this._dirty) {\n      MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n    }\n  }\n\n  /**\n   * Update the layout position and size of the widgets.\n   *\n   * The parent offset dimensions should be `-1` if unknown.\n   */\n  private _update(offsetWidth: number, offsetHeight: number): void {\n    // Clear the dirty flag to indicate the update occurred.\n    this._dirty = false;\n\n    // Compute the visible item count.\n    let nVisible = 0;\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      nVisible += +!this._items[i].isHidden;\n    }\n\n    // Bail early if there are no visible items to layout.\n    if (nVisible === 0) {\n      return;\n    }\n\n    // Measure the parent if the offset dimensions are unknown.\n    if (offsetWidth < 0) {\n      offsetWidth = this.parent!.node.offsetWidth;\n    }\n    if (offsetHeight < 0) {\n      offsetHeight = this.parent!.node.offsetHeight;\n    }\n\n    // Ensure the parent box sizing data is computed.\n    if (!this._box) {\n      this._box = ElementExt.boxSizing(this.parent!.node);\n    }\n\n    // Compute the actual layout bounds adjusted for border and padding.\n    let top = this._box.paddingTop;\n    let left = this._box.paddingLeft;\n    let width = offsetWidth - this._box.horizontalSum;\n    let height = offsetHeight - this._box.verticalSum;\n\n    // Update the widget stacking order and layout geometry.\n    for (let i = 0, n = this._items.length; i < n; ++i) {\n      // Fetch the item.\n      let item = this._items[i];\n\n      // Ignore hidden items.\n      if (item.isHidden) {\n        continue;\n      }\n\n      // Set the z-index for the widget.\n      item.widget.node.style.zIndex = `${i}`;\n\n      // Update the item geometry.\n      item.update(left, top, width, height);\n    }\n  }\n\n  private _dirty = false;\n  private _items: LayoutItem[] = [];\n  private _box: ElementExt.IBoxSizing | null = null;\n  private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n  /**\n   * An options object for initializing a stacked layout.\n   */\n  export interface IOptions extends Layout.IOptions {\n    /**\n     * The method for hiding widgets.\n     *\n     * The default is `Widget.HiddenMode.Display`.\n     */\n    hiddenMode?: Widget.HiddenMode;\n  }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker<T extends Widget> implements IDisposable {\n  /**\n   * Dispose of the resources held by the tracker.\n   */\n  dispose(): void {\n    // Do nothing if the tracker is already disposed.\n    if (this._counter < 0) {\n      return;\n    }\n\n    // Mark the tracker as disposed.\n    this._counter = -1;\n\n    // Clear the connections for the tracker.\n    Signal.clearData(this);\n\n    // Remove all event listeners.\n    for (const widget of this._widgets) {\n      widget.node.removeEventListener('focus', this, true);\n      widget.node.removeEventListener('blur', this, true);\n    }\n\n    // Clear the internal data structures.\n    this._activeWidget = null;\n    this._currentWidget = null;\n    this._nodes.clear();\n    this._numbers.clear();\n    this._widgets.length = 0;\n  }\n\n  /**\n   * A signal emitted when the current widget has changed.\n   */\n  get currentChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._currentChanged;\n  }\n\n  /**\n   * A signal emitted when the active widget has changed.\n   */\n  get activeChanged(): ISignal<this, FocusTracker.IChangedArgs<T>> {\n    return this._activeChanged;\n  }\n\n  /**\n   * A flag indicating whether the tracker is disposed.\n   */\n  get isDisposed(): boolean {\n    return this._counter < 0;\n  }\n\n  /**\n   * The current widget in the tracker.\n   *\n   * #### Notes\n   * The current widget is the widget among the tracked widgets which\n   * has the *descendant node* which has most recently been focused.\n   *\n   * The current widget will not be updated if the node loses focus. It\n   * will only be updated when a different tracked widget gains focus.\n   *\n   * If the current widget is removed from the tracker, the previous\n   * current widget will be restored.\n   *\n   * This behavior is intended to follow a user's conceptual model of\n   * a semantically \"current\" widget, where the \"last thing of type X\"\n   * to be interacted with is the \"current instance of X\", regardless\n   * of whether that instance still has focus.\n   */\n  get currentWidget(): T | null {\n    return this._currentWidget;\n  }\n\n  /**\n   * The active widget in the tracker.\n   *\n   * #### Notes\n   * The active widget is the widget among the tracked widgets which\n   * has the *descendant node* which is currently focused.\n   */\n  get activeWidget(): T | null {\n    return this._activeWidget;\n  }\n\n  /**\n   * A read only array of the widgets being tracked.\n   */\n  get widgets(): ReadonlyArray<T> {\n    return this._widgets;\n  }\n\n  /**\n   * Get the focus number for a particular widget in the tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns The focus number for the given widget, or `-1` if the\n   *   widget has not had focus since being added to the tracker, or\n   *   is not contained by the tracker.\n   *\n   * #### Notes\n   * The focus number indicates the relative order in which the widgets\n   * have gained focus. A widget with a larger number has gained focus\n   * more recently than a widget with a smaller number.\n   *\n   * The `currentWidget` will always have the largest focus number.\n   *\n   * All widgets start with a focus number of `-1`, which indicates that\n   * the widget has not been focused since being added to the tracker.\n   */\n  focusNumber(widget: T): number {\n    let n = this._numbers.get(widget);\n    return n === undefined ? -1 : n;\n  }\n\n  /**\n   * Test whether the focus tracker contains a given widget.\n   *\n   * @param widget - The widget of interest.\n   *\n   * @returns `true` if the widget is tracked, `false` otherwise.\n   */\n  has(widget: T): boolean {\n    return this._numbers.has(widget);\n  }\n\n  /**\n   * Add a widget to the focus tracker.\n   *\n   * @param widget - The widget of interest.\n   *\n   * #### Notes\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is already tracked, this is a no-op.\n   */\n  add(widget: T): void {\n    // Do nothing if the widget is already tracked.\n    if (this._numbers.has(widget)) {\n      return;\n    }\n\n    // Test whether the widget has focus.\n    let focused = widget.node.contains(document.activeElement);\n\n    // Set up the initial focus number.\n    let n = focused ? this._counter++ : -1;\n\n    // Add the widget to the internal data structures.\n    this._widgets.push(widget);\n    this._numbers.set(widget, n);\n    this._nodes.set(widget.node, widget);\n\n    // Set up the event listeners. The capturing phase must be used\n    // since the 'focus' and 'blur' events don't bubble and Firefox\n    // doesn't support the 'focusin' or 'focusout' events.\n    widget.node.addEventListener('focus', this, true);\n    widget.node.addEventListener('blur', this, true);\n\n    // Connect the disposed signal handler.\n    widget.disposed.connect(this._onWidgetDisposed, this);\n\n    // Set the current and active widgets if needed.\n    if (focused) {\n      this._setWidgets(widget, widget);\n    }\n  }\n\n  /**\n   * Remove a widget from the focus tracker.\n   *\n   * #### Notes\n   * If the widget is the `currentWidget`, the previous current widget\n   * will become the new `currentWidget`.\n   *\n   * A widget will be automatically removed from the tracker if it\n   * is disposed after being added.\n   *\n   * If the widget is not tracked, this is a no-op.\n   */\n  remove(widget: T): void {\n    // Bail early if the widget is not tracked.\n    if (!this._numbers.has(widget)) {\n      return;\n    }\n\n    // Disconnect the disposed signal handler.\n    widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n    // Remove the event listeners.\n    widget.node.removeEventListener('focus', this, true);\n    widget.node.removeEventListener('blur', this, true);\n\n    // Remove the widget from the internal data structures.\n    ArrayExt.removeFirstOf(this._widgets, widget);\n    this._nodes.delete(widget.node);\n    this._numbers.delete(widget);\n\n    // Bail early if the widget is not the current widget.\n    if (this._currentWidget !== widget) {\n      return;\n    }\n\n    // Filter the widgets for those which have had focus.\n    let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n    // Get the valid widget with the max focus number.\n    let previous =\n      max(valid, (first, second) => {\n        let a = this._numbers.get(first)!;\n        let b = this._numbers.get(second)!;\n        return a - b;\n      }) || null;\n\n    // Set the current and active widgets.\n    this._setWidgets(previous, null);\n  }\n\n  /**\n   * Handle the DOM events for the focus tracker.\n   *\n   * @param event - The DOM event sent to the panel.\n   *\n   * #### Notes\n   * This method implements the DOM `EventListener` interface and is\n   * called in response to events on the tracked nodes. It should\n   * not be called directly by user code.\n   */\n  handleEvent(event: Event): void {\n    switch (event.type) {\n      case 'focus':\n        this._evtFocus(event as FocusEvent);\n        break;\n      case 'blur':\n        this._evtBlur(event as FocusEvent);\n        break;\n    }\n  }\n\n  /**\n   * Set the current and active widgets for the tracker.\n   */\n  private _setWidgets(current: T | null, active: T | null): void {\n    // Swap the current widget.\n    let oldCurrent = this._currentWidget;\n    this._currentWidget = current;\n\n    // Swap the active widget.\n    let oldActive = this._activeWidget;\n    this._activeWidget = active;\n\n    // Emit the `currentChanged` signal if needed.\n    if (oldCurrent !== current) {\n      this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n    }\n\n    // Emit the `activeChanged` signal if needed.\n    if (oldActive !== active) {\n      this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n    }\n  }\n\n  /**\n   * Handle the `'focus'` event for a tracked widget.\n   */\n  private _evtFocus(event: FocusEvent): void {\n    // Find the widget which gained focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Update the focus number if necessary.\n    if (widget !== this._currentWidget) {\n      this._numbers.set(widget, this._counter++);\n    }\n\n    // Set the current and active widgets.\n    this._setWidgets(widget, widget);\n  }\n\n  /**\n   * Handle the `'blur'` event for a tracked widget.\n   */\n  private _evtBlur(event: FocusEvent): void {\n    // Find the widget which lost focus, which is known to exist.\n    let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n    // Get the node which being focused after this blur.\n    let focusTarget = event.relatedTarget as HTMLElement;\n\n    // If no other node is being focused, clear the active widget.\n    if (!focusTarget) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n\n    // Bail if the focus widget is not changing.\n    if (widget.node.contains(focusTarget)) {\n      return;\n    }\n\n    // If no tracked widget is being focused, clear the active widget.\n    if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n      this._setWidgets(this._currentWidget, null);\n      return;\n    }\n  }\n\n  /**\n   * Handle the `disposed` signal for a tracked widget.\n   */\n  private _onWidgetDisposed(sender: T): void {\n    this.remove(sender);\n  }\n\n  private _counter = 0;\n  private _widgets: T[] = [];\n  private _activeWidget: T | null = null;\n  private _currentWidget: T | null = null;\n  private _numbers = new Map<T, number>();\n  private _nodes = new Map<HTMLElement, T>();\n  private _activeChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(this);\n  private _currentChanged = new Signal<this, FocusTracker.IChangedArgs<T>>(\n    this\n  );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n  /**\n   * An arguments object for the changed signals.\n   */\n  export interface IChangedArgs<T extends Widget> {\n    /**\n     * The old value for the widget.\n     */\n    oldValue: T | null;\n\n    /**\n     * The new value for the widget.\n     */\n    newValue: T | null;\n  }\n}\n"],"mappings":"2/BAoBaA,EAAbC,cAcEC,KAAQC,SAAG,EAeXD,KAAOE,QAAG,EAeVF,KAAOG,QAAGC,IAkBVJ,KAAOK,QAAG,EAcVL,KAAIM,KAAG,EAUPN,KAAIO,MAAG,C,EAMT,IAAiBC,EC+gCPC,EC1TAA,ECh0BOC,EH2GAF,gDA0XhB,KA3TiBG,KAAhB,SAAqBC,EAA6BC,GAEhD,IAAIC,EAAQF,EAAOG,OACnB,GAAc,IAAVD,EACF,OAAOD,EAIT,IAAIG,EAAW,EACXC,EAAW,EACXC,EAAY,EACZC,EAAe,EACfC,EAAe,EAG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y,MAAMlC,MAAM4E,U,CAMX0yB,qBACN1iB,EACAoG,GAEAA,EAAK9Y,MAAMlC,MAAM8E,O,CAMXsyB,YACNxiB,EACAoG,GAEA1e,KAAK8lC,aAAa32B,aAAauP,EAAK3O,QAAS2O,EAAK9Y,MAAMlC,M,CAMlDqiC,iBAAiBztB,EAAsB/Q,GAC7CA,EAAOpC,KAAK0F,gBAAgB,QAC5BtD,EAAOpC,KAAK0F,gBAAgB,mBAC5B7K,KAAKw0B,OAAOhH,UAAUjmB,EAAO3B,M"}
\ No newline at end of file
diff --git a/node_modules/@lumino/widgets/src/menu.ts b/node_modules/@lumino/widgets/src/menu.ts
index aa6d19b..89dc081 100644
--- a/node_modules/@lumino/widgets/src/menu.ts
+++ b/node_modules/@lumino/widgets/src/menu.ts
@@ -527,29 +527,29 @@ export class Menu extends Widget {
   }
 
   /**
-   * A message handler invoked on a `'before-attach'` message.
+   * A message handler invoked on a `'after-attach'` message.
    */
-  protected onBeforeAttach(msg: Message): void {
+  protected override onAfterAttach(msg: Message): void {
     this.node.addEventListener('keydown', this);
     this.node.addEventListener('mouseup', this);
     this.node.addEventListener('mousemove', this);
     this.node.addEventListener('mouseenter', this);
     this.node.addEventListener('mouseleave', this);
     this.node.addEventListener('contextmenu', this);
-    document.addEventListener('mousedown', this, true);
+    this.node.ownerDocument.addEventListener('mousedown', this, true);
   }
 
   /**
-   * A message handler invoked on an `'after-detach'` message.
+   * A message handler invoked on an `'before-detach'` message.
    */
-  protected onAfterDetach(msg: Message): void {
+  protected override onBeforeDetach(msg: Message): void {
     this.node.removeEventListener('keydown', this);
     this.node.removeEventListener('mouseup', this);
     this.node.removeEventListener('mousemove', this);
     this.node.removeEventListener('mouseenter', this);
     this.node.removeEventListener('mouseleave', this);
     this.node.removeEventListener('contextmenu', this);
-    document.removeEventListener('mousedown', this, true);
+    this.node.ownerDocument.removeEventListener('mousedown', this, true);
   }
 
   /**
@@ -1444,16 +1444,9 @@ namespace Private {
    */
   export const SUBMENU_OVERLAP = 3;
 
-  let transientWindowDataCache: IWindowData | null = null;
-  let transientCacheCounter: number = 0;
+  function getWindowData(element: HTMLElement): IWindowData {
 
-  function getWindowData(): IWindowData {
-    // if transient cache is in use, take one from it
-    if (transientCacheCounter > 0) {
-      transientCacheCounter--;
-      return transientWindowDataCache!;
-    }
-    return _getWindowData();
+    return _getWindowData(element);
   }
 
   /**
@@ -1466,8 +1459,6 @@ namespace Private {
    * Note: should be called before any DOM modifications.
    */
   export function saveWindowData(): void {
-    transientWindowDataCache = _getWindowData();
-    transientCacheCounter++;
   }
 
   /**
@@ -1569,12 +1560,12 @@ namespace Private {
     return result;
   }
 
-  function _getWindowData(): IWindowData {
+  function _getWindowData(element: HTMLElement): IWindowData {
     return {
-      pageXOffset: window.pageXOffset,
-      pageYOffset: window.pageYOffset,
-      clientWidth: document.documentElement.clientWidth,
-      clientHeight: document.documentElement.clientHeight
+      pageXOffset: element.ownerDocument.defaultView?.window.scrollX || 0,
+      pageYOffset: element.ownerDocument.defaultView?.window.scrollY || 0,
+      clientWidth: element.ownerDocument.documentElement.clientWidth,
+      clientHeight: element.ownerDocument.documentElement.clientHeight
     };
   }
 
@@ -1592,7 +1583,7 @@ namespace Private {
     ref: HTMLElement | null
   ): void {
     // Get the current position and size of the main viewport.
-    const windowData = getWindowData();
+    const windowData = getWindowData(host || menu.node);
     let px = windowData.pageXOffset;
     let py = windowData.pageYOffset;
     let cw = windowData.clientWidth;
@@ -1607,6 +1598,8 @@ namespace Private {
     // Fetch common variables.
     let node = menu.node;
     let style = node.style;
+    style.top = '0';
+    style.left = '0';
 
     // Clear the menu geometry and prepare it for measuring.
     style.opacity = '0';
@@ -1649,7 +1642,7 @@ namespace Private {
    */
   export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {
     // Get the current position and size of the main viewport.
-    const windowData = getWindowData();
+    const windowData = getWindowData(itemNode);
     let px = windowData.pageXOffset;
     let py = windowData.pageYOffset;
     let cw = windowData.clientWidth;
@@ -1670,7 +1663,7 @@ namespace Private {
     style.maxHeight = `${maxHeight}px`;
 
     // Attach the menu to the document.
-    Widget.attach(submenu, document.body);
+    Widget.attach(submenu, itemNode.ownerDocument.body);
 
     // Measure the size of the menu.
     let { width, height } = node.getBoundingClientRect();
@@ -1697,6 +1690,8 @@ namespace Private {
       y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;
     }
 
+    style.top = '0';
+    style.left = '0';
     // Update the position of the menu to the computed position.
     style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;
 
diff --git a/node_modules/@lumino/widgets/types/menu.d.ts b/node_modules/@lumino/widgets/types/menu.d.ts
index bd814f1..49f72ac 100644
--- a/node_modules/@lumino/widgets/types/menu.d.ts
+++ b/node_modules/@lumino/widgets/types/menu.d.ts
@@ -216,13 +216,13 @@ export declare class Menu extends Widget {
      */
     handleEvent(event: Event): void;
     /**
-     * A message handler invoked on a `'before-attach'` message.
+     * A message handler invoked on a `'after-attach'` message.
      */
-    protected onBeforeAttach(msg: Message): void;
+    protected onAfterAttach(msg: Message): void;
     /**
-     * A message handler invoked on an `'after-detach'` message.
+     * A message handler invoked on an `'before-detach'` message.
      */
-    protected onAfterDetach(msg: Message): void;
+    protected onBeforeDetach(msg: Message): void;
     /**
      * A message handler invoked on an `'activate-request'` message.
      */
