nal
    // function will look like this -
    // function () {
    //   EdgeTextChunkObject = [{'s': 'Hello World'}];
    //   if (EdgeTextChunkObject.length === 0) {
    //     return '';
    //   }
    //
    //   if (!EdgeTextChunkObject[0].hasOwnProperty('s')) {
    //     return '';
    //   }
    //
    //   return EdgeTextChunkObject[0]['s'];
    // }
    scriptText += `;
      if (EdgeTextChunkObject.length === 0) {
        return '';
      }

      if (!EdgeTextChunkObject[0].hasOwnProperty('s')) {
        return '';
      }

      return EdgeTextChunkObject[0]['s'];
    `;

    const scriptExtractTextFunction = new Function(scriptText);
    return scriptExtractTextFunction();
  }

  // Get all script tags in the page.
  const scripts = [...document.querySelectorAll('script')];
  if (scripts) {
    const chunks = scripts
      .map((script) => script.innerText)
      .filter(
        (scrTxt) => scrTxt && scrTxt.trim().startsWith("DOCS_modelChunk =")
      )
      .map((scriptText) => extractTextFromScript(scriptText.trim()))
      .filter((extractedText) => extractedText.length > 0);

    if (chunks.length > 0) {
      return chunks.join(' ');
    } else {
      // Fallback to the body text.
      return document.body?.innerText || '';
    }
  } else {
    return '';
  }
})();