ai12z 3.13.3 → 3.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/cjs/ai12z-bot.cjs.entry.js +107 -19
  2. package/dist/cjs/ai12z-chat-message.cjs.entry.js +17 -46
  3. package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +14 -60
  4. package/dist/cjs/index.cjs.js +1 -0
  5. package/dist/cjs/styleSheetRegistry-7aecMygn.js +175 -0
  6. package/dist/collection/components/ai12z-bot/ai12z-bot.js +32 -13
  7. package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +15 -61
  8. package/dist/collection/components/ai12z-knowledge-box/components/ai12z-chat-message.js +16 -46
  9. package/dist/collection/utils/liveagents/providers/salesforce.js +75 -6
  10. package/dist/collection/utils/styleSheetRegistry.js +169 -0
  11. package/dist/components/ai12z-bot.js +1 -1
  12. package/dist/components/ai12z-chat-message.js +1 -1
  13. package/dist/components/ai12z-chat.js +1 -1
  14. package/dist/components/ai12z-container.js +1 -1
  15. package/dist/components/ai12z-cta.js +1 -1
  16. package/dist/components/ai12z-form.js +1 -1
  17. package/dist/components/ai12z-inline-search.js +1 -1
  18. package/dist/components/ai12z-input-form.js +1 -1
  19. package/dist/components/ai12z-knowledge-box.js +1 -1
  20. package/dist/components/ai12z-search-panel.js +1 -1
  21. package/dist/components/audio-recorder.js +1 -1
  22. package/dist/components/dynamic-form.js +1 -1
  23. package/dist/components/index.js +1 -1
  24. package/dist/components/interaction-buttons.js +1 -1
  25. package/dist/components/item-list.js +1 -1
  26. package/dist/components/{p-DKxaam7U.js → p-3j2aDKYq.js} +1 -1
  27. package/dist/components/{p-BP8ig03d.js → p-AQ1MS6Ps.js} +1 -1
  28. package/dist/components/p-B9IJbo4G.js +1 -0
  29. package/dist/components/{p-DsZWeAcM.js → p-BWMhH2R1.js} +1 -1
  30. package/dist/components/{p-5UYwpNzl.js → p-BaXs0IIw.js} +1 -1
  31. package/dist/components/{p-Gr6Q2s96.js → p-Bnj1LjUJ.js} +1 -1
  32. package/dist/components/p-BwpiW24r.js +1 -0
  33. package/dist/components/{p-Bo3Ig8oX.js → p-BwqXbNCx.js} +1 -1
  34. package/dist/components/{p-D2nUK4Pa.js → p-COqFEHJ7.js} +1 -1
  35. package/dist/components/{p-DA32xa7d.js → p-Ci85xHWQ.js} +1 -1
  36. package/dist/components/{p-DUaZgAhA.js → p-CrfXJRIo.js} +1 -1
  37. package/dist/components/{p-DJ68HDol.js → p-DkRAkHLI.js} +2 -2
  38. package/dist/components/{p-ha1wIlZ-.js → p-Dubjoiw6.js} +1 -1
  39. package/dist/components/{p-C2wKkcYa.js → p-DvtUY5FW.js} +1 -1
  40. package/dist/components/{p-J--erGbY.js → p-dQEvevXk.js} +1 -1
  41. package/dist/{library/p-DAGa-uHD.js → components/p-g36mIk7k.js} +1 -1
  42. package/dist/components/p-m0Ed3g6I.js +1 -0
  43. package/dist/components/p-mBjDeFh_.js +1 -0
  44. package/dist/components/{p-q7YWDP9B.js → p-pOVc-eI8.js} +1 -1
  45. package/dist/components/{p-BCJzelr9.js → p-qwKoi5kn.js} +1 -1
  46. package/dist/components/{p-CKAp10SJ.js → p-xTOLReQF.js} +1 -1
  47. package/dist/components/privacy-modal.js +1 -1
  48. package/dist/components/search-results-page.js +1 -1
  49. package/dist/esm/ai12z-bot.entry.js +115 -27
  50. package/dist/esm/ai12z-category_2.entry.js +3 -3
  51. package/dist/esm/ai12z-chat-message.entry.js +17 -46
  52. package/dist/esm/ai12z-chat_2.entry.js +8 -8
  53. package/dist/esm/ai12z-container.entry.js +3 -3
  54. package/dist/esm/ai12z-cta.entry.js +4 -4
  55. package/dist/esm/ai12z-form.entry.js +2 -2
  56. package/dist/esm/ai12z-inline-search.entry.js +2 -2
  57. package/dist/esm/ai12z-knowledge-box.entry.js +18 -64
  58. package/dist/esm/ai12z-search-panel.entry.js +1 -1
  59. package/dist/esm/chat-avatar_6.entry.js +1 -1
  60. package/dist/esm/{ctaHelpers-BhM8KbEY.js → ctaHelpers-DrH6S5iU.js} +1 -1
  61. package/dist/esm/dynamic-form.entry.js +1 -1
  62. package/dist/esm/{index-BQKLwW-C.js → index-VWr-8RG8.js} +1 -1
  63. package/dist/esm/index.js +10 -9
  64. package/dist/esm/item-list.entry.js +2 -2
  65. package/dist/esm/{keyboard-shortcuts-Bd3LDe9j.js → keyboard-shortcuts-BhKv64FZ.js} +2 -2
  66. package/dist/esm/{parseHelper-9rP0JS7J.js → parseHelper-kOGOndOe.js} +1 -1
  67. package/dist/esm/{processCarouselData-Bf2pDFsV.js → processCarouselData-DX152a4X.js} +1 -1
  68. package/dist/esm/{reCaptchaHelpers-CUcgfdqX.js → reCaptchaHelpers-DUpCzUFb.js} +1 -1
  69. package/dist/esm/search-results-page.entry.js +4 -4
  70. package/dist/esm/{socket-service-B1OMbkCM.js → socket-service-D_h5x8Gr.js} +1 -1
  71. package/dist/esm/styleSheetRegistry-Bfi9VkqK.js +172 -0
  72. package/dist/esm/{surveyHelpers-CvrZlir1.js → surveyHelpers-D-00eWjv.js} +1 -1
  73. package/dist/esm/{utils-BTLjNTwP.js → utils-DK_Yhmpx.js} +1 -1
  74. package/dist/library/index.esm.js +1 -1
  75. package/dist/library/library.esm.js +1 -1
  76. package/dist/library/{p-cd764f70.entry.js → p-11c1f91d.entry.js} +1 -1
  77. package/dist/library/{p-806bfb3d.entry.js → p-1d382046.entry.js} +1 -1
  78. package/dist/library/{p-0641ba91.entry.js → p-252bb713.entry.js} +2 -2
  79. package/dist/library/p-25a678ca.entry.js +1 -0
  80. package/dist/library/p-53edf210.entry.js +1 -0
  81. package/dist/library/p-646a7eae.entry.js +1 -0
  82. package/dist/library/p-675d0243.entry.js +1 -0
  83. package/dist/library/{p-60d5d99f.entry.js → p-6ea05db1.entry.js} +1 -1
  84. package/dist/library/{p-7f0e306c.entry.js → p-7154a204.entry.js} +1 -1
  85. package/dist/library/{p-07f11cb8.entry.js → p-72a5eaf2.entry.js} +1 -1
  86. package/dist/library/{p-2d262192.entry.js → p-8f238b3f.entry.js} +1 -1
  87. package/dist/library/p-9cffb6fa.entry.js +1 -0
  88. package/dist/library/{p-y3Go1NSi.js → p-BCkDiHIY.js} +1 -1
  89. package/dist/{components/p-BhV62IFF.js → library/p-By1gJKXA.js} +1 -1
  90. package/dist/library/{p-Bbow4UZX.js → p-C0wNDqKO.js} +1 -1
  91. package/dist/library/p-C3yxqbFh.js +1 -0
  92. package/dist/library/p-CwZwG6gL.js +1 -0
  93. package/dist/library/{p-D5m1leH0.js → p-D1IPrgJe.js} +3 -3
  94. package/dist/library/{p-NAKC5NP9.js → p-KSKiM1sy.js} +1 -1
  95. package/dist/library/{p-C1eU4fpM.js → p-TJuczvVq.js} +1 -1
  96. package/dist/library/{p-CnadO0kA.js → p-ZyOWOLs5.js} +1 -1
  97. package/dist/library/{p-94bf0c7f.entry.js → p-cbfc9f73.entry.js} +1 -1
  98. package/dist/library/{p-014d5664.entry.js → p-d8506e43.entry.js} +1 -1
  99. package/dist/library/{p-BZ_koFpE.js → p-n8ydBHE4.js} +1 -1
  100. package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +1 -0
  101. package/dist/types/components/ai12z-knowledge-box/ai12z-knowledge-box.d.ts +0 -3
  102. package/dist/types/components/ai12z-knowledge-box/components/ai12z-chat-message.d.ts +0 -2
  103. package/dist/types/utils/liveagents/providers/salesforce.d.ts +2 -0
  104. package/dist/types/utils/styleSheetRegistry.d.ts +40 -0
  105. package/package.json +2 -2
  106. package/dist/components/p-B3lv_O-6.js +0 -1
  107. package/dist/components/p-CLdlCTTp.js +0 -1
  108. package/dist/components/p-DT0Uarfg.js +0 -1
  109. package/dist/components/p-zVXADzTq.js +0 -1
  110. package/dist/library/p-29cd4edc.entry.js +0 -1
  111. package/dist/library/p-6f3727d3.entry.js +0 -1
  112. package/dist/library/p-83a71da9.entry.js +0 -1
  113. package/dist/library/p-DoBD_KPG.js +0 -1
  114. package/dist/library/p-d3a2acee.entry.js +0 -1
  115. package/dist/library/p-dc131a5c.entry.js +0 -1
