text: /*
   * Copyright © 2020. TIBCO Software Inc.
   * This file is subject to the license terms contained
   * in the license file that is distributed with this file.
   */
  
  //@ts-check - Get type warnings from the TypeScript language server. Remove if not wanted
  
  // Manually import the array polyfills because the API is using functions not supported in IE11.
  import "core-js/es/array";
  
  /**
   * Get access to the Spotfire Mod API by providing a callback to the initialize method.
   */
  window.Spotfire.initialize(async (mod) => {
      /**
       * Create the read function.
       */
      const reader = mod.createReader(mod.visualization.data(), mod.windowSize(), mod.property("myProperty"));
  
      /**
       * Store the context.
       */
      const context = mod.getRenderContext();
  
      /**
       * Initiate the read loop
       */
      reader.subscribe(render);
  
      /**
       * @param {Spotfire.DataView} dataView
       * @param {Spotfire.Size} windowSize
       * @param {Spotfire.ModProperty<string>} prop
       */
      async function render(dataView, windowSize, prop) {
          /**
           * Check the data view for errors
           */
          let errors = await dataView.getErrors();
          if (errors.length > 0) {
              // Showing an error overlay will hide the mod iframe.
              // Clear the mod content here to avoid flickering effect of
              // an old configuration when next valid data view is received.
              mod.controls.errorOverlay.show(errors);
              return;
          }
          mod.controls.errorOverlay.hide();
  
          /**
           * Get the hierarchy of the categorical X-axis.
           */
          const xHierarchy = await dataView.hierarchy("X");
          const xRoot = await xHierarchy.root();
  
          if (xRoot == null) {
              // User interaction caused the data view to expire.
              // Don't clear the mod content here to avoid flickering.
              return;
          }
  
          /**
           * Print out to document
           */
          const container = document.querySelector("#mod-container");
          container.textContent = `windowSize: ${windowSize.width}x${windowSize.height}\r\n`;
          container.textContent += `should render: ${xRoot.rows().length} rows\r\n`;
          container.textContent += `${prop.name}: ${prop.value()}`;
  
          /**
           * Signal that the mod is ready for export.
           */
          context.signalRenderComplete();
      }
  });
  