open-chat-studio-widget 0.5.2 → 0.6.0

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.
Files changed (34) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/{index-Ctja7z-R.js → index-CcvroTR_.js} +3 -3
  3. package/dist/cjs/{index-Ctja7z-R.js.map → index-CcvroTR_.js.map} +1 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/open-chat-studio-widget.cjs.entry.js +45 -11
  6. package/dist/cjs/open-chat-studio-widget.cjs.entry.js.map +1 -1
  7. package/dist/cjs/open-chat-studio-widget.cjs.js +2 -2
  8. package/dist/cjs/open-chat-studio-widget.entry.cjs.js.map +1 -1
  9. package/dist/collection/components/ocs-chat/ocs-chat.js +53 -3
  10. package/dist/collection/components/ocs-chat/ocs-chat.js.map +1 -1
  11. package/dist/collection/services/chat-session-service.js +14 -6
  12. package/dist/collection/services/chat-session-service.js.map +1 -1
  13. package/dist/collection/services/file-attachment-manager.js +2 -1
  14. package/dist/collection/services/file-attachment-manager.js.map +1 -1
  15. package/dist/components/open-chat-studio-widget.js +46 -10
  16. package/dist/components/open-chat-studio-widget.js.map +1 -1
  17. package/dist/esm/{index-BbCwiO7g.js → index-BKVXO_5E.js} +3 -3
  18. package/dist/esm/{index-BbCwiO7g.js.map → index-BKVXO_5E.js.map} +1 -1
  19. package/dist/esm/loader.js +3 -3
  20. package/dist/esm/open-chat-studio-widget.entry.js +45 -11
  21. package/dist/esm/open-chat-studio-widget.entry.js.map +1 -1
  22. package/dist/esm/open-chat-studio-widget.js +3 -3
  23. package/dist/open-chat-studio-widget/open-chat-studio-widget.entry.esm.js.map +1 -1
  24. package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js +1 -1
  25. package/dist/open-chat-studio-widget/{p-BbCwiO7g.js → p-BKVXO_5E.js} +2 -2
  26. package/dist/open-chat-studio-widget/{p-BbCwiO7g.js.map → p-BKVXO_5E.js.map} +1 -1
  27. package/dist/open-chat-studio-widget/p-a0d04423.entry.js +4 -0
  28. package/dist/open-chat-studio-widget/p-a0d04423.entry.js.map +1 -0
  29. package/dist/types/components/ocs-chat/ocs-chat.d.ts +12 -0
  30. package/dist/types/components.d.ts +8 -0
  31. package/dist/types/services/chat-session-service.d.ts +1 -0
  32. package/package.json +1 -1
  33. package/dist/open-chat-studio-widget/p-96920183.entry.js +0 -4
  34. package/dist/open-chat-studio-widget/p-96920183.entry.js.map +0 -1
