@alan-ai/alan-sdk-web 1.8.125 → 1.8.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/alan_lib.js CHANGED
@@ -97644,15 +97644,37 @@
97644
97644
  `;
97645
97645
  const inlinedHtml = juice.inlineContent(rawHtml, css3);
97646
97646
  const blobHtml = new Blob([inlinedHtml], { type: "text/html" });
97647
- const blobText = new Blob([bubbleToCopy.innerText], { type: "text/plain" });
97647
+ const plainText = bubbleToCopy.innerText.replace(/[ \t]+/g, " ").replace(/\n{3,}/g, "\n\n").trim();
97648
+ const blobText = new Blob([plainText], { type: "text/plain" });
97648
97649
  const data4 = [new ClipboardItem({
97649
97650
  "text/html": blobHtml,
97650
97651
  "text/plain": blobText
97651
97652
  })];
97652
- try {
97653
- await navigator.clipboard.write(data4);
97654
- } catch (err) {
97655
- console.error("Failed to copy: ", err);
97653
+ if (navigator.clipboard && navigator.clipboard.write) {
97654
+ try {
97655
+ await navigator.clipboard.write(data4);
97656
+ } catch (err) {
97657
+ console.error("Failed to copy rich text: ", err);
97658
+ if (navigator.clipboard.writeText) {
97659
+ try {
97660
+ await navigator.clipboard.writeText(plainText);
97661
+ } catch (err2) {
97662
+ console.error("Failed to copy plain text: ", err2);
97663
+ copyTextToBuffer(plainText);
97664
+ }
97665
+ } else {
97666
+ copyTextToBuffer(plainText);
97667
+ }
97668
+ }
97669
+ } else if (navigator.clipboard && navigator.clipboard.writeText) {
97670
+ try {
97671
+ await navigator.clipboard.writeText(plainText);
97672
+ } catch (err) {
97673
+ console.error("Failed to copy plain text: ", err);
97674
+ copyTextToBuffer(plainText);
97675
+ }
97676
+ } else {
97677
+ copyTextToBuffer(plainText);
97656
97678
  }
97657
97679
  }
97658
97680
 
@@ -109508,7 +109530,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
109508
109530
  let controlsDiv = document.createElement("div");
109509
109531
  controlsDiv.classList.add("alan-iframe-controls");
109510
109532
  let hiddenIframe = document.createElement("iframe");
109511
- hiddenIframe.srcdoc = `<!--${initHtmlContent}-->`;
109533
+ hiddenIframe.srcdoc = `<!--${htmlContent2}-->`;
109512
109534
  hiddenIframe.setAttribute("style", "display: none;");
109513
109535
  hiddenIframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups allow-downloads");
109514
109536
  controlsDiv.appendChild(hiddenIframe);
@@ -110425,7 +110447,8 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
110425
110447
  console.error(`Failed to inline stylesheet from ${href}:`, error);
110426
110448
  }
110427
110449
  }));
110428
- const code = extractScriptContents(htmlContent);
110450
+ const htmlContentWithInlinedScripts = doc.documentElement.outerHTML;
110451
+ const code = extractScriptContents(htmlContentWithInlinedScripts);
110429
110452
  const initIframeFn = extractFunction(code, "initIframe");
110430
110453
  let allInitIframeResourcesInlined = false;
110431
110454
  if (initIframeFn) {
@@ -110804,7 +110827,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
110804
110827
  // alan_btn/alan_btn.ts
110805
110828
  (function(ns) {
110806
110829
  const uiState10 = getUIState();
110807
- const version2 = "alan-version.1.8.125".replace("alan-version.", "");
110830
+ const version2 = "alan-version.1.8.126".replace("alan-version.", "");
110808
110831
  uiState10.lib.version = version2;
110809
110832
  window.alanLib = { version: version2 };
110810
110833
  if (window.alanBtn) {