@@ -1,2 +1,2 @@
1
- import{p as e,H as t,d as n,E as i,e as r,h as o,t as a}from"./p-ZGVz1_9H.js";import{a as s,H as l,m as c,n as u,d}from"./p-DUaZgAhA.js";import{s as f,p}from"./p-D2nUK4Pa.js";import{i as m,p as h,r as g}from"./p-DmqUTHP1.js";
2
- /*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:y,setPrototypeOf:w,isFrozen:b,getPrototypeOf:v,getOwnPropertyDescriptor:x}=Object;let{freeze:k,seal:T,create:A}=Object,{apply:S,construct:E}="undefined"!=typeof Reflect&&Reflect;k||(k=function(e){return e}),T||(T=function(e){return e}),S||(S=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return e.apply(t,i)}),E||(E=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const R=B(Array.prototype.forEach),_=B(Array.prototype.lastIndexOf),z=B(Array.prototype.pop),D=B(Array.prototype.push),L=B(Array.prototype.splice),P=B(String.prototype.toLowerCase),O=B(String.prototype.toString),C=B(String.prototype.match),M=B(String.prototype.replace),F=B(String.prototype.indexOf),N=B(String.prototype.trim),I=B(Object.prototype.hasOwnProperty),j=B(RegExp.prototype.test),U=(q=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return E(q,t)});var q;function B(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return S(e,t,i)}}function H(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P;w&&w(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(b(t)||(t[i]=e),r=e)}e[r]=!0}return e}function W(e){for(let t=0;t<e.length;t++)I(e,t)||(e[t]=null);return e}function $(e){const t=A(null);for(const[n,i]of y(e))I(e,n)&&(t[n]=Array.isArray(i)?W(i):i&&"object"==typeof i&&i.constructor===Object?$(i):i);return t}function G(e,t){for(;null!==e;){const n=x(e,t);if(n){if(n.get)return B(n.get);if("function"==typeof n.value)return B(n.value)}e=v(e)}return function(){return null}}const Y=k(["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","search","section","select","shadow","slot","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"]),K=k(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),X=k(["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"]),V=k(["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"]),Z=k(["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"]),Q=k(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),J=k(["#text"]),ee=k(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),te=k(["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","mask-type","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"]),ne=k(["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"]),ie=k(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),re=T(/\{\{[\w\W]*|[\w\W]*\}\}/gm),oe=T(/<%[\w\W]*|[\w\W]*%>/gm),ae=T(/\$\{[\w\W]*/gm),se=T(/^data-[\-\w.\u00B7-\uFFFF]+$/),le=T(/^aria-[\-\w]+$/),ce=T(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ue=T(/^(?:\w+script|data):/i),de=T(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fe=T(/^html$/i),pe=T(/^[a-z][.\w]*(-[.\w]+)+$/i);var me=Object.freeze({__proto__:null,ARIA_ATTR:le,ATTR_WHITESPACE:de,CUSTOM_ELEMENT:pe,DATA_ATTR:se,DOCTYPE_NAME:fe,ERB_EXPR:oe,IS_ALLOWED_URI:ce,IS_SCRIPT_OR_DATA:ue,MUSTACHE_EXPR:re,TMPLIT_EXPR:ae});const he=function(){return"undefined"==typeof window?null:window};var ge=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:he();const n=t=>e(t);if(n.version="3.3.3",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,o=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:m}=t,h=c.prototype,g=G(h,"cloneNode"),w=G(h,"remove"),b=G(h,"nextSibling"),v=G(h,"childNodes"),x=G(h,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let T,S="";const{implementation:E,createNodeIterator:q,createDocumentFragment:B,getElementsByTagName:W}=i,{importNode:re}=r;let oe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof y&&"function"==typeof x&&E&&void 0!==E.createHTMLDocument;const{MUSTACHE_EXPR:ae,ERB_EXPR:se,TMPLIT_EXPR:le,DATA_ATTR:ue,ARIA_ATTR:de,IS_SCRIPT_OR_DATA:pe,ATTR_WHITESPACE:ge,CUSTOM_ELEMENT:ye}=me;let{IS_ALLOWED_URI:we}=me,be=null;const ve=H({},[...Y,...K,...X,...Z,...J]);let xe=null;const ke=H({},[...ee,...te,...ne,...ie]);let Te=Object.seal(A(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Se=null;const Ee=Object.seal(A(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Re=!0,_e=!0,ze=!1,De=!0,Le=!1,Pe=!0,Oe=!1,Ce=!1,Me=!1,Fe=!1,Ne=!1,Ie=!1,je=!0,Ue=!1,qe=!0,Be=!1,He={},We=null;const $e=H({},["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 Ge=null;const Ye=H({},["audio","video","img","source","image","track"]);let Ke=null;const Xe=H({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ve="http://www.w3.org/1998/Math/MathML",Ze="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let Je=Qe,et=!1,tt=null;const nt=H({},[Ve,Ze,Qe],O);let it=H({},["mi","mo","mn","ms","mtext"]),rt=H({},["annotation-xml"]);const ot=H({},["title","style","font","a","script"]);let at=null;const st=["application/xhtml+xml","text/html"];let lt=null,ct=null;const ut=i.createElement("form"),dt=function(e){return e instanceof RegExp||e instanceof Function},ft=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ct||ct!==e){if(e&&"object"==typeof e||(e={}),e=$(e),at=-1===st.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,lt="application/xhtml+xml"===at?O:P,be=I(e,"ALLOWED_TAGS")?H({},e.ALLOWED_TAGS,lt):ve,xe=I(e,"ALLOWED_ATTR")?H({},e.ALLOWED_ATTR,lt):ke,tt=I(e,"ALLOWED_NAMESPACES")?H({},e.ALLOWED_NAMESPACES,O):nt,Ke=I(e,"ADD_URI_SAFE_ATTR")?H($(Xe),e.ADD_URI_SAFE_ATTR,lt):Xe,Ge=I(e,"ADD_DATA_URI_TAGS")?H($(Ye),e.ADD_DATA_URI_TAGS,lt):Ye,We=I(e,"FORBID_CONTENTS")?H({},e.FORBID_CONTENTS,lt):$e,Ae=I(e,"FORBID_TAGS")?H({},e.FORBID_TAGS,lt):$({}),Se=I(e,"FORBID_ATTR")?H({},e.FORBID_ATTR,lt):$({}),He=!!I(e,"USE_PROFILES")&&e.USE_PROFILES,Re=!1!==e.ALLOW_ARIA_ATTR,_e=!1!==e.ALLOW_DATA_ATTR,ze=e.ALLOW_UNKNOWN_PROTOCOLS||!1,De=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Le=e.SAFE_FOR_TEMPLATES||!1,Pe=!1!==e.SAFE_FOR_XML,Oe=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,Ne=e.RETURN_DOM_FRAGMENT||!1,Ie=e.RETURN_TRUSTED_TYPE||!1,Me=e.FORCE_BODY||!1,je=!1!==e.SANITIZE_DOM,Ue=e.SANITIZE_NAMED_PROPS||!1,qe=!1!==e.KEEP_CONTENT,Be=e.IN_PLACE||!1,we=e.ALLOWED_URI_REGEXP||ce,Je=e.NAMESPACE||Qe,it=e.MATHML_TEXT_INTEGRATION_POINTS||it,rt=e.HTML_INTEGRATION_POINTS||rt,Te=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Te.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Le&&(_e=!1),Ne&&(Fe=!0),He&&(be=H({},J),xe=A(null),!0===He.html&&(H(be,Y),H(xe,ee)),!0===He.svg&&(H(be,K),H(xe,te),H(xe,ie)),!0===He.svgFilters&&(H(be,X),H(xe,te),H(xe,ie)),!0===He.mathMl&&(H(be,Z),H(xe,ne),H(xe,ie))),I(e,"ADD_TAGS")||(Ee.tagCheck=null),I(e,"ADD_ATTR")||(Ee.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Ee.tagCheck=e.ADD_TAGS:(be===ve&&(be=$(be)),H(be,e.ADD_TAGS,lt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Ee.attributeCheck=e.ADD_ATTR:(xe===ke&&(xe=$(xe)),H(xe,e.ADD_ATTR,lt))),e.ADD_URI_SAFE_ATTR&&H(Ke,e.ADD_URI_SAFE_ATTR,lt),e.FORBID_CONTENTS&&(We===$e&&(We=$(We)),H(We,e.FORBID_CONTENTS,lt)),e.ADD_FORBID_CONTENTS&&(We===$e&&(We=$(We)),H(We,e.ADD_FORBID_CONTENTS,lt)),qe&&(be["#text"]=!0),Oe&&H(be,["html","head","body"]),be.table&&(H(be,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw U('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw U('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=e.TRUSTED_TYPES_POLICY,S=T.createHTML("")}else void 0===T&&(T=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(m,o)),null!==T&&"string"==typeof S&&(S=T.createHTML(""));k&&k(e),ct=e}},pt=H({},[...K,...X,...V]),mt=H({},[...Z,...Q]),ht=function(e){D(n.removed,{element:e});try{x(e).removeChild(e)}catch(t){w(e)}},gt=function(e,t){try{D(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){D(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Fe||Ne)try{ht(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},yt=function(e){let t=null,n=null;if(Me)e="<remove></remove>"+e;else{const t=C(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===at&&Je===Qe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=T?T.createHTML(e):e;if(Je===Qe)try{t=(new p).parseFromString(r,at)}catch(e){}if(!t||!t.documentElement){t=E.createDocument(Je,"template",null);try{t.documentElement.innerHTML=et?S:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),Je===Qe?W.call(t,Oe?"html":"body")[0]:Oe?t.documentElement:o},wt=function(e){return q.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},bt=function(e){return e instanceof f&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},vt=function(e){return"function"==typeof l&&e instanceof l};function xt(e,t,i){R(e,(e=>{e.call(n,t,i,ct)}))}const kt=function(e){let t=null;if(xt(oe.beforeSanitizeElements,e,null),bt(e))return ht(e),!0;const i=lt(e.nodeName);if(xt(oe.uponSanitizeElement,e,{tagName:i,allowedTags:be}),Pe&&e.hasChildNodes()&&!vt(e.firstElementChild)&&j(/<[/\w!]/g,e.innerHTML)&&j(/<[/\w!]/g,e.textContent))return ht(e),!0;if(7===e.nodeType)return ht(e),!0;if(Pe&&8===e.nodeType&&j(/<[/\w]/g,e.data))return ht(e),!0;if(!(Ee.tagCheck instanceof Function&&Ee.tagCheck(i))&&(!be[i]||Ae[i])){if(!Ae[i]&&At(i)){if(Te.tagNameCheck instanceof RegExp&&j(Te.tagNameCheck,i))return!1;if(Te.tagNameCheck instanceof Function&&Te.tagNameCheck(i))return!1}if(qe&&!We[i]){const t=x(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t)for(let i=n.length-1;i>=0;--i){const r=g(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,b(e))}}return ht(e),!0}return e instanceof c&&!function(e){let t=x(e);t&&t.tagName||(t={namespaceURI:Je,tagName:"template"});const n=P(e.tagName),i=P(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Ze?t.namespaceURI===Qe?"svg"===n:t.namespaceURI===Ve?"svg"===n&&("annotation-xml"===i||it[i]):Boolean(pt[n]):e.namespaceURI===Ve?t.namespaceURI===Qe?"math"===n:t.namespaceURI===Ze?"math"===n&&rt[i]:Boolean(mt[n]):e.namespaceURI===Qe?!(t.namespaceURI===Ze&&!rt[i])&&!(t.namespaceURI===Ve&&!it[i])&&!mt[n]&&(ot[n]||!pt[n]):!("application/xhtml+xml"!==at||!tt[e.namespaceURI]))}(e)?(ht(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!j(/<\/no(script|embed|frames)/i,e.innerHTML)?(Le&&3===e.nodeType&&(t=e.textContent,R([ae,se,le],(e=>{t=M(t,e," ")})),e.textContent!==t&&(D(n.removed,{element:e.cloneNode()}),e.textContent=t)),xt(oe.afterSanitizeElements,e,null),!1):(ht(e),!0)},Tt=function(e,t,n){if(Se[t])return!1;if(je&&("id"===t||"name"===t)&&(n in i||n in ut))return!1;if(_e&&!Se[t]&&j(ue,t));else if(Re&&j(de,t));else if(Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e));else if(!xe[t]||Se[t]){if(!(At(e)&&(Te.tagNameCheck instanceof RegExp&&j(Te.tagNameCheck,e)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(e))&&(Te.attributeNameCheck instanceof RegExp&&j(Te.attributeNameCheck,t)||Te.attributeNameCheck instanceof Function&&Te.attributeNameCheck(t,e))||"is"===t&&Te.allowCustomizedBuiltInElements&&(Te.tagNameCheck instanceof RegExp&&j(Te.tagNameCheck,n)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(n))))return!1}else if(Ke[t]);else if(j(we,M(n,ge,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==F(n,"data:")||!Ge[e])if(ze&&!j(pe,M(n,ge,"")));else if(n)return!1;return!0},At=function(e){return"annotation-xml"!==e&&C(e,ye)},St=function(e){xt(oe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||bt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let r=t.length;for(;r--;){const o=t[r],{name:a,namespaceURI:s,value:l}=o,c=lt(a),u=l;let d="value"===a?u:N(u);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,xt(oe.uponSanitizeAttribute,e,i),d=i.attrValue,!Ue||"id"!==c&&"name"!==c||(gt(a,e),d="user-content-"+d),Pe&&j(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){gt(a,e);continue}if("attributename"===c&&C(d,"href")){gt(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){gt(a,e);continue}if(!De&&j(/\/>/i,d)){gt(a,e);continue}Le&&R([ae,se,le],(e=>{d=M(d,e," ")}));const f=lt(e.nodeName);if(Tt(f,c,d)){if(T&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(s);else switch(m.getAttributeType(f,c)){case"TrustedHTML":d=T.createHTML(d);break;case"TrustedScriptURL":d=T.createScriptURL(d)}if(d!==u)try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),bt(e)?ht(e):z(n.removed)}catch(t){gt(a,e)}}else gt(a,e)}xt(oe.afterSanitizeAttributes,e,null)},Et=function e(t){let n=null;const i=wt(t);for(xt(oe.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)xt(oe.uponSanitizeShadowNode,n,null),kt(n),St(n),n.content instanceof a&&e(n.content);xt(oe.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,o=null,s=null,c=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!vt(e)){if("function"!=typeof e.toString)throw U("toString is not a function");if("string"!=typeof(e=e.toString()))throw U("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Ce||ft(t),n.removed=[],"string"==typeof e&&(Be=!1),Be){if(e.nodeName){const t=lt(e.nodeName);if(!be[t]||Ae[t])throw U("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=yt("\x3c!----\x3e"),o=i.ownerDocument.importNode(e,!0),1===o.nodeType&&"BODY"===o.nodeName||"HTML"===o.nodeName?i=o:i.appendChild(o);else{if(!Fe&&!Le&&!Oe&&-1===e.indexOf("<"))return T&&Ie?T.createHTML(e):e;if(i=yt(e),!i)return Fe?null:Ie?S:""}i&&Me&&ht(i.firstChild);const u=wt(Be?e:i);for(;s=u.nextNode();)kt(s),St(s),s.content instanceof a&&Et(s.content);if(Be)return e;if(Fe){if(Ne)for(c=B.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(xe.shadowroot||xe.shadowrootmode)&&(c=re.call(r,c,!0)),c}let d=Oe?i.outerHTML:i.innerHTML;return Oe&&be["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&j(fe,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Le&&R([ae,se,le],(e=>{d=M(d,e," ")})),T&&Ie?T.createHTML(d):d},n.setConfig=function(){ft(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ce=!0},n.clearConfig=function(){ct=null,Ce=!1},n.isValidAttribute=function(e,t,n){ct||ft({});const i=lt(e),r=lt(t);return Tt(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&D(oe[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=_(oe[e],t);return-1===n?void 0:L(oe[e],n,1)[0]}return z(oe[e])},n.removeHooks=function(e){oe[e]=[]},n.removeAllHooks=function(){oe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const ye=e(class e extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.responseReceived=n(this,"responseReceived",7),this.errored=n(this,"errored",7),this.isDisconnected=!1,this.dataKey=i.DATA_KEY||"",this.dataMode=i.DATA_MODE||"prod",this.keyName="",this.instanceId="",this.renderType="integration",this.contentTemplate="",this.isLoading=!1,this.error="",this.contentText="",this.htmlWidgetMarkup="",this.domId=`widget-${s()}`,this.registrationKey="",this.requestVersion=0,this.lastKbResponse=null,this.markAsActive=()=>{this.registrationKey&&r.setActive(this.registrationKey)},this.initializeScript=e=>(this.markAsActive(),m(e,this.mainObject))}get mainObject(){return window.ai12z||(window.ai12z={}),window.ai12z}getResolvedKeyName(){var e,t,n,i,r;const o=null===(e=this.keyName)||void 0===e?void 0:e.trim(),a=(null===(n=null===(t=this.el)||void 0===t?void 0:t.getAttribute("key-name"))||void 0===n?void 0:n.trim())||"";if(o)return o;if(a)return a;if("undefined"==typeof window)return"";const s=new URLSearchParams(window.location.search);return(null===(i=s.get("keyName"))||void 0===i?void 0:i.trim())||(null===(r=s.get("keyname"))||void 0===r?void 0:r.trim())||""}waitForNextPaint(e=0){return new Promise((t=>{requestAnimationFrame((()=>{e>0?setTimeout((()=>t()),e):t()}))}))}async renderControl(t){switch(await this.waitForNextPaint(e.CONTAINER_MOUNT_DELAY_MS),this.renderType){case"carousel":await p({id:`carousel-${this.domId}`},{controlData:t},this.el,(e=>this.hideSpinner(e)),(()=>{}),t.scripts,t.styles,!1,"widget");break;case"template":let e=!1;await new Promise((n=>{const i=()=>{e||(e=!0,n())};h({id:`html-${this.domId}`},{controlData:t,controlType:t.controlType},this.el.shadowRoot,(e=>this.hideSpinner(e)),(async e=>{await this.renderTemplateData(e),i()}),(()=>{this.markAsActive()}),l).then(i)}));break;case"content":{this.lastKbResponse=t;const e=null==t?void 0:t.data;if(!e){this.error="Knowledge base content unavailable.",this.errored.emit(this.error);break}let{question:n="",answer:i=""}=e;if(i=(new f.Converter).makeHtml(i),n=(new f.Converter).makeHtml(n),this.contentTemplate){const e=l.compile(this.contentTemplate);this.contentText=e({question:n,answer:i}),this.contentText=ge.sanitize(this.contentText)}else this.contentText=ge.sanitize(i);break}}}async componentWillLoad(){var e;this.registrationKey=(null===(e=this.instanceId)||void 0===e?void 0:e.trim())||`container-${this.domId}`,r.register(this.registrationKey,this),(this.getResolvedKeyName()&&void 0!==this.parameters||"content"===this.renderType)&&await this.invokeApi()}componentDidLoad(){"undefined"==typeof window||window.Handlebars||(window.Handlebars=l),this.el.addEventListener("focusin",this.markAsActive),this.el.addEventListener("pointerenter",this.markAsActive)}disconnectedCallback(){this.el.removeEventListener("focusin",this.markAsActive),this.el.removeEventListener("pointerenter",this.markAsActive),this.isDisconnected=!0,this.registrationKey&&r.unregister(this.registrationKey)}async onParametersChanged(e,t){e!==t&&this.getResolvedKeyName()&&await this.invokeApi(e)}onContentTemplateChanged(){if("content"!==this.renderType||!this.lastKbResponse)return;const{question:e="",answer:t=""}=this.lastKbResponse.data||{},n=this.contentTemplate?l.compile(this.contentTemplate)({question:e,answer:t}):t;this.contentText=ge.sanitize(n)}async invokeApi(t=this.parameters){this.error="";const n=++this.requestVersion,i=this.getResolvedKeyName();if(!i)return this.error='Key Name is required. Provide the "key-name" attribute or pass "keyName" in the URL.',this.errored.emit(this.error),void(this.isLoading=!1);e.renderQueueTail=e.renderQueueTail.then((async()=>{try{if(this.isDisconnected||n!==this.requestVersion)return;let e;if(this.registrationKey&&r.setActive(this.registrationKey),this.isLoading=!0,"content"===this.renderType?e=await c(this.dataKey,this.dataMode,i):(e=await u(this.dataKey,this.dataMode,i,t),this.renderType=e.controlType),this.isDisconnected||n!==this.requestVersion)return;if(this.isLoading=!1,await this.waitForNextPaint(150),await this.renderControl(e),this.isDisconnected||n!==this.requestVersion)return;this.responseReceived.emit(e),await this.waitForNextPaint(600)}catch(e){this.error=(null==e?void 0:e.message)||"Failed to load widget response",console.error("Failed to retrieve data",e),this.errored.emit(this.error)}finally{this.isLoading=!1}})).catch((e=>{console.error("Queue item failed — chain preserved:",e)}))}async renderTemplateData(e){await g(e,this.el,[],this.mainObject,this.initializeScript)}hideSpinner(e){return new Promise((t=>{const n=this.el.shadowRoot.querySelector(`#${e.id}`);if(n){const e=n.querySelector("#spinner");e&&(e.style.display="none")}t(!0)}))}renderSpinner(){return o("div",{class:"widget-spinner",id:"spinner"},o("div",{class:"widget-spinner-pulse"},o("div",{class:"widget-spinner-body"},o("div",{class:"widget-spinner-bar"}),o("div",{class:"widget-spinner-rows"},o("div",{class:"widget-spinner-grid"},o("div",{class:"widget-spinner-col-wide"}),o("div",{class:"widget-spinner-col-narrow"})),o("div",{class:"widget-spinner-bar"})))))}renderByType(){switch(this.renderType){case"carousel":return o("div",{class:"carousel-grid",id:`carousel-${this.domId}`},this.renderSpinner());case"template":return o("div",{class:"html-widget",id:`html-${this.domId}`},this.renderSpinner());default:return o("div",{class:"content-widget",id:`content-${this.domId}`,innerHTML:this.contentText})}}render(){return o("div",{key:"ec7c4261c505fb29882acf30d0c9c10a8703dc51",class:"ai12z-container-root"},this.isLoading&&o("div",{key:"ab3899fe20a637293b1fa5c24b40edf9cc20f333",class:"state-message"},"Loading..."),!this.isLoading&&this.error&&o("div",{key:"d70e83ff89ab6df1b090e7034f021c71466796c6",class:"state-message error"},this.error),!this.isLoading&&!this.error&&this.renderByType())}get el(){return this}static get watchers(){return{parameters:[{onParametersChanged:0}],contentTemplate:[{onContentTemplateChanged:0}]}}static get style(){return".ai12z-container-root{width:100%;box-sizing:border-box}.state-message{padding:12px;border-radius:8px;background:#f4f7fb;color:#1f2937;font-size:14px}.state-message.error{background:#fdecec;color:#991b1b}.widget-spinner{width:100%;border-radius:6px}.widget-spinner-pulse{display:flex;animation:widget-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;gap:16px}@keyframes widget-pulse{0%,100%{opacity:1}50%{opacity:0.4}}.widget-spinner-body{flex:1;display:flex;flex-direction:column;gap:12px;padding:4px 0}.widget-spinner-bar{height:16px;border-radius:4px;background:#e5e7eb}.widget-spinner-rows{display:flex;flex-direction:column;gap:12px}.widget-spinner-grid{display:grid;grid-template-columns:2fr 1fr;gap:16px}.widget-spinner-col-wide,.widget-spinner-col-narrow{height:16px;border-radius:4px;background:#e5e7eb}"}},[1,"ai12z-container",{dataKey:[513,"data-key"],dataMode:[513,"data-mode"],keyName:[513,"key-name"],instanceId:[513,"instance-id"],parameters:[513],renderType:[1537,"render-type"],contentTemplate:[513,"content-template"],isLoading:[32],error:[32],contentText:[32],htmlWidgetMarkup:[32],domId:[32]},void 0,{parameters:[{onParametersChanged:0}],contentTemplate:[{onContentTemplateChanged:0}]}]);function we(){"undefined"!=typeof customElements&&["ai12z-container","item-list"].forEach((e=>{switch(e){case"ai12z-container":customElements.get(a(e))||customElements.define(a(e),ye);break;case"item-list":customElements.get(a(e))||d()}}))}ye.renderQueueTail=Promise.resolve(),ye.CONTAINER_MOUNT_DELAY_MS=150,we();export{ye as A,we as d}
1
+ import{p as e,H as t,d as n,E as i,e as r,h as o,t as a}from"./p-ZGVz1_9H.js";import{a as s,H as l,m as c,n as u,d}from"./p-CrfXJRIo.js";import{s as f,p}from"./p-COqFEHJ7.js";import{i as m,p as h,r as g}from"./p-DmqUTHP1.js";
2
+ /*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:y,setPrototypeOf:w,isFrozen:b,getPrototypeOf:v,getOwnPropertyDescriptor:x}=Object;let{freeze:k,seal:T,create:A}=Object,{apply:S,construct:E}="undefined"!=typeof Reflect&&Reflect;k||(k=function(e){return e}),T||(T=function(e){return e}),S||(S=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return e.apply(t,i)}),E||(E=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const R=B(Array.prototype.forEach),_=B(Array.prototype.lastIndexOf),z=B(Array.prototype.pop),D=B(Array.prototype.push),L=B(Array.prototype.splice),O=B(String.prototype.toLowerCase),C=B(String.prototype.toString),P=B(String.prototype.match),M=B(String.prototype.replace),F=B(String.prototype.indexOf),I=B(String.prototype.trim),N=B(Object.prototype.hasOwnProperty),j=B(RegExp.prototype.test),U=(q=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return E(q,t)});var q;function B(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return S(e,t,i)}}function H(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:O;w&&w(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(b(t)||(t[i]=e),r=e)}e[r]=!0}return e}function W(e){for(let t=0;t<e.length;t++)N(e,t)||(e[t]=null);return e}function $(e){const t=A(null);for(const[n,i]of y(e))N(e,n)&&(t[n]=Array.isArray(i)?W(i):i&&"object"==typeof i&&i.constructor===Object?$(i):i);return t}function G(e,t){for(;null!==e;){const n=x(e,t);if(n){if(n.get)return B(n.get);if("function"==typeof n.value)return B(n.value)}e=v(e)}return function(){return null}}const X=k(["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","search","section","select","shadow","slot","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"]),Y=k(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),K=k(["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"]),J=k(["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"]),V=k(["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"]),Q=k(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Z=k(["#text"]),ee=k(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),te=k(["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","mask-type","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"]),ne=k(["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"]),ie=k(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),re=T(/\{\{[\w\W]*|[\w\W]*\}\}/gm),oe=T(/<%[\w\W]*|[\w\W]*%>/gm),ae=T(/\$\{[\w\W]*/gm),se=T(/^data-[\-\w.\u00B7-\uFFFF]+$/),le=T(/^aria-[\-\w]+$/),ce=T(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ue=T(/^(?:\w+script|data):/i),de=T(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fe=T(/^html$/i),pe=T(/^[a-z][.\w]*(-[.\w]+)+$/i);var me=Object.freeze({__proto__:null,ARIA_ATTR:le,ATTR_WHITESPACE:de,CUSTOM_ELEMENT:pe,DATA_ATTR:se,DOCTYPE_NAME:fe,ERB_EXPR:oe,IS_ALLOWED_URI:ce,IS_SCRIPT_OR_DATA:ue,MUSTACHE_EXPR:re,TMPLIT_EXPR:ae});const he=function(){return"undefined"==typeof window?null:window};var ge=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:he();const n=t=>e(t);if(n.version="3.3.3",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,o=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:m}=t,h=c.prototype,g=G(h,"cloneNode"),w=G(h,"remove"),b=G(h,"nextSibling"),v=G(h,"childNodes"),x=G(h,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let T,S="";const{implementation:E,createNodeIterator:q,createDocumentFragment:B,getElementsByTagName:W}=i,{importNode:re}=r;let oe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof y&&"function"==typeof x&&E&&void 0!==E.createHTMLDocument;const{MUSTACHE_EXPR:ae,ERB_EXPR:se,TMPLIT_EXPR:le,DATA_ATTR:ue,ARIA_ATTR:de,IS_SCRIPT_OR_DATA:pe,ATTR_WHITESPACE:ge,CUSTOM_ELEMENT:ye}=me;let{IS_ALLOWED_URI:we}=me,be=null;const ve=H({},[...X,...Y,...K,...V,...Z]);let xe=null;const ke=H({},[...ee,...te,...ne,...ie]);let Te=Object.seal(A(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Se=null;const Ee=Object.seal(A(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Re=!0,_e=!0,ze=!1,De=!0,Le=!1,Oe=!0,Ce=!1,Pe=!1,Me=!1,Fe=!1,Ie=!1,Ne=!1,je=!0,Ue=!1,qe=!0,Be=!1,He={},We=null;const $e=H({},["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 Ge=null;const Xe=H({},["audio","video","img","source","image","track"]);let Ye=null;const Ke=H({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Je="http://www.w3.org/1998/Math/MathML",Ve="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let Ze=Qe,et=!1,tt=null;const nt=H({},[Je,Ve,Qe],C);let it=H({},["mi","mo","mn","ms","mtext"]),rt=H({},["annotation-xml"]);const ot=H({},["title","style","font","a","script"]);let at=null;const st=["application/xhtml+xml","text/html"];let lt=null,ct=null;const ut=i.createElement("form"),dt=function(e){return e instanceof RegExp||e instanceof Function},ft=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ct||ct!==e){if(e&&"object"==typeof e||(e={}),e=$(e),at=-1===st.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,lt="application/xhtml+xml"===at?C:O,be=N(e,"ALLOWED_TAGS")?H({},e.ALLOWED_TAGS,lt):ve,xe=N(e,"ALLOWED_ATTR")?H({},e.ALLOWED_ATTR,lt):ke,tt=N(e,"ALLOWED_NAMESPACES")?H({},e.ALLOWED_NAMESPACES,C):nt,Ye=N(e,"ADD_URI_SAFE_ATTR")?H($(Ke),e.ADD_URI_SAFE_ATTR,lt):Ke,Ge=N(e,"ADD_DATA_URI_TAGS")?H($(Xe),e.ADD_DATA_URI_TAGS,lt):Xe,We=N(e,"FORBID_CONTENTS")?H({},e.FORBID_CONTENTS,lt):$e,Ae=N(e,"FORBID_TAGS")?H({},e.FORBID_TAGS,lt):$({}),Se=N(e,"FORBID_ATTR")?H({},e.FORBID_ATTR,lt):$({}),He=!!N(e,"USE_PROFILES")&&e.USE_PROFILES,Re=!1!==e.ALLOW_ARIA_ATTR,_e=!1!==e.ALLOW_DATA_ATTR,ze=e.ALLOW_UNKNOWN_PROTOCOLS||!1,De=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Le=e.SAFE_FOR_TEMPLATES||!1,Oe=!1!==e.SAFE_FOR_XML,Ce=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,Ne=e.RETURN_TRUSTED_TYPE||!1,Me=e.FORCE_BODY||!1,je=!1!==e.SANITIZE_DOM,Ue=e.SANITIZE_NAMED_PROPS||!1,qe=!1!==e.KEEP_CONTENT,Be=e.IN_PLACE||!1,we=e.ALLOWED_URI_REGEXP||ce,Ze=e.NAMESPACE||Qe,it=e.MATHML_TEXT_INTEGRATION_POINTS||it,rt=e.HTML_INTEGRATION_POINTS||rt,Te=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Te.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Le&&(_e=!1),Ie&&(Fe=!0),He&&(be=H({},Z),xe=A(null),!0===He.html&&(H(be,X),H(xe,ee)),!0===He.svg&&(H(be,Y),H(xe,te),H(xe,ie)),!0===He.svgFilters&&(H(be,K),H(xe,te),H(xe,ie)),!0===He.mathMl&&(H(be,V),H(xe,ne),H(xe,ie))),N(e,"ADD_TAGS")||(Ee.tagCheck=null),N(e,"ADD_ATTR")||(Ee.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Ee.tagCheck=e.ADD_TAGS:(be===ve&&(be=$(be)),H(be,e.ADD_TAGS,lt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Ee.attributeCheck=e.ADD_ATTR:(xe===ke&&(xe=$(xe)),H(xe,e.ADD_ATTR,lt))),e.ADD_URI_SAFE_ATTR&&H(Ye,e.ADD_URI_SAFE_ATTR,lt),e.FORBID_CONTENTS&&(We===$e&&(We=$(We)),H(We,e.FORBID_CONTENTS,lt)),e.ADD_FORBID_CONTENTS&&(We===$e&&(We=$(We)),H(We,e.ADD_FORBID_CONTENTS,lt)),qe&&(be["#text"]=!0),Ce&&H(be,["html","head","body"]),be.table&&(H(be,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw U('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw U('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=e.TRUSTED_TYPES_POLICY,S=T.createHTML("")}else void 0===T&&(T=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(m,o)),null!==T&&"string"==typeof S&&(S=T.createHTML(""));k&&k(e),ct=e}},pt=H({},[...Y,...K,...J]),mt=H({},[...V,...Q]),ht=function(e){D(n.removed,{element:e});try{x(e).removeChild(e)}catch(t){w(e)}},gt=function(e,t){try{D(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){D(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Fe||Ie)try{ht(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},yt=function(e){let t=null,n=null;if(Me)e="<remove></remove>"+e;else{const t=P(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===at&&Ze===Qe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=T?T.createHTML(e):e;if(Ze===Qe)try{t=(new p).parseFromString(r,at)}catch(e){}if(!t||!t.documentElement){t=E.createDocument(Ze,"template",null);try{t.documentElement.innerHTML=et?S:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),Ze===Qe?W.call(t,Ce?"html":"body")[0]:Ce?t.documentElement:o},wt=function(e){return q.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},bt=function(e){return e instanceof f&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},vt=function(e){return"function"==typeof l&&e instanceof l};function xt(e,t,i){R(e,(e=>{e.call(n,t,i,ct)}))}const kt=function(e){let t=null;if(xt(oe.beforeSanitizeElements,e,null),bt(e))return ht(e),!0;const i=lt(e.nodeName);if(xt(oe.uponSanitizeElement,e,{tagName:i,allowedTags:be}),Oe&&e.hasChildNodes()&&!vt(e.firstElementChild)&&j(/<[/\w!]/g,e.innerHTML)&&j(/<[/\w!]/g,e.textContent))return ht(e),!0;if(7===e.nodeType)return ht(e),!0;if(Oe&&8===e.nodeType&&j(/<[/\w]/g,e.data))return ht(e),!0;if(!(Ee.tagCheck instanceof Function&&Ee.tagCheck(i))&&(!be[i]||Ae[i])){if(!Ae[i]&&At(i)){if(Te.tagNameCheck instanceof RegExp&&j(Te.tagNameCheck,i))return!1;if(Te.tagNameCheck instanceof Function&&Te.tagNameCheck(i))return!1}if(qe&&!We[i]){const t=x(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t)for(let i=n.length-1;i>=0;--i){const r=g(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,b(e))}}return ht(e),!0}return e instanceof c&&!function(e){let t=x(e);t&&t.tagName||(t={namespaceURI:Ze,tagName:"template"});const n=O(e.tagName),i=O(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Ve?t.namespaceURI===Qe?"svg"===n:t.namespaceURI===Je?"svg"===n&&("annotation-xml"===i||it[i]):Boolean(pt[n]):e.namespaceURI===Je?t.namespaceURI===Qe?"math"===n:t.namespaceURI===Ve?"math"===n&&rt[i]:Boolean(mt[n]):e.namespaceURI===Qe?!(t.namespaceURI===Ve&&!rt[i])&&!(t.namespaceURI===Je&&!it[i])&&!mt[n]&&(ot[n]||!pt[n]):!("application/xhtml+xml"!==at||!tt[e.namespaceURI]))}(e)?(ht(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!j(/<\/no(script|embed|frames)/i,e.innerHTML)?(Le&&3===e.nodeType&&(t=e.textContent,R([ae,se,le],(e=>{t=M(t,e," ")})),e.textContent!==t&&(D(n.removed,{element:e.cloneNode()}),e.textContent=t)),xt(oe.afterSanitizeElements,e,null),!1):(ht(e),!0)},Tt=function(e,t,n){if(Se[t])return!1;if(je&&("id"===t||"name"===t)&&(n in i||n in ut))return!1;if(_e&&!Se[t]&&j(ue,t));else if(Re&&j(de,t));else if(Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e));else if(!xe[t]||Se[t]){if(!(At(e)&&(Te.tagNameCheck instanceof RegExp&&j(Te.tagNameCheck,e)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(e))&&(Te.attributeNameCheck instanceof RegExp&&j(Te.attributeNameCheck,t)||Te.attributeNameCheck instanceof Function&&Te.attributeNameCheck(t,e))||"is"===t&&Te.allowCustomizedBuiltInElements&&(Te.tagNameCheck instanceof RegExp&&j(Te.tagNameCheck,n)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(n))))return!1}else if(Ye[t]);else if(j(we,M(n,ge,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==F(n,"data:")||!Ge[e])if(ze&&!j(pe,M(n,ge,"")));else if(n)return!1;return!0},At=function(e){return"annotation-xml"!==e&&P(e,ye)},St=function(e){xt(oe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||bt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let r=t.length;for(;r--;){const o=t[r],{name:a,namespaceURI:s,value:l}=o,c=lt(a),u=l;let d="value"===a?u:I(u);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,xt(oe.uponSanitizeAttribute,e,i),d=i.attrValue,!Ue||"id"!==c&&"name"!==c||(gt(a,e),d="user-content-"+d),Oe&&j(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){gt(a,e);continue}if("attributename"===c&&P(d,"href")){gt(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){gt(a,e);continue}if(!De&&j(/\/>/i,d)){gt(a,e);continue}Le&&R([ae,se,le],(e=>{d=M(d,e," ")}));const f=lt(e.nodeName);if(Tt(f,c,d)){if(T&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(s);else switch(m.getAttributeType(f,c)){case"TrustedHTML":d=T.createHTML(d);break;case"TrustedScriptURL":d=T.createScriptURL(d)}if(d!==u)try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),bt(e)?ht(e):z(n.removed)}catch(t){gt(a,e)}}else gt(a,e)}xt(oe.afterSanitizeAttributes,e,null)},Et=function e(t){let n=null;const i=wt(t);for(xt(oe.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)xt(oe.uponSanitizeShadowNode,n,null),kt(n),St(n),n.content instanceof a&&e(n.content);xt(oe.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,o=null,s=null,c=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!vt(e)){if("function"!=typeof e.toString)throw U("toString is not a function");if("string"!=typeof(e=e.toString()))throw U("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Pe||ft(t),n.removed=[],"string"==typeof e&&(Be=!1),Be){if(e.nodeName){const t=lt(e.nodeName);if(!be[t]||Ae[t])throw U("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=yt("\x3c!----\x3e"),o=i.ownerDocument.importNode(e,!0),1===o.nodeType&&"BODY"===o.nodeName||"HTML"===o.nodeName?i=o:i.appendChild(o);else{if(!Fe&&!Le&&!Ce&&-1===e.indexOf("<"))return T&&Ne?T.createHTML(e):e;if(i=yt(e),!i)return Fe?null:Ne?S:""}i&&Me&&ht(i.firstChild);const u=wt(Be?e:i);for(;s=u.nextNode();)kt(s),St(s),s.content instanceof a&&Et(s.content);if(Be)return e;if(Fe){if(Ie)for(c=B.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(xe.shadowroot||xe.shadowrootmode)&&(c=re.call(r,c,!0)),c}let d=Ce?i.outerHTML:i.innerHTML;return Ce&&be["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&j(fe,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Le&&R([ae,se,le],(e=>{d=M(d,e," ")})),T&&Ne?T.createHTML(d):d},n.setConfig=function(){ft(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Pe=!0},n.clearConfig=function(){ct=null,Pe=!1},n.isValidAttribute=function(e,t,n){ct||ft({});const i=lt(e),r=lt(t);return Tt(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&D(oe[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=_(oe[e],t);return-1===n?void 0:L(oe[e],n,1)[0]}return z(oe[e])},n.removeHooks=function(e){oe[e]=[]},n.removeAllHooks=function(){oe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const ye=e(class e extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.responseReceived=n(this,"responseReceived",7),this.errored=n(this,"errored",7),this.isDisconnected=!1,this.dataKey=i.DATA_KEY||"",this.dataMode=i.DATA_MODE||"prod",this.keyName="",this.instanceId="",this.renderType="integration",this.contentTemplate="",this.isLoading=!1,this.error="",this.contentText="",this.htmlWidgetMarkup="",this.domId=`widget-${s()}`,this.registrationKey="",this.requestVersion=0,this.lastKbResponse=null,this.markAsActive=()=>{this.registrationKey&&r.setActive(this.registrationKey)},this.initializeScript=e=>(this.markAsActive(),m(e,this.mainObject))}get mainObject(){return window.ai12z||(window.ai12z={}),window.ai12z}getResolvedKeyName(){var e,t,n,i,r;const o=null===(e=this.keyName)||void 0===e?void 0:e.trim(),a=(null===(n=null===(t=this.el)||void 0===t?void 0:t.getAttribute("key-name"))||void 0===n?void 0:n.trim())||"";if(o)return o;if(a)return a;if("undefined"==typeof window)return"";const s=new URLSearchParams(window.location.search);return(null===(i=s.get("keyName"))||void 0===i?void 0:i.trim())||(null===(r=s.get("keyname"))||void 0===r?void 0:r.trim())||""}waitForNextPaint(e=0){return new Promise((t=>{requestAnimationFrame((()=>{e>0?setTimeout((()=>t()),e):t()}))}))}async renderControl(t){switch(await this.waitForNextPaint(e.CONTAINER_MOUNT_DELAY_MS),this.renderType){case"carousel":await p({id:`carousel-${this.domId}`},{controlData:t},this.el,(e=>this.hideSpinner(e)),(()=>{}),t.scripts,t.styles,!1,"widget");break;case"template":let e=!1;await new Promise((n=>{const i=()=>{e||(e=!0,n())};h({id:`html-${this.domId}`},{controlData:t,controlType:t.controlType},this.el.shadowRoot,(e=>this.hideSpinner(e)),(async e=>{await this.renderTemplateData(e),i()}),(()=>{this.markAsActive()}),l).then(i)}));break;case"content":{this.lastKbResponse=t;const e=null==t?void 0:t.data;if(!e){this.error="Knowledge base content unavailable.",this.errored.emit(this.error);break}let{question:n="",answer:i=""}=e;if(i=(new f.Converter).makeHtml(i),n=(new f.Converter).makeHtml(n),this.contentTemplate){const e=l.compile(this.contentTemplate);this.contentText=e({question:n,answer:i}),this.contentText=ge.sanitize(this.contentText)}else this.contentText=ge.sanitize(i);break}}}async componentWillLoad(){var e;this.registrationKey=(null===(e=this.instanceId)||void 0===e?void 0:e.trim())||`container-${this.domId}`,r.register(this.registrationKey,this),(this.getResolvedKeyName()&&void 0!==this.parameters||"content"===this.renderType)&&await this.invokeApi()}componentDidLoad(){"undefined"==typeof window||window.Handlebars||(window.Handlebars=l),this.el.addEventListener("focusin",this.markAsActive),this.el.addEventListener("pointerenter",this.markAsActive)}disconnectedCallback(){this.el.removeEventListener("focusin",this.markAsActive),this.el.removeEventListener("pointerenter",this.markAsActive),this.isDisconnected=!0,this.registrationKey&&r.unregister(this.registrationKey)}async onParametersChanged(e,t){e!==t&&this.getResolvedKeyName()&&await this.invokeApi(e)}onContentTemplateChanged(){if("content"!==this.renderType||!this.lastKbResponse)return;const{question:e="",answer:t=""}=this.lastKbResponse.data||{},n=this.contentTemplate?l.compile(this.contentTemplate)({question:e,answer:t}):t;this.contentText=ge.sanitize(n)}async invokeApi(t=this.parameters){this.error="";const n=++this.requestVersion,i=this.getResolvedKeyName();if(!i)return this.error='Key Name is required. Provide the "key-name" attribute or pass "keyName" in the URL.',this.errored.emit(this.error),void(this.isLoading=!1);e.renderQueueTail=e.renderQueueTail.then((async()=>{try{if(this.isDisconnected||n!==this.requestVersion)return;let e;if(this.registrationKey&&r.setActive(this.registrationKey),this.isLoading=!0,"content"===this.renderType?e=await c(this.dataKey,this.dataMode,i):(e=await u(this.dataKey,this.dataMode,i,t),this.renderType=e.controlType),this.isDisconnected||n!==this.requestVersion)return;if(this.isLoading=!1,await this.waitForNextPaint(150),await this.renderControl(e),this.isDisconnected||n!==this.requestVersion)return;this.responseReceived.emit(e),await this.waitForNextPaint(600)}catch(e){this.error=(null==e?void 0:e.message)||"Failed to load widget response",console.error("Failed to retrieve data",e),this.errored.emit(this.error)}finally{this.isLoading=!1}})).catch((e=>{console.error("Queue item failed — chain preserved:",e)}))}async renderTemplateData(e){await g(e,this.el,[],this.mainObject,this.initializeScript)}hideSpinner(e){return new Promise((t=>{const n=this.el.shadowRoot.querySelector(`#${e.id}`);if(n){const e=n.querySelector("#spinner");e&&(e.style.display="none")}t(!0)}))}renderSpinner(){return o("div",{class:"widget-spinner",id:"spinner"},o("div",{class:"widget-spinner-pulse"},o("div",{class:"widget-spinner-body"},o("div",{class:"widget-spinner-bar"}),o("div",{class:"widget-spinner-rows"},o("div",{class:"widget-spinner-grid"},o("div",{class:"widget-spinner-col-wide"}),o("div",{class:"widget-spinner-col-narrow"})),o("div",{class:"widget-spinner-bar"})))))}renderByType(){switch(this.renderType){case"carousel":return o("div",{class:"carousel-grid",id:`carousel-${this.domId}`},this.renderSpinner());case"template":return o("div",{class:"html-widget",id:`html-${this.domId}`},this.renderSpinner());default:return o("div",{class:"content-widget",id:`content-${this.domId}`,innerHTML:this.contentText})}}render(){return o("div",{key:"ec7c4261c505fb29882acf30d0c9c10a8703dc51",class:"ai12z-container-root"},this.isLoading&&o("div",{key:"ab3899fe20a637293b1fa5c24b40edf9cc20f333",class:"state-message"},"Loading..."),!this.isLoading&&this.error&&o("div",{key:"d70e83ff89ab6df1b090e7034f021c71466796c6",class:"state-message error"},this.error),!this.isLoading&&!this.error&&this.renderByType())}get el(){return this}static get watchers(){return{parameters:[{onParametersChanged:0}],contentTemplate:[{onContentTemplateChanged:0}]}}static get style(){return".ai12z-container-root{width:100%;box-sizing:border-box}.state-message{padding:12px;border-radius:8px;background:#f4f7fb;color:#1f2937;font-size:14px}.state-message.error{background:#fdecec;color:#991b1b}.widget-spinner{width:100%;border-radius:6px}.widget-spinner-pulse{display:flex;animation:widget-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;gap:16px}@keyframes widget-pulse{0%,100%{opacity:1}50%{opacity:0.4}}.widget-spinner-body{flex:1;display:flex;flex-direction:column;gap:12px;padding:4px 0}.widget-spinner-bar{height:16px;border-radius:4px;background:#e5e7eb}.widget-spinner-rows{display:flex;flex-direction:column;gap:12px}.widget-spinner-grid{display:grid;grid-template-columns:2fr 1fr;gap:16px}.widget-spinner-col-wide,.widget-spinner-col-narrow{height:16px;border-radius:4px;background:#e5e7eb}"}},[1,"ai12z-container",{dataKey:[513,"data-key"],dataMode:[513,"data-mode"],keyName:[513,"key-name"],instanceId:[513,"instance-id"],parameters:[513],renderType:[1537,"render-type"],contentTemplate:[513,"content-template"],isLoading:[32],error:[32],contentText:[32],htmlWidgetMarkup:[32],domId:[32]},void 0,{parameters:[{onParametersChanged:0}],contentTemplate:[{onContentTemplateChanged:0}]}]);function we(){"undefined"!=typeof customElements&&["ai12z-container","item-list"].forEach((e=>{switch(e){case"ai12z-container":customElements.get(a(e))||customElements.define(a(e),ye);break;case"item-list":customElements.get(a(e))||d()}}))}ye.renderQueueTail=Promise.resolve(),ye.CONTAINER_MOUNT_DELAY_MS=150,we();export{ye as A,we as d}
@@ -1 +1 @@
1
- import{t as e,p as t,H as s,h as a}from"./p-ZGVz1_9H.js";import{r as i,d as o,C as c,D as n,E as l}from"./p-DUaZgAhA.js";import{t as d}from"./p-ChFVg77w.js";function h(e,t){const s=t.querySelector(`#thumbsUp_${e}`),a=t.querySelector(`#thumbsDown_${e}`);s.classList.add("not-allowed"),s.setAttribute("disabled","true"),a.classList.add("not-allowed"),a.setAttribute("disabled","true")}const b=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.voiceType="default",this.voice="Google US English",this.source="",this.conversationId="",this.projectId="",this.isPlayed=!1,this.audioElement=null,this.copied=!1}copyToClipboard(e){navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([c(e)],{type:"text/plain"})})]).then((()=>{this.copied=!0,setTimeout((()=>{this.copied=!1}),2e3)}))}async speakText(e){if("default"===this.voiceType)if("speechSynthesis"in window){const t=window.speechSynthesis.getVoices().find((e=>e.name===this.voice));this.isPlayed=!0;const s=new SpeechSynthesisUtterance(e);s.lang="en-US",s.rate=1,s.pitch=1,s.voice=t,window.speechSynthesis.speak(s)}else alert("Speech Synthesis API is not supported in your browser.");if("google"===this.voiceType){const t=await n(this.dataKey,this.dataMode,e,this.voice),s=l(t.audio_content,"audio/mpeg"),a=URL.createObjectURL(s);this.audioElement=new Audio(a),this.audioElement.onended=()=>{this.isPlayed=!1},this.audioElement.paused?(this.audioElement.play(),this.isPlayed=!0):(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null,this.isPlayed=!1)}}render(){var e;return a("div",{key:"1301676693d2dae8759c238c2528b54d2179454e",class:"thumbs-container flex gap-2 mt-2"},this.isPlayed&&a("button",{key:"10cd8e47e1c37f28f1238c1b7288db94b9ce8f3c",class:"copy-btn",tabindex:"0","aria-label":"Stop Speaking",onClick:()=>{this.isPlayed=!1,window.speechSynthesis.cancel(),this.audioElement&&(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null)}},a("svg",{key:"7917d77a2ae82e41ecca58761b24bdd40ed901f8",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-md-heavy"},a("path",{key:"709788d90a11ef6e33c4b504b58f5daab0d91d6d","fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM9.5 8.5C8.94772 8.5 8.5 8.94772 8.5 9.5V14.5C8.5 15.0523 8.94772 15.5 9.5 15.5H14.5C15.0523 15.5 15.5 15.0523 15.5 14.5V9.5C15.5 8.94772 15.0523 8.5 14.5 8.5H9.5Z",fill:"currentColor"}))),!this.isPlayed&&a("button",{key:"007f1ba6c2f17d809dafb460e49e6d58cac83b2f",class:"copy-btn",tabindex:"0",onClick:()=>this.speakText(c(this.message.text)),"aria-label":"Speak Text"},a("svg",{key:"ff62913d5c73c19b3b1bdf5b37057cc9e022fda4",class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("path",{key:"8186495b322cd06040e9ea23e50d2c9ea50bebd4","fill-rule":"evenodd","clip-rule":"evenodd",d:"M11 4.9099C11 4.47485 10.4828 4.24734 10.1621 4.54132L6.67572 7.7372C6.49129 7.90626 6.25019 8.00005 6 8.00005H4C3.44772 8.00005 3 8.44776 3 9.00005V15C3 15.5523 3.44772 16 4 16H6C6.25019 16 6.49129 16.0938 6.67572 16.2629L10.1621 19.4588C10.4828 19.7527 11 19.5252 11 19.0902V4.9099ZM8.81069 3.06701C10.4142 1.59714 13 2.73463 13 4.9099V19.0902C13 21.2655 10.4142 22.403 8.81069 20.9331L5.61102 18H4C2.34315 18 1 16.6569 1 15V9.00005C1 7.34319 2.34315 6.00005 4 6.00005H5.61102L8.81069 3.06701ZM20.3166 6.35665C20.8019 6.09313 21.409 6.27296 21.6725 6.75833C22.5191 8.3176 22.9996 10.1042 22.9996 12.0001C22.9996 13.8507 22.5418 15.5974 21.7323 17.1302C21.4744 17.6185 20.8695 17.8054 20.3811 17.5475C19.8927 17.2896 19.7059 16.6846 19.9638 16.1962C20.6249 14.9444 20.9996 13.5175 20.9996 12.0001C20.9996 10.4458 20.6064 8.98627 19.9149 7.71262C19.6514 7.22726 19.8312 6.62017 20.3166 6.35665ZM15.7994 7.90049C16.241 7.5688 16.8679 7.65789 17.1995 8.09947C18.0156 9.18593 18.4996 10.5379 18.4996 12.0001C18.4996 13.3127 18.1094 14.5372 17.4385 15.5604C17.1357 16.0222 16.5158 16.1511 16.0539 15.8483C15.5921 15.5455 15.4632 14.9255 15.766 14.4637C16.2298 13.7564 16.4996 12.9113 16.4996 12.0001C16.4996 10.9859 16.1653 10.0526 15.6004 9.30063C15.2687 8.85905 15.3578 8.23218 15.7994 7.90049Z",fill:"currentColor"}))),a("button",{key:"73b95dd34970f896e9ad3a5641924b5cb825a6ec",id:`thumbsUp_${this.message.thumbsId}`,tabindex:"0",onClick:()=>{var e;!function(e,t,s,a){const o=s.querySelector(`#thumbsUp_${e}`);o.classList.add("thumbs-up"),o.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path d="M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z" />\n </svg>\n ',h(e,s),i(a.dataKey,a.dataMode,t,{value:1}),d("up",t||e,a)}(this.message.thumbsId,this.message.insightId,this.el,{dataKey:this.dataKey,dataMode:this.dataMode,conversationId:this.conversationId,projectId:this.projectId,questionText:(null===(e=this.chatArray[this.currentIndex-1])||void 0===e?void 0:e.text)||""})},class:"chat-thumbs-up","aria-label":"Thumbs Up"},a("svg",{key:"ac3bd7b9dca8a7b2fe280f454bfa719aa5064bb5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},a("path",{key:"24d32fb905fd8499f529f7ab8fdbb28f4428f192","stroke-linecap":"round","stroke-linejoin":"round",d:"M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z"}))),a("button",{key:"e88dacbba6d2b8d45beb06a7d5b6e60405fa11d4",id:`thumbsDown_${this.message.thumbsId}`,onClick:()=>{var e;return function(e,t,s,a){const o=s.querySelector(`#thumbsDown_${e}`);o.classList.add("thumbs-down"),o.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path d="M15.73 5.5h1.035A7.465 7.465 0 0 1 18 9.625a7.465 7.465 0 0 1-1.235 4.125h-.148c-.806 0-1.534.446-2.031 1.08a9.04 9.04 0 0 1-2.861 2.4c-.723.384-1.35.956-1.653 1.715a4.499 4.499 0 0 0-.322 1.672v.633A.75.75 0 0 1 9 22a2.25 2.25 0 0 1-2.25-2.25c0-1.152.26-2.243.723-3.218.266-.558-.107-1.282-.725-1.282H3.622c-1.026 0-1.945-.694-2.054-1.715A12.137 12.137 0 0 1 1.5 12.25c0-2.848.992-5.464 2.649-7.521C4.537 4.247 5.136 4 5.754 4H9.77a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23ZM21.669 14.023c.536-1.362.831-2.845.831-4.398 0-1.22-.182-2.398-.52-3.507-.26-.85-1.084-1.368-1.973-1.368H19.1c-.445 0-.72.498-.523.898.591 1.2.924 2.55.924 3.977a8.958 8.958 0 0 1-1.302 4.666c-.245.403.028.959.5.959h1.053c.832 0 1.612-.453 1.918-1.227Z" />\n </svg>\n ',h(e,s),i(a.dataKey,a.dataMode,t,{value:-1}),d("down",t||e,a)}(this.message.thumbsId,this.message.insightId,this.el,{dataKey:this.dataKey,dataMode:this.dataMode,conversationId:this.conversationId,projectId:this.projectId,questionText:(null===(e=this.chatArray[this.currentIndex-1])||void 0===e?void 0:e.text)||""})},class:"chat-thumbs-up","aria-label":"Thumbs Down"},a("svg",{key:"b23d5fa5643c1e6cc6f3026385a8d7cb93bc6693",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},a("path",{key:"20c32a05eb6e12926ac553a1ab4bed9e45fceb7e","stroke-linecap":"round","stroke-linejoin":"round",d:"M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54"}))),a("button",{key:"3c6b36fba4822583aa696ecb0554d7f21bb16ee7",class:"copy-btn",onClick:()=>this.copyToClipboard(this.message.text),"aria-label":"Copy Text"},!this.copied&&a("svg",{key:"8894cf516b01e42bb49103091ba8b7a79b1b28b9",class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("path",{key:"9f0571488b60f8b39794c78cb962a3e0c5d0273a","fill-rule":"evenodd","clip-rule":"evenodd",d:"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z",fill:"currentColor"})),this.copied&&a("svg",{key:"389e0dd0c42e6a2686a66a898b6b3727eb9f104b",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6"},a("path",{key:"00419fae11b47645d88eff7bc416ca20c0142d1d","fill-rule":"evenodd","clip-rule":"evenodd",d:"M19.8198 6.19526C20.0601 6.45561 20.0601 6.87772 19.8198 7.13807L9.9736 17.8047C9.73328 18.0651 9.34364 18.0651 9.10332 17.8047L4.18024 12.4714C3.93992 12.2111 3.93992 11.7889 4.18024 11.5286C4.42056 11.2682 4.8102 11.2682 5.05053 11.5286L9.53846 16.3905L18.9495 6.19526C19.1898 5.93491 19.5794 5.93491 19.8198 6.19526Z",fill:"currentColor"}))),a("button",{key:"bc7d7e38758231b7f146300a5f8876c6082666b3",class:"copy-btn","aria-label":"Send Email"},a("a",{key:"0d3f2e732bb670fa494b50cc2151f6770e221a57",href:`mailto:?subject=${encodeURIComponent(null===(e=this.chatArray[this.currentIndex-1])||void 0===e?void 0:e.text)}&body=${encodeURIComponent(c(this.message.text))}`,target:"_blank"},a("svg",{key:"4cff30b349e567b0ddc05b7dfeef3cea54c2b1fa",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor","stroke-width":"0.3",class:"w-6 h-6"},a("path",{key:"ba202044b745f9d37b91520cff1086941f155c56","fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.75 5.25L3 6V18L3.75 18.75H20.25L21 18V6L20.25 5.25H3.75ZM4.5 7.6955V17.25H19.5V7.69525L11.9999 14.5136L4.5 7.6955ZM18.3099 6.75H5.68986L11.9999 12.4864L18.3099 6.75Z",fill:"currentColor"})," "))))}get el(){return this}static get style(){return""}},[0,"interaction-buttons",{message:[8],chatArray:[16],currentIndex:[2,"current-index"],dataKey:[1,"data-key"],dataMode:[1,"data-mode"],voiceType:[1,"voice-type"],voice:[1],source:[1],conversationId:[1,"conversation-id"],projectId:[1,"project-id"],isPlayed:[32],audioElement:[32],copied:[32]}]);function r(){"undefined"!=typeof customElements&&["interaction-buttons","item-list"].forEach((t=>{switch(t){case"interaction-buttons":customElements.get(e(t))||customElements.define(e(t),b);break;case"item-list":customElements.get(e(t))||o()}}))}r();export{b as I,r as d}
1
+ import{t as e,p as t,H as s,h as a}from"./p-ZGVz1_9H.js";import{r as i,d as o,C as c,D as n,E as l}from"./p-CrfXJRIo.js";import{t as d}from"./p-ChFVg77w.js";function h(e,t){const s=t.querySelector(`#thumbsUp_${e}`),a=t.querySelector(`#thumbsDown_${e}`);s.classList.add("not-allowed"),s.setAttribute("disabled","true"),a.classList.add("not-allowed"),a.setAttribute("disabled","true")}const r=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.voiceType="default",this.voice="Google US English",this.source="",this.conversationId="",this.projectId="",this.isPlayed=!1,this.audioElement=null,this.copied=!1}copyToClipboard(e){navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([c(e)],{type:"text/plain"})})]).then((()=>{this.copied=!0,setTimeout((()=>{this.copied=!1}),2e3)}))}async speakText(e){if("default"===this.voiceType)if("speechSynthesis"in window){const t=window.speechSynthesis.getVoices().find((e=>e.name===this.voice));this.isPlayed=!0;const s=new SpeechSynthesisUtterance(e);s.lang="en-US",s.rate=1,s.pitch=1,s.voice=t,window.speechSynthesis.speak(s)}else alert("Speech Synthesis API is not supported in your browser.");if("google"===this.voiceType){const t=await n(this.dataKey,this.dataMode,e,this.voice),s=l(t.audio_content,"audio/mpeg"),a=URL.createObjectURL(s);this.audioElement=new Audio(a),this.audioElement.onended=()=>{this.isPlayed=!1},this.audioElement.paused?(this.audioElement.play(),this.isPlayed=!0):(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null,this.isPlayed=!1)}}render(){var e;return a("div",{key:"1301676693d2dae8759c238c2528b54d2179454e",class:"thumbs-container flex gap-2 mt-2"},this.isPlayed&&a("button",{key:"10cd8e47e1c37f28f1238c1b7288db94b9ce8f3c",class:"copy-btn",tabindex:"0","aria-label":"Stop Speaking",onClick:()=>{this.isPlayed=!1,window.speechSynthesis.cancel(),this.audioElement&&(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null)}},a("svg",{key:"7917d77a2ae82e41ecca58761b24bdd40ed901f8",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-md-heavy"},a("path",{key:"709788d90a11ef6e33c4b504b58f5daab0d91d6d","fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM9.5 8.5C8.94772 8.5 8.5 8.94772 8.5 9.5V14.5C8.5 15.0523 8.94772 15.5 9.5 15.5H14.5C15.0523 15.5 15.5 15.0523 15.5 14.5V9.5C15.5 8.94772 15.0523 8.5 14.5 8.5H9.5Z",fill:"currentColor"}))),!this.isPlayed&&a("button",{key:"007f1ba6c2f17d809dafb460e49e6d58cac83b2f",class:"copy-btn",tabindex:"0",onClick:()=>this.speakText(c(this.message.text)),"aria-label":"Speak Text"},a("svg",{key:"ff62913d5c73c19b3b1bdf5b37057cc9e022fda4",class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("path",{key:"8186495b322cd06040e9ea23e50d2c9ea50bebd4","fill-rule":"evenodd","clip-rule":"evenodd",d:"M11 4.9099C11 4.47485 10.4828 4.24734 10.1621 4.54132L6.67572 7.7372C6.49129 7.90626 6.25019 8.00005 6 8.00005H4C3.44772 8.00005 3 8.44776 3 9.00005V15C3 15.5523 3.44772 16 4 16H6C6.25019 16 6.49129 16.0938 6.67572 16.2629L10.1621 19.4588C10.4828 19.7527 11 19.5252 11 19.0902V4.9099ZM8.81069 3.06701C10.4142 1.59714 13 2.73463 13 4.9099V19.0902C13 21.2655 10.4142 22.403 8.81069 20.9331L5.61102 18H4C2.34315 18 1 16.6569 1 15V9.00005C1 7.34319 2.34315 6.00005 4 6.00005H5.61102L8.81069 3.06701ZM20.3166 6.35665C20.8019 6.09313 21.409 6.27296 21.6725 6.75833C22.5191 8.3176 22.9996 10.1042 22.9996 12.0001C22.9996 13.8507 22.5418 15.5974 21.7323 17.1302C21.4744 17.6185 20.8695 17.8054 20.3811 17.5475C19.8927 17.2896 19.7059 16.6846 19.9638 16.1962C20.6249 14.9444 20.9996 13.5175 20.9996 12.0001C20.9996 10.4458 20.6064 8.98627 19.9149 7.71262C19.6514 7.22726 19.8312 6.62017 20.3166 6.35665ZM15.7994 7.90049C16.241 7.5688 16.8679 7.65789 17.1995 8.09947C18.0156 9.18593 18.4996 10.5379 18.4996 12.0001C18.4996 13.3127 18.1094 14.5372 17.4385 15.5604C17.1357 16.0222 16.5158 16.1511 16.0539 15.8483C15.5921 15.5455 15.4632 14.9255 15.766 14.4637C16.2298 13.7564 16.4996 12.9113 16.4996 12.0001C16.4996 10.9859 16.1653 10.0526 15.6004 9.30063C15.2687 8.85905 15.3578 8.23218 15.7994 7.90049Z",fill:"currentColor"}))),a("button",{key:"73b95dd34970f896e9ad3a5641924b5cb825a6ec",id:`thumbsUp_${this.message.thumbsId}`,tabindex:"0",onClick:()=>{var e;!function(e,t,s,a){const o=s.querySelector(`#thumbsUp_${e}`);o.classList.add("thumbs-up"),o.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path d="M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z" />\n </svg>\n ',h(e,s),i(a.dataKey,a.dataMode,t,{value:1}),d("up",t||e,a)}(this.message.thumbsId,this.message.insightId,this.el,{dataKey:this.dataKey,dataMode:this.dataMode,conversationId:this.conversationId,projectId:this.projectId,questionText:(null===(e=this.chatArray[this.currentIndex-1])||void 0===e?void 0:e.text)||""})},class:"chat-thumbs-up","aria-label":"Thumbs Up"},a("svg",{key:"ac3bd7b9dca8a7b2fe280f454bfa719aa5064bb5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},a("path",{key:"24d32fb905fd8499f529f7ab8fdbb28f4428f192","stroke-linecap":"round","stroke-linejoin":"round",d:"M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z"}))),a("button",{key:"e88dacbba6d2b8d45beb06a7d5b6e60405fa11d4",id:`thumbsDown_${this.message.thumbsId}`,onClick:()=>{var e;return function(e,t,s,a){const o=s.querySelector(`#thumbsDown_${e}`);o.classList.add("thumbs-down"),o.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path d="M15.73 5.5h1.035A7.465 7.465 0 0 1 18 9.625a7.465 7.465 0 0 1-1.235 4.125h-.148c-.806 0-1.534.446-2.031 1.08a9.04 9.04 0 0 1-2.861 2.4c-.723.384-1.35.956-1.653 1.715a4.499 4.499 0 0 0-.322 1.672v.633A.75.75 0 0 1 9 22a2.25 2.25 0 0 1-2.25-2.25c0-1.152.26-2.243.723-3.218.266-.558-.107-1.282-.725-1.282H3.622c-1.026 0-1.945-.694-2.054-1.715A12.137 12.137 0 0 1 1.5 12.25c0-2.848.992-5.464 2.649-7.521C4.537 4.247 5.136 4 5.754 4H9.77a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23ZM21.669 14.023c.536-1.362.831-2.845.831-4.398 0-1.22-.182-2.398-.52-3.507-.26-.85-1.084-1.368-1.973-1.368H19.1c-.445 0-.72.498-.523.898.591 1.2.924 2.55.924 3.977a8.958 8.958 0 0 1-1.302 4.666c-.245.403.028.959.5.959h1.053c.832 0 1.612-.453 1.918-1.227Z" />\n </svg>\n ',h(e,s),i(a.dataKey,a.dataMode,t,{value:-1}),d("down",t||e,a)}(this.message.thumbsId,this.message.insightId,this.el,{dataKey:this.dataKey,dataMode:this.dataMode,conversationId:this.conversationId,projectId:this.projectId,questionText:(null===(e=this.chatArray[this.currentIndex-1])||void 0===e?void 0:e.text)||""})},class:"chat-thumbs-up","aria-label":"Thumbs Down"},a("svg",{key:"b23d5fa5643c1e6cc6f3026385a8d7cb93bc6693",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},a("path",{key:"20c32a05eb6e12926ac553a1ab4bed9e45fceb7e","stroke-linecap":"round","stroke-linejoin":"round",d:"M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54"}))),a("button",{key:"3c6b36fba4822583aa696ecb0554d7f21bb16ee7",class:"copy-btn",onClick:()=>this.copyToClipboard(this.message.text),"aria-label":"Copy Text"},!this.copied&&a("svg",{key:"8894cf516b01e42bb49103091ba8b7a79b1b28b9",class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("path",{key:"9f0571488b60f8b39794c78cb962a3e0c5d0273a","fill-rule":"evenodd","clip-rule":"evenodd",d:"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z",fill:"currentColor"})),this.copied&&a("svg",{key:"389e0dd0c42e6a2686a66a898b6b3727eb9f104b",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6"},a("path",{key:"00419fae11b47645d88eff7bc416ca20c0142d1d","fill-rule":"evenodd","clip-rule":"evenodd",d:"M19.8198 6.19526C20.0601 6.45561 20.0601 6.87772 19.8198 7.13807L9.9736 17.8047C9.73328 18.0651 9.34364 18.0651 9.10332 17.8047L4.18024 12.4714C3.93992 12.2111 3.93992 11.7889 4.18024 11.5286C4.42056 11.2682 4.8102 11.2682 5.05053 11.5286L9.53846 16.3905L18.9495 6.19526C19.1898 5.93491 19.5794 5.93491 19.8198 6.19526Z",fill:"currentColor"}))),a("button",{key:"bc7d7e38758231b7f146300a5f8876c6082666b3",class:"copy-btn","aria-label":"Send Email"},a("a",{key:"0d3f2e732bb670fa494b50cc2151f6770e221a57",href:`mailto:?subject=${encodeURIComponent(null===(e=this.chatArray[this.currentIndex-1])||void 0===e?void 0:e.text)}&body=${encodeURIComponent(c(this.message.text))}`,target:"_blank"},a("svg",{key:"4cff30b349e567b0ddc05b7dfeef3cea54c2b1fa",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor","stroke-width":"0.3",class:"w-6 h-6"},a("path",{key:"ba202044b745f9d37b91520cff1086941f155c56","fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.75 5.25L3 6V18L3.75 18.75H20.25L21 18V6L20.25 5.25H3.75ZM4.5 7.6955V17.25H19.5V7.69525L11.9999 14.5136L4.5 7.6955ZM18.3099 6.75H5.68986L11.9999 12.4864L18.3099 6.75Z",fill:"currentColor"})," "))))}get el(){return this}static get style(){return""}},[0,"interaction-buttons",{message:[8],chatArray:[16],currentIndex:[2,"current-index"],dataKey:[1,"data-key"],dataMode:[1,"data-mode"],voiceType:[1,"voice-type"],voice:[1],source:[1],conversationId:[1,"conversation-id"],projectId:[1,"project-id"],isPlayed:[32],audioElement:[32],copied:[32]}]);function b(){"undefined"!=typeof customElements&&["interaction-buttons","item-list"].forEach((t=>{switch(t){case"interaction-buttons":customElements.get(e(t))||customElements.define(e(t),r);break;case"item-list":customElements.get(e(t))||o()}}))}b();export{r as I,b as d}
@@ -1 +1 @@
1
- import{t as e,p as t,H as i,d as a,h as s}from"./p-ZGVz1_9H.js";import{d as o,a as r,v as c}from"./p-DUaZgAhA.js";import{D as d}from"./p-CsY3PAR1.js";import{d as n}from"./p-DsZWeAcM.js";import{d as l}from"./p-DXCT5yQi.js";import{d as h}from"./p-BwTPnzKJ.js";const f=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.action=a(this,"action",7),this.capturedImgUpload=a(this,"capturedImgUpload",7),this.instanceId=`input-${r()}`,this.imagesBase64List=[],this.showShortcutsDialog=!1,this.shortcuts=d,this.componentType="search",this.chatLength=0,this.searchInput="",this.submitted=!1,this.showErrorMessage=!1,this.hideAllButtons=!1,this.isOpen=!1,this.capturedFile=null,this.errorMessage="You can upload a maximum of 10 images once at a time.",this.emptyMessageError=!1,this.announceMessage="",this.adjustHeight=()=>{this.searchInputElem.style.height="auto",this.searchInputElem.style.height=this.searchInputElem.scrollHeight+"px"},this.handleInputChange=e=>{if(this.searchInput=this.searchInputElem.value,this.isChat)return;const t=this.searchInputElem.value;t.length>3&&!this.isChat&&this.action.emit({event:e,value:t,type:"search",imgFiles:this.imagesBase64List})},this.handleClickOutside=e=>{this.isOpen&&this.menuElem&&!this.menuElem.contains(e.target)&&(this.isOpen=!1)},this.handleFormSubmit=e=>{e.preventDefault(),this.searchInput.length>3&&this.action.emit({event:e,value:this.searchInputElem.value,type:"search"})},this.handleKeyDown=e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),""!==this.searchInputElem.value.trim()||this.imagesBase64List.length>0?this.handleAskAI(e):0===this.imagesBase64List.length&&""===this.searchInputElem.value.trim()&&(this.emptyMessageError=!0,this.searchInputElem.focus(),setTimeout((()=>{this.emptyMessageError=!1}),3e3)))},this.handleFollowUp=e=>{this.action.emit({event:e,value:this.searchInputElem.value,imgFiles:this.imagesBase64List,type:"follow-up",followUp:!1})},this.handleRecentChat=e=>{this.action.emit({event:e,value:this.searchInputElem.value,type:"history"})},this.handleAskAI=e=>{var t,i;if(e.preventDefault(),""===this.searchInputElem.value.trim()&&0===this.imagesBase64List.length)return this.emptyMessageError=!0,this.searchInputElem.focus(),void setTimeout((()=>{this.emptyMessageError=!1}),3e3);this.submitted=!0,this.showErrorMessage=!1,this.emptyMessageError=!1,this.announce("Message sent successfully"),this.tempValue=this.searchInputElem.value,this.searchInputElem.value="";const a=this.imagesBase64List;this.imagesBase64List=[],this.action.emit({event:e,value:this.tempValue,imgFiles:a,followUp:null!==(i=null===(t=this.followUpElem)||void 0===t?void 0:t.checked)&&void 0!==i&&i,type:"ask-ai"})},this.handleImageChange=e=>{this.imagesBase64List=e.detail,this.showErrorMessage=!1},this.handleImageError=e=>{this.errorMessage=e.detail,this.showErrorMessage=!0},this.toggleBox=e=>{e.stopPropagation(),this.isOpen=!this.isOpen},this.handlePaste=e=>{var t;e.preventDefault();const i=(null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text"))||"";if(this.searchInputElem&&i){const e=this.searchInputElem,t=e.selectionStart,a=e.selectionEnd,s=e.value,o=s.substring(0,t)+i+s.substring(a);e.value=o;const r=t+i.length;e.setSelectionRange(r,r),setTimeout((()=>{this.adjustHeight()}),0)}}}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside)}componentDidLoad(){this.isImageUpload&&document.addEventListener("click",this.handleClickOutside)}stateChangedHandler(e){if(this.submitted=!1,this.isChat){this.searchInputElem.value="",this.searchInput="";const e=this.el.querySelector(`#previewContainer-${this.instanceId}`);this.el.querySelector(`#searchInput-${this.instanceId}`).style.overflow="hidden",e&&(e.innerHTML=""),this.imagesBase64List=[]}}clearInputHandler(e){this.submitted=!1,this.searchInput="";const t=this.el.querySelector(`#previewContainer-${this.instanceId}`);t&&(t.innerHTML=""),this.imagesBase64List=[],this.searchInputElem.style.height="auto"}announce(e){this.announceMessage=e,setTimeout((()=>{this.announceMessage=""}),1e3)}async captureScreen(){try{const e=await navigator.mediaDevices.getDisplayMedia({video:!0}),t=document.createElement("video");t.srcObject=e,t.autoplay=!0,document.body.appendChild(t),await new Promise((e=>t.onloadedmetadata=e)),await new Promise((e=>setTimeout(e,500)));const i=document.createElement("canvas");i.width=t.videoWidth,i.height=t.videoHeight;const a=i.getContext("2d");a&&(a.drawImage(t,0,0,i.width,i.height),i.toBlob((e=>{if(e){const t=new File([e],`screenshot-${Date.now()}.png`,{type:"image/png"});this.capturedFile=t,this.capturedImgUpload.emit([t])}}),"image/png")),e.getTracks().forEach((e=>e.stop())),document.body.removeChild(t)}catch(e){console.error("Error capturing screen:",e)}}render(){return s("div",{key:"623f7b93a8fee68a98ffe0d15fe49232c928d541"},s("div",{key:"33fa75b886a6d845785ab7ad4be2cba4437deead",class:"absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10\n "+(this.isOpen?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-90 pointer-events-none"),ref:e=>this.menuElem=e},s("ul",{key:"c7a41dcf7bbb7d3b52d3adac6f7871553d082a97",class:"space-y-2"},this.isImageUpload&&s("li",{key:"4efc17c2a136caf0b8bfc2fba39622a1bab801c9",class:"px-4 py-2 hover:bg-gray-100 cursor-pointer flex"},s("image-uploader",{key:"8c669dda8dd81f4a24da8232938bbd6cae65ad7f",maxImages:10,images:this.imagesBase64List,targetElement:this.searchInputElem,onImagesChange:this.handleImageChange,onError:this.handleImageError,ref:e=>this.imageUploaderRef=e})),s("li",{key:"5fc6b84028c421a57c9b4c3ed36a1b19c6833546",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex",onClick:e=>{this.captureScreen(),this.toggleBox(e)}},s("div",{key:"20cd5b58b14938dde41c3ec82a4d204ddaebea4d",class:"mr-1 mt-px"},s("svg",{key:"c740a9f51839e41055786d23fd7b4ed44ed29324",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"20",height:"20"},s("path",{key:"f8516209c60f8478b6b6e510ceff2ec0a6fb57cd",d:"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z"}),s("path",{key:"8c59bd0faf944dedc4b311cf6c7403e4e8c79689","fill-rule":"evenodd",d:"M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"}))),s("div",{key:"e10bf86ebd212649837dfad5094d9f39c0555af4"},"Capture")),s("li",{key:"d2b7a298b838ed7259019e26f211a09d69f328b5",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex","aria-label":"Start Over","aria-disabled":0===this.chatLength,style:{opacity:0===this.chatLength?"0.5":"1",cursor:0===this.chatLength?"not-allowed":"pointer"},onClick:e=>{0!==this.chatLength&&(this.handleFollowUp(e),this.toggleBox(e))}},s("div",{key:"95729576e7131a1bcde5edf2f00704e3979f0168",class:"mr-1 mt-px"},s("svg",{key:"aca3169ad3c1933750e6e70156ff3aafa9cb700e",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("path",{key:"f09ce7b4c487d62f744ab255274120d648cebd0c",d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"}))),s("div",{key:"22838c5639850ca1520b5859188cd0cc7f62ae78"},"Start Over")),s("li",{key:"0625819dc4f37253f68674ae2f41169abd7249d3",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex","aria-label":"View Recent Chat",onClick:e=>{this.handleRecentChat(e)}},s("div",{key:"1bd82e7a2f97481c5215af8b5d67ec71d2c69719",class:"mr-1 mt-px"},s("svg",{key:"1a88182d117cadac2c5c491578533860b008cf75",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("path",{key:"1e75ddfc584d70d0ada8008463ea08d8d0ac6623",d:"M21 15a4 4 0 0 1-4 4H7l-4 4V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"}),s("path",{key:"d1db69ed6ae7f982b1839204e52a90c32630f1fb",d:"M12 7v5l3 2"}))),s("div",{key:"813b01482c85e7b63908facb41c4a48f226ecd3b"},"View Recent Chat")))),s("form",{key:"b810bd80536347059124d3827e26502e03a97092",class:"w-full flex flex-col gap-1.5 sticky",onSubmit:this.handleFormSubmit},s("div",{key:"f69b95ec734d662c3e88cdc93aa15f8983f380a7",class:"flex-1 flex flex-col relative w-full rounded-3xl px-1 "+("inline"===this.componentType?"inline-searchbar-bgcolor":"searchbar-bgcolor"),dir:"LTR",ref:e=>this.searchFormElem=e},s("div",{key:"c64d576d4675e5993fcecde579f4a992da296a3f",class:"flex items-center"},s("div",{key:"e41c8a31a3775a409810f12f856dd6bb5113b67d",class:"ml-1 self-center flex space-x-1"},!this.hideAllButtons&&s("div",{key:"7614880c9a53a7e99ead7090637185b996b7cc2e",class:"relative inline-block",style:{width:"5%"}},s("button",{key:"edfcedc1fe6e77f2da4d26a60aad3748683ca6ef",class:"plus-icon","aria-label":"Options",title:"Add images or capture screen",tabindex:"0",onClick:e=>{e.stopPropagation(),this.toggleBox(e)}},s("svg",{key:"123d73fdd31ea56f503df593818a05f5574c6fdb",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20"},s("path",{key:"cded16c28c1421bc4c9d4b9f18af6411309a22ba",d:"M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"}))))),!this.hideAllButtons&&s("div",{key:"9b0213ad6586daecb71c46941b17108f13c58048",class:"scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto"},s("div",{key:"619ef140b69574f9b5f6b56d3d7dc8355163fbc1",class:"relative w-full min-w-full h-full min-h-fit flex items-center input-prose"},s("div",{key:"a972c24cc5748376eedced77c91dffd331054293",id:`previewContainer-${this.instanceId}`,draggable:!0}),s("label",{key:"b515979270ffdbf8024951c04a826888539a0e64",htmlFor:`searchInput-${this.instanceId}`,class:"sr-only"},"Your message"),s("textarea",{key:"32123cab1fb36680b6e62a53e975988434721974",readOnly:this.submitted,"aria-describedby":this.emptyMessageError?`message-error-${this.instanceId} search-hint-${this.instanceId}`:`search-hint-${this.instanceId}`,"aria-invalid":this.emptyMessageError,id:`searchInput-${this.instanceId}`,ref:e=>{this.searchInputElem=e,null==e||e.focus()},placeholder:this.placeholder,autoComplete:"off",class:"w-full p-1 custom-input",value:this.searchInput,rows:1,onInput:c((e=>this.handleInputChange(e)),500),onKeyUp:this.adjustHeight,onKeyDown:this.handleKeyDown,onFocus:()=>this.searchFormElem.classList.add("input-focus-color"),onBlur:()=>this.searchFormElem.classList.remove("input-focus-color"),onPaste:e=>{this.handlePaste(e)}}),s("div",{key:"4ced8688e0edac2ed1f8a30ea7c0e1099b09e331",role:"status","aria-live":"polite","aria-atomic":"true",class:"sr-only"},this.announceMessage),s("span",{key:"114b87fb5a67f955503a87624e402722cad00276",class:"sr-only"},"Press Enter to send, Shift+Enter for new line"))),s("div",{key:"d9ce04f9657eba2ed56116f3e51ceba84f518052",class:"p-1 self-end flex space-x-1 flex-row",style:{width:this.hideAllButtons?"100%":"auto"}},s("div",{key:"a4752b743e10f5c90e0c7d03192d64e6ba8d2c08","aria-label":"Record voice",class:"flex self-center",style:{width:this.hideAllButtons?"100%":"auto"}},this.isEnableMic&&s("audio-recorder",{key:"e195ba053e5aeb6d017bccf44c01a3a6df2a684c","component-type":"cta",onStartRecord:()=>{this.hideAllButtons=!0},onStopRecord:()=>{this.hideAllButtons=!1},onSendTranscript:e=>{setTimeout((()=>{this.searchInputElem&&(this.searchInputElem.value=e.detail,this.searchInputElem.focus(),requestAnimationFrame((()=>{this.adjustHeight()})))}),1e3)},style:{width:"100%"}}))," ",!this.hideAllButtons&&s("div",{key:"bd7cbc198fbeb575c0105f686683ff0b0a7cd078",class:"flex items-center"},s("div",{key:"50b9e47852a3830eb9fbf0915d75d994924990fd","aria-label":"Send message",class:"flex"},s("button",{key:"15299d903700edfebc1a7084940e2fd6100ccce3",id:`send-message-button-${this.instanceId}`,class:"btn-bg-color text-white transition rounded-full p-1.5 self-center",disabled:this.submitted,onClick:this.handleAskAI,tabindex:"0","aria-label":"Send Message",title:"Send Message"},s("svg",{key:"f27771c390def50b54ec73c295d2c29f4193fafb",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",class:"size-6"},s("path",{key:"c1c893815c40e536537c0c9f1e486666ad2bb0c9","fill-rule":"evenodd",d:"M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z","clip-rule":"evenodd"}))))))),this.imagesBase64List.length>0&&s("div",{key:"3f67411ac3c2f9decf28c5e73767c587744619a5",class:"flex flex-wrap gap-2 mx-1 mt-2.5 mb-1"},this.imagesBase64List.map(((e,t)=>s("div",{class:"image-Container sc-ai12z-input-form",key:t},s("img",{src:e,style:{width:"70px",height:"50px",borderRadius:".75rem"}}),s("span",{class:"delete-image sc-ai12z-input-form cursor-pointer ml-1",onClick:()=>{this.imagesBase64List=this.imagesBase64List.filter(((e,i)=>i!==t)),this.imageUploaderRef&&"function"==typeof this.imageUploaderRef.removeImageAtIndex&&this.imageUploaderRef.removeImageAtIndex(t)}},"×")))))),this.showErrorMessage&&s("div",{key:"868075f816f1704f7a033e44c58b457d3221773d",class:"flex"}," ",s("p",{key:"b3f13d96e369071675db049057032c5e2df64e97",class:"error-msg",innerHTML:this.errorMessage})),this.emptyMessageError&&s("div",{key:"bdda68e0bdf5067c5c188a33652925453afde468",class:"flex"},s("p",{key:"bc9f69e378e0b6ad52f9c4420c6db64343ea3be2",id:`message-error-${this.instanceId}`,class:"error-msg",role:"alert"},"Message cannot be empty. Please enter a message to send.")),0===this.chatLength&&s("div",{key:"5927e7b9968e6dc33cf3f6f4a61c3d3a5e2c86a0",class:"enter-tip",role:"tooltip"},"Tip: Press Enter to send, Shift+Enter for new line"," ",s("button",{key:"b6cc8c60952881f38a68913949f63647e4dedd3f",onClick:()=>this.showShortcutsDialog=!0,class:"keyboard-shortcuts-btn","aria-label":"Show keyboard shortcuts",title:"Keyboard shortcuts (?)",tabindex:"0"},s("svg",{key:"a1330e6d41582e0af855b76a463eb4d5ba5b1c14",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("circle",{key:"c1e6d8628ad15d82d90d686e7f1608c0b0a1b65d",cx:"12",cy:"12",r:"10"}),s("path",{key:"a339edfb79c587493f9935e19ac3db6439906d11",d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),s("line",{key:"9a5a90516a6dbaef064ad268712ada0ba9877d4f",x1:"12",y1:"17",x2:"12.01",y2:"17"}))))),this.showShortcutsDialog&&s("keyboard-shortcuts-dialog",{key:"6f92ef187ba852baf48a50418028ed36ab6ce8dd",show:this.showShortcutsDialog,shortcuts:this.shortcuts,onCloseDialog:()=>this.showShortcutsDialog=!1}))}get el(){return this}static get style(){return":host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important}.input-form{display:flex;flex-direction:column;width:100%;margin-bottom:1rem}.input-container{margin-right:1rem;position:relative;border-radius:4rem;border-width:1px;align-items:stretch;display:flex;}.inner-container{flex-grow:1;padding:0.75rem}.custom-input{color:black;border-width:0;max-height:300px;resize:none;overflow:hidden;background-color:inherit}.custom-input::-moz-placeholder{color:var(--ai12z-input-placeholder-color);opacity:1;font-size:var(--ai12z-input-placeholder-font-size)}.custom-input::placeholder{color:var(--ai12z-input-placeholder-color);opacity:1;font-size:var(--ai12z-input-placeholder-font-size)}.custom-input:focus{outline:none;box-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--ai12z-border-color)}.input-focus-color{border-color:rgb(59 130 246) !important}.plus-icon{color:var(--ai12z-plus-icon-color)}.ai-button{border-left-width:1px;padding-left:1rem;padding-right:1rem;white-space:nowrap;display:inline-flex;place-items:center;color:var(--ai12z-button-font-color);font-size:var(--ai12z-button-font-size);}.ai-button:hover{background-color:var(--ai12z-primary-color);color:rgb(255 255 255)}.custom-svg-checkbox{margin-top:0.25rem;width:1rem;height:1rem;position:absolute}.hide-svg{display:none}.icon-width{width:1.75rem}.custom-attachment{border-right-width:1px;padding-top:10px;padding-left:1rem;padding-right:2rem;cursor:pointer;width:5%}#fileInput{display:none}.error-msg{color:red;font-size:0.75rem;margin-top:0.25rem;text-align:center}.image-Container{position:relative;display:inline-block;margin-right:10px}.delete-image{opacity:3;position:absolute;right:3px;top:0;cursor:pointer;line-height:10px}.btn-bg-color{background-color:var(--ai12z-button-bgcolor)}.searchbar-bgcolor{background-color:var(--ai12z-searchbar-bgcolor)}.inline-searchbar-bgcolor{border-color:var(--ai12z-inlinesearchbar-border-color);background-color:var(--ai12z-inlinesearchbar-bgcolor);border-width:1px}.enter-tip{font-size:12px;color:#666;margin-left:10px}#message-error{margin-left:10px}"}},[0,"ai12z-input-form",{isChat:[4,"is-chat"],placeholder:[1],buttonText:[1,"button-text"],followUpLabel:[1,"follow-up-label"],iconSrc:[1,"icon-src"],isImageUpload:[4,"is-image-upload"],isEnableMic:[4,"is-enable-mic"],componentType:[1,"component-type"],chatLength:[2,"chat-length"],dataKey:[1,"data-key"],dataMode:[1,"data-mode"],imagesBase64List:[32],showShortcutsDialog:[32],shortcuts:[32],searchInput:[32],submitted:[32],showErrorMessage:[32],hideAllButtons:[32],isOpen:[32],capturedFile:[32],errorMessage:[32],emptyMessageError:[32],announceMessage:[32]},[[4,"stateChanged","stateChangedHandler"],[4,"clearInput","clearInputHandler"]]]);function b(){"undefined"!=typeof customElements&&["ai12z-input-form","audio-recorder","image-uploader","item-list","keyboard-shortcuts-dialog"].forEach((t=>{switch(t){case"ai12z-input-form":customElements.get(e(t))||customElements.define(e(t),f);break;case"audio-recorder":customElements.get(e(t))||n();break;case"image-uploader":customElements.get(e(t))||l();break;case"item-list":customElements.get(e(t))||o();break;case"keyboard-shortcuts-dialog":customElements.get(e(t))||h()}}))}b();export{f as I,b as d}
1
+ import{t as e,p as t,H as i,d as a,h as s}from"./p-ZGVz1_9H.js";import{d as o,a as r,v as c}from"./p-CrfXJRIo.js";import{D as d}from"./p-CsY3PAR1.js";import{d as n}from"./p-BWMhH2R1.js";import{d as l}from"./p-DXCT5yQi.js";import{d as h}from"./p-BwTPnzKJ.js";const f=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.action=a(this,"action",7),this.capturedImgUpload=a(this,"capturedImgUpload",7),this.instanceId=`input-${r()}`,this.imagesBase64List=[],this.showShortcutsDialog=!1,this.shortcuts=d,this.componentType="search",this.chatLength=0,this.searchInput="",this.submitted=!1,this.showErrorMessage=!1,this.hideAllButtons=!1,this.isOpen=!1,this.capturedFile=null,this.errorMessage="You can upload a maximum of 10 images once at a time.",this.emptyMessageError=!1,this.announceMessage="",this.adjustHeight=()=>{this.searchInputElem.style.height="auto",this.searchInputElem.style.height=this.searchInputElem.scrollHeight+"px"},this.handleInputChange=e=>{if(this.searchInput=this.searchInputElem.value,this.isChat)return;const t=this.searchInputElem.value;t.length>3&&!this.isChat&&this.action.emit({event:e,value:t,type:"search",imgFiles:this.imagesBase64List})},this.handleClickOutside=e=>{this.isOpen&&this.menuElem&&!this.menuElem.contains(e.target)&&(this.isOpen=!1)},this.handleFormSubmit=e=>{e.preventDefault(),this.searchInput.length>3&&this.action.emit({event:e,value:this.searchInputElem.value,type:"search"})},this.handleKeyDown=e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),""!==this.searchInputElem.value.trim()||this.imagesBase64List.length>0?this.handleAskAI(e):0===this.imagesBase64List.length&&""===this.searchInputElem.value.trim()&&(this.emptyMessageError=!0,this.searchInputElem.focus(),setTimeout((()=>{this.emptyMessageError=!1}),3e3)))},this.handleFollowUp=e=>{this.action.emit({event:e,value:this.searchInputElem.value,imgFiles:this.imagesBase64List,type:"follow-up",followUp:!1})},this.handleRecentChat=e=>{this.action.emit({event:e,value:this.searchInputElem.value,type:"history"})},this.handleAskAI=e=>{var t,i;if(e.preventDefault(),""===this.searchInputElem.value.trim()&&0===this.imagesBase64List.length)return this.emptyMessageError=!0,this.searchInputElem.focus(),void setTimeout((()=>{this.emptyMessageError=!1}),3e3);this.submitted=!0,this.showErrorMessage=!1,this.emptyMessageError=!1,this.announce("Message sent successfully"),this.tempValue=this.searchInputElem.value,this.searchInputElem.value="";const a=this.imagesBase64List;this.imagesBase64List=[],this.action.emit({event:e,value:this.tempValue,imgFiles:a,followUp:null!==(i=null===(t=this.followUpElem)||void 0===t?void 0:t.checked)&&void 0!==i&&i,type:"ask-ai"})},this.handleImageChange=e=>{this.imagesBase64List=e.detail,this.showErrorMessage=!1},this.handleImageError=e=>{this.errorMessage=e.detail,this.showErrorMessage=!0},this.toggleBox=e=>{e.stopPropagation(),this.isOpen=!this.isOpen},this.handlePaste=e=>{var t;e.preventDefault();const i=(null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text"))||"";if(this.searchInputElem&&i){const e=this.searchInputElem,t=e.selectionStart,a=e.selectionEnd,s=e.value,o=s.substring(0,t)+i+s.substring(a);e.value=o;const r=t+i.length;e.setSelectionRange(r,r),setTimeout((()=>{this.adjustHeight()}),0)}}}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside)}componentDidLoad(){this.isImageUpload&&document.addEventListener("click",this.handleClickOutside)}stateChangedHandler(e){if(this.submitted=!1,this.isChat){this.searchInputElem.value="",this.searchInput="";const e=this.el.querySelector(`#previewContainer-${this.instanceId}`);this.el.querySelector(`#searchInput-${this.instanceId}`).style.overflow="hidden",e&&(e.innerHTML=""),this.imagesBase64List=[]}}clearInputHandler(e){this.submitted=!1,this.searchInput="";const t=this.el.querySelector(`#previewContainer-${this.instanceId}`);t&&(t.innerHTML=""),this.imagesBase64List=[],this.searchInputElem.style.height="auto"}announce(e){this.announceMessage=e,setTimeout((()=>{this.announceMessage=""}),1e3)}async captureScreen(){try{const e=await navigator.mediaDevices.getDisplayMedia({video:!0}),t=document.createElement("video");t.srcObject=e,t.autoplay=!0,document.body.appendChild(t),await new Promise((e=>t.onloadedmetadata=e)),await new Promise((e=>setTimeout(e,500)));const i=document.createElement("canvas");i.width=t.videoWidth,i.height=t.videoHeight;const a=i.getContext("2d");a&&(a.drawImage(t,0,0,i.width,i.height),i.toBlob((e=>{if(e){const t=new File([e],`screenshot-${Date.now()}.png`,{type:"image/png"});this.capturedFile=t,this.capturedImgUpload.emit([t])}}),"image/png")),e.getTracks().forEach((e=>e.stop())),document.body.removeChild(t)}catch(e){console.error("Error capturing screen:",e)}}render(){return s("div",{key:"623f7b93a8fee68a98ffe0d15fe49232c928d541"},s("div",{key:"33fa75b886a6d845785ab7ad4be2cba4437deead",class:"absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10\n "+(this.isOpen?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-90 pointer-events-none"),ref:e=>this.menuElem=e},s("ul",{key:"c7a41dcf7bbb7d3b52d3adac6f7871553d082a97",class:"space-y-2"},this.isImageUpload&&s("li",{key:"4efc17c2a136caf0b8bfc2fba39622a1bab801c9",class:"px-4 py-2 hover:bg-gray-100 cursor-pointer flex"},s("image-uploader",{key:"8c669dda8dd81f4a24da8232938bbd6cae65ad7f",maxImages:10,images:this.imagesBase64List,targetElement:this.searchInputElem,onImagesChange:this.handleImageChange,onError:this.handleImageError,ref:e=>this.imageUploaderRef=e})),s("li",{key:"5fc6b84028c421a57c9b4c3ed36a1b19c6833546",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex",onClick:e=>{this.captureScreen(),this.toggleBox(e)}},s("div",{key:"20cd5b58b14938dde41c3ec82a4d204ddaebea4d",class:"mr-1 mt-px"},s("svg",{key:"c740a9f51839e41055786d23fd7b4ed44ed29324",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"20",height:"20"},s("path",{key:"f8516209c60f8478b6b6e510ceff2ec0a6fb57cd",d:"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z"}),s("path",{key:"8c59bd0faf944dedc4b311cf6c7403e4e8c79689","fill-rule":"evenodd",d:"M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"}))),s("div",{key:"e10bf86ebd212649837dfad5094d9f39c0555af4"},"Capture")),s("li",{key:"d2b7a298b838ed7259019e26f211a09d69f328b5",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex","aria-label":"Start Over","aria-disabled":0===this.chatLength,style:{opacity:0===this.chatLength?"0.5":"1",cursor:0===this.chatLength?"not-allowed":"pointer"},onClick:e=>{0!==this.chatLength&&(this.handleFollowUp(e),this.toggleBox(e))}},s("div",{key:"95729576e7131a1bcde5edf2f00704e3979f0168",class:"mr-1 mt-px"},s("svg",{key:"aca3169ad3c1933750e6e70156ff3aafa9cb700e",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("path",{key:"f09ce7b4c487d62f744ab255274120d648cebd0c",d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"}))),s("div",{key:"22838c5639850ca1520b5859188cd0cc7f62ae78"},"Start Over")),s("li",{key:"0625819dc4f37253f68674ae2f41169abd7249d3",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex","aria-label":"View Recent Chat",onClick:e=>{this.handleRecentChat(e)}},s("div",{key:"1bd82e7a2f97481c5215af8b5d67ec71d2c69719",class:"mr-1 mt-px"},s("svg",{key:"1a88182d117cadac2c5c491578533860b008cf75",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("path",{key:"1e75ddfc584d70d0ada8008463ea08d8d0ac6623",d:"M21 15a4 4 0 0 1-4 4H7l-4 4V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"}),s("path",{key:"d1db69ed6ae7f982b1839204e52a90c32630f1fb",d:"M12 7v5l3 2"}))),s("div",{key:"813b01482c85e7b63908facb41c4a48f226ecd3b"},"View Recent Chat")))),s("form",{key:"b810bd80536347059124d3827e26502e03a97092",class:"w-full flex flex-col gap-1.5 sticky",onSubmit:this.handleFormSubmit},s("div",{key:"f69b95ec734d662c3e88cdc93aa15f8983f380a7",class:"flex-1 flex flex-col relative w-full rounded-3xl px-1 "+("inline"===this.componentType?"inline-searchbar-bgcolor":"searchbar-bgcolor"),dir:"LTR",ref:e=>this.searchFormElem=e},s("div",{key:"c64d576d4675e5993fcecde579f4a992da296a3f",class:"flex items-center"},s("div",{key:"e41c8a31a3775a409810f12f856dd6bb5113b67d",class:"ml-1 self-center flex space-x-1"},!this.hideAllButtons&&s("div",{key:"7614880c9a53a7e99ead7090637185b996b7cc2e",class:"relative inline-block",style:{width:"5%"}},s("button",{key:"edfcedc1fe6e77f2da4d26a60aad3748683ca6ef",class:"plus-icon","aria-label":"Options",title:"Add images or capture screen",tabindex:"0",onClick:e=>{e.stopPropagation(),this.toggleBox(e)}},s("svg",{key:"123d73fdd31ea56f503df593818a05f5574c6fdb",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20"},s("path",{key:"cded16c28c1421bc4c9d4b9f18af6411309a22ba",d:"M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"}))))),!this.hideAllButtons&&s("div",{key:"9b0213ad6586daecb71c46941b17108f13c58048",class:"scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto"},s("div",{key:"619ef140b69574f9b5f6b56d3d7dc8355163fbc1",class:"relative w-full min-w-full h-full min-h-fit flex items-center input-prose"},s("div",{key:"a972c24cc5748376eedced77c91dffd331054293",id:`previewContainer-${this.instanceId}`,draggable:!0}),s("label",{key:"b515979270ffdbf8024951c04a826888539a0e64",htmlFor:`searchInput-${this.instanceId}`,class:"sr-only"},"Your message"),s("textarea",{key:"32123cab1fb36680b6e62a53e975988434721974",readOnly:this.submitted,"aria-describedby":this.emptyMessageError?`message-error-${this.instanceId} search-hint-${this.instanceId}`:`search-hint-${this.instanceId}`,"aria-invalid":this.emptyMessageError,id:`searchInput-${this.instanceId}`,ref:e=>{this.searchInputElem=e,null==e||e.focus()},placeholder:this.placeholder,autoComplete:"off",class:"w-full p-1 custom-input",value:this.searchInput,rows:1,onInput:c((e=>this.handleInputChange(e)),500),onKeyUp:this.adjustHeight,onKeyDown:this.handleKeyDown,onFocus:()=>this.searchFormElem.classList.add("input-focus-color"),onBlur:()=>this.searchFormElem.classList.remove("input-focus-color"),onPaste:e=>{this.handlePaste(e)}}),s("div",{key:"4ced8688e0edac2ed1f8a30ea7c0e1099b09e331",role:"status","aria-live":"polite","aria-atomic":"true",class:"sr-only"},this.announceMessage),s("span",{key:"114b87fb5a67f955503a87624e402722cad00276",class:"sr-only"},"Press Enter to send, Shift+Enter for new line"))),s("div",{key:"d9ce04f9657eba2ed56116f3e51ceba84f518052",class:"p-1 self-end flex space-x-1 flex-row",style:{width:this.hideAllButtons?"100%":"auto"}},s("div",{key:"a4752b743e10f5c90e0c7d03192d64e6ba8d2c08","aria-label":"Record voice",class:"flex self-center",style:{width:this.hideAllButtons?"100%":"auto"}},this.isEnableMic&&s("audio-recorder",{key:"e195ba053e5aeb6d017bccf44c01a3a6df2a684c","component-type":"cta",onStartRecord:()=>{this.hideAllButtons=!0},onStopRecord:()=>{this.hideAllButtons=!1},onSendTranscript:e=>{setTimeout((()=>{this.searchInputElem&&(this.searchInputElem.value=e.detail,this.searchInputElem.focus(),requestAnimationFrame((()=>{this.adjustHeight()})))}),1e3)},style:{width:"100%"}}))," ",!this.hideAllButtons&&s("div",{key:"bd7cbc198fbeb575c0105f686683ff0b0a7cd078",class:"flex items-center"},s("div",{key:"50b9e47852a3830eb9fbf0915d75d994924990fd","aria-label":"Send message",class:"flex"},s("button",{key:"15299d903700edfebc1a7084940e2fd6100ccce3",id:`send-message-button-${this.instanceId}`,class:"btn-bg-color text-white transition rounded-full p-1.5 self-center",disabled:this.submitted,onClick:this.handleAskAI,tabindex:"0","aria-label":"Send Message",title:"Send Message"},s("svg",{key:"f27771c390def50b54ec73c295d2c29f4193fafb",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",class:"size-6"},s("path",{key:"c1c893815c40e536537c0c9f1e486666ad2bb0c9","fill-rule":"evenodd",d:"M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z","clip-rule":"evenodd"}))))))),this.imagesBase64List.length>0&&s("div",{key:"3f67411ac3c2f9decf28c5e73767c587744619a5",class:"flex flex-wrap gap-2 mx-1 mt-2.5 mb-1"},this.imagesBase64List.map(((e,t)=>s("div",{class:"image-Container sc-ai12z-input-form",key:t},s("img",{src:e,style:{width:"70px",height:"50px",borderRadius:".75rem"}}),s("span",{class:"delete-image sc-ai12z-input-form cursor-pointer ml-1",onClick:()=>{this.imagesBase64List=this.imagesBase64List.filter(((e,i)=>i!==t)),this.imageUploaderRef&&"function"==typeof this.imageUploaderRef.removeImageAtIndex&&this.imageUploaderRef.removeImageAtIndex(t)}},"×")))))),this.showErrorMessage&&s("div",{key:"868075f816f1704f7a033e44c58b457d3221773d",class:"flex"}," ",s("p",{key:"b3f13d96e369071675db049057032c5e2df64e97",class:"error-msg",innerHTML:this.errorMessage})),this.emptyMessageError&&s("div",{key:"bdda68e0bdf5067c5c188a33652925453afde468",class:"flex"},s("p",{key:"bc9f69e378e0b6ad52f9c4420c6db64343ea3be2",id:`message-error-${this.instanceId}`,class:"error-msg",role:"alert"},"Message cannot be empty. Please enter a message to send.")),0===this.chatLength&&s("div",{key:"5927e7b9968e6dc33cf3f6f4a61c3d3a5e2c86a0",class:"enter-tip",role:"tooltip"},"Tip: Press Enter to send, Shift+Enter for new line"," ",s("button",{key:"b6cc8c60952881f38a68913949f63647e4dedd3f",onClick:()=>this.showShortcutsDialog=!0,class:"keyboard-shortcuts-btn","aria-label":"Show keyboard shortcuts",title:"Keyboard shortcuts (?)",tabindex:"0"},s("svg",{key:"a1330e6d41582e0af855b76a463eb4d5ba5b1c14",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("circle",{key:"c1e6d8628ad15d82d90d686e7f1608c0b0a1b65d",cx:"12",cy:"12",r:"10"}),s("path",{key:"a339edfb79c587493f9935e19ac3db6439906d11",d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),s("line",{key:"9a5a90516a6dbaef064ad268712ada0ba9877d4f",x1:"12",y1:"17",x2:"12.01",y2:"17"}))))),this.showShortcutsDialog&&s("keyboard-shortcuts-dialog",{key:"6f92ef187ba852baf48a50418028ed36ab6ce8dd",show:this.showShortcutsDialog,shortcuts:this.shortcuts,onCloseDialog:()=>this.showShortcutsDialog=!1}))}get el(){return this}static get style(){return":host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important}.input-form{display:flex;flex-direction:column;width:100%;margin-bottom:1rem}.input-container{margin-right:1rem;position:relative;border-radius:4rem;border-width:1px;align-items:stretch;display:flex;}.inner-container{flex-grow:1;padding:0.75rem}.custom-input{color:black;border-width:0;max-height:300px;resize:none;overflow:hidden;background-color:inherit}.custom-input::-moz-placeholder{color:var(--ai12z-input-placeholder-color);opacity:1;font-size:var(--ai12z-input-placeholder-font-size)}.custom-input::placeholder{color:var(--ai12z-input-placeholder-color);opacity:1;font-size:var(--ai12z-input-placeholder-font-size)}.custom-input:focus{outline:none;box-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--ai12z-border-color)}.input-focus-color{border-color:rgb(59 130 246) !important}.plus-icon{color:var(--ai12z-plus-icon-color)}.ai-button{border-left-width:1px;padding-left:1rem;padding-right:1rem;white-space:nowrap;display:inline-flex;place-items:center;color:var(--ai12z-button-font-color);font-size:var(--ai12z-button-font-size);}.ai-button:hover{background-color:var(--ai12z-primary-color);color:rgb(255 255 255)}.custom-svg-checkbox{margin-top:0.25rem;width:1rem;height:1rem;position:absolute}.hide-svg{display:none}.icon-width{width:1.75rem}.custom-attachment{border-right-width:1px;padding-top:10px;padding-left:1rem;padding-right:2rem;cursor:pointer;width:5%}#fileInput{display:none}.error-msg{color:red;font-size:0.75rem;margin-top:0.25rem;text-align:center}.image-Container{position:relative;display:inline-block;margin-right:10px}.delete-image{opacity:3;position:absolute;right:3px;top:0;cursor:pointer;line-height:10px}.btn-bg-color{background-color:var(--ai12z-button-bgcolor)}.searchbar-bgcolor{background-color:var(--ai12z-searchbar-bgcolor)}.inline-searchbar-bgcolor{border-color:var(--ai12z-inlinesearchbar-border-color);background-color:var(--ai12z-inlinesearchbar-bgcolor);border-width:1px}.enter-tip{font-size:12px;color:#666;margin-left:10px}#message-error{margin-left:10px}"}},[0,"ai12z-input-form",{isChat:[4,"is-chat"],placeholder:[1],buttonText:[1,"button-text"],followUpLabel:[1,"follow-up-label"],iconSrc:[1,"icon-src"],isImageUpload:[4,"is-image-upload"],isEnableMic:[4,"is-enable-mic"],componentType:[1,"component-type"],chatLength:[2,"chat-length"],dataKey:[1,"data-key"],dataMode:[1,"data-mode"],imagesBase64List:[32],showShortcutsDialog:[32],shortcuts:[32],searchInput:[32],submitted:[32],showErrorMessage:[32],hideAllButtons:[32],isOpen:[32],capturedFile:[32],errorMessage:[32],emptyMessageError:[32],announceMessage:[32]},[[4,"stateChanged","stateChangedHandler"],[4,"clearInput","clearInputHandler"]]]);function b(){"undefined"!=typeof customElements&&["ai12z-input-form","audio-recorder","image-uploader","item-list","keyboard-shortcuts-dialog"].forEach((t=>{switch(t){case"ai12z-input-form":customElements.get(e(t))||customElements.define(e(t),f);break;case"audio-recorder":customElements.get(e(t))||n();break;case"image-uploader":customElements.get(e(t))||l();break;case"item-list":customElements.get(e(t))||o();break;case"keyboard-shortcuts-dialog":customElements.get(e(t))||h()}}))}b();export{f as I,b as d}