@@ -95,6 +95,10 @@ export declare class OcsChat {
95
95
  */
96
96
  language?: string;
97
97
  translationsUrl?: string;
98
+ /**
99
+ * Optional context object to send with each message. This provides page-specific context to the bot.
100
+ */
101
+ pageContext?: Record<string, any>;
98
102
  error: string;
99
103
  messages: ChatMessage[];
100
104
  sessionId?: string;
@@ -143,6 +147,7 @@ export declare class OcsChat {
143
147
  private chatWindowWidth;
144
148
  private chatWindowFullscreenWidth;
145
149
  private positionInitialized;
150
+ private internalPageContext?;
146
151
  host: HTMLElement;
147
152
  componentWillLoad(): Promise<void>;
148
153
  componentDidLoad(): void;
@@ -154,6 +159,7 @@ export declare class OcsChat {
154
159
  private parseWelcomeMessages;
155
160
  private parseStarterQuestions;
156
161
  private initializeTranslations;
162
+ private loadInternalPageContext;
157
163
  private loadTranslationsFromUrl;
158
164
  private cleanup;
159
165
  private startSession;
@@ -174,6 +180,12 @@ export declare class OcsChat {
174
180
  private formatFileSize;
175
181
  private formatTime;
176
182
  private toggleWindowVisibility;
183
+ /**
184
+ * Watch for changes to the `pageContext` prop and sync to internal variable.
185
+ *
186
+ * @param pageContext - The new value for the field.
187
+ */
188
+ pageContextHandler(): void;
177
189
  /**
178
190
  * Watch for changes to the `visible` attribute and update accordingly.
179
191
  *
@@ -55,6 +55,10 @@ export namespace Components {
55
55
  * The message to display in the new chat confirmation dialog.
56
56
  */
57
57
  "newChatConfirmationMessage"?: string;
58
+ /**
59
+ * Optional context object to send with each message. This provides page-specific context to the bot.
60
+ */
61
+ "pageContext"?: Record<string, any>;
58
62
  /**
59
63
  * Whether to persist session data to local storage to allow resuming previous conversations after page reload.
60
64
  * @default true
@@ -159,6 +163,10 @@ declare namespace LocalJSX {
159
163
  * The message to display in the new chat confirmation dialog.
160
164
  */
161
165
  "newChatConfirmationMessage"?: string;
166
+ /**
167
+ * Optional context object to send with each message. This provides page-specific context to the bot.
168
+ */
169
+ "pageContext"?: Record<string, any>;
162
170
  /**
163
171
  * Whether to persist session data to local storage to allow resuming previous conversations after page reload.
164
172
  * @default true
@@ -74,4 +74,5 @@ export declare class ChatSessionService {
74
74
  startMessagePolling(sessionId: string, callbacks: MessagePollingCallbacks): MessagePollingHandle;
75
75
  stopMessagePolling(): void;
76
76
  private getJsonHeaders;
77
+ private getCommonHeaders;
77
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-chat-studio-widget",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "description": "Chat component for Open Chat Studio",
5
5
  "main": "dist/index.cjs.js",
6
6
  "exports": "./dist/esm/open-chat-studio-widget.js",
@@ -1,4 +0,0 @@
1
- import{h as t,r as e,E as o,H as r,g as n}from"./p-BbCwiO7g.js";const s=()=>t("svg",{width:"24",height:"24",viewBox:"0 0 500 500",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M80.1777 149.487C73.7354 160.531 68.6208 172.445 65.0576 185.012C43.6097 196.458 29.0128 219.057 29.0127 245.065C29.0127 270.995 43.5207 293.535 64.8613 305.014C68.3612 317.586 73.409 329.512 79.7881 340.575C34.4248 332.436 2.20245e-05 292.771 0 245.065C0.000198788 197.223 34.6221 157.469 80.1777 149.487ZM419.821 149.487C465.377 157.469 500 197.223 500 245.065C500 292.771 465.575 332.436 420.211 340.575C426.59 329.512 431.638 317.586 435.138 305.014C456.479 293.535 470.987 270.995 470.987 245.065C470.987 219.056 456.39 196.458 434.941 185.012C431.378 172.445 426.264 160.532 419.821 149.487ZM259.868 16.4473C304.099 16.4473 341.297 46.5498 352.097 87.3848C340.566 81.9422 328.254 77.8819 315.375 75.4209C303.51 57.3742 283.08 45.46 259.868 45.46H253.289C230.975 45.4601 211.232 56.4698 199.197 73.3535C186.6 74.535 174.442 77.2268 162.906 81.248C175.656 43.5694 211.305 16.4474 253.289 16.4473H259.868Z"}),t("path",{d:"M286.185 72.6685C371.571 72.6686 440.789 141.888 440.789 227.274V263.458C440.789 348.844 371.57 418.064 286.185 418.064H213.815C128.43 418.064 59.2111 348.844 59.2109 263.458V227.274C59.211 141.888 128.43 72.6686 213.815 72.6685H286.185ZM213.815 105.263C142.963 105.263 85.5265 162.7 85.5264 233.552V256.579C85.5264 327.431 142.963 384.868 213.815 384.869H286.185C357.037 384.868 414.474 327.431 414.474 256.579V233.552C414.473 162.7 357.037 105.263 286.185 105.263H213.815Z"}),t("rect",{x:"289.475",y:"184.808",width:"61.9019",height:"115.73",rx:"30.951"}),t("rect",{x:"161.184",y:"184.808",width:"61.9019",height:"115.73",rx:"30.951"}),t("path",{d:"M325.658 483.553V414.58V401.316H148.027L325.658 483.553Z"}));const i=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18 18 6M6 6l12 12"}));const a=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},t("circle",{cx:"8",cy:"6",r:"1.5"}),t("circle",{cx:"8",cy:"12",r:"1.5"}),t("circle",{cx:"8",cy:"18",r:"1.5"}),t("circle",{cx:"16",cy:"6",r:"1.5"}),t("circle",{cx:"16",cy:"12",r:"1.5"}),t("circle",{cx:"16",cy:"18",r:"1.5"}));const l=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}));const c=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"}));const h=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M15 9h4.5M15 9V4.5M15 9l5.25-5.25M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"}));const d=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13"}));const u=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"}));const f=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18 18 6M6 6l12 12"}));function p(){return{async:false,baseUrl:null,breaks:false,extensions:null,gfm:true,headerIds:true,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:true,pedantic:false,renderer:null,sanitize:false,sanitizer:null,silent:false,smartypants:false,tokenizer:null,walkTokens:null,xhtml:false}}let m=p();function w(t){m=t}const g=/[&<>"']/;const b=new RegExp(g.source,"g");const v=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;const y=new RegExp(v.source,"g");const x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};const k=t=>x[t];function z(t,e){if(e){if(g.test(t)){return t.replace(b,k)}}else{if(v.test(t)){return t.replace(y,k)}}return t}const T=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function S(t){return t.replace(T,((t,e)=>{e=e.toLowerCase();if(e==="colon")return":";if(e.charAt(0)==="#"){return e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1))}return""}))}const $=/(^|[^\[])\^/g;function C(t,e){t=typeof t==="string"?t:t.source;e=e||"";const o={replace:(e,r)=>{r=r.source||r;r=r.replace($,"$1");t=t.replace(e,r);return o},getRegex:()=>new RegExp(t,e)};return o}const _=/[^\w:]/g;const A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(t,e,o){if(t){let t;try{t=decodeURIComponent(S(o)).replace(_,"").toLowerCase()}catch(t){return null}if(t.indexOf("javascript:")===0||t.indexOf("vbscript:")===0||t.indexOf("data:")===0){return null}}if(e&&!A.test(o)){o=j(e,o)}try{o=encodeURI(o).replace(/%25/g,"%")}catch(t){return null}return o}const E={};const F=/^[^:]+:\/*[^/]*$/;const I=/^([^:]+:)[\s\S]*$/;const L=/^([^:]+:\/*[^/]*)[\s\S]*$/;function j(t,e){if(!E[" "+t]){if(F.test(t)){E[" "+t]=t+"/"}else{E[" "+t]=P(t,"/",true)}}t=E[" "+t];const o=t.indexOf(":")===-1;if(e.substring(0,2)==="//"){if(o){return e}return t.replace(I,"$1")+e}else if(e.charAt(0)==="/"){if(o){return e}return t.replace(L,"$1")+e}else{return t+e}}const R={exec:function t(){}};function D(t,e){const o=t.replace(/\|/g,((t,e,o)=>{let r=false,n=e;while(--n>=0&&o[n]==="\\")r=!r;if(r){return"|"}else{return" |"}})),r=o.split(/ \|/);let n=0;if(!r[0].trim()){r.shift()}if(r.length>0&&!r[r.length-1].trim()){r.pop()}if(r.length>e){r.splice(e)}else{while(r.length<e)r.push("")}for(;n<r.length;n++){r[n]=r[n].trim().replace(/\\\|/g,"|")}return r}function P(t,e,o){const r=t.length;if(r===0){return""}let n=0;while(n<r){const s=t.charAt(r-n-1);if(s===e&&!o){n++}else if(s!==e&&o){n++}else{break}}return t.slice(0,r-n)}function q(t,e){if(t.indexOf(e[1])===-1){return-1}const o=t.length;let r=0,n=0;for(;n<o;n++){if(t[n]==="\\"){n++}else if(t[n]===e[0]){r++}else if(t[n]===e[1]){r--;if(r<0){return n}}}return-1}function B(t){if(t&&t.sanitize&&!t.silent){console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}}function O(t,e){if(e<1){return""}let o="";while(e>1){if(e&1){o+=t}e>>=1;t+=t}return o+t}function N(t,e,o,r){const n=e.href;const s=e.title?z(e.title):null;const i=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){r.state.inLink=true;const t={type:"link",raw:o,href:n,title:s,text:i,tokens:r.inlineTokens(i)};r.state.inLink=false;return t}return{type:"image",raw:o,href:n,title:s,text:z(i)}}function U(t,e){const o=t.match(/^(\s+)(?:```)/);if(o===null){return e}const r=o[1];return e.split("\n").map((t=>{const e=t.match(/^\s+/);if(e===null){return t}const[o]=e;if(o.length>=r.length){return t.slice(r.length)}return t})).join("\n")}class H{constructor(t){this.options=t||m}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0){return{type:"space",raw:e[0]}}}code(t){const e=this.rules.block.code.exec(t);if(e){const t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:!this.options.pedantic?P(t,"\n"):t}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const t=e[0];const o=U(t,e[3]||"");return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline._escapes,"$1"):e[2],text:o}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let t=e[2].trim();if(/#$/.test(t)){const e=P(t,"#");if(this.options.pedantic){t=e.trim()}else if(!e||/ $/.test(e)){t=e.trim()}}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e){return{type:"hr",raw:e[0]}}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){const t=e[0].replace(/^ *>[ \t]?/gm,"");const o=this.lexer.state.top;this.lexer.state.top=true;const r=this.lexer.blockTokens(t);this.lexer.state.top=o;return{type:"blockquote",raw:e[0],tokens:r,text:t}}}list(t){let e=this.rules.block.list.exec(t);if(e){let o,r,n,s,i,a,l,c,h,d,u,f;let p=e[1].trim();const m=p.length>1;const w={type:"list",raw:"",ordered:m,start:m?+p.slice(0,-1):"",loose:false,items:[]};p=m?`\\d{1,9}\\${p.slice(-1)}`:`\\${p}`;if(this.options.pedantic){p=m?p:"[*+-]"}const g=new RegExp(`^( {0,3}${p})((?:[\t ][^\\n]*)?(?:\\n|$))`);while(t){f=false;if(!(e=g.exec(t))){break}if(this.rules.block.hr.test(t)){break}o=e[0];t=t.substring(o.length);c=e[2].split("\n",1)[0].replace(/^\t+/,(t=>" ".repeat(3*t.length)));h=t.split("\n",1)[0];if(this.options.pedantic){s=2;u=c.trimLeft()}else{s=e[2].search(/[^ ]/);s=s>4?1:s;u=c.slice(s);s+=e[1].length}a=false;if(!c&&/^ *$/.test(h)){o+=h+"\n";t=t.substring(h.length+1);f=true}if(!f){const e=new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);const r=new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);const n=new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`);const i=new RegExp(`^ {0,${Math.min(3,s-1)}}#`);while(t){d=t.split("\n",1)[0];h=d;if(this.options.pedantic){h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")}if(n.test(h)){break}if(i.test(h)){break}if(e.test(h)){break}if(r.test(t)){break}if(h.search(/[^ ]/)>=s||!h.trim()){u+="\n"+h.slice(s)}else{if(a){break}if(c.search(/[^ ]/)>=4){break}if(n.test(c)){break}if(i.test(c)){break}if(r.test(c)){break}u+="\n"+h}if(!a&&!h.trim()){a=true}o+=d+"\n";t=t.substring(d.length+1);c=h.slice(s)}}if(!w.loose){if(l){w.loose=true}else if(/\n *\n *$/.test(o)){l=true}}if(this.options.gfm){r=/^\[[ xX]\] /.exec(u);if(r){n=r[0]!=="[ ] ";u=u.replace(/^\[[ xX]\] +/,"")}}w.items.push({type:"list_item",raw:o,task:!!r,checked:n,loose:false,text:u});w.raw+=o}w.items[w.items.length-1].raw=o.trimRight();w.items[w.items.length-1].text=u.trimRight();w.raw=w.raw.trimRight();const b=w.items.length;for(i=0;i<b;i++){this.lexer.state.top=false;w.items[i].tokens=this.lexer.blockTokens(w.items[i].text,[]);if(!w.loose){const t=w.items[i].tokens.filter((t=>t.type==="space"));const e=t.length>0&&t.some((t=>/\n.*\n/.test(t.raw)));w.loose=e}}if(w.loose){for(i=0;i<b;i++){w.items[i].loose=true}}return w}}html(t){const e=this.rules.block.html.exec(t);if(e){const t={type:"html",raw:e[0],pre:!this.options.sanitizer&&(e[1]==="pre"||e[1]==="script"||e[1]==="style"),text:e[0]};if(this.options.sanitize){const o=this.options.sanitizer?this.options.sanitizer(e[0]):z(e[0]);t.type="paragraph";t.text=o;t.tokens=this.lexer.inline(o)}return t}}def(t){const e=this.rules.block.def.exec(t);if(e){const t=e[1].toLowerCase().replace(/\s+/g," ");const o=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"";const r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline._escapes,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:o,title:r}}}table(t){const e=this.rules.block.table.exec(t);if(e){const t={type:"table",header:D(e[1]).map((t=>({text:t}))),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(t.header.length===t.align.length){t.raw=e[0];let o=t.align.length;let r,n,s,i;for(r=0;r<o;r++){if(/^ *-+: *$/.test(t.align[r])){t.align[r]="right"}else if(/^ *:-+: *$/.test(t.align[r])){t.align[r]="center"}else if(/^ *:-+ *$/.test(t.align[r])){t.align[r]="left"}else{t.align[r]=null}}o=t.rows.length;for(r=0;r<o;r++){t.rows[r]=D(t.rows[r],t.header.length).map((t=>({text:t})))}o=t.header.length;for(n=0;n<o;n++){t.header[n].tokens=this.lexer.inline(t.header[n].text)}o=t.rows.length;for(n=0;n<o;n++){i=t.rows[n];for(s=0;s<i.length;s++){i[s].tokens=this.lexer.inline(i[s].text)}}return t}}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e){return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const t=e[1].charAt(e[1].length-1)==="\n"?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(t){const e=this.rules.block.text.exec(t);if(e){return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}}escape(t){const e=this.rules.inline.escape.exec(t);if(e){return{type:"escape",raw:e[0],text:z(e[1])}}}tag(t){const e=this.rules.inline.tag.exec(t);if(e){if(!this.lexer.state.inLink&&/^<a /i.test(e[0])){this.lexer.state.inLink=true}else if(this.lexer.state.inLink&&/^<\/a>/i.test(e[0])){this.lexer.state.inLink=false}if(!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])){this.lexer.state.inRawBlock=true}else if(this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])){this.lexer.state.inRawBlock=false}return{type:this.options.sanitize?"text":"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):z(e[0]):e[0]}}}link(t){const e=this.rules.inline.link.exec(t);if(e){const t=e[2].trim();if(!this.options.pedantic&&/^</.test(t)){if(!/>$/.test(t)){return}const e=P(t.slice(0,-1),"\\");if((t.length-e.length)%2===0){return}}else{const t=q(e[2],"()");if(t>-1){const o=e[0].indexOf("!")===0?5:4;const r=o+e[1].length+t;e[2]=e[2].substring(0,t);e[0]=e[0].substring(0,r).trim();e[3]=""}}let o=e[2];let r="";if(this.options.pedantic){const t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);if(t){o=t[1];r=t[3]}}else{r=e[3]?e[3].slice(1,-1):""}o=o.trim();if(/^</.test(o)){if(this.options.pedantic&&!/>$/.test(t)){o=o.slice(1)}else{o=o.slice(1,-1)}}return N(e,{href:o?o.replace(this.rules.inline._escapes,"$1"):o,title:r?r.replace(this.rules.inline._escapes,"$1"):r},e[0],this.lexer)}}reflink(t,e){let o;if((o=this.rules.inline.reflink.exec(t))||(o=this.rules.inline.nolink.exec(t))){let t=(o[2]||o[1]).replace(/\s+/g," ");t=e[t.toLowerCase()];if(!t){const t=o[0].charAt(0);return{type:"text",raw:t,text:t}}return N(o,t,o[0],this.lexer)}}emStrong(t,e,o=""){let r=this.rules.inline.emStrong.lDelim.exec(t);if(!r)return;if(r[3]&&o.match(/[\p{L}\p{N}]/u))return;const n=r[1]||r[2]||"";if(!n||n&&(o===""||this.rules.inline.punctuation.exec(o))){const o=r[0].length-1;let n,s,i=o,a=0;const l=r[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;l.lastIndex=0;e=e.slice(-1*t.length+o);while((r=l.exec(e))!=null){n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6];if(!n)continue;s=n.length;if(r[3]||r[4]){i+=s;continue}else if(r[5]||r[6]){if(o%3&&!((o+s)%3)){a+=s;continue}}i-=s;if(i>0)continue;s=Math.min(s,s+i+a);const e=t.slice(0,o+r.index+(r[0].length-n.length)+s);if(Math.min(o,s)%2){const t=e.slice(1,-1);return{type:"em",raw:e,text:t,tokens:this.lexer.inlineTokens(t)}}const l=e.slice(2,-2);return{type:"strong",raw:e,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let t=e[2].replace(/\n/g," ");const o=/[^ ]/.test(t);const r=/^ /.test(t)&&/ $/.test(t);if(o&&r){t=t.substring(1,t.length-1)}t=z(t,true);return{type:"codespan",raw:e[0],text:t}}}br(t){const e=this.rules.inline.br.exec(t);if(e){return{type:"br",raw:e[0]}}}del(t){const e=this.rules.inline.del.exec(t);if(e){return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}}autolink(t,e){const o=this.rules.inline.autolink.exec(t);if(o){let t,r;if(o[2]==="@"){t=z(this.options.mangle?e(o[1]):o[1]);r="mailto:"+t}else{t=z(o[1]);r=t}return{type:"link",raw:o[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(t,e){let o;if(o=this.rules.inline.url.exec(t)){let t,r;if(o[2]==="@"){t=z(this.options.mangle?e(o[0]):o[0]);r="mailto:"+t}else{let e;do{e=o[0];o[0]=this.rules.inline._backpedal.exec(o[0])[0]}while(e!==o[0]);t=z(o[0]);if(o[1]==="www."){r="http://"+o[0]}else{r=o[0]}}return{type:"link",raw:o[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(t,e){const o=this.rules.inline.text.exec(t);if(o){let t;if(this.lexer.state.inRawBlock){t=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(o[0]):z(o[0]):o[0]}else{t=z(this.options.smartypants?e(o[0]):o[0])}return{type:"text",raw:o[0],text:t}}}}const Z={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:"+"<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)"+"|comment[^\\n]*(\\n+|$)"+"|<\\?[\\s\\S]*?(?:\\?>\\n*|$)"+"|<![A-Z][\\s\\S]*?(?:>\\n*|$)"+"|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)"+"|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)"+"|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)"+"|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)"+")",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:R,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};Z._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;Z._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;Z.def=C(Z.def).replace("label",Z._label).replace("title",Z._title).getRegex();Z.bullet=/(?:[*+-]|\d{1,9}[.)])/;Z.listItemStart=C(/^( *)(bull) */).replace("bull",Z.bullet).getRegex();Z.list=C(Z.list).replace(/bull/g,Z.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Z.def.source+")").getRegex();Z._tag="address|article|aside|base|basefont|blockquote|body|caption"+"|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption"+"|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe"+"|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option"+"|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr"+"|track|ul";Z._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/;Z.html=C(Z.html,"i").replace("comment",Z._comment).replace("tag",Z._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();Z.paragraph=C(Z._paragraph).replace("hr",Z.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z._tag).getRegex();Z.blockquote=C(Z.blockquote).replace("paragraph",Z.paragraph).getRegex();Z.normal={...Z};Z.gfm={...Z.normal,table:"^ *([^\\n ].*\\|.*)\\n"+" {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?"+"(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"};Z.gfm.table=C(Z.gfm.table).replace("hr",Z.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z._tag).getRegex();Z.gfm.paragraph=C(Z._paragraph).replace("hr",Z.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Z.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z._tag).getRegex();Z.pedantic={...Z.normal,html:C("^ *(?:comment *(?:\\n|\\s*$)"+"|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)"+"|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Z._comment).replace(/tag/g,"(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub"+"|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)"+"\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:R,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:C(Z.normal._paragraph).replace("hr",Z.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Z.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const W={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:R,tag:"^comment"+"|^</[a-zA-Z][\\w:-]*\\s*>"+"|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>"+"|^<\\?[\\s\\S]*?\\?>"+"|^<![a-zA-Z]+\\s[\\s\\S]*?>"+"|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:R,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};W._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";W.punctuation=C(W.punctuation).replace(/punctuation/g,W._punctuation).getRegex();W.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;W.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;W._comment=C(Z._comment).replace("(?:--\x3e|$)","--\x3e").getRegex();W.emStrong.lDelim=C(W.emStrong.lDelim).replace(/punct/g,W._punctuation).getRegex();W.emStrong.rDelimAst=C(W.emStrong.rDelimAst,"g").replace(/punct/g,W._punctuation).getRegex();W.emStrong.rDelimUnd=C(W.emStrong.rDelimUnd,"g").replace(/punct/g,W._punctuation).getRegex();W._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;W._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;W._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;W.autolink=C(W.autolink).replace("scheme",W._scheme).replace("email",W._email).getRegex();W._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;W.tag=C(W.tag).replace("comment",W._comment).replace("attribute",W._attribute).getRegex();W._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;W._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;W._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;W.link=C(W.link).replace("label",W._label).replace("href",W._href).replace("title",W._title).getRegex();W.reflink=C(W.reflink).replace("label",W._label).replace("ref",Z._label).getRegex();W.nolink=C(W.nolink).replace("ref",Z._label).getRegex();W.reflinkSearch=C(W.reflinkSearch,"g").replace("reflink",W.reflink).replace("nolink",W.nolink).getRegex();W.normal={...W};W.pedantic={...W.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:C(/^!?\[(label)\]\((.*?)\)/).replace("label",W._label).getRegex(),reflink:C(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",W._label).getRegex()};W.gfm={...W.normal,escape:C(W.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/};W.gfm.url=C(W.gfm.url,"i").replace("email",W.gfm._extended_email).getRegex();W.breaks={...W.gfm,br:C(W.br).replace("{2,}","*").getRegex(),text:C(W.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};function X(t){return t.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function V(t){let e="",o,r;const n=t.length;for(o=0;o<n;o++){r=t.charCodeAt(o);if(Math.random()>.5){r="x"+r.toString(16)}e+="&#"+r+";"}return e}class Q{constructor(t){this.tokens=[];this.tokens.links=Object.create(null);this.options=t||m;this.options.tokenizer=this.options.tokenizer||new H;this.tokenizer=this.options.tokenizer;this.tokenizer.options=this.options;this.tokenizer.lexer=this;this.inlineQueue=[];this.state={inLink:false,inRawBlock:false,top:true};const e={block:Z.normal,inline:W.normal};if(this.options.pedantic){e.block=Z.pedantic;e.inline=W.pedantic}else if(this.options.gfm){e.block=Z.gfm;if(this.options.breaks){e.inline=W.breaks}else{e.inline=W.gfm}}this.tokenizer.rules=e}static get rules(){return{block:Z,inline:W}}static lex(t,e){const o=new Q(e);return o.lex(t)}static lexInline(t,e){const o=new Q(e);return o.inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,"\n");this.blockTokens(t,this.tokens);let e;while(e=this.inlineQueue.shift()){this.inlineTokens(e.src,e.tokens)}return this.tokens}blockTokens(t,e=[]){if(this.options.pedantic){t=t.replace(/\t/g," ").replace(/^ +$/gm,"")}else{t=t.replace(/^( *)(\t+)/gm,((t,e,o)=>e+" ".repeat(o.length)))}let o,r,n,s;while(t){if(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((r=>{if(o=r.call({lexer:this},t,e)){t=t.substring(o.raw.length);e.push(o);return true}return false}))){continue}if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);if(o.raw.length===1&&e.length>0){e[e.length-1].raw+="\n"}else{e.push(o)}continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);r=e[e.length-1];if(r&&(r.type==="paragraph"||r.type==="text")){r.raw+="\n"+o.raw;r.text+="\n"+o.text;this.inlineQueue[this.inlineQueue.length-1].src=r.text}else{e.push(o)}continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length);r=e[e.length-1];if(r&&(r.type==="paragraph"||r.type==="text")){r.raw+="\n"+o.raw;r.text+="\n"+o.raw;this.inlineQueue[this.inlineQueue.length-1].src=r.text}else if(!this.tokens.links[o.tag]){this.tokens.links[o.tag]={href:o.href,title:o.title}}continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length);e.push(o);continue}n=t;if(this.options.extensions&&this.options.extensions.startBlock){let e=Infinity;const o=t.slice(1);let r;this.options.extensions.startBlock.forEach((function(t){r=t.call({lexer:this},o);if(typeof r==="number"&&r>=0){e=Math.min(e,r)}}));if(e<Infinity&&e>=0){n=t.substring(0,e+1)}}if(this.state.top&&(o=this.tokenizer.paragraph(n))){r=e[e.length-1];if(s&&r.type==="paragraph"){r.raw+="\n"+o.raw;r.text+="\n"+o.text;this.inlineQueue.pop();this.inlineQueue[this.inlineQueue.length-1].src=r.text}else{e.push(o)}s=n.length!==t.length;t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length);r=e[e.length-1];if(r&&r.type==="text"){r.raw+="\n"+o.raw;r.text+="\n"+o.text;this.inlineQueue.pop();this.inlineQueue[this.inlineQueue.length-1].src=r.text}else{e.push(o)}continue}if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}else{throw new Error(e)}}}this.state.top=true;return e}inline(t,e=[]){this.inlineQueue.push({src:t,tokens:e});return e}inlineTokens(t,e=[]){let o,r,n;let s=t;let i;let a,l;if(this.tokens.links){const t=Object.keys(this.tokens.links);if(t.length>0){while((i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null){if(t.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))){s=s.slice(0,i.index)+"["+O("a",i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)}}}}while((i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null){s=s.slice(0,i.index)+"["+O("a",i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex)}while((i=this.tokenizer.rules.inline.escapedEmSt.exec(s))!=null){s=s.slice(0,i.index+i[0].length-2)+"++"+s.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);this.tokenizer.rules.inline.escapedEmSt.lastIndex--}while(t){if(!a){l=""}a=false;if(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((r=>{if(o=r.call({lexer:this},t,e)){t=t.substring(o.raw.length);e.push(o);return true}return false}))){continue}if(o=this.tokenizer.escape(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.tag(t)){t=t.substring(o.raw.length);r=e[e.length-1];if(r&&o.type==="text"&&r.type==="text"){r.raw+=o.raw;r.text+=o.text}else{e.push(o)}continue}if(o=this.tokenizer.link(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(o.raw.length);r=e[e.length-1];if(r&&o.type==="text"&&r.type==="text"){r.raw+=o.raw;r.text+=o.text}else{e.push(o)}continue}if(o=this.tokenizer.emStrong(t,s,l)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.codespan(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.br(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.del(t)){t=t.substring(o.raw.length);e.push(o);continue}if(o=this.tokenizer.autolink(t,V)){t=t.substring(o.raw.length);e.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(t,V))){t=t.substring(o.raw.length);e.push(o);continue}n=t;if(this.options.extensions&&this.options.extensions.startInline){let e=Infinity;const o=t.slice(1);let r;this.options.extensions.startInline.forEach((function(t){r=t.call({lexer:this},o);if(typeof r==="number"&&r>=0){e=Math.min(e,r)}}));if(e<Infinity&&e>=0){n=t.substring(0,e+1)}}if(o=this.tokenizer.inlineText(n,X)){t=t.substring(o.raw.length);if(o.raw.slice(-1)!=="_"){l=o.raw.slice(-1)}a=true;r=e[e.length-1];if(r&&r.type==="text"){r.raw+=o.raw;r.text+=o.text}else{e.push(o)}continue}if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}else{throw new Error(e)}}}return e}}class J{constructor(t){this.options=t||m}code(t,e,o){const r=(e||"").match(/\S*/)[0];if(this.options.highlight){const e=this.options.highlight(t,r);if(e!=null&&e!==t){o=true;t=e}}t=t.replace(/\n$/,"")+"\n";if(!r){return"<pre><code>"+(o?t:z(t,true))+"</code></pre>\n"}return'<pre><code class="'+this.options.langPrefix+z(r)+'">'+(o?t:z(t,true))+"</code></pre>\n"}blockquote(t){return`<blockquote>\n${t}</blockquote>\n`}html(t){return t}heading(t,e,o,r){if(this.options.headerIds){const n=this.options.headerPrefix+r.slug(o);return`<h${e} id="${n}">${t}</h${e}>\n`}return`<h${e}>${t}</h${e}>\n`}hr(){return this.options.xhtml?"<hr/>\n":"<hr>\n"}list(t,e,o){const r=e?"ol":"ul",n=e&&o!==1?' start="'+o+'"':"";return"<"+r+n+">\n"+t+"</"+r+">\n"}listitem(t){return`<li>${t}</li>\n`}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(t){return`<p>${t}</p>\n`}table(t,e){if(e)e=`<tbody>${e}</tbody>`;return"<table>\n"+"<thead>\n"+t+"</thead>\n"+e+"</table>\n"}tablerow(t){return`<tr>\n${t}</tr>\n`}tablecell(t,e){const o=e.header?"th":"td";const r=e.align?`<${o} align="${e.align}">`:`<${o}>`;return r+t+`</${o}>\n`}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(t){return`<del>${t}</del>`}link(t,e,o){t=M(this.options.sanitize,this.options.baseUrl,t);if(t===null){return o}let r='<a href="'+t+'"';if(e){r+=' title="'+e+'"'}r+=">"+o+"</a>";return r}image(t,e,o){t=M(this.options.sanitize,this.options.baseUrl,t);if(t===null){return o}let r=`<img src="${t}" alt="${o}"`;if(e){r+=` title="${e}"`}r+=this.options.xhtml?"/>":">";return r}text(t){return t}}class G{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,e,o){return""+o}image(t,e,o){return""+o}br(){return""}}class K{constructor(){this.seen={}}serialize(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(t,e){let o=t;let r=0;if(this.seen.hasOwnProperty(o)){r=this.seen[t];do{r++;o=t+"-"+r}while(this.seen.hasOwnProperty(o))}if(!e){this.seen[t]=r;this.seen[o]=0}return o}slug(t,e={}){const o=this.serialize(t);return this.getNextSafeSlug(o,e.dryrun)}}class Y{constructor(t){this.options=t||m;this.options.renderer=this.options.renderer||new J;this.renderer=this.options.renderer;this.renderer.options=this.options;this.textRenderer=new G;this.slugger=new K}static parse(t,e){const o=new Y(e);return o.parse(t)}static parseInline(t,e){const o=new Y(e);return o.parseInline(t)}parse(t,e=true){let o="",r,n,s,i,a,l,c,h,d,u,f,p,m,w,g,b,v,y,x;const k=t.length;for(r=0;r<k;r++){u=t[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[u.type]){x=this.options.extensions.renderers[u.type].call({parser:this},u);if(x!==false||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(u.type)){o+=x||"";continue}}switch(u.type){case"space":{continue}case"hr":{o+=this.renderer.hr();continue}case"heading":{o+=this.renderer.heading(this.parseInline(u.tokens),u.depth,S(this.parseInline(u.tokens,this.textRenderer)),this.slugger);continue}case"code":{o+=this.renderer.code(u.text,u.lang,u.escaped);continue}case"table":{h="";c="";i=u.header.length;for(n=0;n<i;n++){c+=this.renderer.tablecell(this.parseInline(u.header[n].tokens),{header:true,align:u.align[n]})}h+=this.renderer.tablerow(c);d="";i=u.rows.length;for(n=0;n<i;n++){l=u.rows[n];c="";a=l.length;for(s=0;s<a;s++){c+=this.renderer.tablecell(this.parseInline(l[s].tokens),{header:false,align:u.align[s]})}d+=this.renderer.tablerow(c)}o+=this.renderer.table(h,d);continue}case"blockquote":{d=this.parse(u.tokens);o+=this.renderer.blockquote(d);continue}case"list":{f=u.ordered;p=u.start;m=u.loose;i=u.items.length;d="";for(n=0;n<i;n++){g=u.items[n];b=g.checked;v=g.task;w="";if(g.task){y=this.renderer.checkbox(b);if(m){if(g.tokens.length>0&&g.tokens[0].type==="paragraph"){g.tokens[0].text=y+" "+g.tokens[0].text;if(g.tokens[0].tokens&&g.tokens[0].tokens.length>0&&g.tokens[0].tokens[0].type==="text"){g.tokens[0].tokens[0].text=y+" "+g.tokens[0].tokens[0].text}}else{g.tokens.unshift({type:"text",text:y})}}else{w+=y}}w+=this.parse(g.tokens,m);d+=this.renderer.listitem(w,v,b)}o+=this.renderer.list(d,f,p);continue}case"html":{o+=this.renderer.html(u.text);continue}case"paragraph":{o+=this.renderer.paragraph(this.parseInline(u.tokens));continue}case"text":{d=u.tokens?this.parseInline(u.tokens):u.text;while(r+1<k&&t[r+1].type==="text"){u=t[++r];d+="\n"+(u.tokens?this.parseInline(u.tokens):u.text)}o+=e?this.renderer.paragraph(d):d;continue}default:{const t='Token with "'+u.type+'" type was not found.';if(this.options.silent){console.error(t);return}else{throw new Error(t)}}}}return o}parseInline(t,e){e=e||this.renderer;let o="",r,n,s;const i=t.length;for(r=0;r<i;r++){n=t[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){s=this.options.extensions.renderers[n.type].call({parser:this},n);if(s!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){o+=s||"";continue}}switch(n.type){case"escape":{o+=e.text(n.text);break}case"html":{o+=e.html(n.text);break}case"link":{o+=e.link(n.href,n.title,this.parseInline(n.tokens,e));break}case"image":{o+=e.image(n.href,n.title,n.text);break}case"strong":{o+=e.strong(this.parseInline(n.tokens,e));break}case"em":{o+=e.em(this.parseInline(n.tokens,e));break}case"codespan":{o+=e.codespan(n.text);break}case"br":{o+=e.br();break}case"del":{o+=e.del(this.parseInline(n.tokens,e));break}case"text":{o+=e.text(n.text);break}default:{const t='Token with "'+n.type+'" type was not found.';if(this.options.silent){console.error(t);return}else{throw new Error(t)}}}}return o}}class tt{constructor(t){this.options=t||m}static passThroughHooks=new Set(["preprocess","postprocess"]);preprocess(t){return t}postprocess(t){return t}}function et(t,e,o){return r=>{r.message+="\nPlease report this to https://github.com/markedjs/marked.";if(t){const t="<p>An error occurred:</p><pre>"+z(r.message+"",true)+"</pre>";if(e){return Promise.resolve(t)}if(o){o(null,t);return}return t}if(e){return Promise.reject(r)}if(o){o(r);return}throw r}}function ot(t,e){return(o,r,n)=>{if(typeof r==="function"){n=r;r=null}const s={...r};r={...rt.defaults,...s};const i=et(r.silent,r.async,n);if(typeof o==="undefined"||o===null){return i(new Error("marked(): input parameter is undefined or null"))}if(typeof o!=="string"){return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"))}B(r);if(r.hooks){r.hooks.options=r}if(n){const s=r.highlight;let a;try{if(r.hooks){o=r.hooks.preprocess(o)}a=t(o,r)}catch(t){return i(t)}const l=function(t){let o;if(!t){try{if(r.walkTokens){rt.walkTokens(a,r.walkTokens)}o=e(a,r);if(r.hooks){o=r.hooks.postprocess(o)}}catch(e){t=e}}r.highlight=s;return t?i(t):n(null,o)};if(!s||s.length<3){return l()}delete r.highlight;if(!a.length)return l();let c=0;rt.walkTokens(a,(function(t){if(t.type==="code"){c++;setTimeout((()=>{s(t.text,t.lang,(function(e,o){if(e){return l(e)}if(o!=null&&o!==t.text){t.text=o;t.escaped=true}c--;if(c===0){l()}}))}),0)}}));if(c===0){l()}return}if(r.async){return Promise.resolve(r.hooks?r.hooks.preprocess(o):o).then((e=>t(e,r))).then((t=>r.walkTokens?Promise.all(rt.walkTokens(t,r.walkTokens)).then((()=>t)):t)).then((t=>e(t,r))).then((t=>r.hooks?r.hooks.postprocess(t):t)).catch(i)}try{if(r.hooks){o=r.hooks.preprocess(o)}const n=t(o,r);if(r.walkTokens){rt.walkTokens(n,r.walkTokens)}let s=e(n,r);if(r.hooks){s=r.hooks.postprocess(s)}return s}catch(t){return i(t)}}}function rt(t,e,o){return ot(Q.lex,Y.parse)(t,e,o)}rt.options=rt.setOptions=function(t){rt.defaults={...rt.defaults,...t};w(rt.defaults);return rt};rt.getDefaults=p;rt.defaults=m;rt.use=function(...t){const e=rt.defaults.extensions||{renderers:{},childTokens:{}};t.forEach((t=>{const o={...t};o.async=rt.defaults.async||o.async||false;if(t.extensions){t.extensions.forEach((t=>{if(!t.name){throw new Error("extension name required")}if(t.renderer){const o=e.renderers[t.name];if(o){e.renderers[t.name]=function(...e){let r=t.renderer.apply(this,e);if(r===false){r=o.apply(this,e)}return r}}else{e.renderers[t.name]=t.renderer}}if(t.tokenizer){if(!t.level||t.level!=="block"&&t.level!=="inline"){throw new Error("extension level must be 'block' or 'inline'")}if(e[t.level]){e[t.level].unshift(t.tokenizer)}else{e[t.level]=[t.tokenizer]}if(t.start){if(t.level==="block"){if(e.startBlock){e.startBlock.push(t.start)}else{e.startBlock=[t.start]}}else if(t.level==="inline"){if(e.startInline){e.startInline.push(t.start)}else{e.startInline=[t.start]}}}}if(t.childTokens){e.childTokens[t.name]=t.childTokens}}));o.extensions=e}if(t.renderer){const e=rt.defaults.renderer||new J;for(const o in t.renderer){const r=e[o];e[o]=(...n)=>{let s=t.renderer[o].apply(e,n);if(s===false){s=r.apply(e,n)}return s}}o.renderer=e}if(t.tokenizer){const e=rt.defaults.tokenizer||new H;for(const o in t.tokenizer){const r=e[o];e[o]=(...n)=>{let s=t.tokenizer[o].apply(e,n);if(s===false){s=r.apply(e,n)}return s}}o.tokenizer=e}if(t.hooks){const e=rt.defaults.hooks||new tt;for(const o in t.hooks){const r=e[o];if(tt.passThroughHooks.has(o)){e[o]=n=>{if(rt.defaults.async){return Promise.resolve(t.hooks[o].call(e,n)).then((t=>r.call(e,t)))}const s=t.hooks[o].call(e,n);return r.call(e,s)}}else{e[o]=(...n)=>{let s=t.hooks[o].apply(e,n);if(s===false){s=r.apply(e,n)}return s}}}o.hooks=e}if(t.walkTokens){const e=rt.defaults.walkTokens;o.walkTokens=function(o){let r=[];r.push(t.walkTokens.call(this,o));if(e){r=r.concat(e.call(this,o))}return r}}rt.setOptions(o)}))};rt.walkTokens=function(t,e){let o=[];for(const r of t){o=o.concat(e.call(rt,r));switch(r.type){case"table":{for(const t of r.header){o=o.concat(rt.walkTokens(t.tokens,e))}for(const t of r.rows){for(const r of t){o=o.concat(rt.walkTokens(r.tokens,e))}}break}case"list":{o=o.concat(rt.walkTokens(r.items,e));break}default:{if(rt.defaults.extensions&&rt.defaults.extensions.childTokens&&rt.defaults.extensions.childTokens[r.type]){rt.defaults.extensions.childTokens[r.type].forEach((function(t){o=o.concat(rt.walkTokens(r[t],e))}))}else if(r.tokens){o=o.concat(rt.walkTokens(r.tokens,e))}}}}return o};rt.parseInline=ot(Q.lexInline,Y.parseInline);rt.Parser=Y;rt.parser=Y.parse;rt.Renderer=J;rt.TextRenderer=G;rt.Lexer=Q;rt.lexer=Q.lex;rt.Tokenizer=H;rt.Slugger=K;rt.Hooks=tt;rt.parse=rt;
2
- /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:nt,setPrototypeOf:st,isFrozen:it,getPrototypeOf:at,getOwnPropertyDescriptor:lt}=Object;let{freeze:ct,seal:ht,create:dt}=Object;let{apply:ut,construct:ft}=typeof Reflect!=="undefined"&&Reflect;if(!ct){ct=function t(e){return e}}if(!ht){ht=function t(e){return e}}if(!ut){ut=function t(e,o,r){return e.apply(o,r)}}if(!ft){ft=function t(e,o){return new e(...o)}}const pt=_t(Array.prototype.forEach);const mt=_t(Array.prototype.lastIndexOf);const wt=_t(Array.prototype.pop);const gt=_t(Array.prototype.push);const bt=_t(Array.prototype.splice);const vt=_t(String.prototype.toLowerCase);const yt=_t(String.prototype.toString);const xt=_t(String.prototype.match);const kt=_t(String.prototype.replace);const zt=_t(String.prototype.indexOf);const Tt=_t(String.prototype.trim);const St=_t(Object.prototype.hasOwnProperty);const $t=_t(RegExp.prototype.test);const Ct=At(TypeError);function _t(t){return function(e){if(e instanceof RegExp){e.lastIndex=0}for(var o=arguments.length,r=new Array(o>1?o-1:0),n=1;n<o;n++){r[n-1]=arguments[n]}return ut(t,e,r)}}function At(t){return function(){for(var e=arguments.length,o=new Array(e),r=0;r<e;r++){o[r]=arguments[r]}return ft(t,o)}}function Mt(t,e){let o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:vt;if(st){st(t,null)}let r=e.length;while(r--){let n=e[r];if(typeof n==="string"){const t=o(n);if(t!==n){if(!it(e)){e[r]=t}n=t}}t[n]=true}return t}function Et(t){for(let e=0;e<t.length;e++){const o=St(t,e);if(!o){t[e]=null}}return t}function Ft(t){const e=dt(null);for(const[o,r]of nt(t)){const n=St(t,o);if(n){if(Array.isArray(r)){e[o]=Et(r)}else if(r&&typeof r==="object"&&r.constructor===Object){e[o]=Ft(r)}else{e[o]=r}}}return e}function It(t,e){while(t!==null){const o=lt(t,e);if(o){if(o.get){return _t(o.get)}if(typeof o.value==="function"){return _t(o.value)}}t=at(t)}function o(){return null}return o}const Lt=ct(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]);const jt=ct(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]);const Rt=ct(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]);const Dt=ct(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]);const Pt=ct(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]);const qt=ct(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]);const Bt=ct(["#text"]);const Ot=ct(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]);const Nt=ct(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]);const Ut=ct(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]);const Ht=ct(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]);const Zt=ht(/\{\{[\w\W]*|[\w\W]*\}\}/gm);const Wt=ht(/<%[\w\W]*|[\w\W]*%>/gm);const Xt=ht(/\$\{[\w\W]*/gm);const Vt=ht(/^data-[\-\w.\u00B7-\uFFFF]+$/);const Qt=ht(/^aria-[\-\w]+$/);const Jt=ht(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);const Gt=ht(/^(?:\w+script|data):/i);const Kt=ht(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);const Yt=ht(/^html$/i);const te=ht(/^[a-z][.\w]*(-[.\w]+)+$/i);var ee=Object.freeze({__proto__:null,ARIA_ATTR:Qt,ATTR_WHITESPACE:Kt,CUSTOM_ELEMENT:te,DATA_ATTR:Vt,DOCTYPE_NAME:Yt,ERB_EXPR:Wt,IS_ALLOWED_URI:Jt,IS_SCRIPT_OR_DATA:Gt,MUSTACHE_EXPR:Zt,TMPLIT_EXPR:Xt});const oe={element:1,text:3,progressingInstruction:7,comment:8,document:9};const re=function t(){return typeof window==="undefined"?null:window};const ne=function t(e,o){if(typeof e!=="object"||typeof e.createPolicy!=="function"){return null}let r=null;const n="data-tt-policy-suffix";if(o&&o.hasAttribute(n)){r=o.getAttribute(n)}const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(t){return t},createScriptURL(t){return t}})}catch(t){console.warn("TrustedTypes policy "+s+" could not be created.");return null}};const se=function t(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ie(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:re();const e=t=>ie(t);e.version="3.2.6";e.removed=[];if(!t||!t.document||t.document.nodeType!==oe.document||!t.Element){e.isSupported=false;return e}let{document:o}=t;const r=o;const n=r.currentScript;const{DocumentFragment:s,HTMLTemplateElement:i,Node:a,Element:l,NodeFilter:c,NamedNodeMap:h=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:u,trustedTypes:f}=t;const p=l.prototype;const m=It(p,"cloneNode");const w=It(p,"remove");const g=It(p,"nextSibling");const b=It(p,"childNodes");const v=It(p,"parentNode");if(typeof i==="function"){const t=o.createElement("template");if(t.content&&t.content.ownerDocument){o=t.content.ownerDocument}}let y;let x="";const{implementation:k,createNodeIterator:z,createDocumentFragment:T,getElementsByTagName:S}=o;const{importNode:$}=r;let C=se();e.isSupported=typeof nt==="function"&&typeof v==="function"&&k&&k.createHTMLDocument!==undefined;const{MUSTACHE_EXPR:_,ERB_EXPR:A,TMPLIT_EXPR:M,DATA_ATTR:E,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:j}=ee;let{IS_ALLOWED_URI:R}=ee;let D=null;const P=Mt({},[...Lt,...jt,...Rt,...Pt,...Bt]);let q=null;const B=Mt({},[...Ot,...Nt,...Ut,...Ht]);let O=Object.seal(dt(null,{tagNameCheck:{writable:true,configurable:false,enumerable:true,value:null},attributeNameCheck:{writable:true,configurable:false,enumerable:true,value:null},allowCustomizedBuiltInElements:{writable:true,configurable:false,enumerable:true,value:false}}));let N=null;let U=null;let H=true;let Z=true;let W=false;let X=true;let V=false;let Q=true;let J=false;let G=false;let K=false;let Y=false;let tt=false;let et=false;let ot=true;let rt=false;const st="user-content-";let it=true;let at=false;let lt={};let ht=null;const ut=Mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ft=null;const _t=Mt({},["audio","video","img","source","image","track"]);let At=null;const Et=Mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]);const Zt="http://www.w3.org/1998/Math/MathML";const Wt="http://www.w3.org/2000/svg";const Xt="http://www.w3.org/1999/xhtml";let Vt=Xt;let Qt=false;let Gt=null;const Kt=Mt({},[Zt,Wt,Xt],yt);let te=Mt({},["mi","mo","mn","ms","mtext"]);let ae=Mt({},["annotation-xml"]);const le=Mt({},["title","style","font","a","script"]);let ce=null;const he=["application/xhtml+xml","text/html"];const de="text/html";let ue=null;let fe=null;const pe=o.createElement("form");const me=function t(e){return e instanceof RegExp||e instanceof Function};const we=function t(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(fe&&fe===e){return}if(!e||typeof e!=="object"){e={}}e=Ft(e);ce=he.indexOf(e.PARSER_MEDIA_TYPE)===-1?de:e.PARSER_MEDIA_TYPE;ue=ce==="application/xhtml+xml"?yt:vt;D=St(e,"ALLOWED_TAGS")?Mt({},e.ALLOWED_TAGS,ue):P;q=St(e,"ALLOWED_ATTR")?Mt({},e.ALLOWED_ATTR,ue):B;Gt=St(e,"ALLOWED_NAMESPACES")?Mt({},e.ALLOWED_NAMESPACES,yt):Kt;At=St(e,"ADD_URI_SAFE_ATTR")?Mt(Ft(Et),e.ADD_URI_SAFE_ATTR,ue):Et;ft=St(e,"ADD_DATA_URI_TAGS")?Mt(Ft(_t),e.ADD_DATA_URI_TAGS,ue):_t;ht=St(e,"FORBID_CONTENTS")?Mt({},e.FORBID_CONTENTS,ue):ut;N=St(e,"FORBID_TAGS")?Mt({},e.FORBID_TAGS,ue):Ft({});U=St(e,"FORBID_ATTR")?Mt({},e.FORBID_ATTR,ue):Ft({});lt=St(e,"USE_PROFILES")?e.USE_PROFILES:false;H=e.ALLOW_ARIA_ATTR!==false;Z=e.ALLOW_DATA_ATTR!==false;W=e.ALLOW_UNKNOWN_PROTOCOLS||false;X=e.ALLOW_SELF_CLOSE_IN_ATTR!==false;V=e.SAFE_FOR_TEMPLATES||false;Q=e.SAFE_FOR_XML!==false;J=e.WHOLE_DOCUMENT||false;Y=e.RETURN_DOM||false;tt=e.RETURN_DOM_FRAGMENT||false;et=e.RETURN_TRUSTED_TYPE||false;K=e.FORCE_BODY||false;ot=e.SANITIZE_DOM!==false;rt=e.SANITIZE_NAMED_PROPS||false;it=e.KEEP_CONTENT!==false;at=e.IN_PLACE||false;R=e.ALLOWED_URI_REGEXP||Jt;Vt=e.NAMESPACE||Xt;te=e.MATHML_TEXT_INTEGRATION_POINTS||te;ae=e.HTML_INTEGRATION_POINTS||ae;O=e.CUSTOM_ELEMENT_HANDLING||{};if(e.CUSTOM_ELEMENT_HANDLING&&me(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)){O.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck}if(e.CUSTOM_ELEMENT_HANDLING&&me(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)){O.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck}if(e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==="boolean"){O.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements}if(V){Z=false}if(tt){Y=true}if(lt){D=Mt({},Bt);q=[];if(lt.html===true){Mt(D,Lt);Mt(q,Ot)}if(lt.svg===true){Mt(D,jt);Mt(q,Nt);Mt(q,Ht)}if(lt.svgFilters===true){Mt(D,Rt);Mt(q,Nt);Mt(q,Ht)}if(lt.mathMl===true){Mt(D,Pt);Mt(q,Ut);Mt(q,Ht)}}if(e.ADD_TAGS){if(D===P){D=Ft(D)}Mt(D,e.ADD_TAGS,ue)}if(e.ADD_ATTR){if(q===B){q=Ft(q)}Mt(q,e.ADD_ATTR,ue)}if(e.ADD_URI_SAFE_ATTR){Mt(At,e.ADD_URI_SAFE_ATTR,ue)}if(e.FORBID_CONTENTS){if(ht===ut){ht=Ft(ht)}Mt(ht,e.FORBID_CONTENTS,ue)}if(it){D["#text"]=true}if(J){Mt(D,["html","head","body"])}if(D.table){Mt(D,["tbody"]);delete N.tbody}if(e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=="function"){throw Ct('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.')}if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=="function"){throw Ct('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.')}y=e.TRUSTED_TYPES_POLICY;x=y.createHTML("")}else{if(y===undefined){y=ne(f,n)}if(y!==null&&typeof x==="string"){x=y.createHTML("")}}if(ct){ct(e)}fe=e};const ge=Mt({},[...jt,...Rt,...Dt]);const be=Mt({},[...Pt,...qt]);const ve=function t(e){let o=v(e);if(!o||!o.tagName){o={namespaceURI:Vt,tagName:"template"}}const r=vt(e.tagName);const n=vt(o.tagName);if(!Gt[e.namespaceURI]){return false}if(e.namespaceURI===Wt){if(o.namespaceURI===Xt){return r==="svg"}if(o.namespaceURI===Zt){return r==="svg"&&(n==="annotation-xml"||te[n])}return Boolean(ge[r])}if(e.namespaceURI===Zt){if(o.namespaceURI===Xt){return r==="math"}if(o.namespaceURI===Wt){return r==="math"&&ae[n]}return Boolean(be[r])}if(e.namespaceURI===Xt){if(o.namespaceURI===Wt&&!ae[n]){return false}if(o.namespaceURI===Zt&&!te[n]){return false}return!be[r]&&(le[r]||!ge[r])}if(ce==="application/xhtml+xml"&&Gt[e.namespaceURI]){return true}return false};const ye=function t(o){gt(e.removed,{element:o});try{v(o).removeChild(o)}catch(t){w(o)}};const xe=function t(o,r){try{gt(e.removed,{attribute:r.getAttributeNode(o),from:r})}catch(t){gt(e.removed,{attribute:null,from:r})}r.removeAttribute(o);if(o==="is"){if(Y||tt){try{ye(r)}catch(t){}}else{try{r.setAttribute(o,"")}catch(t){}}}};const ke=function t(e){let r=null;let n=null;if(K){e="<remove></remove>"+e}else{const t=xt(e,/^[\r\n\t ]+/);n=t&&t[0]}if(ce==="application/xhtml+xml"&&Vt===Xt){e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>"}const s=y?y.createHTML(e):e;if(Vt===Xt){try{r=(new u).parseFromString(s,ce)}catch(t){}}if(!r||!r.documentElement){r=k.createDocument(Vt,"template",null);try{r.documentElement.innerHTML=Qt?x:s}catch(t){}}const i=r.body||r.documentElement;if(e&&n){i.insertBefore(o.createTextNode(n),i.childNodes[0]||null)}if(Vt===Xt){return S.call(r,J?"html":"body")[0]}return J?r.documentElement:i};const ze=function t(e){return z.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)};const Te=function t(e){return e instanceof d&&(typeof e.nodeName!=="string"||typeof e.textContent!=="string"||typeof e.removeChild!=="function"||!(e.attributes instanceof h)||typeof e.removeAttribute!=="function"||typeof e.setAttribute!=="function"||typeof e.namespaceURI!=="string"||typeof e.insertBefore!=="function"||typeof e.hasChildNodes!=="function")};const Se=function t(e){return typeof a==="function"&&e instanceof a};function $e(t,o,r){pt(t,(t=>{t.call(e,o,r,fe)}))}const Ce=function t(o){let r=null;$e(C.beforeSanitizeElements,o,null);if(Te(o)){ye(o);return true}const n=ue(o.nodeName);$e(C.uponSanitizeElement,o,{tagName:n,allowedTags:D});if(Q&&o.hasChildNodes()&&!Se(o.firstElementChild)&&$t(/<[/\w!]/g,o.innerHTML)&&$t(/<[/\w!]/g,o.textContent)){ye(o);return true}if(o.nodeType===oe.progressingInstruction){ye(o);return true}if(Q&&o.nodeType===oe.comment&&$t(/<[/\w]/g,o.data)){ye(o);return true}if(!D[n]||N[n]){if(!N[n]&&Ae(n)){if(O.tagNameCheck instanceof RegExp&&$t(O.tagNameCheck,n)){return false}if(O.tagNameCheck instanceof Function&&O.tagNameCheck(n)){return false}}if(it&&!ht[n]){const t=v(o)||o.parentNode;const e=b(o)||o.childNodes;if(e&&t){const r=e.length;for(let n=r-1;n>=0;--n){const r=m(e[n],true);r.__removalCount=(o.__removalCount||0)+1;t.insertBefore(r,g(o))}}}ye(o);return true}if(o instanceof l&&!ve(o)){ye(o);return true}if((n==="noscript"||n==="noembed"||n==="noframes")&&$t(/<\/no(script|embed|frames)/i,o.innerHTML)){ye(o);return true}if(V&&o.nodeType===oe.text){r=o.textContent;pt([_,A,M],(t=>{r=kt(r,t," ")}));if(o.textContent!==r){gt(e.removed,{element:o.cloneNode()});o.textContent=r}}$e(C.afterSanitizeElements,o,null);return false};const _e=function t(e,r,n){if(ot&&(r==="id"||r==="name")&&(n in o||n in pe)){return false}if(Z&&!U[r]&&$t(E,r));else if(H&&$t(F,r));else if(!q[r]||U[r]){if(Ae(e)&&(O.tagNameCheck instanceof RegExp&&$t(O.tagNameCheck,e)||O.tagNameCheck instanceof Function&&O.tagNameCheck(e))&&(O.attributeNameCheck instanceof RegExp&&$t(O.attributeNameCheck,r)||O.attributeNameCheck instanceof Function&&O.attributeNameCheck(r))||r==="is"&&O.allowCustomizedBuiltInElements&&(O.tagNameCheck instanceof RegExp&&$t(O.tagNameCheck,n)||O.tagNameCheck instanceof Function&&O.tagNameCheck(n)));else{return false}}else if(At[r]);else if($t(R,kt(n,L,"")));else if((r==="src"||r==="xlink:href"||r==="href")&&e!=="script"&&zt(n,"data:")===0&&ft[e]);else if(W&&!$t(I,kt(n,L,"")));else if(n){return false}else;return true};const Ae=function t(e){return e!=="annotation-xml"&&xt(e,j)};const Me=function t(o){$e(C.beforeSanitizeAttributes,o,null);const{attributes:r}=o;if(!r||Te(o)){return}const n={attrName:"",attrValue:"",keepAttr:true,allowedAttributes:q,forceKeepAttr:undefined};let s=r.length;while(s--){const t=r[s];const{name:i,namespaceURI:a,value:l}=t;const c=ue(i);const h=l;let d=i==="value"?h:Tt(h);n.attrName=c;n.attrValue=d;n.keepAttr=true;n.forceKeepAttr=undefined;$e(C.uponSanitizeAttribute,o,n);d=n.attrValue;if(rt&&(c==="id"||c==="name")){xe(i,o);d=st+d}if(Q&&$t(/((--!?|])>)|<\/(style|title)/i,d)){xe(i,o);continue}if(n.forceKeepAttr){continue}if(!n.keepAttr){xe(i,o);continue}if(!X&&$t(/\/>/i,d)){xe(i,o);continue}if(V){pt([_,A,M],(t=>{d=kt(d,t," ")}))}const u=ue(o.nodeName);if(!_e(u,c,d)){xe(i,o);continue}if(y&&typeof f==="object"&&typeof f.getAttributeType==="function"){if(a);else{switch(f.getAttributeType(u,c)){case"TrustedHTML":{d=y.createHTML(d);break}case"TrustedScriptURL":{d=y.createScriptURL(d);break}}}}if(d!==h){try{if(a){o.setAttributeNS(a,i,d)}else{o.setAttribute(i,d)}if(Te(o)){ye(o)}else{wt(e.removed)}}catch(t){xe(i,o)}}}$e(C.afterSanitizeAttributes,o,null)};const Ee=function t(e){let o=null;const r=ze(e);$e(C.beforeSanitizeShadowDOM,e,null);while(o=r.nextNode()){$e(C.uponSanitizeShadowNode,o,null);Ce(o);Me(o);if(o.content instanceof s){t(o.content)}}$e(C.afterSanitizeShadowDOM,e,null)};e.sanitize=function(t){let o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let n=null;let i=null;let l=null;let c=null;Qt=!t;if(Qt){t="\x3c!--\x3e"}if(typeof t!=="string"&&!Se(t)){if(typeof t.toString==="function"){t=t.toString();if(typeof t!=="string"){throw Ct("dirty is not a string, aborting")}}else{throw Ct("toString is not a function")}}if(!e.isSupported){return t}if(!G){we(o)}e.removed=[];if(typeof t==="string"){at=false}if(at){if(t.nodeName){const e=ue(t.nodeName);if(!D[e]||N[e]){throw Ct("root node is forbidden and cannot be sanitized in-place")}}}else if(t instanceof a){n=ke("\x3c!----\x3e");i=n.ownerDocument.importNode(t,true);if(i.nodeType===oe.element&&i.nodeName==="BODY"){n=i}else if(i.nodeName==="HTML"){n=i}else{n.appendChild(i)}}else{if(!Y&&!V&&!J&&t.indexOf("<")===-1){return y&&et?y.createHTML(t):t}n=ke(t);if(!n){return Y?null:et?x:""}}if(n&&K){ye(n.firstChild)}const h=ze(at?t:n);while(l=h.nextNode()){Ce(l);Me(l);if(l.content instanceof s){Ee(l.content)}}if(at){return t}if(Y){if(tt){c=T.call(n.ownerDocument);while(n.firstChild){c.appendChild(n.firstChild)}}else{c=n}if(q.shadowroot||q.shadowrootmode){c=$.call(r,c,true)}return c}let d=J?n.outerHTML:n.innerHTML;if(J&&D["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&$t(Yt,n.ownerDocument.doctype.name)){d="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+d}if(V){pt([_,A,M],(t=>{d=kt(d,t," ")}))}return y&&et?y.createHTML(d):d};e.setConfig=function(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};we(t);G=true};e.clearConfig=function(){fe=null;G=false};e.isValidAttribute=function(t,e,o){if(!fe){we({})}const r=ue(t);const n=ue(e);return _e(r,n,o)};e.addHook=function(t,e){if(typeof e!=="function"){return}gt(C[t],e)};e.removeHook=function(t,e){if(e!==undefined){const o=mt(C[t],e);return o===-1?undefined:bt(C[t],o,1)[0]}return wt(C[t])};e.removeHooks=function(t){C[t]=[]};e.removeAllHooks=function(){C=se()};return e}var ae=ie();rt.setOptions({breaks:true,gfm:true,smartypants:true});function le(t){if(typeof window==="undefined"){return t}try{const e=document.createElement("div");e.innerHTML=t;const o=e.querySelectorAll("a[href]");o.forEach((t=>{const e=t.getAttribute("href");if(e&&(e.startsWith("http://")||e.startsWith("https://"))){t.setAttribute("target","_blank");t.setAttribute("rel","noopener noreferrer")}}));return e.innerHTML}catch(e){console.error("Error post-processing markdown HTML:",e);return t}}function ce(t){if(!t||typeof t!=="string"){return""}try{const e=rt.parse(t);const o=ae.sanitize(e,{ALLOWED_TAGS:["p","br","strong","b","em","i","u","code","pre","ul","ol","li","h1","h2","h3","h4","h5","h6","blockquote","a","img","hr","table","thead","tbody","tr","td","th","del","ins","sub","sup"],ALLOWED_ATTR:["href","target","rel","class","src","alt","title","width","height","align","colspan","rowspan"],ALLOWED_URI_REGEXP:/^(?:(?:https?):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i,ADD_ATTR:["target"],FORBID_TAGS:["script","style","form","input","button"],FORBID_ATTR:["onclick","onload","onerror","onmouseover"]});return le(o)}catch(e){console.error("Error rendering markdown sync:",e);return ae.sanitize(t)}}const he=(t,e,o)=>{t=t.trim();if(t.includes("%")){const o=de(t);if(!isNaN(o)){return e*o}}else if(t.includes("px")){const e=parseFloat(t);if(!isNaN(e)){return e}}return o};const de=t=>{const e=parseFloat(t);if(isNaN(e)){return NaN}return e/100};var ue={"launcher.open":"فتح المحادثة","window.close":"إغلاق","window.newChat":"بدء محادثة جديدة","window.fullscreen":"دخول وضع ملء الشاشة","window.exitFullscreen":"الخروج من وضع ملء الشاشة","attach.add":"إرفاق ملفات","attach.remove":"إزالة الملف","attach.success":"تم إرفاق الملف","status.starting":"جارٍ بدء المحادثة...","status.typing":"جارٍ تحضير الرد","status.uploading":"جارٍ التحميل","modal.newChatTitle":"بدء محادثة جديدة","modal.newChatBody":"بدء محادثة جديدة سيؤدي إلى مسح المحادثة الحالية. هل ترغب بالمتابعة؟","modal.cancel":"إلغاء","modal.confirm":"تأكيد","composer.placeholder":"اكتب رسالة...","composer.send":"إرسال الرسالة","error.fileTooLarge":"الملف كبير جدًا","error.totalTooLarge":"إجمالي حجم الملفات كبير جدًا","error.unsupportedType":"نوع الملف غير مدعوم","error.connection":"خطأ في الاتصال. يرجى المحاولة مرة أخرى.","error.sessionExpired":"انتهت صلاحية الجلسة. يرجى بدء محادثة جديدة.","branding.poweredBy":"مدعوم من","branding.buttonText":"","branding.headerText":"","content.welcomeMessages":[],"content.starterQuestions":[]};var fe={"launcher.open":"Open chat","window.close":"Close","window.newChat":"Start new chat","window.fullscreen":"Enter fullscreen","window.exitFullscreen":"Exit fullscreen","attach.add":"Attach files","attach.remove":"Remove file","attach.success":"File attached","status.starting":"Starting chat...","status.typing":"Preparing response","status.uploading":"Uploading","modal.newChatTitle":"Start New Chat","modal.newChatBody":"Starting a new chat will clear your current conversation. Continue?","modal.cancel":"Cancel","modal.confirm":"Confirm","composer.placeholder":"Type a message...","composer.send":"Send message","error.fileTooLarge":"File too large","error.totalTooLarge":"Total file size too large","error.unsupportedType":"Unsupported file type","error.connection":"Connection error. Please try again.","error.sessionExpired":"Session expired. Please start a new chat.","branding.poweredBy":"Powered by","branding.buttonText":"","branding.headerText":"","content.welcomeMessages":[],"content.starterQuestions":[]};var pe={"launcher.open":"Abrir chat","window.close":"Cerrar","window.newChat":"Iniciar nuevo chat","window.fullscreen":"Pantalla completa","window.exitFullscreen":"Salir de pantalla completa","attach.add":"Adjuntar archivos","attach.remove":"Eliminar archivo","attach.success":"Archivo adjunto","status.starting":"Iniciando chat...","status.typing":"Preparando respuesta","status.uploading":"Subiendo","modal.newChatTitle":"Iniciar Nuevo Chat","modal.newChatBody":"Iniciar un nuevo chat borrará tu conversación actual. ¿Continuar?","modal.cancel":"Cancelar","modal.confirm":"Confirmar","composer.placeholder":"Escribe un mensaje...","composer.send":"Enviar mensaje","error.fileTooLarge":"Archivo demasiado grande","error.totalTooLarge":"Tamaño total de archivos demasiado grande","error.unsupportedType":"Tipo de archivo no soportado","error.connection":"Error de conexión. Por favor, inténtalo de nuevo.","error.sessionExpired":"Sesión expirada. Por favor, inicia un nuevo chat.","branding.poweredBy":"Desarrollado por","branding.buttonText":"","branding.headerText":"","content.welcomeMessages":[],"content.starterQuestions":[]};var me={"launcher.open":"Ouvrir le chat","window.close":"Fermer","window.newChat":"Nouveau chat","window.fullscreen":"Plein écran","window.exitFullscreen":"Quitter le plein écran","attach.add":"Joindre des fichiers","attach.remove":"Supprimer le fichier","attach.success":"Fichier joint","status.starting":"Démarrage du chat...","status.typing":"Préparation de la réponse","status.uploading":"Téléversement","modal.newChatTitle":"Nouveau Chat","modal.newChatBody":"Démarrer un nouveau chat effacera votre conversation actuelle. Continuer?","modal.cancel":"Annuler","modal.confirm":"Confirmer","composer.placeholder":"Tapez un message...","composer.send":"Envoyer le message","error.fileTooLarge":"Fichier trop volumineux","error.totalTooLarge":"Taille totale des fichiers trop importante","error.unsupportedType":"Type de fichier non pris en charge","error.connection":"Erreur de connexion. Veuillez réessayer.","error.sessionExpired":"Session expirée. Veuillez démarrer un nouveau chat.","branding.poweredBy":"Propulsé par","branding.buttonText":"","branding.headerText":"","content.welcomeMessages":[],"content.starterQuestions":[]};var we={"launcher.open":"चैट खोलें","window.close":"बंद करें","window.newChat":"नई चैट शुरू करें","window.fullscreen":"पूर्ण स्क्रीन पर जाएं","window.exitFullscreen":"पूर्ण स्क्रीन से बाहर आएं","attach.add":"फ़ाइलें संलग्न करें","attach.remove":"फ़ाइल हटाएँ","attach.success":"फ़ाइल संलग्न की गई","status.starting":"चैट शुरू हो रही है...","status.typing":"जवाब तैयार किया जा रहा है","status.uploading":"अपलोड हो रहा है","modal.newChatTitle":"नई चैट शुरू करें","modal.newChatBody":"नई चैट शुरू करने से आपकी मौजूदा बातचीत हट जाएगी। क्या आप जारी रखना चाहते हैं?","modal.cancel":"रद्द करें","modal.confirm":"पुष्टि करें","composer.placeholder":"संदेश लिखें...","composer.send":"संदेश भेजें","error.fileTooLarge":"फ़ाइल बहुत बड़ी है","error.totalTooLarge":"कुल फ़ाइल आकार बहुत बड़ा है","error.unsupportedType":"फ़ाइल प्रकार समर्थित नहीं है","error.connection":"कनेक्शन त्रुटि। कृपया पुनः प्रयास करें।","error.sessionExpired":"सत्र समाप्त हो गया है। कृपया नई चैट शुरू करें।","branding.poweredBy":"द्वारा संचालित","branding.buttonText":"","branding.headerText":"","content.welcomeMessages":[],"content.starterQuestions":[]};var ge={"launcher.open":"Apri chat","window.close":"Chiudi","window.newChat":"Avvia nuova chat","window.fullscreen":"Schermo intero","window.exitFullscreen":"Esci da schermo intero","attach.add":"Allega file","attach.remove":"Rimuovi file","attach.success":"File allegato","status.starting":"Avvio della chat...","status.typing":"Preparazione della risposta","status.uploading":"Caricamento","modal.newChatTitle":"Avvia nuova chat","modal.newChatBody":"Avviare una nuova chat cancellerà la conversazione attuale. Continuare?","modal.cancel":"Annulla","modal.confirm":"Conferma","composer.placeholder":"Scrivi un messaggio...","composer.send":"Invia messaggio","error.fileTooLarge":"File troppo grande","error.totalTooLarge":"Dimensione totale del file troppo grande","error.unsupportedType":"Tipo di file non supportato","error.connection":"Errore di connessione. Riprova.","error.sessionExpired":"Sessione scaduta. Avvia una nuova chat.","branding.poweredBy":"Offerto da","branding.buttonText":"","branding.headerText":"","content.welcomeMessages":[],"content.starterQuestions":[]};var be={"launcher.open":"Abrir chat","window.close":"Fechar","window.newChat":"Iniciar novo chat","window.fullscreen":"Entrar em tela cheia","window.exitFullscreen":"Sair da tela cheia","attach.add":"Anexar arquivos","attach.remove":"Remover arquivo","attach.success":"Arquivo anexado","status.starting":"Iniciando chat...","status.typing":"Preparando resposta","status.uploading":"Carregando","modal.newChatTitle":"Iniciar novo chat","modal.newChatBody":"Iniciar um novo chat apagará sua conversa atual. Deseja continuar?","modal.cancel":"Cancelar","modal.confirm":"Confirmar","composer.placeholder":"Digite uma mensagem...","composer.send":"Enviar mensagem","error.fileTooLarge":"Arquivo muito grande","error.totalTooLarge":"Tamanho total do arquivo muito grande","error.unsupportedType":"Tipo de arquivo não suportado","error.connection":"Erro de conexão. Por favor, tente novamente.","error.sessionExpired":"Sessão expirada. Por favor, inicie um novo chat.","branding.poweredBy":"Desenvolvido por","branding.buttonText":"","branding.headerText":"","content.welcomeMessages":[],"content.starterQuestions":[]};var ve={"launcher.open":"Fungua gumzo","window.close":"Funga","window.newChat":"Anza gumzo jipya","window.fullscreen":"Ingiza skrini nzima","window.exitFullscreen":"Toka kwenye skrini nzima","attach.add":"Ambatanisha faili","attach.remove":"Ondoa faili","attach.success":"Faili limeambatanishwa","status.starting":"Inaanzisha gumzo...","status.typing":"Inatayarisha jibu","status.uploading":"Inapakia","modal.newChatTitle":"Anza gumzo jipya","modal.newChatBody":"Kuanza gumzo jipya kutafuta gumzo lako la sasa. Je, ungependa kuendelea?","modal.cancel":"Ghairi","modal.confirm":"Thibitisha","composer.placeholder":"Andika ujumbe...","composer.send":"Tuma ujumbe","error.fileTooLarge":"Faili ni kubwa sana","error.totalTooLarge":"Jumla ya ukubwa wa faili ni kubwa sana","error.unsupportedType":"Aina ya faili haitumiki","error.connection":"Hitilafu ya muunganisho. Tafadhali jaribu tena.","error.sessionExpired":"Kipindi kimeisha muda wake. Tafadhali anza gumzo jipya.","branding.poweredBy":"Inaendeshwa na","branding.buttonText":"","branding.headerText":"","content.welcomeMessages":[],"content.starterQuestions":[]};var ye={"launcher.open":"Відкрити чат","window.close":"Закрити","window.newChat":"Почати новий чат","window.fullscreen":"На весь екран","window.exitFullscreen":"Вийти з повного екрану","attach.add":"Прикріпити файли","attach.remove":"Видалити файл","attach.success":"Файл прикріплено","status.starting":"Запуск чату...","status.typing":"Готується відповідь","status.uploading":"Завантаження","modal.newChatTitle":"Почати новий чат","modal.newChatBody":"Початок нового чату видалить вашу поточну розмову. Продовжити?","modal.cancel":"Скасувати","modal.confirm":"Підтвердити","composer.placeholder":"Введіть повідомлення...","composer.send":"Надіслати повідомлення","error.fileTooLarge":"Файл занадто великий","error.totalTooLarge":"Загальний розмір файлів занадто великий","error.unsupportedType":"Непідтримуваний тип файлу","error.connection":"Помилка з'єднання. Будь ласка, спробуйте ще раз.","error.sessionExpired":"Сесія завершилася. Будь ласка, почніть новий чат.","branding.poweredBy":"Працює на","branding.buttonText":"","branding.headerText":"","content.welcomeMessages":[],"content.starterQuestions":[]};const xe=fe;const ke={ar:ue,en:fe,es:pe,fr:me,hi:we,it:ge,pt:be,sw:ve,uk:ye};function ze(){if(typeof navigator!=="undefined"){const t=navigator.language||navigator.userLanguage;if(t){return t.split("-")[0].toLowerCase()}}return"en"}function Te(t){if(t){return t.toLowerCase()}return ze()}async function Se(t){return ke[t]||xe}function $e(t,e){return Object.assign(Object.assign({},t),e)}class Ce{constructor(t,e){this.translations=xe;this.language="en";this.language=Te(t);this.loadTranslations(e)}async loadTranslations(t){let e;try{e=await Se(this.language)}catch(t){console.error("Failed to load translations:",t);e=xe}this.translations=t?$e(e,t):e}get(t,e){var o;if(e!==undefined&&e!==null){return e}const r=(o=this.translations[t])!==null&&o!==void 0?o:xe[t];if(Array.isArray(r)){return r.length>0?r[0]:undefined}return r!==null&&r!==void 0?r:undefined}getAll(){return this.translations}getArray(t){const e=this.translations[t]||xe[t];if(Array.isArray(e)){return e}if(typeof e==="string"){return[e]}return[]}getLanguage(){return this.language}}
3
- /*! js-cookie v3.0.5 | MIT */function _e(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o){t[r]=o[r]}}return t}var Ae={read:function(t){if(t[0]==='"'){t=t.slice(1,-1)}return t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Me(t,e){function o(o,r,n){if(typeof document==="undefined"){return}n=_e({},e,n);if(typeof n.expires==="number"){n.expires=new Date(Date.now()+n.expires*864e5)}if(n.expires){n.expires=n.expires.toUTCString()}o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var i in n){if(!n[i]){continue}s+="; "+i;if(n[i]===true){continue}s+="="+n[i].split(";")[0]}return document.cookie=o+"="+t.write(r,o)+s}function r(e){if(typeof document==="undefined"||arguments.length&&!e){return}var o=document.cookie?document.cookie.split("; "):[];var r={};for(var n=0;n<o.length;n++){var s=o[n].split("=");var i=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);r[a]=t.read(i,a);if(e===a){break}}catch(t){}}return e?r[e]:r}return Object.create({set:o,get:r,remove:function(t,e){o(t,"",_e({},e,{expires:-1}))},withAttributes:function(t){return Me(this.converter,_e({},this.attributes,t))},withConverter:function(t){return Me(_e({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Ee=Me(Ae,{path:"/"});function Fe(t){if(!Ie(t)){return undefined}return Ee.get("csrftoken")}function Ie(t){let e;try{e=new URL(t)}catch(t){return false}return window.location.origin===e.origin}class Le{constructor(t){var e,o,r,n;this.apiBaseUrl=t.apiBaseUrl;this.embedKey=t.embedKey;this.widgetVersion=t.widgetVersion;this.csrfTokenProvider=(e=t.csrfTokenProvider)!==null&&e!==void 0?e:Fe;this.taskPollingIntervalMs=(o=t.taskPollingIntervalMs)!==null&&o!==void 0?o:1e3;this.taskPollingMaxAttempts=(r=t.taskPollingMaxAttempts)!==null&&r!==void 0?r:120;this.messagePollingIntervalMs=(n=t.messagePollingIntervalMs)!==null&&n!==void 0?n:3e4}async startSession(t){const e=await fetch(`${this.apiBaseUrl}/api/chat/start/`,{method:"POST",headers:this.getJsonHeaders(),body:JSON.stringify(t)});if(!e.ok){throw new Error(`Failed to start session: ${e.statusText}`)}return e.json()}async sendMessage(t,e){const o=await fetch(`${this.apiBaseUrl}/api/chat/${t}/message/`,{method:"POST",headers:this.getJsonHeaders(),body:JSON.stringify(e)});if(!o.ok){throw new Error(`Failed to send message: ${o.statusText}`)}return o.json()}async pollTaskOnce(t,e){const o=await fetch(`${this.apiBaseUrl}/api/chat/${t}/${e}/poll/`);if(!o.ok){throw new Error(`Failed to poll task: ${o.statusText}`)}return o.json()}pollTask(t,e,o){let r=0;let n=false;let s;const i=()=>{s=setTimeout((()=>{void a()}),this.taskPollingIntervalMs)};const a=async()=>{if(n){return}try{const n=await this.pollTaskOnce(t,e);if(n.error){throw new Error(n.error)}if(n.status==="complete"&&n.message){o.onMessage(n.message);return}r+=1;if(r>=this.taskPollingMaxAttempts){if(o.onTimeout){o.onTimeout()}return}i()}catch(t){if(o.onError){o.onError(t instanceof Error?t:new Error("Failed to get response"))}}};void a();return{cancel:()=>{n=true;if(s){clearTimeout(s)}}}}async fetchMessages(t,e){const o=new URL(`${this.apiBaseUrl}/api/chat/${t}/poll/`);if(e){o.searchParams.set("since",e)}const r=await fetch(o.toString());if(!r.ok){throw new Error(`Failed to poll messages: ${r.statusText}`)}return r.json()}startMessagePolling(t,e){const o=async()=>{try{const o=e.getSince();const r=await this.fetchMessages(t,o);if(r.messages.length>0){e.onMessages(r.messages)}}catch(t){if(e.onError){e.onError(t instanceof Error?t:new Error("Failed to poll messages"))}}};void o();this.messagePollingTimer=setInterval((()=>{void o()}),this.messagePollingIntervalMs);return{stop:()=>this.stopMessagePolling()}}stopMessagePolling(){if(this.messagePollingTimer){clearInterval(this.messagePollingTimer);this.messagePollingTimer=undefined}}getJsonHeaders(){const t={"Content-Type":"application/json","x-ocs-widget-version":this.widgetVersion};const e=this.csrfTokenProvider(this.apiBaseUrl);if(e){t["X-CSRFToken"]=e}if(this.embedKey){t["X-Embed-Key"]=this.embedKey}return t}}class je{constructor(t){this.supportedExtensions=t.supportedExtensions;this.maxFileSizeMb=t.maxFileSizeMb;this.maxTotalSizeMb=t.maxTotalSizeMb}addFiles(t,e){const o=[];const r=Array.from(e instanceof FileList?Array.from(e):e);let n=t.reduce(((t,e)=>t+e.file.size),0);for(const t of r){const e=this.getFileExtension(t.name);if(!this.supportedExtensions.includes(e)){o.push({file:t,error:`File type ${e} not supported`});continue}const r=this.bytesToMb(t.size);if(r>this.maxFileSizeMb){o.push({file:t,error:`File exceeds ${this.maxFileSizeMb}MB limit`});continue}n+=t.size;const s=this.bytesToMb(n);if(s>this.maxTotalSizeMb){o.push({file:t,error:`Total size exceeds ${this.maxTotalSizeMb}MB limit`});continue}o.push({file:t})}return[...t,...o]}removeFile(t,e){return t.filter(((t,o)=>o!==e))}markPendingFilesWithError(t,e){return t.map((t=>{if(!t.error&&!t.uploaded){return Object.assign(Object.assign({},t),{error:e})}return t}))}async uploadPendingFiles(t,e){if(t.length===0){return{selectedFiles:t,uploadedIds:[]}}const o=t.filter((t=>!t.error&&!t.uploaded));const r=t.filter((t=>t.uploaded)).map((t=>t.uploaded.id));if(o.length===0){return{selectedFiles:t,uploadedIds:r}}const n=new FormData;for(const t of o){n.append("files",t.file)}n.append("participant_remote_id",e.participantId);if(e.participantName){n.append("participant_name",e.participantName)}try{const o=await fetch(`${e.apiBaseUrl}/api/chat/${e.sessionId}/upload/`,{method:"POST",body:n});if(!o.ok){const e=await this.safeJson(o);const n=e&&typeof e==="object"&&"error"in e&&e.error||"Failed to upload files";return{selectedFiles:this.markPendingFilesWithError(t,n),uploadedIds:r,errorMessage:n}}const s=await this.safeJson(o);if(!s||typeof s!=="object"||!Array.isArray(s.files)){const e="Unexpected upload response shape";return{selectedFiles:this.markPendingFilesWithError(t,e),uploadedIds:r,errorMessage:e}}const i=s.files;let a=0;const l=t.map((t=>{if(!t.error&&!t.uploaded){const e=i[a];a+=1;return Object.assign(Object.assign({},t),{uploaded:e})}return t}));r.push(...i.map((t=>t.id)));return{selectedFiles:l,uploadedIds:r}}catch(e){const o=e instanceof Error?e.message:"Failed to upload files";return{selectedFiles:this.markPendingFilesWithError(t,o),uploadedIds:r,errorMessage:o}}}bytesToMb(t){return t/(1024*1024)}getFileExtension(t){const e=t.split(".");const o=e.pop();return o?`.${o.toLowerCase()}`:""}async safeJson(t){try{return await t.json()}catch(t){return undefined}}}const Re='/*! tailwindcss v4.1.12 | MIT License | https://tailwindcss.com */@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-blue-300:oklch(80.9% .105 251.813);--color-slate-500:oklch(55.4% .046 257.417);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--spacing:.25rem;--breakpoint-lg:64rem;--container-sm:24rem;--font-weight-light:300;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--animate-progress:progress 3s infinite linear;--animate-dots:dots 1s steps(5,end)infinite;--transform-origin-left-right:0% 50%}}@layer base{*,::backdrop,:after,:before{border:0 solid;border-color:var(--color-gray-200,currentcolor);box-sizing:border-box;margin:0;padding:0}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button;background-color:#0000;border:0 solid;border-color:var(--color-gray-200,currentcolor);border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentColor}::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.static{position:static}.container{width:100%}.flex{display:flex}.hidden{display:none}.w-full{width:100%}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.resize{resize:both}.items-center{align-items:center}.justify-center{justify-content:center}.gap-\\[0\\.5em\\]{gap:.5em}:where(.space-y-\\[0\\.25em\\]>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(.25em*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(.25em*var(--tw-space-y-reverse))}.border{border-style:var(--tw-border-style);border-width:1px}.py-\\[2px\\]{padding-block:2px}.text-\\[0\\.8em\\]{font-size:.8em}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.text-slate-500{color:var(--color-slate-500)}.underline{text-decoration-line:underline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a)}.ring,.shadow{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)}} /*! tailwindcss v4.1.12 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components; /*! tailwindcss v4.1.12 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components{#ocs-chat-window{font-size:var(--chat-window-font-size);z-index:var(--chat-z-index)}.starter-question{border-radius:var(--radius-lg);text-align:left;--tw-duration:.2s;background-color:var(--starter-question-bg-color);border:1px solid var(--starter-question-border-color);color:var(--starter-question-text-color);padding:.75em;transition-duration:.2s}.starter-question:hover{background-color:var(--starter-question-bg-hover-color);border-color:var(--starter-question-border-hover-color)}.chat-btn-text{border-radius:var(--radius-lg);border-style:var(--tw-border-style);transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));--tw-duration:.2s;--tw-ease:var(--ease-in-out);align-items:center;background-color:var(--button-background-color,#fff);border-width:0;border:1px solid var(--button-border-color);color:var(--button-text-color,#111827);display:flex;font-size:var(--button-font-size);gap:8px;padding:.5em;transition-duration:.2s;transition-timing-function:var(--ease-in-out);z-index:var(--chat-z-index,50)}.chat-btn-text:hover{border:1px solid var(--button-border-color-hover);color:var(--button-text-color-hover,#1d4ed8)}.chat-btn-text span{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);white-space:nowrap}.chat-btn-text img{flex-shrink:0;height:var(--button-icon-size);-o-object-fit:contain;object-fit:contain;width:var(--button-icon-size)}.chat-btn-text.round{border-radius:3.40282e+38px}.chat-btn-icon{border-radius:var(--radius-lg);border-style:var(--tw-border-style);transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));--tw-duration:.2s;--tw-ease:var(--ease-in-out);background-color:var(--button-background-color,#fff);border-width:0;border:1px solid var(--button-border-color);font-size:var(--button-font-size);padding:.5em;transition-duration:.2s;transition-timing-function:var(--ease-in-out);z-index:var(--chat-z-index,50)}.chat-btn-icon:hover{border:1px solid var(--button-border-color-hover);color:var(--button-text-color-hover,#1d4ed8)}.chat-btn-icon img{height:var(--button-icon-size);-o-object-fit:contain;object-fit:contain;width:var(--button-icon-size)}.chat-btn-icon.round,.round .chat-btn-icon,.round.chat-btn-text{border-radius:3.40282e+38px}.error-message{color:var(--error-text-color);padding:.5em}.chat-window-fullscreen{border-style:var(--tw-border-style);inset:calc(var(--spacing)*0);z-index:9999;--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);height:100%;max-height:100%;transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));width:100%;--tw-duration:.2s;border-radius:0;border-width:0;max-width:var(--chat-window-fullscreen-width);transition-duration:.2s}.chat-window-fullscreen,.chat-window-normal{background-color:var(--chat-window-bg-color);display:flex;flex-direction:column;overflow:hidden;position:fixed}.chat-window-normal{border:1px solid var(--chat-window-border-color);border-radius:var(--radius-lg);height:100vh;max-width:var(--breakpoint-lg);min-height:300px;min-width:300px;width:100vw}.chat-window-normal:not(.chat-window-dragging){--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));--tw-duration:.2s;transition-duration:.2s}.chat-window-dragging,.chat-window-normal:not(.chat-window-dragging){box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.chat-window-dragging{cursor:grabbing;--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040)}.chat-header{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));--tw-duration:.15s;align-items:center;background-color:var(--header-bg-color);border-bottom:1px solid var(--header-border-color);display:flex;font-size:var(--header-font-size);justify-content:space-between;padding:.5em;transition-duration:.15s}.chat-header:active,.chat-header:hover{background-color:var(--header-bg-hover-color)}.header-text{align-items:center;color:var(--header-text-color);display:flex;font-size:var(--header-text-font-size);justify-content:center}.chat-header-draggable{cursor:grab}.chat-header-dragging{cursor:grabbing}.drag-indicator{display:none}.drag-dots{display:flex;gap:2px;margin-left:2px;pointer-events:none}.header-buttons{align-items:center;display:flex;gap:4px}.header-button{border-radius:var(--radius-md);transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));--tw-duration:.2s;color:var(--header-button-text-color);padding:.375em;transition-duration:.2s}.header-button svg{height:var(--header-button-icon-size);width:var(--header-button-icon-size)}.header-button:hover{background-color:var(--header-button-bg-hover-color)}.fullscreen-button{display:none}.chat-content{display:flex;flex-direction:column;flex-grow:1;overflow:hidden}.loading-container{align-items:center;display:flex;flex-grow:1;justify-content:center}.loading-text{color:var(--loading-text-color);margin-left:2px}.messages-container{flex-grow:1;overflow-y:auto;padding:1em}:where(.messages-container>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--spacing)*2*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--spacing)*2*var(--tw-space-y-reverse))}.message-row{display:flex}.message-row-user{justify-content:flex-end}.message-row-assistant{justify-content:flex-start}.message-bubble{border-radius:var(--radius-lg);padding:.5em 1em}.message-bubble-user{background-color:var(--message-user-bg-color);color:var(--message-user-text-color)}.message-bubble-assistant{background-color:var(--message-assistant-bg-color);color:var(--message-assistant-text-color)}.message-bubble-system{background-color:var(--message-system-bg-color);color:var(--message-system-text-color)}.message-timestamp{font-size:var(--chat-window-font-size-sm);margin-top:4px;opacity:.7}.message-attachments{margin-top:8px}:where(.message-attachments>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--spacing)*1*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--spacing)*1*var(--tw-space-y-reverse))}.attachment-link{display:block;text-decoration-line:underline}:where(.welcome-messages>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--spacing)*2*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--spacing)*2*var(--tw-space-y-reverse))}.typing-indicator{height:calc(var(--spacing)*1.5);overflow:hidden;width:100%}.typing-progress{animation:var(--animate-progress);background-color:var(--typing-progress-bg-color);border-radius:var(--radius-lg);height:100%;transform-origin:var(--transform-origin-left-right);width:100%}.typing-text{font-size:var(--chat-window-font-size-sm);justify-content:center;opacity:.7;width:100%}.typing-dots{animation:var(--animate-dots)}:where(.starter-questions>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--spacing)*2*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--spacing)*2*var(--tw-space-y-reverse))}.starter-questions{padding:1em}.starter-question-row{display:flex;justify-content:flex-end}.input-area{background-color:var(--input-bg-color);border-top:1px solid var(--input-border-color);padding:1em 1em 0}.input-container{display:flex;gap:8px}.message-textarea{background-color:var(--input-bg-color);border-color:var(--color-gray-300);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border:1px solid var(--input-border-color);color:var(--input-text-color);flex-grow:1;padding:.5em .75em;resize:none}.message-textarea:focus{outline-color:var(--input-outline-focus-color)}.send-button{border-radius:var(--radius-md);--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));--tw-duration:.2s;padding:.5em 1em;transition-duration:.2s}.send-button-enabled{background-color:var(--send-button-bg-color);color:var(--send-button-text-color)}.send-button-enabled:hover{background-color:var(--send-button-bg-hover-color)}.send-button-disabled{background-color:var(--send-button-bg-disabled-color);color:var(--send-button-text-disabled-color);cursor:not-allowed}.confirmation-overlay{align-items:center;background-color:var(--confirmation-overlay-bg-color);display:flex;inset:calc(var(--spacing)*0);justify-content:center;position:fixed;z-index:9999}.confirmation-dialog{background-color:var(--confirmation-dialog-bg-color);border:1px solid var(--confirmation-dialog-border-color);border-radius:.75em;box-shadow:0 .625em 1.5625em var(--confirmation-dialog-shadow-color);margin-inline:calc(var(--spacing)*4);max-width:var(--container-sm);width:100%}.confirmation-content{padding:1.5em}.confirmation-title{margin-bottom:calc(var(--spacing)*2);--tw-font-weight:var(--font-weight-semibold);color:var(--confirmation-title-color);font-size:var(--confirmation-title-font-size);font-weight:var(--font-weight-semibold)}.confirmation-message{color:var(--confirmation-message-color);font-size:var(--confirmation-message-font-size);margin-bottom:calc(var(--spacing)*4)}.confirmation-buttons{display:flex;gap:.75em;justify-content:flex-end}.confirmation-button{border-radius:var(--radius-md);--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));--tw-duration:.2s;padding:.5em 1em;transition-duration:.2s}.confirmation-button-cancel{background-color:var(--confirmation-button-cancel-bg-color);color:var(--confirmation-button-cancel-text-color)}.confirmation-button-cancel:hover{background-color:var(--confirmation-button-cancel-bg-hover-color)}.confirmation-button-confirm{background-color:var(--confirmation-button-confirm-bg-color);color:var(--confirmation-button-confirm-text-color)}.confirmation-button-confirm:hover{background-color:var(--confirmation-button-confirm-bg-hover-color)}}@layer utilities{:host{--chat-z-index:50;--button-background-color:#fff;--button-background-color-hover:#f3f4f6;--button-text-color:#111827;--button-text-color-hover:#1d4ed8;--button-border-color:#d1d5db;--button-border-color-hover:#6b7280;--button-font-size:1em;--button-icon-size:1.5em;--chat-window-height:60%;--chat-window-width:25%;--chat-window-fullscreen-width:80%;--chat-window-bg-color:#fff;--chat-window-border-color:#d1d5db;--chat-window-shadow-color:#0000001a;--chat-window-font-size:.875em;--chat-window-font-size-sm:.75em;--header-bg-color:transparent;--header-bg-hover-color:#f9fafb;--header-border-color:#f3f4f6;--header-button-text-color:#6b7280;--header-button-bg-hover-color:#f3f4f6;--header-font-size:1em;--header-text-font-size:1em;--header-text-color:#525762;--header-button-icon-size:1.5em;--starter-question-bg-color:transparent;--starter-question-bg-hover-color:#eff6ff;--starter-question-text-color:#3b82f6;--starter-question-border-color:#3b82f6;--starter-question-border-hover-color:#2563eb;--message-user-bg-color:#e4edfb;--message-user-text-color:#1f2937;--message-user-link-color:#155dfc;--message-assistant-bg-color:#eae7e8;--message-assistant-text-color:var(--message-user-text-color);--message-assistant-link-color:var(--message-user-link-color);--message-system-bg-color:#fbe4f8;--message-system-text-color:var(--message-user-text-color);--message-system-link-color:var(--message-user-link-color);--message-timestamp-color:#ffffffb3;--message-timestamp-assistant-color:#4b5563b3;--input-bg-color:transparent;--input-border-color:#d1d5db;--input-text-color:#111827;--input-placeholder-color:#6b7280;--input-outline-focus-color:#3b82f6;--send-button-bg-color:#3b82f6;--send-button-bg-hover-color:#2563eb;--send-button-text-color:#fff;--send-button-bg-disabled-color:#d1d5db;--send-button-text-disabled-color:#6b7280;--loading-text-color:#6b7280;--loading-spinner-track-color:#e5e7eb;--loading-spinner-fill-color:#3b82f6;--loading-spinner-size:1.25em;--typing-progress-bg-color:#ade3ff;--scrollbar-track-color:#f3f4f6;--scrollbar-thumb-color:#d1d5db;--scrollbar-thumb-hover-color:#9ca3af;--error-text-color:#ef4444;--success-text-color:#10b981;--code-bg-user-color:var(--message-user-bg-color);--code-text-user-color:var(--message-user-text-color);--code-border-user-color:var(--message-user-bg-color);--code-bg-assistant-color:var(--message-assistant-bg-color);--code-text-assistant-color:var(--message-assistant-text-color);--code-border-assistant-color:var(--message-assistant-bg-color);--confirmation-overlay-bg-color:#00000080;--confirmation-dialog-bg-color:var(--chat-window-bg-color);--confirmation-dialog-border-color:var(--chat-window-border-color);--confirmation-dialog-shadow-color:var(--chat-window-shadow-color);--confirmation-title-color:#111827;--confirmation-title-font-size:1.125em;--confirmation-message-color:var(--loading-text-color);--confirmation-message-font-size:1em;--confirmation-button-cancel-bg-color:var(--button-background-color-hover);--confirmation-button-cancel-bg-hover-color:#e5e7eb;--confirmation-button-cancel-text-color:var(--header-button-text-color);--confirmation-button-confirm-bg-color:var(--error-text-color);--confirmation-button-confirm-bg-hover-color:var(--error-text-color);--confirmation-button-confirm-text-color:var(--send-button-text-color);--file-attachment-button-bg-color:transparent;--file-attachment-button-bg-hover-color:var(--header-button-bg-hover-color);--file-attachment-button-text-color:var(--header-button-text-color);--file-attachment-button-text-disabled-color:var(--send-button-text-disabled-color);--selected-files-bg-color:var(--chat-window-bg-color);--selected-files-border-color:var(--header-border-color);--selected-file-bg-color:var(--message-system-bg-color);--selected-file-font-size:var(--chat-window-font-size-sm);--selected-file-name-color:var(--message-assistant-text-color);--selected-file-size-color:var(--input-placeholder-color);--selected-file-icon-size:1.25em;--selected-file-remove-icon-color:var(--error-text-color);--selected-file-remove-icon-hover-color:#dc2626;--message-attachment-icon-size:1em;bottom:30px;display:block;position:fixed;right:30px}@supports (color:color-mix(in lab,red,red)){:host{--code-bg-user-color:color-mix(in srgb,var(--message-user-bg-color)80%,#fff 20%);--code-border-user-color:color-mix(in srgb,var(--message-user-bg-color)90%,#000 10%);--code-bg-assistant-color:color-mix(in srgb,var(--message-assistant-bg-color)50%,#fff 50%);--code-border-assistant-color:color-mix(in srgb,var(--message-assistant-bg-color)90%,#000 10%)}}}textarea{max-height:calc(var(--spacing)*32);min-height:calc(var(--spacing)*10);overflow-y:auto;resize:none}.loading-spinner{animation:var(--animate-spin);border-color:var(--loading-spinner-track-color);border-radius:3.40282e+38px;border-style:var(--tw-border-style);border-top-color:var(--loading-spinner-fill-color);border-width:2px;height:var(--loading-spinner-size);width:var(--loading-spinner-size)}.overflow-y-auto::-webkit-scrollbar{height:calc(var(--spacing)*1.5);width:calc(var(--spacing)*1.5)}.overflow-y-auto::-webkit-scrollbar-track{background-color:var(--scrollbar-track-color);border-radius:var(--radius-sm)}.overflow-y-auto::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-color);border-radius:var(--radius-sm)}.overflow-y-auto::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover-color)}.chat-markdown{color:var(--tw-prose-body);font-size:1rem;font-size:.875rem;line-height:1.75;line-height:1.71429;max-width:65ch;--tw-prose-body:oklch(37.3% .034 259.733);--tw-prose-headings:oklch(21% .034 264.665);--tw-prose-lead:oklch(44.6% .03 256.802);--tw-prose-links:oklch(21% .034 264.665);--tw-prose-bold:oklch(21% .034 264.665);--tw-prose-counters:oklch(55.1% .027 264.364);--tw-prose-bullets:oklch(87.2% .01 258.338);--tw-prose-hr:oklch(92.8% .006 264.531);--tw-prose-quotes:oklch(21% .034 264.665);--tw-prose-quote-borders:oklch(92.8% .006 264.531);--tw-prose-captions:oklch(55.1% .027 264.364);--tw-prose-kbd:oklch(21% .034 264.665);--tw-prose-kbd-shadows:NaN NaN NaN;--tw-prose-code:oklch(21% .034 264.665);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:oklch(87.2% .01 258.338);--tw-prose-td-borders:oklch(92.8% .006 264.531);--tw-prose-invert-body:oklch(87.2% .01 258.338);--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:oklch(70.7% .022 261.325);--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:oklch(70.7% .022 261.325);--tw-prose-invert-bullets:oklch(44.6% .03 256.802);--tw-prose-invert-hr:oklch(37.3% .034 259.733);--tw-prose-invert-quotes:oklch(96.7% .003 264.542);--tw-prose-invert-quote-borders:oklch(37.3% .034 259.733);--tw-prose-invert-captions:oklch(70.7% .022 261.325);--tw-prose-invert-kbd:#fff;--tw-prose-invert-kbd-shadows:255 255 255;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:oklch(87.2% .01 258.338);--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:oklch(44.6% .03 256.802);--tw-prose-invert-td-borders:oklch(37.3% .034 259.733);font-size:1em;max-width:none}.chat-markdown :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;font-size:1.28571em;line-height:1.6;line-height:1.55556;margin-bottom:.888889em;margin-top:.888889em}.chat-markdown :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);font-weight:500;text-decoration:underline;text-decoration-line:none}.chat-markdown :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.chat-markdown :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.chat-markdown :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-bottom:1.25em;margin-top:1.25em;padding-inline-start:1.625em}.chat-markdown :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.chat-markdown :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.chat-markdown :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.chat-markdown :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.chat-markdown :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.chat-markdown :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.chat-markdown :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.chat-markdown :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.chat-markdown :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.chat-markdown :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-bottom:1.25em;margin-top:1.25em;padding-inline-start:1.625em}.chat-markdown :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-counters);font-weight:400}.chat-markdown :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.chat-markdown :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.14286em}.chat-markdown :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-bottom:2.85714em;margin-top:2.85714em}.chat-markdown :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){border-inline-start-color:var(--tw-prose-quote-borders);border-inline-start-width:.25rem;color:var(--tw-prose-quotes);font-style:italic;font-weight:500;margin-bottom:1.33333em;margin-top:1.33333em;padding-inline-start:1em;padding-inline-start:1.11111em;quotes:"“""”""‘""’"}.chat-markdown :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.chat-markdown :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.chat-markdown :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-size:2.25em;font-size:2.14286em;font-weight:800;line-height:1.11111;line-height:1.2;margin-bottom:.8em;margin-top:0}.chat-markdown :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:900}.chat-markdown :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-size:1.5em;font-size:1.42857em;font-weight:700;line-height:1.33333;line-height:1.4;margin-bottom:.8em;margin-top:1.6em}.chat-markdown :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:800}.chat-markdown :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-size:1.25em;font-size:1.28571em;font-weight:600;line-height:1.6;line-height:1.55556;margin-bottom:.444444em;margin-top:1.55556em}.chat-markdown :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.chat-markdown :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;line-height:1.5;line-height:1.42857;margin-bottom:.571429em;margin-top:1.42857em}.chat-markdown :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.chat-markdown :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-bottom:2em;margin-top:2em}.chat-markdown :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){border-radius:.3125rem;box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows)/10%),0 3px 0 rgb(var(--tw-prose-kbd-shadows)/10%);color:var(--tw-prose-kbd);font-family:inherit;font-size:.875em;font-size:.857143em;font-weight:500;padding-inline-end:.375em;padding-inline-end:.357143em;padding-bottom:.142857em;padding-inline-start:.375em;padding-top:.142857em;padding-inline-start:.357143em}.chat-markdown :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-size:.875em;font-size:.857143em;font-weight:600}.chat-markdown :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after,.chat-markdown :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"\\`"}.chat-markdown :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.chat-markdown :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em;font-size:.9em}.chat-markdown :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em;font-size:.888889em}.chat-markdown :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.chat-markdown :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:var(--tw-prose-pre-bg);border-radius:.375rem;border-radius:.25rem;color:var(--tw-prose-pre-code);font-size:.875em;font-size:.857143em;font-weight:400;line-height:1.71429;line-height:1.66667;margin-bottom:1.66667em;margin-top:1.66667em;overflow-x:auto;padding-inline-end:1.14286em;padding-inline-end:1em;padding-bottom:.666667em;padding-inline-start:1.14286em;padding-top:.666667em;padding-inline-start:1em}.chat-markdown :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:#0000;border-radius:0;border-width:0;color:inherit;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;padding:0}.chat-markdown :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after,.chat-markdown :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}.chat-markdown :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.875em;font-size:.857143em;line-height:1.71429;line-height:1.5;margin-bottom:2em;margin-top:2em;table-layout:auto;width:100%}.chat-markdown :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-color:var(--tw-prose-th-borders);border-bottom-width:1px}.chat-markdown :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;padding-inline-end:.571429em;padding-inline-end:1em;padding-bottom:.666667em;padding-inline-start:.571429em;padding-inline-start:1em;vertical-align:bottom}.chat-markdown :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-color:var(--tw-prose-td-borders);border-bottom-width:1px}.chat-markdown :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.chat-markdown :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.chat-markdown :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-color:var(--tw-prose-th-borders);border-top-width:1px}.chat-markdown :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.chat-markdown :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.chat-markdown :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;font-size:.857143em;line-height:1.42857;line-height:1.33333;margin-top:.666667em}.chat-markdown :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:.75em;margin-top:.75em}.chat-markdown :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.chat-markdown :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.chat-markdown :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.chat-markdown :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.chat-markdown :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.chat-markdown :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.chat-markdown :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.14286em;margin-top:1.14286em}.chat-markdown :where(img):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.71429em;margin-top:1.71429em}.chat-markdown :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0;margin-top:0}.chat-markdown :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.71429em;margin-top:1.71429em}.chat-markdown :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.14286em;margin-top:1.14286em;padding-inline-start:1.57143em}.chat-markdown :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:.285714em;margin-top:.285714em}.chat-markdown :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.428571em}.chat-markdown :where(.prose-sm>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:.571429em;margin-top:.571429em}.chat-markdown :where(.prose-sm>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.14286em}.chat-markdown :where(.prose-sm>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.14286em}.chat-markdown :where(.prose-sm>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.14286em}.chat-markdown :where(.prose-sm>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.14286em}.chat-markdown :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:.571429em;margin-top:.571429em}.chat-markdown :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.14286em;margin-top:1.14286em}.chat-markdown :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.285714em;padding-inline-start:1.57143em}.chat-markdown :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)),.chat-markdown :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.chat-markdown :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.chat-markdown :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.chat-markdown :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:1em;padding-bottom:.666667em;padding-top:.666667em;padding-inline-start:1em}.chat-markdown :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.chat-markdown :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.chat-markdown :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.71429em;margin-top:1.71429em}.chat-markdown :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0;margin-top:0}.chat-markdown :where(.prose-sm>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.chat-markdown :where(.prose-sm>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.chat-markdown>*{margin-bottom:.1em;margin-top:.1em}.message-bubble-assistant .chat-markdown{--tw-prose-body:var(--message-assistant-text-color);--tw-prose-headings:var(--message-assistant-text-color);--tw-prose-lead:var(--message-assistant-text-color);--tw-prose-links:var(--message-assistant-link-color);--tw-prose-bold:var(--message-assistant-text-color);--tw-prose-counters:var(--message-assistant-text-color);--tw-prose-bullets:var(--message-assistant-text-color);--tw-prose-hr:var(--message-assistant-text-color);--tw-prose-quotes:var(--message-assistant-text-color);--tw-prose-quote-borders:var(--message-assistant-text-color);--tw-prose-captions:var(--message-assistant-text-color);--tw-prose-kbd:var(--message-assistant-text-color);--tw-prose-kbd-shadows:var(--message-assistant-text-color);--tw-prose-code:var(--code-text-assistant-color);--tw-prose-pre-code:var(--code-text-assistant-color);--tw-prose-pre-bg:var(--code-bg-assistant-color);--tw-prose-th-borders:var(--message-assistant-text-color);--tw-prose-td-borders:var(--message-assistant-text-color)}.message-bubble-user .chat-markdown{--tw-prose-body:var(--message-user-text-color);--tw-prose-headings:var(--message-user-text-color);--tw-prose-lead:var(--message-user-text-color);--tw-prose-links:var(--message-user-link-color);--tw-prose-bold:var(--message-user-text-color);--tw-prose-counters:var(--message-user-text-color);--tw-prose-bullets:var(--message-user-text-color);--tw-prose-hr:var(--message-user-text-color);--tw-prose-quotes:var(--message-user-text-color);--tw-prose-quote-borders:var(--message-user-text-color);--tw-prose-captions:var(--message-user-text-color);--tw-prose-kbd:var(--message-user-text-color);--tw-prose-kbd-shadows:var(--message-user-text-color);--tw-prose-code:var(--code-text-user-color);--tw-prose-pre-code:var(--code-text-user-color);--tw-prose-pre-bg:var(--code-bg-user-color);--tw-prose-th-borders:var(--message-user-text-color);--tw-prose-td-borders:var(--message-user-text-color)}.message-bubble-system .chat-markdown{--tw-prose-body:var(--message-system-text-color);--tw-prose-headings:var(--message-system-text-color);--tw-prose-lead:var(--message-system-text-color);--tw-prose-links:var(--message-system-link-color);--tw-prose-bold:var(--message-system-text-color);--tw-prose-counters:var(--message-system-text-color);--tw-prose-bullets:var(--message-system-text-color);--tw-prose-hr:var(--message-system-text-color);--tw-prose-quotes:var(--message-system-text-color);--tw-prose-quote-borders:var(--message-system-text-color);--tw-prose-captions:var(--message-system-text-color);--tw-prose-kbd:var(--message-system-text-color);--tw-prose-kbd-shadows:var(--message-system-text-color);--tw-prose-code:var(--message-system-text-color);--tw-prose-pre-code:var(--message-system-text-color);--tw-prose-pre-bg:var(--message-system-text-color);--tw-prose-th-borders:var(--message-system-text-color);--tw-prose-td-borders:var(--message-system-text-color)}.message-bubble-user .chat-markdown pre{border:1px solid var(--code-border-user-color)}.message-bubble-assistant .chat-markdown pre{border:1px solid var(--code-border-assistant-color)}.loading:after{content:" ."}.file-attachment-button{border-radius:var(--radius-md);transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));--tw-duration:.2s;background-color:var(--file-attachment-button-bg-color);color:var(--file-attachment-button-text-color);padding:.375em;transition-duration:.2s}.file-attachment-button:disabled{color:var(--file-attachment-button-text-disabled-color);cursor:not-allowed;opacity:.5}.file-attachment-button svg{height:1.5em;width:1.5em}.file-attachment-button:hover:not(:disabled){background-color:var(--file-attachment-button-bg-hover-color)}.selected-files-container{background-color:var(--selected-files-bg-color);border-top:1px solid var(--selected-files-border-color);padding:1em 1em .5em}.selected-file-item{align-items:center;background-color:var(--selected-file-bg-color);border-radius:.375em;color:var(--selected-file-name-color);display:flex;font-size:var(--selected-file-font-size);justify-content:space-between;padding:.25em .5em}.selected-file-icon{align-items:center;display:flex;justify-content:center}.selected-file-icon svg{height:var(--selected-file-icon-size);width:var(--selected-file-icon-size)}.selected-file-size{color:var(--selected-file-size-color)}.selected-file-error{color:var(--error-text-color)}.selected-file-success-icon{align-items:center;color:var(--success-text-color);display:flex;height:var(--selected-file-icon-size);justify-content:center;width:var(--selected-file-icon-size)}.selected-file-remove-button{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold);transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));--tw-duration:.2s;color:var(--selected-file-remove-icon-color);padding:.375em;transition-duration:.2s}.selected-file-remove-button svg{height:var(--selected-file-icon-size);width:var(--selected-file-icon-size)}.selected-file-remove-button:hover{color:var(--selected-file-remove-icon-hover-color)}.message-attachments{font-size:var(--chat-window-font-size-sm);margin-top:.5em}:where(.message-attachments>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(.25em*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(.25em*var(--tw-space-y-reverse))}.message-attachment-icon{align-items:center;display:flex;height:var(--message-attachment-icon-size);justify-content:center;width:var(--message-attachment-icon-size)}.send-button-disabled{background-color:var(--send-button-bg-disabled-color);color:var(--send-button-text-disabled-color);cursor:not-allowed}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(1turn)}}@keyframes progress{0%{transform:translate(0)scaleX(0)}10%{transform:translate(0)scaleX(.3)}50%{transform:translate(100%)scaleX(.3)}90%{transform:translate(0)scaleX(.3)}to{transform:translate(0)scaleX(0)}}@keyframes dots{0%,20%{color:#0000;text-shadow:.25em 0 #0000,.5em 0 #0000}40%{color:#000;text-shadow:.25em 0 #0000,.5em 0 #0000}60%{text-shadow:.25em 0 #000,.5em 0 #0000}80%,to{text-shadow:.25em 0 #000,.5em 0 #000}}@media (min-width:40rem){.container{max-width:40rem}.chat-window-normal{height:var(--chat-window-height);width:var(--chat-window-width)}.drag-indicator{display:flex}.fullscreen-button{display:block}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}@media (hover:hover){.chat-btn-icon:hover,.chat-btn-text:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.attachment-link:hover{text-decoration-line:none}.chat-markdown :where(a):not(:where([class~=not-prose],[class~=not-prose] *)):hover{text-decoration-line:underline}}';const De=class{constructor(t){e(this,t);this.apiBaseUrl="https://www.openchatstudio.com";this.buttonShape="square";this.visible=false;this.position="right";this.persistentSession=true;this.persistentSessionExpire=60*24;this.allowFullScreen=true;this.allowAttachments=false;this.error="";this.messages=[];this.isLoading=false;this.isTyping=false;this.messageInput="";this.currentPollTaskId="";this.isDragging=false;this.dragOffset={x:0,y:0};this.windowPosition={x:0,y:0};this.fullscreenPosition={x:0};this.parsedWelcomeMessages=[];this.parsedStarterQuestions=[];this.isFullscreen=false;this.showNewChatConfirmation=false;this.selectedFiles=[];this.isUploadingFiles=false;this.buttonPosition={x:30,y:30};this.buttonHorizontalSide="right";this.buttonVerticalSide="bottom";this.isButtonDragging=false;this.buttonWasDragged=false;this.translationManager=new Ce;this.attachmentManager=new je({supportedExtensions:De.SUPPORTED_FILE_EXTENSIONS,maxFileSizeMb:De.MAX_FILE_SIZE_MB,maxTotalSizeMb:De.MAX_TOTAL_SIZE_MB});this.buttonDragOffset={x:0,y:0};this.rafId=null;this.buttonListenersAttached=false;this.chatWindowHeight=600;this.chatWindowWidth=450;this.chatWindowFullscreenWidth=1024;this.positionInitialized=false;this.handleMouseDown=t=>{if(!this.isFullscreen&&window.innerWidth<De.MOBILE_BREAKPOINT)return;if(t.target.closest("button"))return;const e=this.getPointerCoordinates(t);if(!e)return;this.startDrag(e);this.addEventListeners();t.preventDefault()};this.handleMouseMove=t=>{const e=this.getPointerCoordinates(t);if(!e)return;this.updateDragPosition(e)};this.handleMouseUp=()=>{this.endDrag()};this.handleTouchStart=t=>{if(t.target.closest("button"))return;if(!this.chatWindowRef)return;const e=this.getPointerCoordinates(t);if(!e)return;this.startDrag(e);this.addEventListeners();t.preventDefault()};this.handleTouchMove=t=>{const e=this.getPointerCoordinates(t);if(!e)return;this.updateDragPosition(e);t.preventDefault()};this.handleTouchEnd=()=>{this.endDrag()};this.handleWindowResize=()=>{var t,e;this.positionInitialized=false;this.initializePosition();if(this.isButtonDraggable()){const o=window.innerWidth;const r=window.innerHeight;const n=((t=this.buttonRef)===null||t===void 0?void 0:t.offsetWidth)||60;const s=((e=this.buttonRef)===null||e===void 0?void 0:e.offsetHeight)||60;const i=10;this.buttonPosition={x:Math.max(i,Math.min(this.buttonPosition.x,o-n-i)),y:Math.max(i,Math.min(this.buttonPosition.y,r-s-i))};this.updateHostPosition()}};this.handleButtonMouseDown=t=>{if(!this.buttonRef||!this.isButtonDraggable())return;t.preventDefault();t.stopPropagation();const e=this.getPointerCoordinates(t);if(!e)return;this.isButtonDragging=true;this.buttonWasDragged=false;const o=this.host.getBoundingClientRect();this.buttonDragOffset={x:e.clientX-o.left,y:e.clientY-o.top};this.addButtonEventListeners()};this.handleButtonTouchStart=t=>{if(!this.buttonRef||!this.isButtonDraggable())return;t.preventDefault();t.stopPropagation();const e=this.getPointerCoordinates(t);if(!e)return;this.isButtonDragging=true;this.buttonWasDragged=false;const o=this.host.getBoundingClientRect();this.buttonDragOffset={x:e.clientX-o.left,y:e.clientY-o.top};this.addButtonEventListeners()};this.handleButtonMouseMove=t=>{if(!this.isButtonDragging)return;const e=this.getPointerCoordinates(t);if(!e)return;this.updateButtonPosition(e)};this.handleButtonTouchMove=t=>{if(!this.isButtonDragging)return;t.preventDefault();const e=this.getPointerCoordinates(t);if(!e)return;this.updateButtonPosition(e)};this.handleButtonMouseUp=()=>{if(this.isButtonDragging){this.isButtonDragging=false;this.removeButtonEventListeners()}};this.handleButtonTouchEnd=()=>{if(this.isButtonDragging){this.isButtonDragging=false;this.removeButtonEventListeners()}};this.handleButtonClick=()=>{if(!this.buttonWasDragged){this.toggleWindowVisibility()}this.buttonWasDragged=false}}async componentWillLoad(){if(!this.chatbotId){this.error="Chatbot ID is required";return}await this.initializeTranslations();if(this.persistentSession&&this.isLocalStorageAvailable()){const{sessionId:t,messages:e}=this.loadSessionFromStorage();if(t&&e){this.sessionId=t;this.messages=e}}this.parseWelcomeMessages();this.parseStarterQuestions()}componentDidLoad(){const t=getComputedStyle(this.host);const e=t.getPropertyValue("--chat-window-height");const o=t.getPropertyValue("--chat-window-width");const r=t.getPropertyValue("--chat-window-fullscreen-width");this.chatWindowHeight=he(e,window.innerHeight,this.chatWindowHeight);this.chatWindowWidth=he(o,window.innerWidth,this.chatWindowWidth);this.chatWindowFullscreenWidth=he(r,window.innerWidth,this.chatWindowFullscreenWidth);this.initializeButtonPosition();setTimeout((()=>{if(this.visible){this.initializePosition()}if(this.visible&&this.sessionId){this.startMessagePolling()}}),0);window.addEventListener("resize",this.handleWindowResize)}disconnectedCallback(){this.cleanup();this.removeEventListeners();this.removeButtonEventListeners();window.removeEventListener("resize",this.handleWindowResize)}getChatService(){if(!this.chatService){this.chatService=new Le({apiBaseUrl:this.apiBaseUrl||"https://www.openchatstudio.com",embedKey:this.embedKey,widgetVersion:o.version,taskPollingIntervalMs:De.TASK_POLLING_INTERVAL_MS,taskPollingMaxAttempts:De.TASK_POLLING_MAX_ATTEMPTS,messagePollingIntervalMs:De.MESSAGE_POLLING_INTERVAL_MS})}return this.chatService}addErrorMessage(t){const e={created_at:(new Date).toISOString(),role:"system",content:`**Error:** ${t}\nPlease try again.`,attachments:[]};this.messages=[...this.messages,e];this.saveSessionToStorage();this.scrollToBottom()}handleError(t){this.addErrorMessage(t);this.isLoading=false;this.isTyping=false;this.isUploadingFiles=false;this.currentPollTaskId=""}parseJSONProp(t,e){try{if(t){try{return JSON.parse(t)}catch(e){const o=t.replace(/'/g,'"');return JSON.parse(o)}}}catch(t){console.warn(`Failed to parse ${e}:`,t)}return[]}parseWelcomeMessages(){this.parsedWelcomeMessages=this.parseJSONProp(this.welcomeMessages,"welcome messages")}parseStarterQuestions(){this.parsedStarterQuestions=this.parseJSONProp(this.starterQuestions,"starter questions")}async initializeTranslations(){let t;if(this.translationsUrl){t=await this.loadTranslationsFromUrl(this.translationsUrl)}this.translationManager=new Ce(this.language,t)}async loadTranslationsFromUrl(t){try{const e=await fetch(t);if(!e.ok){throw new Error(`HTTP ${e.status}: ${e.statusText}`)}const o=await e.json();return o}catch(t){console.error("Error loading translations from URL:",t);return xe}}cleanup(){this.stopMessagePolling();if(this.taskPollingHandle){this.taskPollingHandle.cancel();this.taskPollingHandle=undefined}this.currentPollTaskId=""}async startSession(){try{this.isLoading=true;const t=this.getOrGenerateUserId();const e={chatbot_id:this.chatbotId,session_data:{source:"widget",page_url:window.location.href},participant_remote_id:t};if(this.userName){e.participant_name=this.userName}const o=await this.getChatService().startSession(e);this.sessionId=o.session_id;this.saveSessionToStorage();this.startMessagePolling()}catch(t){this.handleError("Failed to start chat session")}finally{this.isLoading=false}}async uploadFiles(){if(this.selectedFiles.length===0||!this.sessionId||!this.allowAttachments){return[]}this.isUploadingFiles=true;try{const t=await this.attachmentManager.uploadPendingFiles(this.selectedFiles,{apiBaseUrl:this.apiBaseUrl||"https://www.openchatstudio.com",sessionId:this.sessionId,participantId:this.getOrGenerateUserId(),participantName:this.userName});this.selectedFiles=t.selectedFiles;return t.uploadedIds}finally{this.isUploadingFiles=false}}async sendMessage(t){if(!t.trim())return;if(!this.sessionId){if(this.isLoading){return}await this.startSession();if(!this.sessionId){return}}try{let e=[];if(this.allowAttachments&&this.selectedFiles.length>0){e=await this.uploadFiles();const t=this.selectedFiles.some((t=>t.error));if(t){this.handleError("Please remove or fix file errors before sending your message.");return}}const o=this.getWelcomeMessages();if(this.messages.length===0&&o.length>0){const t=new Date;const e=o.map(((e,r)=>({created_at:new Date(t.getTime()-(o.length-r)*1e3).toISOString(),role:"assistant",content:e,attachments:[]})));this.messages=[...this.messages,...e]}const r={created_at:(new Date).toISOString(),role:"user",content:t.trim(),attachments:this.allowAttachments?this.selectedFiles.filter((t=>!t.error&&t.uploaded)).map((t=>({name:t.file.name,content_type:t.file.type,size:t.file.size}))):[]};this.messages=[...this.messages,r];this.saveSessionToStorage();this.messageInput="";if(this.allowAttachments){this.selectedFiles=[]}this.scrollToBottom();const n={message:t.trim()};if(this.allowAttachments&&e.length>0){n.attachment_ids=e}const s=await this.getChatService().sendMessage(this.sessionId,n);if(s.status==="error"){throw new Error(s.error||"Failed to send message")}this.startTaskPolling(s.task_id)}catch(t){const e=t instanceof Error?t.message:"Failed to send message";this.handleError(e)}}handleStarterQuestionClick(t){this.sendMessage(t)}scrollToBottom(t=false){setTimeout((()=>{if(this.messageListRef){const e=this.messageListRef.lastElementChild;if(!t&&e){const t=this.messageListRef.getBoundingClientRect();const o=e.getBoundingClientRect();const r=this.messageListRef.scrollTop;const n=o.top-t.top;const s=r+n-t.height/2;this.messageListRef.scrollTo({top:s,behavior:"smooth"})}else{this.messageListRef.scrollTop=this.messageListRef.scrollHeight}}}),De.SCROLL_DELAY_MS)}focusInput(){setTimeout((()=>{if(this.textareaRef&&!this.isTyping){this.textareaRef.focus()}}),De.FOCUS_DELAY_MS)}handleKeyPress(t){if(t.key==="Enter"&&!t.shiftKey){t.preventDefault();this.sendMessage(this.messageInput)}}handleInputChange(t){this.messageInput=t.target.value}handleFileSelect(t){if(!this.allowAttachments)return;const e=t.target;if(!e.files||e.files.length===0)return;this.selectedFiles=this.attachmentManager.addFiles(this.selectedFiles,e.files);e.value=""}removeSelectedFile(t){if(!this.allowAttachments)return;this.selectedFiles=this.attachmentManager.removeFile(this.selectedFiles,t)}formatFileSize(t){if(t===0)return"0 KB";const e=1024;if(t<e*e){return Math.round(t/e*100)/100+" KB"}else{return Math.round(t/(e*e)*100)/100+" MB"}}formatTime(t){const e=new Date(t);return e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}toggleWindowVisibility(){this.visible=!this.visible}async visibilityHandler(t){if(this.isButtonDragging){this.isButtonDragging=false;this.buttonWasDragged=false;this.removeButtonEventListeners()}if(t){this.initializePosition();if(this.sessionId){this.scrollToBottom(true);this.startMessagePolling()}}else{this.stopMessagePolling()}}startTaskPolling(t){if(!this.sessionId)return;this.currentPollTaskId=t;this.isTyping=true;this.stopMessagePolling();if(this.taskPollingHandle){this.taskPollingHandle.cancel()}this.taskPollingHandle=this.getChatService().pollTask(this.sessionId,t,{onMessage:t=>{this.messages=[...this.messages,t];this.saveSessionToStorage();this.scrollToBottom();this.isTyping=false;this.currentPollTaskId="";this.taskPollingHandle=undefined;this.startMessagePolling();this.focusInput()},onTimeout:()=>{const t={created_at:(new Date).toISOString(),role:"system",content:"The response is taking longer than expected. The system may be experiencing delays. Please try sending your message again.",attachments:[]};this.messages=[...this.messages,t];this.saveSessionToStorage();this.scrollToBottom();this.isTyping=false;this.currentPollTaskId="";this.taskPollingHandle=undefined;this.startMessagePolling();this.focusInput()},onError:t=>{this.handleError(t.message);this.taskPollingHandle=undefined;this.startMessagePolling()}})}startMessagePolling(){if(!this.sessionId||this.currentPollTaskId||!this.visible){return}if(this.messagePollingHandle){return}this.messagePollingHandle=this.getChatService().startMessagePolling(this.sessionId,{getSince:()=>{var t;return this.messages.length>0?(t=this.messages.at(-1))===null||t===void 0?void 0:t.created_at:undefined},onMessages:t=>{if(t.length===0)return;this.messages=[...this.messages,...t];this.saveSessionToStorage();this.scrollToBottom();this.focusInput()},onError:()=>{}})}stopMessagePolling(){var t;if(this.messagePollingHandle){this.messagePollingHandle.stop();this.messagePollingHandle=undefined}else{(t=this.chatService)===null||t===void 0?void 0:t.stopMessagePolling()}}setPosition(t){if(t===this.position)return;this.position=t}getPositionClasses(){if(this.isFullscreen){return"chat-window-fullscreen"}const t="chat-window-normal";const e=this.isDragging?" chat-window-dragging":"";return t+e}getFullscreenBounds(){const t=window.innerWidth;const e=Math.min(t,this.chatWindowFullscreenWidth);const o=(t-e)/2;const r=(t-e)/2;return{windowWidth:t,actualChatWidth:e,centeredX:o,maxOffset:r}}getPositionStyles(){if(this.isFullscreen){const{centeredX:t}=this.getFullscreenBounds();const e=t+this.fullscreenPosition.x;return{left:`${e}px`,top:"0px",transform:"none"}}return{left:`${this.windowPosition.x}px`,top:`${this.windowPosition.y}px`}}initializePosition(){if(this.positionInitialized){return}this.positionInitialized=true;const t=window.innerWidth;const e=window.innerHeight;const o=t<De.MOBILE_BREAKPOINT?t:this.chatWindowWidth;const r=t<De.MOBILE_BREAKPOINT;if(r){this.windowPosition={x:0,y:0};return}switch(this.position){case"left":this.windowPosition={x:De.WINDOW_MARGIN,y:e-this.chatWindowHeight-De.WINDOW_MARGIN};break;case"right":this.windowPosition={x:t-o-De.WINDOW_MARGIN,y:e-this.chatWindowHeight-De.WINDOW_MARGIN};break;case"center":this.windowPosition={x:(t-o)/2,y:(e-this.chatWindowHeight)/2};break}}getPointerCoordinates(t){if(t instanceof MouseEvent){return{clientX:t.clientX,clientY:t.clientY}}else if(t instanceof TouchEvent&&t.touches.length===1){const e=t.touches[0];return{clientX:e.clientX,clientY:e.clientY}}return null}startDrag(t){if(!this.chatWindowRef)return;this.isDragging=true;if(this.isFullscreen){this.dragOffset={x:t.clientX,y:t.clientY}}else{const e=this.chatWindowRef.getBoundingClientRect();this.dragOffset={x:t.clientX-e.left,y:t.clientY-e.top}}}updateDragPosition(t){if(!this.isDragging)return;if(this.isFullscreen){const{maxOffset:e}=this.getFullscreenBounds();const o=t.clientX-this.dragOffset.x;this.fullscreenPosition={x:Math.max(-e,Math.min(e,o))}}else{const e=t.clientX-this.dragOffset.x;const o=t.clientY-this.dragOffset.y;const r=window.innerWidth;const n=window.innerHeight;const s=r<De.MOBILE_BREAKPOINT?r:this.chatWindowWidth;const i=this.chatWindowRef.offsetHeight;this.windowPosition={x:Math.max(0,Math.min(e,r-s)),y:Math.max(0,Math.min(o,n-i))}}}endDrag(){this.isDragging=false;this.removeEventListeners()}addEventListeners(){document.addEventListener("mousemove",this.handleMouseMove);document.addEventListener("mouseup",this.handleMouseUp);document.addEventListener("touchmove",this.handleTouchMove,{passive:false});document.addEventListener("touchend",this.handleTouchEnd)}removeEventListeners(){document.removeEventListener("mousemove",this.handleMouseMove);document.removeEventListener("mouseup",this.handleMouseUp);document.removeEventListener("touchmove",this.handleTouchMove);document.removeEventListener("touchend",this.handleTouchEnd)}initializeButtonPosition(){const t=getComputedStyle(this.host);const e=t.getPropertyValue("position");if(e!=="fixed"){return}const o=this.host.getBoundingClientRect();const r=window.innerWidth;const n=window.innerHeight;const s=t.getPropertyValue("left");const i=t.getPropertyValue("right");const a=t.getPropertyValue("top");const l=t.getPropertyValue("bottom");const c=!this.isAutoPosition(s);const h=!this.isAutoPosition(a);this.buttonHorizontalSide=c?"left":"right";this.buttonVerticalSide=h?"top":"bottom";const d=this.getNumericPositionValue(i,Math.max(0,r-o.right));const u=this.getNumericPositionValue(s,Math.max(0,o.left));const f=this.getNumericPositionValue(l,Math.max(0,n-o.bottom));const p=this.getNumericPositionValue(a,Math.max(0,o.top));const m=this.buttonHorizontalSide==="left"?u:d;const w=this.buttonVerticalSide==="top"?p:f;this.buttonPosition={x:m,y:w};this.updateHostPosition()}updateHostPosition(){this.host.style.position="fixed";if(this.buttonHorizontalSide==="left"){this.host.style.left=`${this.buttonPosition.x}px`;this.host.style.right="auto"}else{this.host.style.right=`${this.buttonPosition.x}px`;this.host.style.left="auto"}if(this.buttonVerticalSide==="top"){this.host.style.top=`${this.buttonPosition.y}px`;this.host.style.bottom="auto"}else{this.host.style.bottom=`${this.buttonPosition.y}px`;this.host.style.top="auto"}}isButtonDraggable(){const t=getComputedStyle(this.host);return t.getPropertyValue("position")==="fixed"}updateButtonPosition(t){var e,o;const r=window.innerWidth;const n=window.innerHeight;const s=((e=this.buttonRef)===null||e===void 0?void 0:e.offsetWidth)||60;const i=((o=this.buttonRef)===null||o===void 0?void 0:o.offsetHeight)||60;const a=10;const l=t.clientX-this.buttonDragOffset.x;const c=t.clientY-this.buttonDragOffset.y;const h=a;const d=r-s-a;const u=a;const f=n-i-a;const p=Math.max(h,Math.min(l,d));const m=Math.max(u,Math.min(c,f));const w=this.buttonHorizontalSide==="left"?p:Math.max(a,r-(p+s));const g=this.buttonVerticalSide==="top"?m:Math.max(a,n-(m+i));if(w!==this.buttonPosition.x||g!==this.buttonPosition.y){this.buttonWasDragged=true;this.buttonPosition={x:w,y:g};if(this.rafId===null){this.rafId=requestAnimationFrame((()=>{this.updateHostPosition();this.rafId=null}))}}}addButtonEventListeners(){if(this.buttonListenersAttached){return}document.addEventListener("mousemove",this.handleButtonMouseMove);document.addEventListener("mouseup",this.handleButtonMouseUp);document.addEventListener("touchmove",this.handleButtonTouchMove,{passive:false});document.addEventListener("touchend",this.handleButtonTouchEnd);this.buttonListenersAttached=true}removeButtonEventListeners(){if(!this.buttonListenersAttached){return}if(this.rafId!==null){cancelAnimationFrame(this.rafId);this.rafId=null}document.removeEventListener("mousemove",this.handleButtonMouseMove);document.removeEventListener("mouseup",this.handleButtonMouseUp);document.removeEventListener("touchmove",this.handleButtonTouchMove);document.removeEventListener("touchend",this.handleButtonTouchEnd);this.buttonListenersAttached=false}isAutoPosition(t){const e=t.trim();return e===""||e==="auto"}parsePixelValue(t){const e=t.trim();if(e===""||e==="auto"){return null}if(e.endsWith("px")){const t=parseFloat(e);return Number.isFinite(t)?t:null}const o=Number(e);if(Number.isFinite(o)){return o}return null}getNumericPositionValue(t,e){const o=this.parsePixelValue(t);if(o!==null){return o}return e}getWelcomeMessages(){const t=this.translationManager.getArray("content.welcomeMessages");return t&&t.length>0?t:this.parsedWelcomeMessages}getStarterQuestions(){const t=this.translationManager.getArray("content.starterQuestions");return t&&t.length>0?t:this.parsedStarterQuestions}getButtonClasses(){const t=this.translationManager.get("branding.buttonText",this.buttonText);const e=!!(t&&t.trim());const o=e?"chat-btn-text":"chat-btn-icon";const r=this.buttonShape==="round"?"round":"";return`${o} ${r}`.trim()}renderButton(){var e;const o=this.translationManager.get("branding.buttonText",this.buttonText);const r=!!(o&&o.trim());const n=this.iconUrl&&this.iconUrl.trim();const i=this.getButtonClasses();const a=o!==null&&o!==void 0?o:"";const l=(e=this.translationManager.get("launcher.open"))!==null&&e!==void 0?e:"";const c=a?`${l} - ${a}`:l;const h=this.isButtonDraggable();const d=h?{cursor:this.isButtonDragging?"grabbing":"grab"}:{};if(r){return t("button",{ref:t=>this.buttonRef=t,class:i,"aria-label":c,title:a||l,style:d,onClick:()=>this.handleButtonClick(),onMouseDown:t=>this.handleButtonMouseDown(t),onTouchStart:t=>this.handleButtonTouchStart(t),"aria-grabbed":this.isButtonDragging,"aria-describedby":h?"chat-button-drag-hint":undefined},n?t("img",{src:this.iconUrl,alt:""}):t(s,null),t("span",null,a),h&&t("span",{id:"chat-button-drag-hint",style:{display:"none"}},"Draggable. Use mouse or touch to reposition."))}else{return t("button",{ref:t=>this.buttonRef=t,class:i,"aria-label":l,title:l,style:d,onClick:()=>this.handleButtonClick(),onMouseDown:t=>this.handleButtonMouseDown(t),onTouchStart:t=>this.handleButtonTouchStart(t),"aria-grabbed":this.isButtonDragging,"aria-describedby":h?"chat-button-drag-hint":undefined},n?t("img",{src:this.iconUrl,alt:""}):t(s,null),h&&t("span",{id:"chat-button-drag-hint",style:{display:"none"}},"Draggable. Use mouse or touch to reposition."))}}getStorageKeys(){return{sessionId:`ocs-chat-session-${this.chatbotId}`,messages:`ocs-chat-messages-${this.chatbotId}`,lastActivity:`ocs-chat-activity-${this.chatbotId}`}}saveSessionToStorage(){if(!this.persistentSession){return}const t=this.getStorageKeys();try{if(this.sessionId){localStorage.setItem(t.sessionId,this.sessionId);localStorage.setItem(t.lastActivity,(new Date).toISOString())}localStorage.setItem(t.messages,JSON.stringify(this.messages))}catch(t){console.warn("Failed to save chat session to localStorage:",t)}}loadSessionFromStorage(){const t=this.getStorageKeys();try{if(this.persistentSessionExpire>0){const e=localStorage.getItem(t.lastActivity);if(e){const t=new Date(e);const o=(Date.now()-t.getTime())/(1e3*60);if(o>this.persistentSessionExpire){this.clearSessionStorage();return{messages:[]}}}}const e=localStorage.getItem(t.sessionId);const o=e?e:undefined;const r=localStorage.getItem(t.messages);let n=[];if(r){try{const t=JSON.parse(r);n=Array.isArray(t)?t:[]}catch(t){console.warn("Failed to parse messages from localStorage:",t);n=[]}}return{sessionId:o,messages:n}}catch(t){console.warn("Failed to load chat session from localStorage, starting new session:",t);return{messages:[]}}}getOrGenerateUserId(){if(this.userId){return this.userId}if(this.generatedUserId){return this.generatedUserId}const t=`ocs-user-id`;const e=localStorage.getItem(t);if(e){this.generatedUserId=e;return e}const o=new Uint8Array(9);window.crypto.getRandomValues(o);const r=Array.from(o,(t=>t.toString(36))).join("").substr(0,9);const n=`ocs:${Date.now()}_${r}`;this.generatedUserId=n;localStorage.setItem(t,n);return n}clearSessionStorage(){const t=this.getStorageKeys();try{localStorage.removeItem(t.sessionId);localStorage.removeItem(t.messages);localStorage.removeItem(t.lastActivity)}catch(t){console.warn("Failed to clear chat session from localStorage:",t)}}isLocalStorageAvailable(){try{localStorage.setItem(De.LOCALSTORAGE_TEST_KEY,"test");localStorage.removeItem(De.LOCALSTORAGE_TEST_KEY);return true}catch(t){return false}}showConfirmationDialog(){this.showNewChatConfirmation=true}hideConfirmationDialog(){this.showNewChatConfirmation=false}async confirmNewChat(){this.hideConfirmationDialog();await this.clearSession()}async clearSession(){this.clearSessionStorage();this.sessionId=undefined;this.messages=[];this.isTyping=false;this.currentPollTaskId="";if(this.allowAttachments){this.selectedFiles=[]}this.cleanup()}toggleFullscreen(){this.isFullscreen=!this.isFullscreen;this.fullscreenPosition={x:0}}render(){if(this.error&&!this.sessionId){return t(r,null,t("p",{class:"error-message"},this.error))}return t(r,null,this.renderButton(),this.visible&&t("div",{ref:t=>this.chatWindowRef=t,id:"ocs-chat-window",class:this.getPositionClasses(),style:this.getPositionStyles()},t("div",{class:`chat-header ${this.isDragging?"chat-header-dragging":"chat-header-draggable"}`,onMouseDown:this.handleMouseDown,onTouchStart:this.handleTouchStart},t("div",{class:"drag-indicator"},t("div",{class:"drag-dots header-button"},t(a,null))),t("div",{class:"header-text"},this.translationManager.get("branding.headerText",this.headerText)),t("div",{class:"header-buttons"},this.messages.length>0&&t("button",{class:"header-button",onClick:()=>this.showConfirmationDialog(),title:this.translationManager.get("window.newChat"),"aria-label":this.translationManager.get("window.newChat")},t(l,null)),this.allowFullScreen&&t("button",{class:"header-button fullscreen-button",onClick:()=>this.toggleFullscreen(),title:this.isFullscreen?this.translationManager.get("window.exitFullscreen"):this.translationManager.get("window.fullscreen"),"aria-label":this.isFullscreen?this.translationManager.get("window.exitFullscreen"):this.translationManager.get("window.fullscreen")},this.isFullscreen?t(h,null):t(c,null)),t("button",{class:"header-button",onClick:()=>this.visible=false,"aria-label":this.translationManager.get("window.close")},t(i,null)))),this.showNewChatConfirmation&&t("div",{class:"confirmation-overlay"},t("div",{class:"confirmation-dialog"},t("div",{class:"confirmation-content"},t("h3",{class:"confirmation-title"},this.translationManager.get("modal.newChatTitle")),t("p",{class:"confirmation-message"},this.translationManager.get("modal.newChatBody",this.newChatConfirmationMessage)),t("div",{class:"confirmation-buttons"},t("button",{class:"confirmation-button confirmation-button-cancel",onClick:()=>this.hideConfirmationDialog()},this.translationManager.get("modal.cancel")),t("button",{class:"confirmation-button confirmation-button-confirm",onClick:()=>this.confirmNewChat()},this.translationManager.get("modal.confirm")))))),t("div",{class:"chat-content"},this.isLoading&&!this.sessionId&&t("div",{class:"loading-container"},t("div",{class:"loading-spinner"}),t("span",{class:"loading-text"},this.translationManager.get("status.starting"))),t("div",{ref:t=>this.messageListRef=t,class:"messages-container"},this.messages.length===0&&this.getWelcomeMessages().length>0&&t("div",{class:"welcome-messages"},this.getWelcomeMessages().map(((e,o)=>t("div",{key:`welcome-${o}`,class:"message-row message-row-assistant"},t("div",{class:"message-bubble message-bubble-assistant"},t("div",{class:"chat-markdown",innerHTML:ce(e)})))))),this.messages.map(((e,o)=>t("div",{key:o,class:`message-row ${e.role==="user"?"message-row-user":"message-row-assistant"}`},t("div",{class:`message-bubble ${e.role==="user"?"message-bubble-user":e.role==="assistant"?"message-bubble-assistant":"message-bubble-system"}`},t("div",{class:"chat-markdown",innerHTML:ce(e.content)}),e.attachments&&e.attachments.length>0&&t("div",{class:"message-attachments"},e.attachments.map(((e,o)=>t("div",{key:o,class:"flex items-center gap-[0.5em]"},t("span",{class:"message-attachment-icon"},t(d,null)),t("span",{class:"message-attachment-name"},e.name))))),t("div",{class:"message-timestamp"},this.formatTime(e.created_at)))))),this.isTyping&&t("div",null,t("div",{class:"typing-indicator"},t("div",{class:"typing-progress"})),t("div",{class:"typing-text"},t("span",null,this.translationManager.get("status.typing",this.typingIndicatorText)),t("span",{class:"typing-dots loading"})))),this.messages.length===0&&this.getStarterQuestions().length>0&&t("div",{class:"starter-questions"},this.getStarterQuestions().map(((e,o)=>t("div",{key:`starter-${o}`,class:"starter-question-row"},t("button",{class:"starter-question",onClick:()=>this.handleStarterQuestionClick(e)},e))))),this.allowAttachments&&this.selectedFiles.length>0&&t("div",{class:"selected-files-container"},t("div",{class:"space-y-[0.25em]"},this.selectedFiles.map(((e,o)=>t("div",{key:o,class:"selected-file-item"},t("div",{class:"flex items-center gap-[0.5em]"},t("span",{class:"selected-file-icon"},t(d,null)),t("span",null,e.file.name),t("span",{class:"selected-file-size"},"(",this.formatFileSize(e.file.size),")"),e.error&&t("span",{class:"selected-file-error"},e.error),e.uploaded&&t("span",{class:"selected-file-success-icon"},t(u,null))),t("button",{onClick:()=>this.removeSelectedFile(o),class:"selected-file-remove-button","aria-label":this.translationManager.get("attach.remove")},t(f,null))))))),t("div",{class:"input-area"},t("div",{class:"input-container"},t("textarea",{ref:t=>this.textareaRef=t,class:"message-textarea",rows:1,placeholder:this.translationManager.get("composer.placeholder"),value:this.messageInput,onInput:t=>this.handleInputChange(t),onKeyPress:t=>this.handleKeyPress(t),disabled:this.isTyping||this.isUploadingFiles||this.isLoading}),this.allowAttachments&&t("input",{ref:t=>{if(t){this.fileInputRef=t}},id:"ocs-file-input",type:"file",multiple:true,accept:De.SUPPORTED_FILE_EXTENSIONS.join(","),onChange:t=>this.handleFileSelect(t),class:"hidden"}),this.allowAttachments&&t("button",{class:"file-attachment-button",onClick:()=>{var t;return(t=this.fileInputRef)===null||t===void 0?void 0:t.click()},disabled:this.isTyping||this.isUploadingFiles||this.isLoading,title:this.translationManager.get("attach.add"),"aria-label":this.translationManager.get("attach.add")},t(d,null)),t("button",{class:`send-button ${!this.isTyping&&!this.isLoading&&!!this.messageInput.trim()?"send-button-enabled":"send-button-disabled"}`,onClick:()=>this.sendMessage(this.messageInput),disabled:this.isTyping||this.isUploadingFiles||this.isLoading||!this.messageInput.trim()},this.isUploadingFiles?`${this.translationManager.get("status.uploading")}...`:this.translationManager.get("composer.send")))),t("div",{class:"flex items-center justify-center text-[0.8em] font-light w-full text-slate-500 py-[2px]"},t("p",null,this.translationManager.get("branding.poweredBy")," "," ",t("a",{class:"underline",href:"https://www.dimagi.com",target:"_blank"},"Dimagi"))))))}get host(){return n(this)}static get watchers(){return{visible:["visibilityHandler"]}}};De.TASK_POLLING_MAX_ATTEMPTS=120;De.TASK_POLLING_INTERVAL_MS=1e3;De.MESSAGE_POLLING_INTERVAL_MS=3e4;De.SCROLL_DELAY_MS=100;De.FOCUS_DELAY_MS=100;De.MOBILE_BREAKPOINT=640;De.WINDOW_MARGIN=20;De.LOCALSTORAGE_TEST_KEY="__ocs_test__";De.MAX_FILE_SIZE_MB=50;De.MAX_TOTAL_SIZE_MB=50;De.SUPPORTED_FILE_EXTENSIONS=[".txt",".pdf",".doc",".docx",".xls",".xlsx",".csv",".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".mp4",".mov",".avi",".mp3",".wav"];De.style=Re;export{De as open_chat_studio_widget};
4
- //# sourceMappingURL=p-96920183.entry.js.map