@veracity/ai 2.5.1 → 2.5.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationMessage.d.ts","sourceRoot":"","sources":["../../src/components/ConversationMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAA0B,cAAc,EAAuB,MAAM,SAAS,CAAC;AAMtF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAwD7D,qBAAa,mBAAoB,YAAW,eAAe;IA6BhD,YAAY,EAAE,YAAY;IAC1B,UAAU,EAAE,WAAW,GAAG,MAAM;IAChC,QAAQ,EAAE,MAAM;IAChB,gBAAgB,EAAE,MAAM;IACxB,iBAAiB,EAAE,MAAM;IACzB,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IAnC1B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,CAAC,gBAAgB,CAAiB;IACzC,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,iBAAiB,CAAiB;IAC1C,OAAO,CAAC,wBAAwB,CAAiB;IACjD,OAAO,CAAC,gCAAgC,CAAS;IACjD,OAAO,CAAC,oBAAoB,CAAM;IAElC,OAAO,CAAC,gBAAgB,CAAyB;IAEjD,OAAO,CAAC,uCAAuC,CAA2D;IAC1G,OAAO,CAAC,yCAAyC,CAA6D;IAI9G,OAAO,CAAC,iBAAiB,CAAwD;IAGjF,IAAI,IAAI,SAEP;IAED,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,mBAAmB,CAAY;IACvC,OAAO,CAAC,mBAAmB,CAAQ;gBAG1B,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,WAAW,GAAG,MAAM,EAChC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM;IA0B1B,6BAA6B;IAsC7B,OAAO,CAAC,0BAA0B;IASlC,MAAM,CAAC,QAAQ,EAAE,MAAM;IAuBvB,cAAc,CAAC,OAAO,EAAE,4BAA4B;IAyBpD,2CAA2C,CACzC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,MAAM;IAsCzB,yBAAyB,CAAC,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,KAAA;IAGpF,wBAAwB,CAAC,wBAAwB,EAAE,wBAAwB,EAAE,KAAK,EAAE,MAAM;IAI1F,oCAAoC,CAAC,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM;IAYrF,qCAAqC,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAwB3E,oCAAoC,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAQzE,OAAO,CAAC,mCAAmC;IAU3C,wBAAwB;IAIxB,sBAAsB;IAMtB,oBAAoB,CAClB,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,MAAM,EACnB,oBAAoB,EAAE,MAAM;IAY9B,0BAA0B,CAAC,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO;IAUjF,mBAAmB;
|
|
1
|
+
{"version":3,"file":"ConversationMessage.d.ts","sourceRoot":"","sources":["../../src/components/ConversationMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAA0B,cAAc,EAAuB,MAAM,SAAS,CAAC;AAMtF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAwD7D,qBAAa,mBAAoB,YAAW,eAAe;IA6BhD,YAAY,EAAE,YAAY;IAC1B,UAAU,EAAE,WAAW,GAAG,MAAM;IAChC,QAAQ,EAAE,MAAM;IAChB,gBAAgB,EAAE,MAAM;IACxB,iBAAiB,EAAE,MAAM;IACzB,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IAnC1B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,CAAC,gBAAgB,CAAiB;IACzC,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,iBAAiB,CAAiB;IAC1C,OAAO,CAAC,wBAAwB,CAAiB;IACjD,OAAO,CAAC,gCAAgC,CAAS;IACjD,OAAO,CAAC,oBAAoB,CAAM;IAElC,OAAO,CAAC,gBAAgB,CAAyB;IAEjD,OAAO,CAAC,uCAAuC,CAA2D;IAC1G,OAAO,CAAC,yCAAyC,CAA6D;IAI9G,OAAO,CAAC,iBAAiB,CAAwD;IAGjF,IAAI,IAAI,SAEP;IAED,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,mBAAmB,CAAY;IACvC,OAAO,CAAC,mBAAmB,CAAQ;gBAG1B,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,WAAW,GAAG,MAAM,EAChC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM;IA0B1B,6BAA6B;IAsC7B,OAAO,CAAC,0BAA0B;IASlC,MAAM,CAAC,QAAQ,EAAE,MAAM;IAuBvB,cAAc,CAAC,OAAO,EAAE,4BAA4B;IAyBpD,2CAA2C,CACzC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,MAAM;IAsCzB,yBAAyB,CAAC,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,KAAA;IAGpF,wBAAwB,CAAC,wBAAwB,EAAE,wBAAwB,EAAE,KAAK,EAAE,MAAM;IAI1F,oCAAoC,CAAC,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM;IAYrF,qCAAqC,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAwB3E,oCAAoC,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAQzE,OAAO,CAAC,mCAAmC;IAU3C,wBAAwB;IAIxB,sBAAsB;IAMtB,oBAAoB,CAClB,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,MAAM,EACnB,oBAAoB,EAAE,MAAM;IAY9B,0BAA0B,CAAC,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO;IAUjF,mBAAmB;IAwHnB,6BAA6B,CAAC,KAAK,KAAA;IAiBnC,KAAK,IAAI,cAAc;IAOvB,WAAW;IAMX,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,IAAI;CAsCzC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,WAarD"}
|
package/dist/veracity-ai.es.js
CHANGED
|
@@ -5497,7 +5497,7 @@ function Zo({ size: e = se.Medium, ...n }) {
|
|
|
5497
5497
|
"M18.1215 16.0003L24.5315 9.59034L25.8534 8.26846C26.0484 8.07346 26.0484 7.75659 25.8534 7.56159L24.439 6.14721C24.244 5.95221 23.9271 5.95221 23.7321 6.14721L16.0002 13.8791L8.26837 6.14659C8.07337 5.95159 7.75649 5.95159 7.56149 6.14659L6.14649 7.56096C5.95149 7.75596 5.95149 8.07284 6.14649 8.26784L13.879 16.0003L6.14649 23.7322C5.95149 23.9272 5.95149 24.2441 6.14649 24.4391L7.56087 25.8535C7.75587 26.0485 8.07274 26.0485 8.26774 25.8535L16.0002 18.1216L22.4102 24.5316L23.7321 25.8535C23.9271 26.0485 24.244 26.0485 24.439 25.8535L25.8534 24.4391C26.0484 24.2441 26.0484 23.9272 25.8534 23.7322L18.1215 16.0003Z"
|
|
5498
5498
|
), t.appendChild(r), t.classList.add("icon"), t;
|
|
5499
5499
|
}
|
|
5500
|
-
const Yo = ".dialog-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;font-family:Gantari,sans-serif}.dialog-content{background:#fff;box-shadow:0 4px 20px #00000026;position:relative;max-width:600px;width:90%;max-height:90vh;overflow-y:auto}.dialog-close-button{position:absolute;top:
|
|
5500
|
+
const Yo = ".dialog-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;font-family:Gantari,sans-serif}.dialog-content{background:#fff;box-shadow:0 4px 20px #00000026;position:relative;max-width:600px;width:90%;max-height:90vh;overflow-y:auto}.dialog-close-button{position:absolute;top:10px;right:10px;background:transparent;border:none;cursor:pointer;padding:10px;display:flex;align-items:center;justify-content:center;transition:background .1s ease-out;color:#00348f;border-radius:3.40282e38px}.dialog-close-button:hover{background:#bce6f5}.dialog-header{padding:20px}.dialog-body{display:flex;flex-direction:column;border-top-width:1px;border-bottom-width:1px;border-top-style:solid;border-bottom-style:solid;border-color:#0000001a;padding-top:8px;padding-bottom:16px;padding-inline:20px;overflow-y:auto}.dialog-footer{gap:8px;padding:16px;display:flex;justify-content:flex-end;flex-shrink:0}.text-label-md{font-size:var(--text-lg, 1.5rem);font-weight:var(--font-weight-semibold, 600);color:#0f214d;margin:0}.text-label-sm{font-size:var(--text-sm, .875rem);font-weight:var(--font-weight-normal, 400);color:#0f214d;line-height:1.5}.feedback-category{padding-bottom:16px}.feedback-suggestion-text{display:inline-block;padding:8px 16px;margin:4px 8px 4px 0;background:#d3eef8;border-radius:6px;cursor:pointer;transition:all .1s ease-out;font-size:var(--text-sm, .875rem);letter-spacing:.05rem;color:#2248aa}.feedback-suggestion-text:hover:not(.feedback-suggestion-text-active){background:#bce6f5;border-color:#17789b}.feedback-suggestion-text-active{background:#001333;color:#fff;border-color:#001333}.feedback-comment-text{width:100%;min-height:100px;font-family:var(--font-sans);font-size:var(--text-sm, 1rem);font-weight:var(--font-weight-normal, 400);letter-spacing:0;resize:none;box-sizing:border-box;transition:border-color .1s ease-out;background:#fff;color:#1a1a19;border-width:1px;border-color:#b5b3b0;padding-left:6px;padding-right:6px;padding-block:6px}.feedback-comment-text:focus{outline:none;border:2px solid #009fda}.btn-base-feedback{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;border-radius:0;display:inline-flex;height:auto;margin:0;outline:none;text-decoration:none;transition:background .1s ease-out,border-color .1s ease-out,color .1s ease-out,box-shadow .1s ease-out;white-space:nowrap;cursor:pointer;font-family:Gantari,sans-serif;font-size:var(--text-sm, .875rem);font-weight:var(--font-weight-medium, 500);justify-content:center}.btn-primary-feedback{background:#00348f;color:#fff}.btn-primary-feedback:disabled{background:#95adea;color:#fff;cursor:not-allowed;opacity:.5}.btn-primary-feedback:hover{background:#002566}.btn-primary-feedback:active{background:#0041b2}.btn-primary-feedback:disabled:hover{background:#00348f;color:#fff}.btn-lg-feedback{min-width:40px;font-size:16px;letter-spacing:0;gap:8px;padding-inline:16px;padding-block:12px;font-weight:500;line-height:1}.flex{display:flex}.flex-col{flex-direction:column}.justify-end{justify-content:flex-end}.gap-2-feedback{gap:8px;padding-top:40px}.gap-5-feedback{gap:20px}.w-\\[600px\\]{width:600px}.pl-7-feedback{padding-top:28px}.footer-note{font-size:12px;color:#6c757d;line-height:1.5;padding-top:12px;text-align:left;font-weight:400;font-family:Gantari,sans-serif;letter-spacing:.02rem}.footer-note a{color:#6c757d;text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px;font-weight:500;transition:color .1s ease-out}.footer-note a:hover{color:#6c757d;text-decoration-thickness:2px}@media (prefers-color-scheme: dark){.dialog-content{background:#0f214d;color:#fff}.text-label-md,.text-label-sm{color:#0f214d}.dialog-close-button:hover{background:#152d6a}.feedback-suggestion-text{background:#0d1b40;border-color:#0d1b40;color:#e0e0e0}.feedback-suggestion-text:hover:not(.feedback-suggestion-text-active){background:#1d3f95;border-color:#8fffb2}.feedback-suggestion-text-active{background:#2651c0;color:#00e649;border-color:#8fffb2}.feedback-comment-text{background:#2d2d2d;border-color:#404040;color:#fff}.feedback-comment-text:focus{border-color:#009930;box-shadow:0 0 0 2px #4caf501a}.feedback-comment-text::-moz-placeholder{color:#b5b3b0}.feedback-comment-text::placeholder{color:#b5b3b0}.btn-primary-feedback{background:#8fffb2;color:#0f214d;border-color:#8fffb2}.btn-primary-feedback:disabled{background:#dcf2d9;color:#d4def7;border-color:#dcf2d9}.btn-primary-feedback:disabled:hover{background:#00cc41;color:#0d1b40;border-color:#00cc41}.btn-primary-feedback:hover{background:#00cc41}.btn-link-feedback{color:#009930}.btn-link-feedback:hover{background:#1e6ea740}.footer-note{color:#8d8d8d}.footer-note a{color:#8fffb2;text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}.footer-note a:hover{color:#00cc41;text-decoration-thickness:2px}}.dialog-close-button:focus-visible,.btn-base-feedback:focus-visible,.btn-link-feedback:focus-visible{box-shadow:0 0 0 2px #8bc8f0}.btn-base-feedback:disabled{opacity:.5;cursor:not-allowed}";
|
|
5501
5501
|
class mr {
|
|
5502
5502
|
constructor(n, t, r, s, i, o, a, u) {
|
|
5503
5503
|
y(this, "node");
|
|
@@ -5648,10 +5648,10 @@ class mr {
|
|
|
5648
5648
|
this._feedbackNode = /* @__PURE__ */ b("div", { class: "flex" }, /* @__PURE__ */ b("a", { class: "btn btn-link-feedback p-1" }, /* @__PURE__ */ b(kt, null)))
|
|
5649
5649
|
);
|
|
5650
5650
|
} }, /* @__PURE__ */ b(kt, null)), /* @__PURE__ */ b("a", { class: "btn btn-link-feedback p-1", onclick: () => {
|
|
5651
|
-
const t = /* @__PURE__ */ b("div", { class: "dialog-overlay" }, /* @__PURE__ */ b("div", { role: "dialog", class: "dialog-content w-[600px]
|
|
5651
|
+
const t = /* @__PURE__ */ b("div", { class: "dialog-overlay" }, /* @__PURE__ */ b("div", { role: "dialog", class: "dialog-content w-[600px]" }, /* @__PURE__ */ b("div", { class: "dialog-header" }, /* @__PURE__ */ b("label", { class: "text-label-md" }, "Tell us more"), /* @__PURE__ */ b("button", { onclick: () => t.remove(), class: "dialog-close-button" }, /* @__PURE__ */ b(Zo, { size: "22" }))), /* @__PURE__ */ b("div", { class: "dialog-body" }, /* @__PURE__ */ b("div", { class: "text-label-sm feedback-category" }, this._suggestionTextList.map((a, u) => /* @__PURE__ */ b("span", { class: "feedback-suggestion-text", onclick: (l) => {
|
|
5652
5652
|
const c = this;
|
|
5653
5653
|
this._suggestionTextList.filter((d, v) => v !== u && d.isActive).forEach((d) => d.isActive = !1), t.querySelectorAll(".feedback-suggestion-text").forEach((d) => d.classList.toggle("feedback-suggestion-text-active", !1)), a.isActive = !a.isActive, l.currentTarget.classList.toggle("feedback-suggestion-text-active", a.isActive), r.call(c);
|
|
5654
|
-
} }, a.text))), /* @__PURE__ */ b("textarea", { placeholder: "Add special details (optional)", class: "feedback-comment-text" }), /* @__PURE__ */ b("div", { class: "footer-note" }, /* @__PURE__ */ b("a", { href: "https://id.veracity.com/terms-of-use", target: "_blank", rel: "noopener noreferrer" }, "Learn more"), " about how this data is used and your rights. By pressing Submit, your conversation will be used to improve Veracity products and services. ", /* @__PURE__ */ b("a", { href: "https://services.veracity.com/PrivacyStatement", target: "_blank", rel: "noopener noreferrer" }, "Privacy statement."))), /* @__PURE__ */ b("div", { class: "dialog-footer
|
|
5654
|
+
} }, a.text))), /* @__PURE__ */ b("textarea", { placeholder: "Add special details (optional)", class: "feedback-comment-text" }), /* @__PURE__ */ b("div", { class: "footer-note" }, /* @__PURE__ */ b("a", { href: "https://id.veracity.com/terms-of-use", target: "_blank", rel: "noopener noreferrer" }, "Learn more"), " about how this data is used and your rights. By pressing Submit, your conversation will be used to improve Veracity products and services. ", /* @__PURE__ */ b("a", { href: "https://services.veracity.com/PrivacyStatement", target: "_blank", rel: "noopener noreferrer" }, "Privacy statement."))), /* @__PURE__ */ b("div", { class: "dialog-footer" }, /* @__PURE__ */ b(
|
|
5655
5655
|
"button",
|
|
5656
5656
|
{
|
|
5657
5657
|
id: "submit-btn",
|
|
@@ -5678,7 +5678,9 @@ class mr {
|
|
|
5678
5678
|
a.disabled = !u;
|
|
5679
5679
|
}
|
|
5680
5680
|
}
|
|
5681
|
-
|
|
5681
|
+
this._suggestionTextList.forEach((a) => {
|
|
5682
|
+
a.isActive = !1;
|
|
5683
|
+
}), r.call(this);
|
|
5682
5684
|
const s = document.createElement("div"), i = s.attachShadow({ mode: "open" }), o = document.createElement("style");
|
|
5683
5685
|
o.textContent = Yo, i.appendChild(o), i.appendChild(t), document.body.appendChild(s);
|
|
5684
5686
|
} }, /* @__PURE__ */ b(zt, null))), this._rightColumnNode.appendChild(this._feedbackNode);
|
package/dist/veracity-ai.umd.js
CHANGED
|
@@ -267,7 +267,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
267
267
|
`);break;case"t":e.push(" ");break;case"r":e.push("\r");break;case"\\":e.push("\\");break;case"'":e.push("'");break;case'"':e.push('"');break;case"b":e.push("\b");break;case"f":e.push("\f");break;case"v":e.push("\v");break;case"a":e.push("a");break;case"0":e.push("\0");break;case"u":r+5<t.length&&(e.push(String.fromCharCode(parseInt(t.substring(r+2,r+6),16))),r+=4);break;case"U":r+9<t.length&&(e.push(String.fromCodePoint(parseInt(t.substring(r+2,r+10),16))),r+=8);break;default:e.push(t[r+1]);break}r+=2}else e.push(t[r]),r++;return e.join("")}function ad(t){const e=[...sd(t)];if(e.length){const n=e[e.length-1];n===","?e.pop():n===":"&&e.push("undefined")}const r=[];for(const n of e)if(n==="{"||n==="[")r.push(n);else if(n==="}")if(r.length&&r[r.length-1]==="{")r.pop();else throw new Error("Invalid JSON");else if(n==="]")if(r.length&&r[r.length-1]==="[")r.pop();else throw new Error("Invalid JSON");for(;r.length;)r.pop()==="{"?e.push("}"):e.push("]");return JSON.parse(e.join(""))}function*sd(t){for(let e=0;e<t.length;++e){let r=t[e];switch(r){case" ":case" ":case`
|
|
268
268
|
`:case"\r":break;case",":case":":case"{":case"}":case"[":case"]":yield r;break;case'"':let n=e++;for(;;++e)if(e<t.length){if(r=t[e],r==='"'){yield t.substring(n,e+1);break}if(r==="\\")if(e+1<t.length)if(t[e+1]==="u")if(e+5<t.length)e+=5;else{yield t.substring(n,e)+'"';return}else++e;else{yield t.substring(n,e)+'"';return}}else{yield t.substring(n,e)+'"';return}break;default:yield r;break}}}function Ao({size:t=Ct.Medium,...e}){const r=qe("svg");r.setAttribute("viewBox","0 0 256 512"),r.setAttribute("fill","currentColor"),r.setAttribute("width",t),r.setAttribute("height",t),Je(r,e);const n=qe("path");return n.setAttribute("d","M119.5 326.9L3.5 209.1c-4.7-4.7-4.7-12.3 0-17l7.1-7.1c4.7-4.7 12.3-4.7 17 0L128 287.3l100.4-102.2c4.7-4.7 12.3-4.7 17 0l7.1 7.1c4.7 4.7 4.7 12.3 0 17L136.5 327c-4.7 4.6-12.3 4.6-17-.1z"),r.appendChild(n),r.classList.add("icon"),r}function ka({size:t=Ct.Medium,...e}){const r=qe("svg");r.setAttribute("viewBox","0 0 320 512"),r.setAttribute("fill","currentColor"),r.setAttribute("width",t),r.setAttribute("height",t),Je(r,e);const n=qe("path");return n.setAttribute("d","M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"),r.appendChild(n),r.classList.add("icon"),r}class Mo{constructor(e,r){P(this,"node");P(this,"_buttonNode");P(this,"_buttonIconWrapperNode");P(this,"_expanded",!1);P(this,"_expandedCt");P(this,"_contentWrapperNode");P(this,"_contentNode");P(this,"_highlightCode");P(this,"_stdoutStderrNode");P(this,"_stdoutNode");P(this,"_stderrNode");P(this,"_resultNode");P(this,"_resultRawNode");P(this,"_errorNode");P(this,"_ignoreSetResult");this.context=e,this.context.conversationMessage.chat.lazyInitializePyodideAsync(),this._highlightCode=new H0("python",r instanceof To?Co(r.functionArguments):r),this._highlightCode.node.classList.add("p-3","bg-Sandstone-97","text-Black","overflow-x-auto"),this.node=_("div",{class:"my-2"},this._buttonNode=_(tn,{class:"p-2 gap-2 group",variant:Ft.Badge,size:$r.Medium,onclick:()=>this.expanded=!this.expanded},this._buttonIconWrapperNode=_("div",{width:"24px",height:"24px"},_(Jn,{size:dn.Small})),"Generate and run Python code",_(Ao,{class:"transition-all duration-300 group-data-[expanded=true]:-rotate-180"})),this._contentWrapperNode=_("div",{class:"grid",gridTemplateRows:this._expanded?"1fr":"0fr",opacity:this._expanded?"1":"0","aria-expanded":this._expanded},_("div",{class:"overflow-hidden"},this._contentNode=_("section",{class:"mt-2 border border-Light flex flex-col text-sm"},this._highlightCode.node))))}get expanded(){return this._expanded}set expanded(e){var r;if(e!==this._expanded){(r=this._expandedCt)==null||r.cancel();const n=this._expandedCt=new Kt;this._buttonNode.setAttribute("data-expanded",String(this._expanded=e)),e?(async()=>{try{await cr(this._contentWrapperNode,[{gridTemplateRows:"1fr"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt),await cr(this._contentWrapperNode,[{opacity:"1"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt)}catch(i){if(!n.isCancellationRequested)throw i}})():(async()=>{try{await cr(this._contentWrapperNode,[{opacity:"0"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt),await cr(this._contentWrapperNode,[{gridTemplateRows:"0fr"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt)}catch(i){if(!n.isCancellationRequested)throw i}})()}}setButtonSuccess(){this._buttonNode.setAttribute("data-status","success"),this._buttonIconWrapperNode.replaceChild(_(Yn,null),this._buttonIconWrapperNode.firstChild)}setButtonError(){this._buttonNode.setAttribute("data-status","error"),this._buttonIconWrapperNode.replaceChild(_(ka,null),this._buttonIconWrapperNode.firstChild)}getOrAddStdoutStderrNode(){return this._stdoutStderrNode?this._stdoutStderrNode:(this._stdoutStderrNode=_("section",{class:"border-t border-t-Light p-3 bg-Black text-White text-sm"},_("h1",{class:"mb-2"},"STDOUT / STDERR")),this._contentNode.insertBefore(this._stdoutStderrNode,this._highlightCode.node.nextSibling),this._stdoutStderrNode)}getOrAddStdoutNode(){return this._stdoutNode?this._stdoutNode:(this._stderrNode=null,this._stdoutNode=_("pre",null),this.getOrAddStdoutStderrNode().appendChild(this._stdoutNode),this._stdoutNode)}getOrAddStderrNode(){return this._stderrNode?this._stderrNode:(this._stdoutNode=null,this._stderrNode=_("pre",{class:"text-Energy-Red-45"}),this.getOrAddStdoutStderrNode().appendChild(this._stderrNode),this._stderrNode)}getOrAddErrorNode(){return this._errorNode?this._errorNode:(this._errorNode=_("pre",{class:"border-t border-t-Light border-l-4 border-Energy-Red-45 p-3 text-sm"}),this._contentNode.appendChild(this._errorNode),this._errorNode)}getOrAddResultRawNode(){return this._resultRawNode?this._resultRawNode:(this._resultNode=_("section",{class:"border-t border-t-Light p-3 bg-Black text-White text-sm"},_("h1",{class:"mb-2"},"RESULT"),this._resultRawNode=_("pre",null)),this._contentNode.appendChild(this._resultNode),this._resultRawNode)}onClientResult(e){if(!this._ignoreSetResult){if(e.stdoutAndStderr)for(const r of e.stdoutAndStderr)r.isStderr?this.getOrAddStderrNode().textContent+=r.text:this.getOrAddStdoutNode().textContent+=r.text;e.terminatedWithError?(this.setButtonError(),e.error&&(this.getOrAddErrorNode().textContent=e.error)):e.result&&(this.setButtonSuccess(),this.getOrAddResultRawNode().textContent=e.result)}}onOpcodeMessageToolCallErrorReceived(e){this.setButtonError()}onErrorWhileReadingBodyStream(e){this.setButtonError()}async run(e){this._ignoreSetResult=!0;const r=this.context.conversationMessage.chat,n=[];try{await r.lazyInitializePyodideAsync(),r.pyodide.setStdout({batched:s=>{const o=s.split(`
|
|
269
269
|
`);if(n.length){const u=n[n.length-1];u.isStderr?n.push(...o.map(h=>({isStderr:!1,text:h}))):(u.text+=o.shift(),n.push(...o.map(h=>({isStderr:!1,text:h}))))}else n.push(...o.map(u=>({isStderr:!1,text:u})));this.getOrAddStdoutNode().textContent+=s}}),r.pyodide.setStderr({batched:s=>{const o=s.split(`
|
|
270
|
-
`);if(n.length){const u=n[n.length-1];u.isStderr?(u.text+=o.shift(),n.push(...o.map(h=>({isStderr:!0,text:h})))):n.push(...o.map(h=>({isStderr:!0,text:h})))}else n.push(...o.map(u=>({isStderr:!0,text:u})));this.getOrAddStderrNode().textContent+=s}});const a=await r.runPythonCodeAsync(e);var i=a===void 0?"None":String(a)}catch(a){this.setButtonError();const s=String(a);this.getOrAddErrorNode().textContent=s,console.error(a),await this.context.postResultAsync({terminatedWithError:!0,error:s,stdoutAndStderr:n});return}this.setButtonSuccess(),i&&(this.getOrAddResultRawNode().textContent=i),await this.context.postResultAsync({result:i,stdoutAndStderr:n})}updateWithToolCallData(e){this._highlightCode.updateCode("python",Co(e.functionArguments))}}function Co(t){if(!t.startsWith("{"))return t;var e=t.indexOf("Code:");if(e!=-1&&t.substring(0,e).trim()=="{"&&(t='{"Code":'+t.substring(e+5)),e=t.indexOf('"""'),e!=-1){var r=t.lastIndexOf('"""');if(e<r&&t.substring(r+3).trim()=="}"){var n=id(t.substring(e+3,r-(e+3))),i=t.substring(0,e)+JSON.stringify(n)+t.substring(r+3);t=i}}try{var a=ad(t)}catch{return console.warn("Error parsing Python code arguments provided as JSON.",t),""}return(a==null?void 0:a.Code)||(a==null?void 0:a.code)||""}class od{constructor(e,r){P(this,"node");P(this,"_buttonNode");P(this,"_buttonIconWrapperNode");this.context=e,this.node=_("div",{class:"my-2"},this._buttonNode=_(tn,{as:"div",class:"p-2 pr-3 gap-2 select-none",variant:Ft.Badge,size:$r.Medium},this._buttonIconWrapperNode=_("div",{width:"24px",height:"24px"},_(Jn,{size:dn.Small})),`Search for '${r}'`))}setButtonSuccess(){this._buttonNode.setAttribute("data-status","success"),this._buttonIconWrapperNode.replaceChild(_(Yn,null),this._buttonIconWrapperNode.firstChild)}setButtonError(){this._buttonNode.setAttribute("data-status","error"),this._buttonIconWrapperNode.replaceChild(_(ka,null),this._buttonIconWrapperNode.firstChild)}onOpcodeMessageToolCallResultReceived(e){this.setButtonSuccess()}onOpcodeMessageToolCallErrorReceived(e){this.setButtonError()}onErrorWhileReadingBodyStream(e){this.setButtonError()}run(e){}}class ld extends Qn{constructor(r,n){super();P(this,"node");this.context=r;let i;switch(n.type){case Rt.Error:i=_(wa,{class:"text-Energy-Red-45"});break;case Rt.Danger:i=_(Zn,{class:"text-Energy-Red-45"});break;case Rt.Warning:i=_(Zn,{class:"text-Terracotta-30"});break;case Rt.Info:i=_(xa,{class:"text-Sea-Blue-Main-28"});break;case Rt.Success:i=_(Eo,{class:"text-Land-Green-30"});break}i.classList.add("shrink-0");let a;this.node=_("section",{class:"max-w-lg text-left my-2 bg-Sandstone-97 select-none border border-Light"},_("div",{class:"p-6 pb-3 flex gap-5"},i,_("div",null,_("h6",null,n.title),a=_("div",{class:"prose prose-sm prose-neutral"}))),_("fieldset",{class:"p-6 pt-3 flex justify-end gap-3"},_(tn,{as:"a",variant:Ft.Tertiary,class:"min-w-24",size:$r.Medium,target:"_blank",href:n.url},"Open in new tab"))),ba(a,n.textInMarkdown,this.context.conversationMessage.chat.pyodide,this.context.conversationMessage.chat.mdastExtensions),n.openRightAway&&window.open(n.url,n.target,n.windowFeatures)}onOpcodeMessageToolCallErrorReceived(r){}onErrorWhileReadingBodyStream(r){}}function Sa({size:t=Ct.Medium,...e}){const r=qe("svg");r.setAttribute("viewBox","0 0 20 20"),r.setAttribute("fill","currentColor"),r.setAttribute("width",t),r.setAttribute("height",t),Je(r,e);const n=qe("path");return n.setAttribute("d","M10.9153 1.83987L11.2942 1.88772L11.4749 1.91507C13.2633 2.24201 14.4107 4.01717 13.9749 5.78225L13.9261 5.95901L13.3987 7.6719C13.7708 7.67575 14.0961 7.68389 14.3792 7.70608C14.8737 7.74486 15.3109 7.82759 15.7015 8.03323L15.8528 8.11819C16.5966 8.56353 17.1278 9.29625 17.3167 10.1475L17.347 10.3096C17.403 10.69 17.3647 11.0832 17.2835 11.5098C17.2375 11.7517 17.1735 12.0212 17.096 12.3233L16.8255 13.3321L16.4456 14.7276C16.2076 15.6001 16.0438 16.2356 15.7366 16.7305L15.595 16.9346C15.2989 17.318 14.9197 17.628 14.4866 17.8408L14.2982 17.9258C13.6885 18.1774 12.9785 18.1651 11.9446 18.1651H7.33331C6.64422 18.1651 6.08726 18.1657 5.63702 18.1289C5.23638 18.0962 4.87565 18.031 4.53936 17.8867L4.39679 17.8203C3.87576 17.5549 3.43916 17.151 3.13507 16.6553L3.013 16.4366C2.82119 16.0599 2.74182 15.6541 2.7044 15.1963C2.66762 14.7461 2.66827 14.1891 2.66827 13.5V11.667C2.66827 10.9349 2.66214 10.4375 2.77569 10.0137L2.83722 9.81253C3.17599 8.81768 3.99001 8.05084 5.01397 7.77639L5.17706 7.73928C5.56592 7.66435 6.02595 7.66799 6.66632 7.66799C6.9429 7.66799 7.19894 7.52038 7.33624 7.2803L10.2562 2.16995L10.3118 2.08792C10.4544 1.90739 10.6824 1.81092 10.9153 1.83987ZM7.33136 14.167C7.33136 14.9841 7.33714 15.2627 7.39386 15.4746L7.42999 15.5918C7.62644 16.1686 8.09802 16.6134 8.69171 16.7725L8.87042 16.8067C9.07652 16.8323 9.38687 16.835 10.0003 16.835H11.9446C13.099 16.835 13.4838 16.8228 13.7903 16.6963L13.8997 16.6465C14.1508 16.5231 14.3716 16.3444 14.5433 16.1221L14.6155 16.0166C14.7769 15.7552 14.8968 15.3517 15.1624 14.378L15.5433 12.9824L15.8079 11.9922C15.8804 11.7102 15.9368 11.4711 15.9769 11.2608C16.0364 10.948 16.0517 10.7375 16.0394 10.5791L16.0179 10.4356C15.9156 9.97497 15.641 9.57381 15.2542 9.31253L15.0814 9.20999C14.9253 9.12785 14.6982 9.06544 14.2747 9.03225C13.8477 8.99881 13.2923 8.99807 12.5003 8.99807C12.2893 8.99807 12.0905 8.89822 11.9651 8.72854C11.8398 8.55879 11.8025 8.33942 11.8646 8.13772L12.6556 5.56741L12.7054 5.36331C12.8941 4.35953 12.216 3.37956 11.1878 3.2178L8.49054 7.93948C8.23033 8.39484 7.81431 8.72848 7.33136 8.88967V14.167ZM3.99835 13.5C3.99835 14.2111 3.99924 14.7044 4.03058 15.0879C4.06128 15.4636 4.11804 15.675 4.19854 15.833L4.26886 15.959C4.44517 16.2466 4.69805 16.4808 5.0003 16.6348L5.13019 16.6905C5.27397 16.7419 5.46337 16.7797 5.74542 16.8028C5.97772 16.8217 6.25037 16.828 6.58722 16.8311C6.41249 16.585 6.27075 16.3136 6.1712 16.0215L6.10968 15.8194C5.99614 15.3956 6.00128 14.899 6.00128 14.167V9.00296C5.79386 9.0067 5.65011 9.01339 5.53741 9.02737L5.3587 9.06057C4.76502 9.21965 4.29247 9.66448 4.09601 10.2412L4.06085 10.3584C4.00404 10.5705 3.99835 10.8493 3.99835 11.667V13.5Z"),r.appendChild(n),r.classList.add("icon"),r}function za({size:t=Ct.Medium,...e}){const r=qe("svg");r.setAttribute("viewBox","0 0 20 20"),r.setAttribute("fill","currentColor"),r.setAttribute("width",t),r.setAttribute("height",t),Je(r,e);const n=qe("path");return n.setAttribute("d","M12.6687 5.83304C12.6687 5.22006 12.6649 4.91019 12.6394 4.70413L12.6062 4.52542C12.4471 3.93179 12.0022 3.45922 11.4255 3.26272L11.3083 3.22757C11.0963 3.17075 10.8175 3.16507 9.99974 3.16507H8.0554C7.04558 3.16507 6.62456 3.17475 6.32982 3.26175L6.2097 3.30374C5.95005 3.41089 5.71908 3.57635 5.53392 3.78616L5.45677 3.87796C5.30475 4.0748 5.20336 4.33135 5.03392 4.91702L4.83763 5.6221L4.45677 7.01761C4.24829 7.78204 4.10326 8.31846 4.02318 8.73929C3.94374 9.15672 3.94298 9.39229 3.98119 9.56448L4.03587 9.75784C4.18618 10.1996 4.50043 10.5702 4.91771 10.7901L5.05052 10.8477C5.20009 10.9014 5.40751 10.9429 5.72533 10.9678C6.15231 11.0012 6.70771 11.002 7.49974 11.002C7.71076 11.002 7.90952 11.1018 8.0349 11.2715C8.14465 11.4201 8.18683 11.6067 8.15404 11.7862L8.13548 11.8623L7.34447 14.4326C7.01523 15.5033 7.71404 16.6081 8.81126 16.7813L11.5095 12.0606L11.5827 11.9405C11.8445 11.5461 12.2289 11.2561 12.6687 11.1094V5.83304ZM17.3318 8.33304C17.3318 8.97366 17.3364 9.43432 17.2615 9.82327L17.2234 9.98538C16.949 11.0094 16.1821 11.8233 15.1872 12.1621L14.9861 12.2237C14.5624 12.3372 14.0656 12.3321 13.3337 12.3321C13.0915 12.3321 12.8651 12.4453 12.7204 12.6348L12.6638 12.7198L9.74388 17.8301C9.61066 18.0631 9.35005 18.1935 9.08372 18.1602L8.70579 18.1123C6.75379 17.8682 5.49542 15.9213 6.07396 14.041L6.60033 12.3272C6.22861 12.3233 5.90377 12.3161 5.62083 12.294C5.18804 12.26 4.79914 12.1931 4.44701 12.0391L4.29857 11.9668C3.52688 11.5605 2.95919 10.8555 2.72533 10.0205L2.68333 9.85257C2.58769 9.42154 2.62379 8.97768 2.71654 8.49026C2.80865 8.00634 2.97082 7.41139 3.17357 6.668L3.55443 5.27249L3.74583 4.58011C3.9286 3.94171 4.10186 3.45682 4.40404 3.06546L4.53685 2.9053C4.85609 2.54372 5.25433 2.25896 5.70189 2.07425L5.93626 1.99222C6.49455 1.82612 7.15095 1.83499 8.0554 1.83499H12.6667C13.3558 1.83499 13.9128 1.83434 14.363 1.87112C14.8208 1.90854 15.2266 1.98789 15.6033 2.17972L15.821 2.30179C16.317 2.6059 16.7215 3.04226 16.987 3.56351L17.0535 3.70608C17.1977 4.04236 17.2629 4.40311 17.2956 4.80374C17.3324 5.25398 17.3318 5.81094 17.3318 6.50003V8.33304ZM13.9978 10.9961C14.3321 10.9901 14.5013 10.977 14.6413 10.9395L14.7585 10.9033C15.3353 10.7069 15.7801 10.2353 15.9392 9.64163L15.9724 9.46292C15.998 9.25682 16.0017 8.94657 16.0017 8.33304V6.50003C16.0017 5.78899 16.0008 5.29566 15.9695 4.91214C15.9464 4.6301 15.9086 4.44069 15.8572 4.2969L15.8015 4.16702C15.6475 3.86478 15.4133 3.6119 15.1257 3.43558L14.9997 3.36526C14.8418 3.28477 14.6302 3.228 14.2546 3.19729C14.0221 3.1783 13.7491 3.17109 13.4118 3.168C13.6267 3.47028 13.7914 3.81126 13.8904 4.18069L13.9275 4.34378C13.981 4.62163 13.9947 4.93582 13.9978 5.3262V10.9961Z"),r.appendChild(n),r.classList.add("icon"),r}function ud({size:t=Ct.Medium,...e}){const r=qe("svg");r.setAttribute("viewBox","0 0 32 32"),r.setAttribute("fill","currentColor"),r.setAttribute("width",t),r.setAttribute("height",t),Je(r,e);const n=qe("path");return n.setAttribute("d","M18.1215 16.0003L24.5315 9.59034L25.8534 8.26846C26.0484 8.07346 26.0484 7.75659 25.8534 7.56159L24.439 6.14721C24.244 5.95221 23.9271 5.95221 23.7321 6.14721L16.0002 13.8791L8.26837 6.14659C8.07337 5.95159 7.75649 5.95159 7.56149 6.14659L6.14649 7.56096C5.95149 7.75596 5.95149 8.07284 6.14649 8.26784L13.879 16.0003L6.14649 23.7322C5.95149 23.9272 5.95149 24.2441 6.14649 24.4391L7.56087 25.8535C7.75587 26.0485 8.07274 26.0485 8.26774 25.8535L16.0002 18.1216L22.4102 24.5316L23.7321 25.8535C23.9271 26.0485 24.244 26.0485 24.439 25.8535L25.8534 24.4391C26.0484 24.2441 26.0484 23.9272 25.8534 23.7322L18.1215 16.0003Z"),r.appendChild(n),r.classList.add("icon"),r}const cd=".dialog-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;font-family:Gantari,sans-serif}.dialog-content{background:#fff;box-shadow:0 4px 20px #00000026;position:relative;max-width:600px;width:90%;max-height:90vh;overflow-y:auto}.dialog-close-button{position:absolute;top:16px;right:16px;background:transparent;border:none;cursor:pointer;padding:4px;border-radius:4px;display:flex;align-items:center;justify-content:center;transition:background .1s ease-out;color:#2248aa}.dialog-close-button:hover{background:#f0f0f0}.dialog-header{padding:24px 24px 0;border-bottom:none}.dialog-body{padding:0 24px;display:flex;flex-direction:column;gap:20px}.dialog-footer{padding:0 24px 24px;border-top:none}.text-label-md{font-size:var(--text-lg, 1.5rem);font-weight:var(--font-weight-semibold, 600);color:#08122b;margin:0}.text-label-sm{font-size:var(--text-sm, .875rem);font-weight:var(--font-weight-normal, 400);color:#08122b;line-height:1.5}.feedback-suggestion-text{display:inline-block;padding:8px 16px;margin:4px 8px 4px 0;background:#d3eef8;border-radius:6px;cursor:pointer;transition:all .1s ease-out;font-size:var(--text-sm, .875rem);letter-spacing:.05rem;color:#2248aa}.feedback-suggestion-text:hover:not(.feedback-suggestion-text-active){background:#bce6f5;border-color:#17789b}.feedback-suggestion-text-active{background:#001333;color:#fff;border-color:#001333}.feedback-comment-text{width:100%;min-height:100px;padding:8px;border:2px solid hsl(40,3%,79%);font-family:Gantari,sans-serif;font-size:var(--text-sm, 1rem);font-weight:var(--font-weight-normal, 400);letter-spacing:.05rem;resize:none;box-sizing:border-box;transition:border-color .1s ease-out}.feedback-comment-text:focus{outline:none;border:4px solid hsl(218,100%,50%);box-shadow:0 0 0 2px #1e6ea71a}.feedback-comment-text::-moz-placeholder{color:#b5b3b0}.feedback-comment-text::placeholder{color:#b5b3b0}.btn-base-feedback{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;border-radius:0;display:inline-flex;height:auto;margin:0;outline:none;text-decoration:none;transition:background .1s ease-out,border-color .1s ease-out,color .1s ease-out,box-shadow .1s ease-out;white-space:nowrap;cursor:pointer;font-family:Gantari,sans-serif;font-size:var(--text-sm, .875rem);font-weight:var(--font-weight-medium, 500);justify-content:center}.btn-primary-feedback{background:#193680;color:#fff;border:1px solid hsl(223,67%,30%)}.btn-primary-feedback:disabled{background:#95adea;color:#fff;border-color:#0000;cursor:not-allowed;opacity:.5}.btn-primary-feedback:hover,.btn-primary-feedback:active{background:#002566}.btn-primary-feedback:disabled:hover{background:#95adea;color:#fff;border-color:#0000}.btn-lg-feedback{padding:10px 20px;min-width:100px;font-size:16px;letter-spacing:.05rem;height:50px}.flex{display:flex}.flex-col{flex-direction:column}.justify-end{justify-content:flex-end}.gap-2-feedback{gap:8px;padding-top:40px}.gap-5-feedback{gap:20px}.w-\\[600px\\]{width:600px}.pl-7-feedback{padding-top:28px}.footer-note{font-size:12px;color:#6c757d;line-height:1.5;margin:0;padding:0;text-align:left;font-weight:400;font-family:Gantari,sans-serif;letter-spacing:.02rem}.footer-note a{color:#6c757d;text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px;font-weight:500;transition:color .1s ease-out}.footer-note a:hover{color:#6c757d;text-decoration-thickness:2px}@media (prefers-color-scheme: dark){.dialog-content{background:#0f214d;color:#fff}.text-label-md,.text-label-sm{color:#fff}.dialog-close-button:hover{background:#152d6a}.feedback-suggestion-text{background:#0d1b40;border-color:#0d1b40;color:#e0e0e0}.feedback-suggestion-text:hover:not(.feedback-suggestion-text-active){background:#1d3f95;border-color:#8fffb2}.feedback-suggestion-text-active{background:#2651c0;color:#00e649;border-color:#8fffb2}.feedback-comment-text{background:#2d2d2d;border-color:#404040;color:#fff}.feedback-comment-text:focus{border-color:#009930;box-shadow:0 0 0 2px #4caf501a}.feedback-comment-text::-moz-placeholder{color:#b5b3b0}.feedback-comment-text::placeholder{color:#b5b3b0}.btn-primary-feedback{background:#8fffb2;color:#0f214d;border-color:#8fffb2}.btn-primary-feedback:disabled{background:#dcf2d9;color:#d4def7;border-color:#dcf2d9}.btn-primary-feedback:disabled:hover{background:#00cc41;color:#0d1b40;border-color:#00cc41}.btn-primary-feedback:hover{background:#00cc41}.btn-link-feedback{color:#009930}.btn-link-feedback:hover{background:#1e6ea740}.footer-note{color:#8d8d8d}.footer-note a{color:#8fffb2;text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}.footer-note a:hover{color:#00cc41;text-decoration-thickness:2px}}.dialog-close-button:focus-visible,.btn-base-feedback:focus-visible,.btn-link-feedback:focus-visible{box-shadow:0 0 0 2px #8bc8f0}.btn-base-feedback:disabled{opacity:.5;cursor:not-allowed}";class _o{constructor(e,r,n,i,a,s,o,u){P(this,"node");P(this,"_rightColumnNode");P(this,"_feedbackNode");P(this,"_showToolCallResult",!1);P(this,"_toolCallInfoNode");P(this,"_currentMessageBlockNode");P(this,"_currentMessageBlockNodeMarkdown");P(this,"_accumulatedMarkdown","");P(this,"_toolCallBuilder",new nd);P(this,"_clientFunctionInvocationsByOperationId",{});P(this,"_clientFunctionInvocationsByLlmFunctionId",{});P(this,"_subConversations",{});P(this,"_pulseNode");P(this,"_pulseNodeAnimation");P(this,"_suggestionTextList");this.conversation=e,this.authorRole=r,this.authorId=n,this.authorPictureUrl=i,this.authorDisplayName=a,this.authorEmail=s,this.messageId=o,this.copilitId=u,this.node=_("li",{class:"p-2 flex gap-2"},_(Zh,{class:"shrink-0",id:this.authorId,title:this.authorDisplayName},this.authorPictureUrl?_("img",{src:this.authorPictureUrl,class:"w-full h-full"}):_("span",{marginTop:"-.1em"},Yh(this.authorDisplayName))),this._rightColumnNode=_("div",{class:"shrink-0 flex-1"},_("div",{class:"font-medium text-base leading-5"},this.authorDisplayName))),this.ensureCurrentMessageBlockNode(),this._suggestionTextList=[{text:"Irrelevant answer",isActive:!1},{text:"Incorrect information",isActive:!1},{text:"Incomplete answer",isActive:!1},{text:"Offensive content",isActive:!1},{text:"Other",isActive:!1}]}get chat(){return this.conversation.chat}ensureCurrentMessageBlockNode(){if(!this._currentMessageBlockNode&&(this._rightColumnNode.appendChild(this._toolCallInfoNode=_("div",{class:"prose prose-neutral prose-sm max-w-none"})),this._rightColumnNode.appendChild(this._currentMessageBlockNode=_("div",{class:"prose prose-neutral prose-sm max-w-none"})),this._currentMessageBlockNodeMarkdown="",this.authorRole==="assistant")){this._pulseNode=_("div",{class:"inline-flex relative h-3 w-3"},_("div",{class:"absolute inline-flex h-full w-full rounded-full bg-Sky-Blue-80"}),_("div",{class:"relative inline-flex rounded-full h-full w-full bg-Sky-Blue-Main-77"})),this._currentMessageBlockNode.appendChild(this._pulseNode);const e=[{transform:"scale(2.5)",opacity:0,offset:.75},{transform:"scale(2.5)",opacity:0,offset:1}],r={duration:1500,iterations:1/0,easing:"cubic-bezier(0, 0, 0.2, 1)"};this._pulseNodeAnimation=this._pulseNode.firstElementChild.animate(e,r)}}removePulseNodeIfItIsThere(){const e=this._pulseNode;e&&(this._pulseNode=null,this._pulseNodeAnimation.cancel(),e.remove())}append(e){if(this._accumulatedMarkdown+=e,this.ensureCurrentMessageBlockNode(),this._currentMessageBlockNodeMarkdown+=e,this._pulseNode){var r=this._pulseNodeAnimation.currentTime;this._pulseNodeAnimation.pause(),this._pulseNode.remove()}ba(this._currentMessageBlockNode,this._currentMessageBlockNodeMarkdown,this.chat.pyodide,this.chat.mdastExtensions),this._pulseNode&&(this._pulseNodeAnimation.currentTime=r,this._pulseNode.classList.add("ml-[1ch]"),hd(this._currentMessageBlockNode).appendChild(this._pulseNode),this._pulseNodeAnimation.play())}toolCallUpdate(e){var n;const r=this._toolCallBuilder.append(e);if(r.llmFunctionId&&r.functionName){let i=this._clientFunctionInvocationsByLlmFunctionId[r.llmFunctionId];if(i){(n=i.updateWithToolCallData)==null||n.call(i,r);return}const a=this.chat.clientFunctionInvocationHandlersPartial[r.functionName];if(a){const s=new d0(r.llmFunctionId,null,this),o=a(s,r);this._clientFunctionInvocationsByLlmFunctionId[r.llmFunctionId]=o,this.removePulseNodeIfItIsThere(),o.node&&(this._rightColumnNode.appendChild(o.node),o instanceof Qn&&o.context.conversationMessage.expandAsync(),this._currentMessageBlockNode=null,this._currentMessageBlockNodeMarkdown=null)}}}onOpcodeMessageInvokeClientFunctionReceived(e,r,n,i){var h,d;const a=JSON.parse(i);let s=this._clientFunctionInvocationsByOperationId[r];if(s){s.run(...a);return}if(s=this._clientFunctionInvocationsByLlmFunctionId[e],s&&!s.context.operationId){s.context.operationId=r,this.chat.clientFunctionInvocationsByOperationId[r]=s,this._clientFunctionInvocationsByOperationId[r]=s,(h=s.run)==null||h.call(s,...a);return}const o=new d0(e,r,this),u=this.chat.clientFunctionInvocationHandlers[n];if(u)s=u(o,...a),this.chat.clientFunctionInvocationsByOperationId[r]=s,this._clientFunctionInvocationsByOperationId[r]=s,this._clientFunctionInvocationsByLlmFunctionId[e]=s,(d=s.run)==null||d.call(s,...a),this.removePulseNodeIfItIsThere(),s.node&&(this._rightColumnNode.appendChild(s.node),s instanceof Qn&&s.context.conversationMessage.expandAsync(),this._currentMessageBlockNode=null,this._currentMessageBlockNodeMarkdown=null);else{const p=`Function '${n}' not found. This occurs if a tool / function has been invoked, that requires some sort of user interaction (e.g. to obtain confirmation or to fill out some form values), then contacts the front-end to obtain a response, but the front-end is unable to handle the request because the function to be invoked does not exist. This error was thrown in the front-end. This most likely indicates that the bot is set up incorrectly, and the user should contact support.`;o.postErrorAsync(p)}}setClientInvocationResult(e,r){var n;(n=e.onClientResult)==null||n.call(e,r)}setClientInvocationError(e,r){var n;(n=e.onClientError)==null||n.call(e,r)}onOpcodeMessageToolCallBeginReceived(e,r){this._showToolCallResult=!0,this.ensureCurrentMessageBlockNode(),this._toolCallInfoNode.appendChild(_("div",{class:"flex"},_("div",{class:"p-1"},_("label",null,r))))}onOpcodeMessageToolCallResultReceived(e,r){var a;let n;try{n=JSON.parse(r)}catch{n=r}this.ensureCurrentMessageBlockNode(),this._showToolCallResult&&r.length>0&&this._toolCallInfoNode.appendChild(_("div",{class:"flex"},_("div",{class:"p-1"},_("pre",{class:"whitespace-pre-wrap"},JSON.stringify(n,null,2)))));let i=this._clientFunctionInvocationsByLlmFunctionId[e];i&&((a=i.onOpcodeMessageToolCallResultReceived)==null||a.call(i,r),this.onClientFunctionInvocationCompleted(i))}onOpcodeMessageToolCallErrorReceived(e,r){const n=this._clientFunctionInvocationsByLlmFunctionId[e];n&&(n.onOpcodeMessageToolCallErrorReceived(r),this.onClientFunctionInvocationCompleted(n))}onClientFunctionInvocationCompleted(e){e.context.llmFunctionId in this._clientFunctionInvocationsByLlmFunctionId&&(delete this._clientFunctionInvocationsByLlmFunctionId[e.context.llmFunctionId],!Object.keys(this._subConversations).length&&!Object.keys(this._clientFunctionInvocationsByLlmFunctionId).length&&this.ensureCurrentMessageBlockNode())}executeLlmFunctionsBegin(){this._toolCallBuilder.clear()}executeLlmFunctionsEnd(){this.ensureCurrentMessageBlockNode(),this._clientFunctionInvocationsByLlmFunctionId={},this._subConversations={}}subConversationBegin(e,r,n,i,a,s){const o=new Bo(this.chat,e,this,s);this.chat.conversationsById.set(e,o),this._subConversations[e]=o,this.removePulseNodeIfItIsThere(),this._rightColumnNode.appendChild(o.node),this._currentMessageBlockNode=null,this._currentMessageBlockNodeMarkdown=null}notifySubConversationEnded(e,r){delete this._subConversations[e.id],!r&&!Object.keys(this._subConversations).length&&!Object.keys(this._clientFunctionInvocationsByLlmFunctionId).length&&this.ensureCurrentMessageBlockNode()}onOpcodeEndReceived(){this.removePulseNodeIfItIsThere(),this._toolCallBuilder.clear(),this._clientFunctionInvocationsByLlmFunctionId={},this._subConversations={};const e=this.conversation.chat.feedbackByMessageId.get(this.messageId);e!=null?this._feedbackNode=_("div",{class:"flex"},_("a",{class:"btn btn-link-feedback p-1"},_(e?Sa:za,null))):this._feedbackNode=_("div",{class:"flex"},_("a",{class:"btn btn-link-feedback p-1",onclick:()=>{this.conversation.chat.setLikeAsync(this.messageId,this.copilitId,!0),this._feedbackNode.replaceWith(this._feedbackNode=_("div",{class:"flex"},_("a",{class:"btn btn-link-feedback p-1"},_(Sa,null))))}},_(Sa,null)),_("a",{class:"btn btn-link-feedback p-1",onclick:()=>{const r=_("div",{class:"dialog-overlay"},_("div",{role:"dialog",class:"dialog-content w-[600px] gap-5-feedback"},_("button",{onclick:()=>r.remove(),class:"dialog-close-button"},_(ud,{size:"22"})),_("div",{class:"dialog-header"},_("label",{class:"text-label-md pl-7-feedback"},"Tell us more")),_("div",{class:"dialog-body flex flex-col gap-5-feedback"},_("div",{class:"text-label-sm pl-7-feedback"},this._suggestionTextList.map((o,u)=>_("span",{class:"feedback-suggestion-text",onclick:h=>{const d=this;this._suggestionTextList.filter((f,z)=>z!==u&&f.isActive).forEach(f=>f.isActive=!1),r.querySelectorAll(".feedback-suggestion-text").forEach(f=>f.classList.toggle("feedback-suggestion-text-active",!1)),o.isActive=!o.isActive,h.currentTarget.classList.toggle("feedback-suggestion-text-active",o.isActive),n.call(d)}},o.text))),_("textarea",{placeholder:"Add special details (optional)",class:"feedback-comment-text"}),_("div",{class:"footer-note"},_("a",{href:"https://id.veracity.com/terms-of-use",target:"_blank",rel:"noopener noreferrer"},"Learn more")," about how this data is used and your rights. By pressing Submit, your conversation will be used to improve Veracity products and services. ",_("a",{href:"https://services.veracity.com/PrivacyStatement",target:"_blank",rel:"noopener noreferrer"},"Privacy statement."))),_("div",{class:"dialog-footer flex justify-end gap-2-feedback"},_("button",{id:"submit-btn",class:"btn-base-feedback btn-primary-feedback btn-lg-feedback",disabled:!0,onclick:()=>{let o="";this._suggestionTextList.map((d,p)=>{d.isActive&&(o=d.text)});let u="";const h=r.querySelector(".feedback-comment-text").value;h!==""&&(u=h),this.conversation.chat.setLikeAsync(this.messageId,this.copilitId,!1,o,u),r.remove(),this._feedbackNode.replaceWith(this._feedbackNode=_("div",{class:"flex"},_("a",{class:"btn btn-link-feedback p-1"},_(za,null))))}},"Submit"))));function n(){const o=r.querySelector("#submit-btn");if(o){const u=this._suggestionTextList.some(h=>h.isActive);o.disabled=!u}}n.call(this);const i=document.createElement("div"),a=i.attachShadow({mode:"open"}),s=document.createElement("style");s.textContent=cd,a.appendChild(s),a.appendChild(r),document.body.appendChild(i)}},_(za,null))),this._rightColumnNode.appendChild(this._feedbackNode)}onErrorWhileReadingBodyStream(e){console.log("ConversationMessage.onErrorWhileReadingBodyStream",e),this.removePulseNodeIfItIsThere();for(const r in this._clientFunctionInvocationsByLlmFunctionId)this._clientFunctionInvocationsByLlmFunctionId[r].onErrorWhileReadingBodyStream(e);this._toolCallBuilder.clear(),this._clientFunctionInvocationsByLlmFunctionId={};for(const r in this._subConversations)this._subConversations[r].onErrorWhileReadingBodyStream(e);this._subConversations={}}toDto(){return{role:this.authorRole,content:this._accumulatedMarkdown}}expandAsync(){if(this.conversation instanceof Bo)return this.conversation.expandAsync()}static installClientFunctions(e){e.clientFunctionInvocationHandlers.python=(r,n)=>{const i=new Mo(r,n);return i.run(n),i},e.clientFunctionInvocationHandlersPartial.python=(r,n)=>new Mo(r,n),e.clientFunctionInvocationHandlers.ButtonOptionsDialog=(r,n)=>new ed(r,n),e.clientFunctionInvocationHandlers.search=(r,n)=>new od(r,n),e.clientFunctionInvocationHandlers.WindowOpenDialog=(r,n)=>new ld(r,n)}}function hd(t){for(;;)for(let e=t.lastChild;;e=e.previousSibling)if(e){if(e.nodeType===Node.TEXT_NODE)return t;if(e.nodeType===Node.ELEMENT_NODE){if(e.tagName==="TABLE")return t;t=e;break}}else return t}class No{constructor(e,r){P(this,"node");P(this,"messagesListNode");P(this,"messages",[]);P(this,"activeMessage");P(this,"_opcodeConversationEndReceived");P(this,"_opcodeConversationErrorReceived");P(this,"_onErrorWhileReadingBodyStreamCalled");this.chat=e,this.id=r,this.node=this.messagesListNode=_("ol",null)}onOpcodeMessageBeginReceived(e,r,n,i,a,s,o){const u=new _o(this,e,r,n,i,a,s,o);return this.messages.push(this.activeMessage=u),this.messagesListNode.appendChild(u.node),u}onOpcodeMessageAppendReceived(e){this.activeMessage.append(e)}onOpcodeMessageExecuteLlmFunctionsBeginReceived(){this.activeMessage.executeLlmFunctionsBegin()}onOpcodeMessageExecuteLlmFunctionsEndReceived(){this.activeMessage.executeLlmFunctionsEnd()}onOpcodeMessageToolCallUpdateReceived(e){this.activeMessage.toolCallUpdate(e)}onOpcodeMessageToolCallBeginReceived(e,r){this.activeMessage.onOpcodeMessageToolCallBeginReceived(e,r)}onOpcodeMessageToolCallResultReceived(e,r){this.activeMessage.onOpcodeMessageToolCallResultReceived(e,r)}onOpcodeMessageToolCallErrorReceived(e,r){this.activeMessage.onOpcodeMessageToolCallErrorReceived(e,r)}onOpcodeMessageInvokeClientFunctionReceived(e,r,n,i){this.activeMessage.onOpcodeMessageInvokeClientFunctionReceived(e,r,n,i)}onOpcodeMessageSubConversationBeginReceived(e,r,n,i,a,s){this.activeMessage.subConversationBegin(e,r,n,i,a,s)}handleMessage(e){switch(e.type){case Me.MessageBegin:return this.onOpcodeMessageBeginReceived(e.messageAuthorRole,e.messageAuthorId,e.messageAuthorPictureUrl,e.messageAuthorDisplayName,e.messageAuthorEmail,e.messageId,e.copilotId),!0;case Me.MessageAppend:return this.onOpcodeMessageAppendReceived(e.appendMessageMarkdown),!0;case Me.MessageToolCallUpdate:return this.onOpcodeMessageToolCallUpdateReceived(e),!0;case Me.MessageToolCallBegin:return this.onOpcodeMessageToolCallBeginReceived(e.llmFunctionId,e.toolCallBeginInfo),!0;case Me.MessageToolCallResult:return this.onOpcodeMessageToolCallResultReceived(e.llmFunctionId,e.result),!0;case Me.MessageToolCallError:return this.onOpcodeMessageToolCallErrorReceived(e.llmFunctionId,e.error),!0;case Me.MessageExecuteLlmFunctionsBegin:return this.onOpcodeMessageExecuteLlmFunctionsBeginReceived(),!0;case Me.MessageExecuteLlmFunctionsEnd:return this.onOpcodeMessageExecuteLlmFunctionsEndReceived(),!0;case Me.MessageInvokeClientFunction:return this.onOpcodeMessageInvokeClientFunctionReceived(e.llmFunctionId,e.operationId,e.clientFunctionName,e.argumentsAsJSON),!0;case Me.MessageSubConversationBegin:return this.onOpcodeMessageSubConversationBeginReceived(e.subConversationId,e.messageAuthorId,e.messageAuthorPictureUrl,e.messageAuthorDisplayName,e.messageAuthorEmail,e.subConversationTitle),!0;case Me.ConversationEnd:return this.onOpcodeConversationEndReceived(),!0;case Me.ConversationError:return this.onOpcodeConversationErrorReceived(e.error,e.stackTrace),this.onOpcodeConversationEndReceived(),!0}return!1}onRootConversationEndOfBodyStream(){!this._opcodeConversationEndReceived&&!this._opcodeConversationErrorReceived&&!this._onErrorWhileReadingBodyStreamCalled&&this.onRootConversationUnexpectedEndOfBodyStream(),this.activeMessage=null,this._opcodeConversationEndReceived=!1,this._opcodeConversationErrorReceived=!1,this._onErrorWhileReadingBodyStreamCalled=!1}onRootConversationUnexpectedEndOfBodyStream(){var e,r;(r=(e=this.activeMessage)==null?void 0:e.onErrorWhileReadingBodyStream)==null||r.call(e,new _l),this.displayError("Unexpected end of response","The response ended unexpectedly. Please check your connectivity. Other possible causes include server instability or a bug.")}onOpcodeConversationEndReceived(){var e;this._opcodeConversationEndReceived=!0,(e=this.activeMessage)==null||e.onOpcodeEndReceived()}onOpcodeConversationErrorReceived(e,r){this._opcodeConversationErrorReceived=!0,e?this.displayError("Error",e):this.displayError("Error","An undisclosed error occurred. Please contact Veracity Support.")}onErrorBeforeReadingBodyStreamStarted(e,r){if(r){this.displayInfo("Stopped","The generation of the response was stopped.");return}if(e instanceof Oa){this.displayError("Max limit reached","You have reached the maximum input limit. Please try again later.");return}else this.displayError("Error",String(e.message))}onErrorWhileReadingBodyStream(e,r){var n;this._onErrorWhileReadingBodyStreamCalled=!0,(n=this.activeMessage)==null||n.onErrorWhileReadingBodyStream(e),r?this.displayInfo("Stopped","The generation of the response was stopped."):this.displayError("Error while reading response",String(e.message))}displayError(e,r){this.messagesListNode.appendChild(_("li",{class:"m-2 border border-Light p-6 flex gap-5 bg-Sandstone-97"},_(wa,{class:"text-Energy-Red-45"}),_("div",null,_("h6",null,e),_("div",{class:"prose prose-sm prose-neutral"},_("p",null,r)))))}displayInfo(e,r){this.messagesListNode.appendChild(_("li",{class:"m-2 border border-Light p-6 flex gap-5 bg-Sandstone-97"},_(xa,{class:"text-Sea-Blue-Main-28"}),_("div",null,_("h6",null,e),_("div",{class:"prose prose-sm prose-neutral"},_("p",null,r)))))}}class Bo extends No{constructor(r,n,i,a){super(r,n);P(this,"_buttonNode");P(this,"_buttonIconWrapperNode");P(this,"_buttonTextNode");P(this,"_contentWrapperNode");P(this,"_contentNode");P(this,"_expanded",!1);P(this,"_expandedCt");P(this,"_expandPromise");this.parentMessage=i,this.title=a,this.node=_("div",{class:"my-2"},this._buttonNode=_(tn,{class:"p-2 gap-2 group",variant:Ft.Badge,size:$r.Medium,onclick:()=>this.expanded=!this.expanded},this._buttonIconWrapperNode=_("div",{width:"24px",height:"24px"},_(Jn,{size:dn.Small})),this.title,_(Ao,{class:"transition-all duration-300 group-data-[expanded=true]:-rotate-180"})),this._contentWrapperNode=_("div",{class:"grid",gridTemplateRows:this._expanded?"1fr":"0fr",opacity:this._expanded?"1":"0","aria-expanded":this._expanded},_("div",{class:"overflow-hidden"},this._contentNode=_("section",{class:"mt-2 border border-Light flex flex-col bg-Sandstone-95 p-3"},this.messagesListNode))))}get expanded(){return this._expanded}set expanded(r){r!==this._expanded&&(r?this.doExpandAsync():this.doCollapseAsync())}async doExpandAsync(){var n;(n=this._expandedCt)==null||n.cancel();const r=this._expandedCt=new Kt;this._buttonNode.setAttribute("data-expanded",String(this._expanded=!0)),this._expandPromise=(async()=>{try{await cr(this._contentWrapperNode,[{gridTemplateRows:"1fr"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt),await cr(this._contentWrapperNode,[{opacity:"1"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt)}catch(i){if(!r.isCancellationRequested)throw i}})(),await this._expandPromise}async doCollapseAsync(){var n;(n=this._expandedCt)==null||n.cancel();const r=this._expandedCt=new Kt;this._buttonNode.setAttribute("data-expanded",String(this._expanded=!1));try{await cr(this._contentWrapperNode,[{opacity:"0"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt),await cr(this._contentWrapperNode,[{gridTemplateRows:"0fr"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt)}catch(i){if(!r.isCancellationRequested)throw i}}onErrorWhileReadingBodyStream(r){var n;(n=this.activeMessage)==null||n.onErrorWhileReadingBodyStream(r),this.setButtonError(),this.parentMessage.notifySubConversationEnded(this,!0)}onOpcodeConversationEndReceived(){var r;(r=this.activeMessage)==null||r.onOpcodeEndReceived(),this.setButtonSuccess(),this.parentMessage.notifySubConversationEnded(this,!1)}onOpcodeConversationErrorReceived(r,n){var s;let i="An undisclosed error occurred. Please contact Veracity Support.";r&&(i=r),this.displayError("Error",i);const a=new Error(i);(s=this.activeMessage)==null||s.onErrorWhileReadingBodyStream(a),this.setButtonError(),this.parentMessage.notifySubConversationEnded(this,!1)}setButtonSuccess(){this._buttonNode.setAttribute("data-status","success"),this._buttonIconWrapperNode.replaceChild(_(Yn,null),this._buttonIconWrapperNode.firstChild)}setButtonError(){this._buttonNode.setAttribute("data-status","error"),this._buttonIconWrapperNode.replaceChild(_(ka,null),this._buttonIconWrapperNode.firstChild)}async expandAsync(){await this.parentMessage.expandAsync(),this._expanded?this._expandPromise&&await this._expandPromise:await this.doExpandAsync()}}class dd{constructor(e){P(this,"node");P(this,"url");P(this,"historyUrl");P(this,"feedbackUrl");P(this,"summarizeTitleUrl");P(this,"fetch");P(this,"conversationsById",new Map);P(this,"feedbackByMessageId",new Map);P(this,"rootConversation",new No(this,null));P(this,"clientFunctionInvocationHandlers",{});P(this,"clientFunctionInvocationHandlersPartial",{});P(this,"clientFunctionInvocationsByOperationId",{});P(this,"mdastExtensions",[]);P(this,"pyodide");P(this,"_lazyInitializePyodidePromise");P(this,"_completion");this.conversationsById.set(null,this.rootConversation),this.url=e.url,this.historyUrl=e.historyUrl,this.feedbackUrl=e.feedbackUrl,this.summarizeTitleUrl=e.summarizeTitleUrl,this.fetch=e.fetch??fetch.bind(window),this.node=_("div",null);const r=document.createElement("style");r.textContent=il+`
|
|
270
|
+
`);if(n.length){const u=n[n.length-1];u.isStderr?(u.text+=o.shift(),n.push(...o.map(h=>({isStderr:!0,text:h})))):n.push(...o.map(h=>({isStderr:!0,text:h})))}else n.push(...o.map(u=>({isStderr:!0,text:u})));this.getOrAddStderrNode().textContent+=s}});const a=await r.runPythonCodeAsync(e);var i=a===void 0?"None":String(a)}catch(a){this.setButtonError();const s=String(a);this.getOrAddErrorNode().textContent=s,console.error(a),await this.context.postResultAsync({terminatedWithError:!0,error:s,stdoutAndStderr:n});return}this.setButtonSuccess(),i&&(this.getOrAddResultRawNode().textContent=i),await this.context.postResultAsync({result:i,stdoutAndStderr:n})}updateWithToolCallData(e){this._highlightCode.updateCode("python",Co(e.functionArguments))}}function Co(t){if(!t.startsWith("{"))return t;var e=t.indexOf("Code:");if(e!=-1&&t.substring(0,e).trim()=="{"&&(t='{"Code":'+t.substring(e+5)),e=t.indexOf('"""'),e!=-1){var r=t.lastIndexOf('"""');if(e<r&&t.substring(r+3).trim()=="}"){var n=id(t.substring(e+3,r-(e+3))),i=t.substring(0,e)+JSON.stringify(n)+t.substring(r+3);t=i}}try{var a=ad(t)}catch{return console.warn("Error parsing Python code arguments provided as JSON.",t),""}return(a==null?void 0:a.Code)||(a==null?void 0:a.code)||""}class od{constructor(e,r){P(this,"node");P(this,"_buttonNode");P(this,"_buttonIconWrapperNode");this.context=e,this.node=_("div",{class:"my-2"},this._buttonNode=_(tn,{as:"div",class:"p-2 pr-3 gap-2 select-none",variant:Ft.Badge,size:$r.Medium},this._buttonIconWrapperNode=_("div",{width:"24px",height:"24px"},_(Jn,{size:dn.Small})),`Search for '${r}'`))}setButtonSuccess(){this._buttonNode.setAttribute("data-status","success"),this._buttonIconWrapperNode.replaceChild(_(Yn,null),this._buttonIconWrapperNode.firstChild)}setButtonError(){this._buttonNode.setAttribute("data-status","error"),this._buttonIconWrapperNode.replaceChild(_(ka,null),this._buttonIconWrapperNode.firstChild)}onOpcodeMessageToolCallResultReceived(e){this.setButtonSuccess()}onOpcodeMessageToolCallErrorReceived(e){this.setButtonError()}onErrorWhileReadingBodyStream(e){this.setButtonError()}run(e){}}class ld extends Qn{constructor(r,n){super();P(this,"node");this.context=r;let i;switch(n.type){case Rt.Error:i=_(wa,{class:"text-Energy-Red-45"});break;case Rt.Danger:i=_(Zn,{class:"text-Energy-Red-45"});break;case Rt.Warning:i=_(Zn,{class:"text-Terracotta-30"});break;case Rt.Info:i=_(xa,{class:"text-Sea-Blue-Main-28"});break;case Rt.Success:i=_(Eo,{class:"text-Land-Green-30"});break}i.classList.add("shrink-0");let a;this.node=_("section",{class:"max-w-lg text-left my-2 bg-Sandstone-97 select-none border border-Light"},_("div",{class:"p-6 pb-3 flex gap-5"},i,_("div",null,_("h6",null,n.title),a=_("div",{class:"prose prose-sm prose-neutral"}))),_("fieldset",{class:"p-6 pt-3 flex justify-end gap-3"},_(tn,{as:"a",variant:Ft.Tertiary,class:"min-w-24",size:$r.Medium,target:"_blank",href:n.url},"Open in new tab"))),ba(a,n.textInMarkdown,this.context.conversationMessage.chat.pyodide,this.context.conversationMessage.chat.mdastExtensions),n.openRightAway&&window.open(n.url,n.target,n.windowFeatures)}onOpcodeMessageToolCallErrorReceived(r){}onErrorWhileReadingBodyStream(r){}}function Sa({size:t=Ct.Medium,...e}){const r=qe("svg");r.setAttribute("viewBox","0 0 20 20"),r.setAttribute("fill","currentColor"),r.setAttribute("width",t),r.setAttribute("height",t),Je(r,e);const n=qe("path");return n.setAttribute("d","M10.9153 1.83987L11.2942 1.88772L11.4749 1.91507C13.2633 2.24201 14.4107 4.01717 13.9749 5.78225L13.9261 5.95901L13.3987 7.6719C13.7708 7.67575 14.0961 7.68389 14.3792 7.70608C14.8737 7.74486 15.3109 7.82759 15.7015 8.03323L15.8528 8.11819C16.5966 8.56353 17.1278 9.29625 17.3167 10.1475L17.347 10.3096C17.403 10.69 17.3647 11.0832 17.2835 11.5098C17.2375 11.7517 17.1735 12.0212 17.096 12.3233L16.8255 13.3321L16.4456 14.7276C16.2076 15.6001 16.0438 16.2356 15.7366 16.7305L15.595 16.9346C15.2989 17.318 14.9197 17.628 14.4866 17.8408L14.2982 17.9258C13.6885 18.1774 12.9785 18.1651 11.9446 18.1651H7.33331C6.64422 18.1651 6.08726 18.1657 5.63702 18.1289C5.23638 18.0962 4.87565 18.031 4.53936 17.8867L4.39679 17.8203C3.87576 17.5549 3.43916 17.151 3.13507 16.6553L3.013 16.4366C2.82119 16.0599 2.74182 15.6541 2.7044 15.1963C2.66762 14.7461 2.66827 14.1891 2.66827 13.5V11.667C2.66827 10.9349 2.66214 10.4375 2.77569 10.0137L2.83722 9.81253C3.17599 8.81768 3.99001 8.05084 5.01397 7.77639L5.17706 7.73928C5.56592 7.66435 6.02595 7.66799 6.66632 7.66799C6.9429 7.66799 7.19894 7.52038 7.33624 7.2803L10.2562 2.16995L10.3118 2.08792C10.4544 1.90739 10.6824 1.81092 10.9153 1.83987ZM7.33136 14.167C7.33136 14.9841 7.33714 15.2627 7.39386 15.4746L7.42999 15.5918C7.62644 16.1686 8.09802 16.6134 8.69171 16.7725L8.87042 16.8067C9.07652 16.8323 9.38687 16.835 10.0003 16.835H11.9446C13.099 16.835 13.4838 16.8228 13.7903 16.6963L13.8997 16.6465C14.1508 16.5231 14.3716 16.3444 14.5433 16.1221L14.6155 16.0166C14.7769 15.7552 14.8968 15.3517 15.1624 14.378L15.5433 12.9824L15.8079 11.9922C15.8804 11.7102 15.9368 11.4711 15.9769 11.2608C16.0364 10.948 16.0517 10.7375 16.0394 10.5791L16.0179 10.4356C15.9156 9.97497 15.641 9.57381 15.2542 9.31253L15.0814 9.20999C14.9253 9.12785 14.6982 9.06544 14.2747 9.03225C13.8477 8.99881 13.2923 8.99807 12.5003 8.99807C12.2893 8.99807 12.0905 8.89822 11.9651 8.72854C11.8398 8.55879 11.8025 8.33942 11.8646 8.13772L12.6556 5.56741L12.7054 5.36331C12.8941 4.35953 12.216 3.37956 11.1878 3.2178L8.49054 7.93948C8.23033 8.39484 7.81431 8.72848 7.33136 8.88967V14.167ZM3.99835 13.5C3.99835 14.2111 3.99924 14.7044 4.03058 15.0879C4.06128 15.4636 4.11804 15.675 4.19854 15.833L4.26886 15.959C4.44517 16.2466 4.69805 16.4808 5.0003 16.6348L5.13019 16.6905C5.27397 16.7419 5.46337 16.7797 5.74542 16.8028C5.97772 16.8217 6.25037 16.828 6.58722 16.8311C6.41249 16.585 6.27075 16.3136 6.1712 16.0215L6.10968 15.8194C5.99614 15.3956 6.00128 14.899 6.00128 14.167V9.00296C5.79386 9.0067 5.65011 9.01339 5.53741 9.02737L5.3587 9.06057C4.76502 9.21965 4.29247 9.66448 4.09601 10.2412L4.06085 10.3584C4.00404 10.5705 3.99835 10.8493 3.99835 11.667V13.5Z"),r.appendChild(n),r.classList.add("icon"),r}function za({size:t=Ct.Medium,...e}){const r=qe("svg");r.setAttribute("viewBox","0 0 20 20"),r.setAttribute("fill","currentColor"),r.setAttribute("width",t),r.setAttribute("height",t),Je(r,e);const n=qe("path");return n.setAttribute("d","M12.6687 5.83304C12.6687 5.22006 12.6649 4.91019 12.6394 4.70413L12.6062 4.52542C12.4471 3.93179 12.0022 3.45922 11.4255 3.26272L11.3083 3.22757C11.0963 3.17075 10.8175 3.16507 9.99974 3.16507H8.0554C7.04558 3.16507 6.62456 3.17475 6.32982 3.26175L6.2097 3.30374C5.95005 3.41089 5.71908 3.57635 5.53392 3.78616L5.45677 3.87796C5.30475 4.0748 5.20336 4.33135 5.03392 4.91702L4.83763 5.6221L4.45677 7.01761C4.24829 7.78204 4.10326 8.31846 4.02318 8.73929C3.94374 9.15672 3.94298 9.39229 3.98119 9.56448L4.03587 9.75784C4.18618 10.1996 4.50043 10.5702 4.91771 10.7901L5.05052 10.8477C5.20009 10.9014 5.40751 10.9429 5.72533 10.9678C6.15231 11.0012 6.70771 11.002 7.49974 11.002C7.71076 11.002 7.90952 11.1018 8.0349 11.2715C8.14465 11.4201 8.18683 11.6067 8.15404 11.7862L8.13548 11.8623L7.34447 14.4326C7.01523 15.5033 7.71404 16.6081 8.81126 16.7813L11.5095 12.0606L11.5827 11.9405C11.8445 11.5461 12.2289 11.2561 12.6687 11.1094V5.83304ZM17.3318 8.33304C17.3318 8.97366 17.3364 9.43432 17.2615 9.82327L17.2234 9.98538C16.949 11.0094 16.1821 11.8233 15.1872 12.1621L14.9861 12.2237C14.5624 12.3372 14.0656 12.3321 13.3337 12.3321C13.0915 12.3321 12.8651 12.4453 12.7204 12.6348L12.6638 12.7198L9.74388 17.8301C9.61066 18.0631 9.35005 18.1935 9.08372 18.1602L8.70579 18.1123C6.75379 17.8682 5.49542 15.9213 6.07396 14.041L6.60033 12.3272C6.22861 12.3233 5.90377 12.3161 5.62083 12.294C5.18804 12.26 4.79914 12.1931 4.44701 12.0391L4.29857 11.9668C3.52688 11.5605 2.95919 10.8555 2.72533 10.0205L2.68333 9.85257C2.58769 9.42154 2.62379 8.97768 2.71654 8.49026C2.80865 8.00634 2.97082 7.41139 3.17357 6.668L3.55443 5.27249L3.74583 4.58011C3.9286 3.94171 4.10186 3.45682 4.40404 3.06546L4.53685 2.9053C4.85609 2.54372 5.25433 2.25896 5.70189 2.07425L5.93626 1.99222C6.49455 1.82612 7.15095 1.83499 8.0554 1.83499H12.6667C13.3558 1.83499 13.9128 1.83434 14.363 1.87112C14.8208 1.90854 15.2266 1.98789 15.6033 2.17972L15.821 2.30179C16.317 2.6059 16.7215 3.04226 16.987 3.56351L17.0535 3.70608C17.1977 4.04236 17.2629 4.40311 17.2956 4.80374C17.3324 5.25398 17.3318 5.81094 17.3318 6.50003V8.33304ZM13.9978 10.9961C14.3321 10.9901 14.5013 10.977 14.6413 10.9395L14.7585 10.9033C15.3353 10.7069 15.7801 10.2353 15.9392 9.64163L15.9724 9.46292C15.998 9.25682 16.0017 8.94657 16.0017 8.33304V6.50003C16.0017 5.78899 16.0008 5.29566 15.9695 4.91214C15.9464 4.6301 15.9086 4.44069 15.8572 4.2969L15.8015 4.16702C15.6475 3.86478 15.4133 3.6119 15.1257 3.43558L14.9997 3.36526C14.8418 3.28477 14.6302 3.228 14.2546 3.19729C14.0221 3.1783 13.7491 3.17109 13.4118 3.168C13.6267 3.47028 13.7914 3.81126 13.8904 4.18069L13.9275 4.34378C13.981 4.62163 13.9947 4.93582 13.9978 5.3262V10.9961Z"),r.appendChild(n),r.classList.add("icon"),r}function ud({size:t=Ct.Medium,...e}){const r=qe("svg");r.setAttribute("viewBox","0 0 32 32"),r.setAttribute("fill","currentColor"),r.setAttribute("width",t),r.setAttribute("height",t),Je(r,e);const n=qe("path");return n.setAttribute("d","M18.1215 16.0003L24.5315 9.59034L25.8534 8.26846C26.0484 8.07346 26.0484 7.75659 25.8534 7.56159L24.439 6.14721C24.244 5.95221 23.9271 5.95221 23.7321 6.14721L16.0002 13.8791L8.26837 6.14659C8.07337 5.95159 7.75649 5.95159 7.56149 6.14659L6.14649 7.56096C5.95149 7.75596 5.95149 8.07284 6.14649 8.26784L13.879 16.0003L6.14649 23.7322C5.95149 23.9272 5.95149 24.2441 6.14649 24.4391L7.56087 25.8535C7.75587 26.0485 8.07274 26.0485 8.26774 25.8535L16.0002 18.1216L22.4102 24.5316L23.7321 25.8535C23.9271 26.0485 24.244 26.0485 24.439 25.8535L25.8534 24.4391C26.0484 24.2441 26.0484 23.9272 25.8534 23.7322L18.1215 16.0003Z"),r.appendChild(n),r.classList.add("icon"),r}const cd=".dialog-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;font-family:Gantari,sans-serif}.dialog-content{background:#fff;box-shadow:0 4px 20px #00000026;position:relative;max-width:600px;width:90%;max-height:90vh;overflow-y:auto}.dialog-close-button{position:absolute;top:10px;right:10px;background:transparent;border:none;cursor:pointer;padding:10px;display:flex;align-items:center;justify-content:center;transition:background .1s ease-out;color:#00348f;border-radius:3.40282e38px}.dialog-close-button:hover{background:#bce6f5}.dialog-header{padding:20px}.dialog-body{display:flex;flex-direction:column;border-top-width:1px;border-bottom-width:1px;border-top-style:solid;border-bottom-style:solid;border-color:#0000001a;padding-top:8px;padding-bottom:16px;padding-inline:20px;overflow-y:auto}.dialog-footer{gap:8px;padding:16px;display:flex;justify-content:flex-end;flex-shrink:0}.text-label-md{font-size:var(--text-lg, 1.5rem);font-weight:var(--font-weight-semibold, 600);color:#0f214d;margin:0}.text-label-sm{font-size:var(--text-sm, .875rem);font-weight:var(--font-weight-normal, 400);color:#0f214d;line-height:1.5}.feedback-category{padding-bottom:16px}.feedback-suggestion-text{display:inline-block;padding:8px 16px;margin:4px 8px 4px 0;background:#d3eef8;border-radius:6px;cursor:pointer;transition:all .1s ease-out;font-size:var(--text-sm, .875rem);letter-spacing:.05rem;color:#2248aa}.feedback-suggestion-text:hover:not(.feedback-suggestion-text-active){background:#bce6f5;border-color:#17789b}.feedback-suggestion-text-active{background:#001333;color:#fff;border-color:#001333}.feedback-comment-text{width:100%;min-height:100px;font-family:var(--font-sans);font-size:var(--text-sm, 1rem);font-weight:var(--font-weight-normal, 400);letter-spacing:0;resize:none;box-sizing:border-box;transition:border-color .1s ease-out;background:#fff;color:#1a1a19;border-width:1px;border-color:#b5b3b0;padding-left:6px;padding-right:6px;padding-block:6px}.feedback-comment-text:focus{outline:none;border:2px solid #009fda}.btn-base-feedback{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;border-radius:0;display:inline-flex;height:auto;margin:0;outline:none;text-decoration:none;transition:background .1s ease-out,border-color .1s ease-out,color .1s ease-out,box-shadow .1s ease-out;white-space:nowrap;cursor:pointer;font-family:Gantari,sans-serif;font-size:var(--text-sm, .875rem);font-weight:var(--font-weight-medium, 500);justify-content:center}.btn-primary-feedback{background:#00348f;color:#fff}.btn-primary-feedback:disabled{background:#95adea;color:#fff;cursor:not-allowed;opacity:.5}.btn-primary-feedback:hover{background:#002566}.btn-primary-feedback:active{background:#0041b2}.btn-primary-feedback:disabled:hover{background:#00348f;color:#fff}.btn-lg-feedback{min-width:40px;font-size:16px;letter-spacing:0;gap:8px;padding-inline:16px;padding-block:12px;font-weight:500;line-height:1}.flex{display:flex}.flex-col{flex-direction:column}.justify-end{justify-content:flex-end}.gap-2-feedback{gap:8px;padding-top:40px}.gap-5-feedback{gap:20px}.w-\\[600px\\]{width:600px}.pl-7-feedback{padding-top:28px}.footer-note{font-size:12px;color:#6c757d;line-height:1.5;padding-top:12px;text-align:left;font-weight:400;font-family:Gantari,sans-serif;letter-spacing:.02rem}.footer-note a{color:#6c757d;text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px;font-weight:500;transition:color .1s ease-out}.footer-note a:hover{color:#6c757d;text-decoration-thickness:2px}@media (prefers-color-scheme: dark){.dialog-content{background:#0f214d;color:#fff}.text-label-md,.text-label-sm{color:#0f214d}.dialog-close-button:hover{background:#152d6a}.feedback-suggestion-text{background:#0d1b40;border-color:#0d1b40;color:#e0e0e0}.feedback-suggestion-text:hover:not(.feedback-suggestion-text-active){background:#1d3f95;border-color:#8fffb2}.feedback-suggestion-text-active{background:#2651c0;color:#00e649;border-color:#8fffb2}.feedback-comment-text{background:#2d2d2d;border-color:#404040;color:#fff}.feedback-comment-text:focus{border-color:#009930;box-shadow:0 0 0 2px #4caf501a}.feedback-comment-text::-moz-placeholder{color:#b5b3b0}.feedback-comment-text::placeholder{color:#b5b3b0}.btn-primary-feedback{background:#8fffb2;color:#0f214d;border-color:#8fffb2}.btn-primary-feedback:disabled{background:#dcf2d9;color:#d4def7;border-color:#dcf2d9}.btn-primary-feedback:disabled:hover{background:#00cc41;color:#0d1b40;border-color:#00cc41}.btn-primary-feedback:hover{background:#00cc41}.btn-link-feedback{color:#009930}.btn-link-feedback:hover{background:#1e6ea740}.footer-note{color:#8d8d8d}.footer-note a{color:#8fffb2;text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}.footer-note a:hover{color:#00cc41;text-decoration-thickness:2px}}.dialog-close-button:focus-visible,.btn-base-feedback:focus-visible,.btn-link-feedback:focus-visible{box-shadow:0 0 0 2px #8bc8f0}.btn-base-feedback:disabled{opacity:.5;cursor:not-allowed}";class _o{constructor(e,r,n,i,a,s,o,u){P(this,"node");P(this,"_rightColumnNode");P(this,"_feedbackNode");P(this,"_showToolCallResult",!1);P(this,"_toolCallInfoNode");P(this,"_currentMessageBlockNode");P(this,"_currentMessageBlockNodeMarkdown");P(this,"_accumulatedMarkdown","");P(this,"_toolCallBuilder",new nd);P(this,"_clientFunctionInvocationsByOperationId",{});P(this,"_clientFunctionInvocationsByLlmFunctionId",{});P(this,"_subConversations",{});P(this,"_pulseNode");P(this,"_pulseNodeAnimation");P(this,"_suggestionTextList");this.conversation=e,this.authorRole=r,this.authorId=n,this.authorPictureUrl=i,this.authorDisplayName=a,this.authorEmail=s,this.messageId=o,this.copilitId=u,this.node=_("li",{class:"p-2 flex gap-2"},_(Zh,{class:"shrink-0",id:this.authorId,title:this.authorDisplayName},this.authorPictureUrl?_("img",{src:this.authorPictureUrl,class:"w-full h-full"}):_("span",{marginTop:"-.1em"},Yh(this.authorDisplayName))),this._rightColumnNode=_("div",{class:"shrink-0 flex-1"},_("div",{class:"font-medium text-base leading-5"},this.authorDisplayName))),this.ensureCurrentMessageBlockNode(),this._suggestionTextList=[{text:"Irrelevant answer",isActive:!1},{text:"Incorrect information",isActive:!1},{text:"Incomplete answer",isActive:!1},{text:"Offensive content",isActive:!1},{text:"Other",isActive:!1}]}get chat(){return this.conversation.chat}ensureCurrentMessageBlockNode(){if(!this._currentMessageBlockNode&&(this._rightColumnNode.appendChild(this._toolCallInfoNode=_("div",{class:"prose prose-neutral prose-sm max-w-none"})),this._rightColumnNode.appendChild(this._currentMessageBlockNode=_("div",{class:"prose prose-neutral prose-sm max-w-none"})),this._currentMessageBlockNodeMarkdown="",this.authorRole==="assistant")){this._pulseNode=_("div",{class:"inline-flex relative h-3 w-3"},_("div",{class:"absolute inline-flex h-full w-full rounded-full bg-Sky-Blue-80"}),_("div",{class:"relative inline-flex rounded-full h-full w-full bg-Sky-Blue-Main-77"})),this._currentMessageBlockNode.appendChild(this._pulseNode);const e=[{transform:"scale(2.5)",opacity:0,offset:.75},{transform:"scale(2.5)",opacity:0,offset:1}],r={duration:1500,iterations:1/0,easing:"cubic-bezier(0, 0, 0.2, 1)"};this._pulseNodeAnimation=this._pulseNode.firstElementChild.animate(e,r)}}removePulseNodeIfItIsThere(){const e=this._pulseNode;e&&(this._pulseNode=null,this._pulseNodeAnimation.cancel(),e.remove())}append(e){if(this._accumulatedMarkdown+=e,this.ensureCurrentMessageBlockNode(),this._currentMessageBlockNodeMarkdown+=e,this._pulseNode){var r=this._pulseNodeAnimation.currentTime;this._pulseNodeAnimation.pause(),this._pulseNode.remove()}ba(this._currentMessageBlockNode,this._currentMessageBlockNodeMarkdown,this.chat.pyodide,this.chat.mdastExtensions),this._pulseNode&&(this._pulseNodeAnimation.currentTime=r,this._pulseNode.classList.add("ml-[1ch]"),hd(this._currentMessageBlockNode).appendChild(this._pulseNode),this._pulseNodeAnimation.play())}toolCallUpdate(e){var n;const r=this._toolCallBuilder.append(e);if(r.llmFunctionId&&r.functionName){let i=this._clientFunctionInvocationsByLlmFunctionId[r.llmFunctionId];if(i){(n=i.updateWithToolCallData)==null||n.call(i,r);return}const a=this.chat.clientFunctionInvocationHandlersPartial[r.functionName];if(a){const s=new d0(r.llmFunctionId,null,this),o=a(s,r);this._clientFunctionInvocationsByLlmFunctionId[r.llmFunctionId]=o,this.removePulseNodeIfItIsThere(),o.node&&(this._rightColumnNode.appendChild(o.node),o instanceof Qn&&o.context.conversationMessage.expandAsync(),this._currentMessageBlockNode=null,this._currentMessageBlockNodeMarkdown=null)}}}onOpcodeMessageInvokeClientFunctionReceived(e,r,n,i){var h,d;const a=JSON.parse(i);let s=this._clientFunctionInvocationsByOperationId[r];if(s){s.run(...a);return}if(s=this._clientFunctionInvocationsByLlmFunctionId[e],s&&!s.context.operationId){s.context.operationId=r,this.chat.clientFunctionInvocationsByOperationId[r]=s,this._clientFunctionInvocationsByOperationId[r]=s,(h=s.run)==null||h.call(s,...a);return}const o=new d0(e,r,this),u=this.chat.clientFunctionInvocationHandlers[n];if(u)s=u(o,...a),this.chat.clientFunctionInvocationsByOperationId[r]=s,this._clientFunctionInvocationsByOperationId[r]=s,this._clientFunctionInvocationsByLlmFunctionId[e]=s,(d=s.run)==null||d.call(s,...a),this.removePulseNodeIfItIsThere(),s.node&&(this._rightColumnNode.appendChild(s.node),s instanceof Qn&&s.context.conversationMessage.expandAsync(),this._currentMessageBlockNode=null,this._currentMessageBlockNodeMarkdown=null);else{const p=`Function '${n}' not found. This occurs if a tool / function has been invoked, that requires some sort of user interaction (e.g. to obtain confirmation or to fill out some form values), then contacts the front-end to obtain a response, but the front-end is unable to handle the request because the function to be invoked does not exist. This error was thrown in the front-end. This most likely indicates that the bot is set up incorrectly, and the user should contact support.`;o.postErrorAsync(p)}}setClientInvocationResult(e,r){var n;(n=e.onClientResult)==null||n.call(e,r)}setClientInvocationError(e,r){var n;(n=e.onClientError)==null||n.call(e,r)}onOpcodeMessageToolCallBeginReceived(e,r){this._showToolCallResult=!0,this.ensureCurrentMessageBlockNode(),this._toolCallInfoNode.appendChild(_("div",{class:"flex"},_("div",{class:"p-1"},_("label",null,r))))}onOpcodeMessageToolCallResultReceived(e,r){var a;let n;try{n=JSON.parse(r)}catch{n=r}this.ensureCurrentMessageBlockNode(),this._showToolCallResult&&r.length>0&&this._toolCallInfoNode.appendChild(_("div",{class:"flex"},_("div",{class:"p-1"},_("pre",{class:"whitespace-pre-wrap"},JSON.stringify(n,null,2)))));let i=this._clientFunctionInvocationsByLlmFunctionId[e];i&&((a=i.onOpcodeMessageToolCallResultReceived)==null||a.call(i,r),this.onClientFunctionInvocationCompleted(i))}onOpcodeMessageToolCallErrorReceived(e,r){const n=this._clientFunctionInvocationsByLlmFunctionId[e];n&&(n.onOpcodeMessageToolCallErrorReceived(r),this.onClientFunctionInvocationCompleted(n))}onClientFunctionInvocationCompleted(e){e.context.llmFunctionId in this._clientFunctionInvocationsByLlmFunctionId&&(delete this._clientFunctionInvocationsByLlmFunctionId[e.context.llmFunctionId],!Object.keys(this._subConversations).length&&!Object.keys(this._clientFunctionInvocationsByLlmFunctionId).length&&this.ensureCurrentMessageBlockNode())}executeLlmFunctionsBegin(){this._toolCallBuilder.clear()}executeLlmFunctionsEnd(){this.ensureCurrentMessageBlockNode(),this._clientFunctionInvocationsByLlmFunctionId={},this._subConversations={}}subConversationBegin(e,r,n,i,a,s){const o=new Bo(this.chat,e,this,s);this.chat.conversationsById.set(e,o),this._subConversations[e]=o,this.removePulseNodeIfItIsThere(),this._rightColumnNode.appendChild(o.node),this._currentMessageBlockNode=null,this._currentMessageBlockNodeMarkdown=null}notifySubConversationEnded(e,r){delete this._subConversations[e.id],!r&&!Object.keys(this._subConversations).length&&!Object.keys(this._clientFunctionInvocationsByLlmFunctionId).length&&this.ensureCurrentMessageBlockNode()}onOpcodeEndReceived(){this.removePulseNodeIfItIsThere(),this._toolCallBuilder.clear(),this._clientFunctionInvocationsByLlmFunctionId={},this._subConversations={};const e=this.conversation.chat.feedbackByMessageId.get(this.messageId);e!=null?this._feedbackNode=_("div",{class:"flex"},_("a",{class:"btn btn-link-feedback p-1"},_(e?Sa:za,null))):this._feedbackNode=_("div",{class:"flex"},_("a",{class:"btn btn-link-feedback p-1",onclick:()=>{this.conversation.chat.setLikeAsync(this.messageId,this.copilitId,!0),this._feedbackNode.replaceWith(this._feedbackNode=_("div",{class:"flex"},_("a",{class:"btn btn-link-feedback p-1"},_(Sa,null))))}},_(Sa,null)),_("a",{class:"btn btn-link-feedback p-1",onclick:()=>{const r=_("div",{class:"dialog-overlay"},_("div",{role:"dialog",class:"dialog-content w-[600px]"},_("div",{class:"dialog-header"},_("label",{class:"text-label-md"},"Tell us more"),_("button",{onclick:()=>r.remove(),class:"dialog-close-button"},_(ud,{size:"22"}))),_("div",{class:"dialog-body"},_("div",{class:"text-label-sm feedback-category"},this._suggestionTextList.map((o,u)=>_("span",{class:"feedback-suggestion-text",onclick:h=>{const d=this;this._suggestionTextList.filter((f,z)=>z!==u&&f.isActive).forEach(f=>f.isActive=!1),r.querySelectorAll(".feedback-suggestion-text").forEach(f=>f.classList.toggle("feedback-suggestion-text-active",!1)),o.isActive=!o.isActive,h.currentTarget.classList.toggle("feedback-suggestion-text-active",o.isActive),n.call(d)}},o.text))),_("textarea",{placeholder:"Add special details (optional)",class:"feedback-comment-text"}),_("div",{class:"footer-note"},_("a",{href:"https://id.veracity.com/terms-of-use",target:"_blank",rel:"noopener noreferrer"},"Learn more")," about how this data is used and your rights. By pressing Submit, your conversation will be used to improve Veracity products and services. ",_("a",{href:"https://services.veracity.com/PrivacyStatement",target:"_blank",rel:"noopener noreferrer"},"Privacy statement."))),_("div",{class:"dialog-footer"},_("button",{id:"submit-btn",class:"btn-base-feedback btn-primary-feedback btn-lg-feedback",disabled:!0,onclick:()=>{let o="";this._suggestionTextList.map((d,p)=>{d.isActive&&(o=d.text)});let u="";const h=r.querySelector(".feedback-comment-text").value;h!==""&&(u=h),this.conversation.chat.setLikeAsync(this.messageId,this.copilitId,!1,o,u),r.remove(),this._feedbackNode.replaceWith(this._feedbackNode=_("div",{class:"flex"},_("a",{class:"btn btn-link-feedback p-1"},_(za,null))))}},"Submit"))));function n(){const o=r.querySelector("#submit-btn");if(o){const u=this._suggestionTextList.some(h=>h.isActive);o.disabled=!u}}this._suggestionTextList.forEach(o=>{o.isActive=!1}),n.call(this);const i=document.createElement("div"),a=i.attachShadow({mode:"open"}),s=document.createElement("style");s.textContent=cd,a.appendChild(s),a.appendChild(r),document.body.appendChild(i)}},_(za,null))),this._rightColumnNode.appendChild(this._feedbackNode)}onErrorWhileReadingBodyStream(e){console.log("ConversationMessage.onErrorWhileReadingBodyStream",e),this.removePulseNodeIfItIsThere();for(const r in this._clientFunctionInvocationsByLlmFunctionId)this._clientFunctionInvocationsByLlmFunctionId[r].onErrorWhileReadingBodyStream(e);this._toolCallBuilder.clear(),this._clientFunctionInvocationsByLlmFunctionId={};for(const r in this._subConversations)this._subConversations[r].onErrorWhileReadingBodyStream(e);this._subConversations={}}toDto(){return{role:this.authorRole,content:this._accumulatedMarkdown}}expandAsync(){if(this.conversation instanceof Bo)return this.conversation.expandAsync()}static installClientFunctions(e){e.clientFunctionInvocationHandlers.python=(r,n)=>{const i=new Mo(r,n);return i.run(n),i},e.clientFunctionInvocationHandlersPartial.python=(r,n)=>new Mo(r,n),e.clientFunctionInvocationHandlers.ButtonOptionsDialog=(r,n)=>new ed(r,n),e.clientFunctionInvocationHandlers.search=(r,n)=>new od(r,n),e.clientFunctionInvocationHandlers.WindowOpenDialog=(r,n)=>new ld(r,n)}}function hd(t){for(;;)for(let e=t.lastChild;;e=e.previousSibling)if(e){if(e.nodeType===Node.TEXT_NODE)return t;if(e.nodeType===Node.ELEMENT_NODE){if(e.tagName==="TABLE")return t;t=e;break}}else return t}class No{constructor(e,r){P(this,"node");P(this,"messagesListNode");P(this,"messages",[]);P(this,"activeMessage");P(this,"_opcodeConversationEndReceived");P(this,"_opcodeConversationErrorReceived");P(this,"_onErrorWhileReadingBodyStreamCalled");this.chat=e,this.id=r,this.node=this.messagesListNode=_("ol",null)}onOpcodeMessageBeginReceived(e,r,n,i,a,s,o){const u=new _o(this,e,r,n,i,a,s,o);return this.messages.push(this.activeMessage=u),this.messagesListNode.appendChild(u.node),u}onOpcodeMessageAppendReceived(e){this.activeMessage.append(e)}onOpcodeMessageExecuteLlmFunctionsBeginReceived(){this.activeMessage.executeLlmFunctionsBegin()}onOpcodeMessageExecuteLlmFunctionsEndReceived(){this.activeMessage.executeLlmFunctionsEnd()}onOpcodeMessageToolCallUpdateReceived(e){this.activeMessage.toolCallUpdate(e)}onOpcodeMessageToolCallBeginReceived(e,r){this.activeMessage.onOpcodeMessageToolCallBeginReceived(e,r)}onOpcodeMessageToolCallResultReceived(e,r){this.activeMessage.onOpcodeMessageToolCallResultReceived(e,r)}onOpcodeMessageToolCallErrorReceived(e,r){this.activeMessage.onOpcodeMessageToolCallErrorReceived(e,r)}onOpcodeMessageInvokeClientFunctionReceived(e,r,n,i){this.activeMessage.onOpcodeMessageInvokeClientFunctionReceived(e,r,n,i)}onOpcodeMessageSubConversationBeginReceived(e,r,n,i,a,s){this.activeMessage.subConversationBegin(e,r,n,i,a,s)}handleMessage(e){switch(e.type){case Me.MessageBegin:return this.onOpcodeMessageBeginReceived(e.messageAuthorRole,e.messageAuthorId,e.messageAuthorPictureUrl,e.messageAuthorDisplayName,e.messageAuthorEmail,e.messageId,e.copilotId),!0;case Me.MessageAppend:return this.onOpcodeMessageAppendReceived(e.appendMessageMarkdown),!0;case Me.MessageToolCallUpdate:return this.onOpcodeMessageToolCallUpdateReceived(e),!0;case Me.MessageToolCallBegin:return this.onOpcodeMessageToolCallBeginReceived(e.llmFunctionId,e.toolCallBeginInfo),!0;case Me.MessageToolCallResult:return this.onOpcodeMessageToolCallResultReceived(e.llmFunctionId,e.result),!0;case Me.MessageToolCallError:return this.onOpcodeMessageToolCallErrorReceived(e.llmFunctionId,e.error),!0;case Me.MessageExecuteLlmFunctionsBegin:return this.onOpcodeMessageExecuteLlmFunctionsBeginReceived(),!0;case Me.MessageExecuteLlmFunctionsEnd:return this.onOpcodeMessageExecuteLlmFunctionsEndReceived(),!0;case Me.MessageInvokeClientFunction:return this.onOpcodeMessageInvokeClientFunctionReceived(e.llmFunctionId,e.operationId,e.clientFunctionName,e.argumentsAsJSON),!0;case Me.MessageSubConversationBegin:return this.onOpcodeMessageSubConversationBeginReceived(e.subConversationId,e.messageAuthorId,e.messageAuthorPictureUrl,e.messageAuthorDisplayName,e.messageAuthorEmail,e.subConversationTitle),!0;case Me.ConversationEnd:return this.onOpcodeConversationEndReceived(),!0;case Me.ConversationError:return this.onOpcodeConversationErrorReceived(e.error,e.stackTrace),this.onOpcodeConversationEndReceived(),!0}return!1}onRootConversationEndOfBodyStream(){!this._opcodeConversationEndReceived&&!this._opcodeConversationErrorReceived&&!this._onErrorWhileReadingBodyStreamCalled&&this.onRootConversationUnexpectedEndOfBodyStream(),this.activeMessage=null,this._opcodeConversationEndReceived=!1,this._opcodeConversationErrorReceived=!1,this._onErrorWhileReadingBodyStreamCalled=!1}onRootConversationUnexpectedEndOfBodyStream(){var e,r;(r=(e=this.activeMessage)==null?void 0:e.onErrorWhileReadingBodyStream)==null||r.call(e,new _l),this.displayError("Unexpected end of response","The response ended unexpectedly. Please check your connectivity. Other possible causes include server instability or a bug.")}onOpcodeConversationEndReceived(){var e;this._opcodeConversationEndReceived=!0,(e=this.activeMessage)==null||e.onOpcodeEndReceived()}onOpcodeConversationErrorReceived(e,r){this._opcodeConversationErrorReceived=!0,e?this.displayError("Error",e):this.displayError("Error","An undisclosed error occurred. Please contact Veracity Support.")}onErrorBeforeReadingBodyStreamStarted(e,r){if(r){this.displayInfo("Stopped","The generation of the response was stopped.");return}if(e instanceof Oa){this.displayError("Max limit reached","You have reached the maximum input limit. Please try again later.");return}else this.displayError("Error",String(e.message))}onErrorWhileReadingBodyStream(e,r){var n;this._onErrorWhileReadingBodyStreamCalled=!0,(n=this.activeMessage)==null||n.onErrorWhileReadingBodyStream(e),r?this.displayInfo("Stopped","The generation of the response was stopped."):this.displayError("Error while reading response",String(e.message))}displayError(e,r){this.messagesListNode.appendChild(_("li",{class:"m-2 border border-Light p-6 flex gap-5 bg-Sandstone-97"},_(wa,{class:"text-Energy-Red-45"}),_("div",null,_("h6",null,e),_("div",{class:"prose prose-sm prose-neutral"},_("p",null,r)))))}displayInfo(e,r){this.messagesListNode.appendChild(_("li",{class:"m-2 border border-Light p-6 flex gap-5 bg-Sandstone-97"},_(xa,{class:"text-Sea-Blue-Main-28"}),_("div",null,_("h6",null,e),_("div",{class:"prose prose-sm prose-neutral"},_("p",null,r)))))}}class Bo extends No{constructor(r,n,i,a){super(r,n);P(this,"_buttonNode");P(this,"_buttonIconWrapperNode");P(this,"_buttonTextNode");P(this,"_contentWrapperNode");P(this,"_contentNode");P(this,"_expanded",!1);P(this,"_expandedCt");P(this,"_expandPromise");this.parentMessage=i,this.title=a,this.node=_("div",{class:"my-2"},this._buttonNode=_(tn,{class:"p-2 gap-2 group",variant:Ft.Badge,size:$r.Medium,onclick:()=>this.expanded=!this.expanded},this._buttonIconWrapperNode=_("div",{width:"24px",height:"24px"},_(Jn,{size:dn.Small})),this.title,_(Ao,{class:"transition-all duration-300 group-data-[expanded=true]:-rotate-180"})),this._contentWrapperNode=_("div",{class:"grid",gridTemplateRows:this._expanded?"1fr":"0fr",opacity:this._expanded?"1":"0","aria-expanded":this._expanded},_("div",{class:"overflow-hidden"},this._contentNode=_("section",{class:"mt-2 border border-Light flex flex-col bg-Sandstone-95 p-3"},this.messagesListNode))))}get expanded(){return this._expanded}set expanded(r){r!==this._expanded&&(r?this.doExpandAsync():this.doCollapseAsync())}async doExpandAsync(){var n;(n=this._expandedCt)==null||n.cancel();const r=this._expandedCt=new Kt;this._buttonNode.setAttribute("data-expanded",String(this._expanded=!0)),this._expandPromise=(async()=>{try{await cr(this._contentWrapperNode,[{gridTemplateRows:"1fr"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt),await cr(this._contentWrapperNode,[{opacity:"1"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt)}catch(i){if(!r.isCancellationRequested)throw i}})(),await this._expandPromise}async doCollapseAsync(){var n;(n=this._expandedCt)==null||n.cancel();const r=this._expandedCt=new Kt;this._buttonNode.setAttribute("data-expanded",String(this._expanded=!1));try{await cr(this._contentWrapperNode,[{opacity:"0"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt),await cr(this._contentWrapperNode,[{gridTemplateRows:"0fr"}],{duration:300,easing:"ease-in-out",fill:"forwards"},this._expandedCt)}catch(i){if(!r.isCancellationRequested)throw i}}onErrorWhileReadingBodyStream(r){var n;(n=this.activeMessage)==null||n.onErrorWhileReadingBodyStream(r),this.setButtonError(),this.parentMessage.notifySubConversationEnded(this,!0)}onOpcodeConversationEndReceived(){var r;(r=this.activeMessage)==null||r.onOpcodeEndReceived(),this.setButtonSuccess(),this.parentMessage.notifySubConversationEnded(this,!1)}onOpcodeConversationErrorReceived(r,n){var s;let i="An undisclosed error occurred. Please contact Veracity Support.";r&&(i=r),this.displayError("Error",i);const a=new Error(i);(s=this.activeMessage)==null||s.onErrorWhileReadingBodyStream(a),this.setButtonError(),this.parentMessage.notifySubConversationEnded(this,!1)}setButtonSuccess(){this._buttonNode.setAttribute("data-status","success"),this._buttonIconWrapperNode.replaceChild(_(Yn,null),this._buttonIconWrapperNode.firstChild)}setButtonError(){this._buttonNode.setAttribute("data-status","error"),this._buttonIconWrapperNode.replaceChild(_(ka,null),this._buttonIconWrapperNode.firstChild)}async expandAsync(){await this.parentMessage.expandAsync(),this._expanded?this._expandPromise&&await this._expandPromise:await this.doExpandAsync()}}class dd{constructor(e){P(this,"node");P(this,"url");P(this,"historyUrl");P(this,"feedbackUrl");P(this,"summarizeTitleUrl");P(this,"fetch");P(this,"conversationsById",new Map);P(this,"feedbackByMessageId",new Map);P(this,"rootConversation",new No(this,null));P(this,"clientFunctionInvocationHandlers",{});P(this,"clientFunctionInvocationHandlersPartial",{});P(this,"clientFunctionInvocationsByOperationId",{});P(this,"mdastExtensions",[]);P(this,"pyodide");P(this,"_lazyInitializePyodidePromise");P(this,"_completion");this.conversationsById.set(null,this.rootConversation),this.url=e.url,this.historyUrl=e.historyUrl,this.feedbackUrl=e.feedbackUrl,this.summarizeTitleUrl=e.summarizeTitleUrl,this.fetch=e.fetch??fetch.bind(window),this.node=_("div",null);const r=document.createElement("style");r.textContent=il+`
|
|
271
271
|
`+al+`
|
|
272
272
|
`+sl;const n=this.node.attachShadow({mode:"closed"});n.appendChild(r),n.appendChild(this.rootConversation.node),_o.installClientFunctions(this)}lazyInitializePyodideAsync(){return this._lazyInitializePyodidePromise??(this._lazyInitializePyodidePromise=this.doInitializePyodide())}async doInitializePyodide(){return this.pyodide=await o0({indexURL:"https://cdn.veracity.com/vcb/pyodide-0.26.4/pyodide/"}),this.pyodide.FS.mkdir("/mnt"),this.pyodide.FS.mkdir("/mnt/data"),this.pyodide}async runPythonCodeAsync(e){return await this.pyodide.loadPackagesFromImports(e),await this.pyodide.runPythonAsync(e)}get canSubmit(){return!this._completion}async LoadHistoryMessages(){let e=new li;await this.LoadLikesAsync();try{await e.initializeExistingAsync(this.fetch,this.historyUrl)}catch(r){let n=e.wasStopped;throw e=null,this.rootConversation.onErrorBeforeReadingBodyStreamStarted(r,n),r}try{for(;await e.waitToReadAsync();)for(const r of e.read()){switch(r.type){case Me.MessageInvokeClientFunctionResult:{const n=this.clientFunctionInvocationsByOperationId[r.operationId];n.context.conversationMessage.setClientInvocationResult(n,JSON.parse(r.result));continue}case Me.MessageInvokeClientFunctionError:{const n=this.clientFunctionInvocationsByOperationId[r.operationId];n.context.conversationMessage.setClientInvocationError(n,r.error);continue}}this.conversationsById.get(r.conversationId).handleMessage(r)}}catch(r){this.rootConversation.onErrorWhileReadingBodyStream(r,e.wasStopped)}finally{e=null,this.rootConversation.onRootConversationEndOfBodyStream()}}async SummarizeTitleAsync(e,r){const n=new li,i=this.rootConversation.messages.map(a=>a.toDto());i.push({role:"user",content:r});for(let a=0;a<i.length;++a)if(i[a].role==="user"){const s=a+1;for(;s<i.length&&i[s].role==="user";)i[a].content+=`
|
|
273
273
|
`+i[s].content,i.splice(s,1)}try{return await n.summarizeTitleAsync(this.fetch,this.summarizeTitleUrl,i,e)}catch(a){return console.error("Error summarizing title:",a),null}}async submitMessageAsync(e,r,n){if(!this.canSubmit)throw new Error("Cannot submit message because another message is currently being processed");this._completion=new li;const i=this.rootConversation.messages.map(a=>a.toDto());i.push({role:"user",content:e});for(let a=0;a<i.length;++a)if(i[a].role==="user"){const s=a+1;for(;s<i.length&&i[s].role==="user";)i[a].content+=`
|