ttp-agent-sdk 2.39.0 → 2.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-widget.dev.js +5002 -2914
- package/dist/agent-widget.dev.js.map +1 -1
- package/dist/agent-widget.esm.js +1 -1
- package/dist/agent-widget.esm.js.map +1 -1
- package/dist/agent-widget.js +1 -1
- package/dist/agent-widget.js.map +1 -1
- package/dist/audio-processor.js +4 -0
- package/dist/demos/index.html +45 -0
- package/dist/demos/test-ecommerce.html +34 -16
- package/dist/demos/test-tour.html +375 -0
- package/dist/demos/widget-customization-dev.html +8 -14
- package/dist/demos/widget-customization.html +1721 -608
- package/dist/examples/test-ecommerce.html +34 -16
- package/dist/examples/test-index.html +45 -0
- package/dist/examples/test-restaurant.html +373 -0
- package/dist/examples/test-text-chat.html +18 -9
- package/dist/examples/test-tour.html +375 -0
- package/dist/examples/widget-customization-dev.html +8 -14
- package/dist/examples/widget-customization.html +1721 -608
- package/examples/test-ecommerce.html +34 -16
- package/examples/test-index.html +45 -0
- package/examples/test-restaurant.html +373 -0
- package/examples/test-text-chat.html +18 -9
- package/examples/test-tour.html +375 -0
- package/examples/widget-customization-dev.html +8 -14
- package/examples/widget-customization.html +1721 -608
- package/package.json +1 -1
package/dist/agent-widget.esm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see agent-widget.esm.js.LICENSE.txt */
|
|
2
|
-
import{useCallback as e,useEffect as t,useRef as n,useState as A}from"react";var o={354:function(e){e.exports=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function A(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(A.prototype=n.prototype,new A)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,A=arguments.length;n<A;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function A(e,t,n,A){return new(n||(n=Promise))(function(o,i){function r(e){try{s(A.next(e))}catch(e){i(e)}}function a(e){try{s(A.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,a)}s((A=A.apply(e,t||[])).next())})}function o(e,t){var n,A,o,i,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,A&&(o=2&i[0]?A.return:i[0]?A.throw||((o=A.return)&&o.call(A),0):A.next)&&!(o=o.call(A,i[1])).done)return o;switch(A=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,A=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){r.label=i[1];break}if(6===i[0]&&r.label<o[1]){r.label=o[1],o=i;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(i);break}o[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e],A=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function i(e,t,n){if(n||2===arguments.length)for(var A,o=0,i=t.length;o<i;o++)!A&&o in t||(A||(A=Array.prototype.slice.call(t,0,o)),A[o]=t[o]);return e.concat(A||t)}for(var r=function(){function e(e,t,n,A){this.left=e,this.top=t,this.width=n,this.height=A}return e.prototype.add=function(t,n,A,o){return new e(this.left+t,this.top+n,this.width+A,this.height+o)},e.fromClientRect=function(t,n){return new e(n.left+t.windowBounds.left,n.top+t.windowBounds.top,n.width,n.height)},e.fromDOMRectList=function(t,n){var A=Array.from(n).find(function(e){return 0!==e.width});return A?new e(A.left+t.windowBounds.left,A.top+t.windowBounds.top,A.width,A.height):e.EMPTY},e.EMPTY=new e(0,0,0,0),e}(),a=function(e,t){return r.fromClientRect(e,t.getBoundingClientRect())},s=function(e){for(var t=[],n=0,A=e.length;n<A;){var o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<A){var i=e.charCodeAt(n++);56320==(64512&i)?t.push(((1023&o)<<10)+(1023&i)+65536):(t.push(o),n--)}else t.push(o)}return t},c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var n=e.length;if(!n)return"";for(var A=[],o=-1,i="";++o<n;){var r=e[o];r<=65535?A.push(r):(r-=65536,A.push(55296+(r>>10),r%1024+56320)),(o+1===n||A.length>16384)&&(i+=String.fromCharCode.apply(String,A),A.length=0)}return i},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="undefined"==typeof Uint8Array?[]:new Uint8Array(256),p=0;p<64;p++)d[l.charCodeAt(p)]=p;for(var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h="undefined"==typeof Uint8Array?[]:new Uint8Array(256),g=0;g<64;g++)h[u.charCodeAt(g)]=g;for(var m=function(e,t,n){return e.slice?e.slice(t,n):new Uint16Array(Array.prototype.slice.call(e,t,n))},f=function(){function e(e,t,n,A,o,i){this.initialValue=e,this.errorValue=t,this.highStart=n,this.highValueIndex=A,this.index=o,this.data=i}return e.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e<this.highStart)return t=2080+(e>>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B="undefined"==typeof Uint8Array?[]:new Uint8Array(256),w=0;w<64;w++)B[v.charCodeAt(w)]=w;var b=10,y=13,x=15,C=17,Q=18,F=19,U=20,S=21,k=22,E=24,I=25,T=26,H=27,_=28,D=30,M=32,P=33,L=34,R=35,K=37,O=38,V=39,N=40,j=42,G=[9001,65288],z="×",W="÷",q=function(e){var t,n,A,o=function(e){var t,n,A,o,i,r=.75*e.length,a=e.length,s=0;"="===e[e.length-1]&&(r--,"="===e[e.length-2]&&r--);var c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(r):new Array(r),l=Array.isArray(c)?c:new Uint8Array(c);for(t=0;t<a;t+=4)n=h[e.charCodeAt(t)],A=h[e.charCodeAt(t+1)],o=h[e.charCodeAt(t+2)],i=h[e.charCodeAt(t+3)],l[s++]=n<<2|A>>4,l[s++]=(15&A)<<4|o>>2,l[s++]=(3&o)<<6|63&i;return c}(e),i=Array.isArray(o)?function(e){for(var t=e.length,n=[],A=0;A<t;A+=4)n.push(e[A+3]<<24|e[A+2]<<16|e[A+1]<<8|e[A]);return n}(o):new Uint32Array(o),r=Array.isArray(o)?function(e){for(var t=e.length,n=[],A=0;A<t;A+=2)n.push(e[A+1]<<8|e[A]);return n}(o):new Uint16Array(o),a=m(r,12,i[4]/2),s=2===i[5]?m(r,(24+i[4])/2):(t=i,n=Math.ceil((24+i[4])/4),t.slice?t.slice(n,A):new Uint32Array(Array.prototype.slice.call(t,n,A)));return new f(i[0],i[1],i[2],i[3],a,s)}("KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA=="),X=[D,36],Y=[1,2,3,5],J=[b,8],Z=[H,T],$=Y.concat(J),ee=[O,V,N,L,R],te=[x,y],ne=function(e,t,n,A){var o=A[n];if(Array.isArray(e)?-1!==e.indexOf(o):e===o)for(var i=n;i<=A.length;){if((s=A[++i])===t)return!0;if(s!==b)break}if(o===b)for(i=n;i>0;){var r=A[--i];if(Array.isArray(e)?-1!==e.indexOf(r):e===r)for(var a=n;a<=A.length;){var s;if((s=A[++a])===t)return!0;if(s!==b)break}if(r!==b)break}return!1},Ae=function(e,t){for(var n=e;n>=0;){var A=t[n];if(A!==b)return A;n--}return 0},oe=function(e,t,n,A,o){if(0===n[A])return z;var i=A-1;if(Array.isArray(o)&&!0===o[i])return z;var r=i-1,a=i+1,s=t[i],c=r>=0?t[r]:0,l=t[a];if(2===s&&3===l)return z;if(-1!==Y.indexOf(s))return"!";if(-1!==Y.indexOf(l))return z;if(-1!==J.indexOf(l))return z;if(8===Ae(i,t))return W;if(11===q.get(e[i]))return z;if((s===M||s===P)&&11===q.get(e[a]))return z;if(7===s||7===l)return z;if(9===s)return z;if(-1===[b,y,x].indexOf(s)&&9===l)return z;if(-1!==[C,Q,F,E,_].indexOf(l))return z;if(Ae(i,t)===k)return z;if(ne(23,k,i,t))return z;if(ne([C,Q],S,i,t))return z;if(ne(12,12,i,t))return z;if(s===b)return W;if(23===s||23===l)return z;if(16===l||16===s)return W;if(-1!==[y,x,S].indexOf(l)||14===s)return z;if(36===c&&-1!==te.indexOf(s))return z;if(s===_&&36===l)return z;if(l===U)return z;if(-1!==X.indexOf(l)&&s===I||-1!==X.indexOf(s)&&l===I)return z;if(s===H&&-1!==[K,M,P].indexOf(l)||-1!==[K,M,P].indexOf(s)&&l===T)return z;if(-1!==X.indexOf(s)&&-1!==Z.indexOf(l)||-1!==Z.indexOf(s)&&-1!==X.indexOf(l))return z;if(-1!==[H,T].indexOf(s)&&(l===I||-1!==[k,x].indexOf(l)&&t[a+1]===I)||-1!==[k,x].indexOf(s)&&l===I||s===I&&-1!==[I,_,E].indexOf(l))return z;if(-1!==[I,_,E,C,Q].indexOf(l))for(var d=i;d>=0;){if((p=t[d])===I)return z;if(-1===[_,E].indexOf(p))break;d--}if(-1!==[H,T].indexOf(l))for(d=-1!==[C,Q].indexOf(s)?r:i;d>=0;){var p;if((p=t[d])===I)return z;if(-1===[_,E].indexOf(p))break;d--}if(O===s&&-1!==[O,V,L,R].indexOf(l)||-1!==[V,L].indexOf(s)&&-1!==[V,N].indexOf(l)||-1!==[N,R].indexOf(s)&&l===N)return z;if(-1!==ee.indexOf(s)&&-1!==[U,T].indexOf(l)||-1!==ee.indexOf(l)&&s===H)return z;if(-1!==X.indexOf(s)&&-1!==X.indexOf(l))return z;if(s===E&&-1!==X.indexOf(l))return z;if(-1!==X.concat(I).indexOf(s)&&l===k&&-1===G.indexOf(e[a])||-1!==X.concat(I).indexOf(l)&&s===Q)return z;if(41===s&&41===l){for(var u=n[i],h=1;u>0&&41===t[--u];)h++;if(h%2!=0)return z}return s===M&&l===P?z:W},ie=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var n=function(e,t){void 0===t&&(t="strict");var n=[],A=[],o=[];return e.forEach(function(e,i){var r=q.get(e);if(r>50?(o.push(!0),r-=50):o.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return A.push(i),n.push(16);if(4===r||11===r){if(0===i)return A.push(i),n.push(D);var a=n[i-1];return-1===$.indexOf(a)?(A.push(A[i-1]),n.push(a)):(A.push(i),n.push(D))}return A.push(i),31===r?n.push("strict"===t?S:K):r===j||29===r?n.push(D):43===r?e>=131072&&e<=196605||e>=196608&&e<=262141?n.push(K):n.push(D):void n.push(r)}),[A,n,o]}(e,t.lineBreak),A=n[0],o=n[1],i=n[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(o=o.map(function(e){return-1!==[I,D,j].indexOf(e)?K:e}));var r="keep-all"===t.wordBreak?i.map(function(t,n){return t&&e[n]>=19968&&e[n]<=40959}):void 0;return[A,o,r]},re=function(){function e(e,t,n,A){this.codePoints=e,this.required="!"===t,this.start=n,this.end=A}return e.prototype.slice=function(){return c.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),ae=45,se=43,ce=-1,le=function(e){return e>=48&&e<=57},de=function(e){return le(e)||e>=65&&e<=70||e>=97&&e<=102},pe=function(e){return 10===e||9===e||32===e},ue=function(e){return function(e){return function(e){return e>=97&&e<=122}(e)||function(e){return e>=65&&e<=90}(e)}(e)||function(e){return e>=128}(e)||95===e},he=function(e){return ue(e)||le(e)||e===ae},ge=function(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e},me=function(e,t){return 92===e&&10!==t},fe=function(e,t,n){return e===ae?ue(t)||me(t,n):!!ue(e)||!(92!==e||!me(e,t))},ve=function(e,t,n){return e===se||e===ae?!!le(t)||46===t&&le(n):le(46===e?t:e)},Be=function(e){var t=0,n=1;e[t]!==se&&e[t]!==ae||(e[t]===ae&&(n=-1),t++);for(var A=[];le(e[t]);)A.push(e[t++]);var o=A.length?parseInt(c.apply(void 0,A),10):0;46===e[t]&&t++;for(var i=[];le(e[t]);)i.push(e[t++]);var r=i.length,a=r?parseInt(c.apply(void 0,i),10):0;69!==e[t]&&101!==e[t]||t++;var s=1;e[t]!==se&&e[t]!==ae||(e[t]===ae&&(s=-1),t++);for(var l=[];le(e[t]);)l.push(e[t++]);var d=l.length?parseInt(c.apply(void 0,l),10):0;return n*(o+a*Math.pow(10,-r))*Math.pow(10,s*d)},we={type:2},be={type:3},ye={type:4},xe={type:13},Ce={type:8},Qe={type:21},Fe={type:9},Ue={type:10},Se={type:11},ke={type:12},Ee={type:14},Ie={type:23},Te={type:1},He={type:25},_e={type:24},De={type:26},Me={type:27},Pe={type:28},Le={type:29},Re={type:31},Ke={type:32},Oe=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(s(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Ke;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case 34:return this.consumeStringToken(34);case 35:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),A=this.peekCodePoint(2);if(he(t)||me(n,A)){var o=fe(t,n,A)?2:1;return{type:5,value:this.consumeName(),flags:o}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),xe;break;case 39:return this.consumeStringToken(39);case 40:return we;case 41:return be;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Ee;break;case se:if(ve(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 44:return ye;case ae:var i=e,r=this.peekCodePoint(0),a=this.peekCodePoint(1);if(ve(i,r,a))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(fe(i,r,a))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(r===ae&&62===a)return this.consumeCodePoint(),this.consumeCodePoint(),_e;break;case 46:if(ve(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var s=this.consumeCodePoint();if(42===s&&47===(s=this.consumeCodePoint()))return this.consumeToken();if(s===ce)return this.consumeToken()}break;case 58:return De;case 59:return Me;case 60:if(33===this.peekCodePoint(0)&&this.peekCodePoint(1)===ae&&this.peekCodePoint(2)===ae)return this.consumeCodePoint(),this.consumeCodePoint(),He;break;case 64:var l=this.peekCodePoint(0),d=this.peekCodePoint(1),p=this.peekCodePoint(2);if(fe(l,d,p))return{type:7,value:this.consumeName()};break;case 91:return Pe;case 92:if(me(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case 93:return Le;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Ce;break;case 123:return Se;case 125:return ke;case 117:case 85:var u=this.peekCodePoint(0),h=this.peekCodePoint(1);return u!==se||!de(h)&&63!==h||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Fe;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),Qe;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Ue;break;case ce:return Ke}return pe(e)?(this.consumeWhiteSpace(),Re):le(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ue(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:c(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();de(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;63===t&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n)return{type:30,start:parseInt(c.apply(void 0,e.map(function(e){return 63===e?48:e})),16),end:parseInt(c.apply(void 0,e.map(function(e){return 63===e?70:e})),16)};var A=parseInt(c.apply(void 0,e),16);if(this.peekCodePoint(0)===ae&&de(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];de(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();return{type:30,start:A,end:parseInt(c.apply(void 0,o),16)}}return{type:30,start:A,end:A}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===ce)return{type:22,value:""};var t=this.peekCodePoint(0);if(39===t||34===t){var n=this.consumeStringToken(this.consumeCodePoint());return 0===n.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===ce||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),Ie)}for(;;){var A=this.consumeCodePoint();if(A===ce||41===A)return{type:22,value:c.apply(void 0,e)};if(pe(A))return this.consumeWhiteSpace(),this.peekCodePoint(0)===ce||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:c.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Ie);if(34===A||39===A||40===A||ge(A))return this.consumeBadUrlRemnants(),Ie;if(92===A){if(!me(A,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),Ie;e.push(this.consumeEscapedCodePoint())}else e.push(A)}},e.prototype.consumeWhiteSpace=function(){for(;pe(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(41===e||e===ce)return;me(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t="";e>0;){var n=Math.min(5e4,e);t+=c.apply(void 0,this._value.splice(0,n)),e-=n}return this._value.shift(),t},e.prototype.consumeStringToken=function(e){for(var t="",n=0;;){var A=this._value[n];if(A===ce||void 0===A||A===e)return{type:0,value:t+=this.consumeStringSlice(n)};if(10===A)return this._value.splice(0,n),Te;if(92===A){var o=this._value[n+1];o!==ce&&void 0!==o&&(10===o?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):me(A,o)&&(t+=this.consumeStringSlice(n),t+=c(this.consumeEscapedCodePoint()),n=-1))}n++}},e.prototype.consumeNumber=function(){var e=[],t=4,n=this.peekCodePoint(0);for(n!==se&&n!==ae||e.push(this.consumeCodePoint());le(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var A=this.peekCodePoint(1);if(46===n&&le(A))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;le(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),A=this.peekCodePoint(1);var o=this.peekCodePoint(2);if((69===n||101===n)&&((A===se||A===ae)&&le(o)||le(A)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;le(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Be(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],A=this.peekCodePoint(0),o=this.peekCodePoint(1),i=this.peekCodePoint(2);return fe(A,o,i)?{type:15,number:t,flags:n,unit:this.consumeName()}:37===A?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(de(e)){for(var t=c(e);de(this.peekCodePoint(0))&&t.length<6;)t+=c(this.consumeCodePoint());pe(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return 0===n||function(e){return e>=55296&&e<=57343}(n)||n>1114111?65533:n}return e===ce?65533:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(he(t))e+=c(t);else{if(!me(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=c(this.consumeEscapedCodePoint())}}},e}(),Ve=function(){function e(e){this._tokens=e}return e.create=function(t){var n=new Oe;return n.write(t),new e(n.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(32===n.type||Je(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(32===n.type||3===n.type)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?Ke:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Ne=function(e){return 15===e.type},je=function(e){return 17===e.type},Ge=function(e){return 20===e.type},ze=function(e){return 0===e.type},We=function(e,t){return Ge(e)&&e.value===t},qe=function(e){return 31!==e.type},Xe=function(e){return 31!==e.type&&4!==e.type},Ye=function(e){var t=[],n=[];return e.forEach(function(e){if(4===e.type){if(0===n.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(n),void(n=[])}31!==e.type&&n.push(e)}),n.length&&t.push(n),t},Je=function(e,t){return 11===t&&12===e.type||28===t&&29===e.type||2===t&&3===e.type},Ze=function(e){return 17===e.type||15===e.type},$e=function(e){return 16===e.type||Ze(e)},et=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},tt={type:17,number:0,flags:4},nt={type:16,number:50,flags:4},At={type:16,number:100,flags:4},ot=function(e,t,n){var A=e[0],o=e[1];return[it(A,t),it(void 0!==o?o:A,n)]},it=function(e,t){if(16===e.type)return e.number/100*t;if(Ne(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},rt="grad",at="turn",st=function(e,t){if(15===t.type)switch(t.unit){case"deg":return Math.PI*t.number/180;case rt:return Math.PI/200*t.number;case"rad":return t.number;case at:return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},ct=function(e){return 15===e.type&&("deg"===e.unit||e.unit===rt||"rad"===e.unit||e.unit===at)},lt=function(e){switch(e.filter(Ge).map(function(e){return e.value}).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[tt,tt];case"to top":case"bottom":return dt(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[tt,At];case"to right":case"left":return dt(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[At,At];case"to bottom":case"top":return dt(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[At,tt];case"to left":case"right":return dt(270)}return 0},dt=function(e){return Math.PI*e/180},pt=function(e,t){if(18===t.type){var n=wt[t.name];if(void 0===n)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return n(e,t.values)}if(5===t.type){if(3===t.value.length){var A=t.value.substring(0,1),o=t.value.substring(1,2),i=t.value.substring(2,3);return gt(parseInt(A+A,16),parseInt(o+o,16),parseInt(i+i,16),1)}if(4===t.value.length){A=t.value.substring(0,1),o=t.value.substring(1,2),i=t.value.substring(2,3);var r=t.value.substring(3,4);return gt(parseInt(A+A,16),parseInt(o+o,16),parseInt(i+i,16),parseInt(r+r,16)/255)}if(6===t.value.length)return A=t.value.substring(0,2),o=t.value.substring(2,4),i=t.value.substring(4,6),gt(parseInt(A,16),parseInt(o,16),parseInt(i,16),1);if(8===t.value.length)return A=t.value.substring(0,2),o=t.value.substring(2,4),i=t.value.substring(4,6),r=t.value.substring(6,8),gt(parseInt(A,16),parseInt(o,16),parseInt(i,16),parseInt(r,16)/255)}if(20===t.type){var a=yt[t.value.toUpperCase()];if(void 0!==a)return a}return yt.TRANSPARENT},ut=function(e){return!(255&e)},ht=function(e){var t=255&e,n=255&e>>8,A=255&e>>16,o=255&e>>24;return t<255?"rgba("+o+","+A+","+n+","+t/255+")":"rgb("+o+","+A+","+n+")"},gt=function(e,t,n,A){return(e<<24|t<<16|n<<8|Math.round(255*A))>>>0},mt=function(e,t){if(17===e.type)return e.number;if(16===e.type){var n=3===t?1:255;return 3===t?e.number/100*n:Math.round(e.number/100*n)}return 0},ft=function(e,t){var n=t.filter(Xe);if(3===n.length){var A=n.map(mt),o=A[0],i=A[1],r=A[2];return gt(o,i,r,1)}if(4===n.length){var a=n.map(mt),s=(o=a[0],i=a[1],r=a[2],a[3]);return gt(o,i,r,s)}return 0};function vt(e,t,n){return n<0&&(n+=1),n>=1&&(n-=1),n<1/6?(t-e)*n*6+e:n<.5?t:n<2/3?6*(t-e)*(2/3-n)+e:e}var Bt=function(e,t){var n=t.filter(Xe),A=n[0],o=n[1],i=n[2],r=n[3],a=(17===A.type?dt(A.number):st(e,A))/(2*Math.PI),s=$e(o)?o.number/100:0,c=$e(i)?i.number/100:0,l=void 0!==r&&$e(r)?it(r,1):1;if(0===s)return gt(255*c,255*c,255*c,1);var d=c<=.5?c*(s+1):c+s-c*s,p=2*c-d,u=vt(p,d,a+1/3),h=vt(p,d,a),g=vt(p,d,a-1/3);return gt(255*u,255*h,255*g,l)},wt={hsl:Bt,hsla:Bt,rgb:ft,rgba:ft},bt=function(e,t){return pt(e,Ve.create(t).parseComponentValue())},yt={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},xt={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(Ge(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ct={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Qt=function(e,t){var n=pt(e,t[0]),A=t[1];return A&&$e(A)?{color:n,stop:A}:{color:n,stop:null}},Ft=function(e,t){var n=e[0],A=e[e.length-1];null===n.stop&&(n.stop=tt),null===A.stop&&(A.stop=At);for(var o=[],i=0,r=0;r<e.length;r++){var a=e[r].stop;if(null!==a){var s=it(a,t);s>i?o.push(s):o.push(i),i=s}else o.push(null)}var c=null;for(r=0;r<o.length;r++){var l=o[r];if(null===l)null===c&&(c=r);else if(null!==c){for(var d=r-c,p=(l-o[c-1])/(d+1),u=1;u<=d;u++)o[c+u-1]=p*u;c=null}}return e.map(function(e,n){return{color:e.color,stop:Math.max(Math.min(1,o[n]/t),0)}})},Ut=function(e,t,n){var A="number"==typeof e?e:function(e,t,n){var A=t/2,o=n/2,i=it(e[0],t)-A,r=o-it(e[1],n);return(Math.atan2(r,i)+2*Math.PI)%(2*Math.PI)}(e,t,n),o=Math.abs(t*Math.sin(A))+Math.abs(n*Math.cos(A)),i=t/2,r=n/2,a=o/2,s=Math.sin(A-Math.PI/2)*a,c=Math.cos(A-Math.PI/2)*a;return[o,i-c,i+c,r-s,r+s]},St=function(e,t){return Math.sqrt(e*e+t*t)},kt=function(e,t,n,A,o){return[[0,0],[0,t],[e,0],[e,t]].reduce(function(e,t){var i=t[0],r=t[1],a=St(n-i,A-r);return(o?a<e.optimumDistance:a>e.optimumDistance)?{optimumCorner:t,optimumDistance:a}:e},{optimumDistance:o?1/0:-1/0,optimumCorner:null}).optimumCorner},Et=function(e,t){var n=dt(180),A=[];return Ye(t).forEach(function(t,o){if(0===o){var i=t[0];if(20===i.type&&-1!==["top","left","right","bottom"].indexOf(i.value))return void(n=lt(t));if(ct(i))return void(n=(st(e,i)+dt(270))%dt(360))}var r=Qt(e,t);A.push(r)}),{angle:n,stops:A,type:1}},It="closest-side",Tt="farthest-side",Ht="closest-corner",_t="farthest-corner",Dt="circle",Mt="ellipse",Pt="cover",Lt="contain",Rt=function(e,t){var n=0,A=3,o=[],i=[];return Ye(t).forEach(function(t,r){var a=!0;if(0===r?a=t.reduce(function(e,t){if(Ge(t))switch(t.value){case"center":return i.push(nt),!1;case"top":case"left":return i.push(tt),!1;case"right":case"bottom":return i.push(At),!1}else if($e(t)||Ze(t))return i.push(t),!1;return e},a):1===r&&(a=t.reduce(function(e,t){if(Ge(t))switch(t.value){case Dt:return n=0,!1;case Mt:return n=1,!1;case Lt:case It:return A=0,!1;case Tt:return A=1,!1;case Ht:return A=2,!1;case Pt:case _t:return A=3,!1}else if(Ze(t)||$e(t))return Array.isArray(A)||(A=[]),A.push(t),!1;return e},a)),a){var s=Qt(e,t);o.push(s)}}),{size:A,shape:n,stops:o,position:i,type:2}},Kt=function(e,t){if(22===t.type){var n={url:t.value,type:0};return e.cache.addImage(t.value),n}if(18===t.type){var A=Vt[t.name];if(void 0===A)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return A(e,t.values)}throw new Error("Unsupported image type "+t.type)};var Ot,Vt={"linear-gradient":function(e,t){var n=dt(180),A=[];return Ye(t).forEach(function(t,o){if(0===o){var i=t[0];if(20===i.type&&"to"===i.value)return void(n=lt(t));if(ct(i))return void(n=st(e,i))}var r=Qt(e,t);A.push(r)}),{angle:n,stops:A,type:1}},"-moz-linear-gradient":Et,"-ms-linear-gradient":Et,"-o-linear-gradient":Et,"-webkit-linear-gradient":Et,"radial-gradient":function(e,t){var n=0,A=3,o=[],i=[];return Ye(t).forEach(function(t,r){var a=!0;if(0===r){var s=!1;a=t.reduce(function(e,t){if(s)if(Ge(t))switch(t.value){case"center":return i.push(nt),e;case"top":case"left":return i.push(tt),e;case"right":case"bottom":return i.push(At),e}else($e(t)||Ze(t))&&i.push(t);else if(Ge(t))switch(t.value){case Dt:return n=0,!1;case Mt:return n=1,!1;case"at":return s=!0,!1;case It:return A=0,!1;case Pt:case Tt:return A=1,!1;case Lt:case Ht:return A=2,!1;case _t:return A=3,!1}else if(Ze(t)||$e(t))return Array.isArray(A)||(A=[]),A.push(t),!1;return e},a)}if(a){var c=Qt(e,t);o.push(c)}}),{size:A,shape:n,stops:o,position:i,type:2}},"-moz-radial-gradient":Rt,"-ms-radial-gradient":Rt,"-o-radial-gradient":Rt,"-webkit-radial-gradient":Rt,"-webkit-gradient":function(e,t){var n=dt(180),A=[],o=1;return Ye(t).forEach(function(t,n){var i=t[0];if(0===n){if(Ge(i)&&"linear"===i.value)return void(o=1);if(Ge(i)&&"radial"===i.value)return void(o=2)}if(18===i.type)if("from"===i.name){var r=pt(e,i.values[0]);A.push({stop:tt,color:r})}else if("to"===i.name)r=pt(e,i.values[0]),A.push({stop:At,color:r});else if("color-stop"===i.name){var a=i.values.filter(Xe);if(2===a.length){r=pt(e,a[1]);var s=a[0];je(s)&&A.push({stop:{type:16,number:100*s.number,flags:s.flags},color:r})}}}),1===o?{angle:(n+dt(180))%dt(360),stops:A,type:o}:{size:3,shape:0,stops:A,position:[],type:o}}},Nt={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var n=t[0];return 20===n.type&&"none"===n.value?[]:t.filter(function(e){return Xe(e)&&function(e){return!(20===e.type&&"none"===e.value||18===e.type&&!Vt[e.name])}(e)}).map(function(t){return Kt(e,t)})}},jt={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(Ge(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Gt={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Ye(t).map(function(e){return e.filter($e)}).map(et)}},zt={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Ye(t).map(function(e){return e.filter(Ge).map(function(e){return e.value}).join(" ")}).map(Wt)}},Wt=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}(Ot||(Ot={}));var qt,Xt={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Ye(t).map(function(e){return e.filter(Yt)})}},Yt=function(e){return Ge(e)||$e(e)},Jt=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Zt=Jt("top"),$t=Jt("right"),en=Jt("bottom"),tn=Jt("left"),nn=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return et(t.filter($e))}}},An=nn("top-left"),on=nn("top-right"),rn=nn("bottom-right"),an=nn("bottom-left"),sn=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},cn=sn("top"),ln=sn("right"),dn=sn("bottom"),pn=sn("left"),un=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Ne(t)?t.number:0}}},hn=un("top"),gn=un("right"),mn=un("bottom"),fn=un("left"),vn={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Bn={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},wn={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(Ge).reduce(function(e,t){return e|bn(t.value)},0)}},bn=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},yn={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},xn={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(qt||(qt={}));var Cn,Qn={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?qt.STRICT:qt.NORMAL}},Fn={name:"line-height",initialValue:"normal",prefix:!1,type:4},Un=function(e,t){return Ge(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:$e(e)?it(e,t):t},Sn={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:Kt(e,t)}},kn={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},En={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},In=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Tn=In("top"),Hn=In("right"),_n=In("bottom"),Dn=In("left"),Mn={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(Ge).map(function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},Pn={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},Ln=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Rn=Ln("top"),Kn=Ln("right"),On=Ln("bottom"),Vn=Ln("left"),Nn={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},jn={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Gn={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&We(t[0],"none")?[]:Ye(t).map(function(t){for(var n={color:yt.TRANSPARENT,offsetX:tt,offsetY:tt,blur:tt},A=0,o=0;o<t.length;o++){var i=t[o];Ze(i)?(0===A?n.offsetX=i:1===A?n.offsetY=i:n.blur=i,A++):n.color=pt(e,i)}return n})}},zn={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Wn={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(e,t){if(20===t.type&&"none"===t.value)return null;if(18===t.type){var n=qn[t.name];if(void 0===n)throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return n(t.values)}return null}},qn={matrix:function(e){var t=e.filter(function(e){return 17===e.type}).map(function(e){return e.number});return 6===t.length?t:null},matrix3d:function(e){var t=e.filter(function(e){return 17===e.type}).map(function(e){return e.number}),n=t[0],A=t[1];t[2],t[3];var o=t[4],i=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var r=t[12],a=t[13];return t[14],t[15],16===t.length?[n,A,o,i,r,a]:null}},Xn={type:16,number:50,flags:4},Yn=[Xn,Xn],Jn={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var n=t.filter($e);return 2!==n.length?Yn:[n[0],n[1]]}},Zn={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"hidden":return 1;case"collapse":return 2;default:return 0}}};!function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"}(Cn||(Cn={}));for(var $n={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return Cn.BREAK_ALL;case"keep-all":return Cn.KEEP_ALL;default:return Cn.NORMAL}}},eA={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(20===t.type)return{auto:!0,order:0};if(je(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},tA={name:"time",parse:function(e,t){if(15===t.type)switch(t.unit.toLowerCase()){case"s":return 1e3*t.number;case"ms":return t.number}throw new Error("Unsupported time type")}},nA={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return je(t)?t.number:1}},AA={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},oA={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(Ge).map(function(e){switch(e.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(e){return 0!==e})}},iA={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(e,t){var n=[],A=[];return t.forEach(function(e){switch(e.type){case 20:case 0:n.push(e.value);break;case 17:n.push(e.number.toString());break;case 4:A.push(n.join(" ")),n.length=0}}),n.length&&A.push(n.join(" ")),A.map(function(e){return-1===e.indexOf(" ")?e:"'"+e+"'"})}},rA={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},aA={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){return je(t)?t.number:Ge(t)&&"bold"===t.value?700:400}},sA={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(Ge).map(function(e){return e.value})}},cA={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},lA=function(e,t){return 0!==(e&t)},dA={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var n=t[0];return 20===n.type&&"none"===n.value?[]:t}},pA={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(0===t.length)return null;var n=t[0];if(20===n.type&&"none"===n.value)return null;for(var A=[],o=t.filter(qe),i=0;i<o.length;i++){var r=o[i],a=o[i+1];if(20===r.type){var s=a&&je(a)?a.number:1;A.push({counter:r.value,increment:s})}}return A}},uA={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(0===t.length)return[];for(var n=[],A=t.filter(qe),o=0;o<A.length;o++){var i=A[o],r=A[o+1];if(Ge(i)&&"none"!==i.value){var a=r&&je(r)?r.number:0;n.push({counter:i.value,reset:a})}}return n}},hA={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(Ne).map(function(t){return tA.parse(e,t)})}},gA={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(0===t.length)return null;var n=t[0];if(20===n.type&&"none"===n.value)return null;var A=[],o=t.filter(ze);if(o.length%2!=0)return null;for(var i=0;i<o.length;i+=2){var r=o[i].value,a=o[i+1].value;A.push({open:r,close:a})}return A}},mA=function(e,t,n){if(!e)return"";var A=e[Math.min(t,e.length-1)];return A?n?A.open:A.close:""},fA={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&We(t[0],"none")?[]:Ye(t).map(function(t){for(var n={color:255,offsetX:tt,offsetY:tt,blur:tt,spread:tt,inset:!1},A=0,o=0;o<t.length;o++){var i=t[o];We(i,"inset")?n.inset=!0:Ze(i)?(0===A?n.offsetX=i:1===A?n.offsetY=i:2===A?n.blur=i:n.spread=i,A++):n.color=pt(e,i)}return n})}},vA={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var n=[];return t.filter(Ge).forEach(function(e){switch(e.value){case"stroke":n.push(1);break;case"fill":n.push(0);break;case"markers":n.push(2)}}),[0,1,2].forEach(function(e){-1===n.indexOf(e)&&n.push(e)}),n}},BA={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},wA={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Ne(t)?t.number:0}},bA=function(){function e(e,t){var n,A;this.animationDuration=CA(e,hA,t.animationDuration),this.backgroundClip=CA(e,xt,t.backgroundClip),this.backgroundColor=CA(e,Ct,t.backgroundColor),this.backgroundImage=CA(e,Nt,t.backgroundImage),this.backgroundOrigin=CA(e,jt,t.backgroundOrigin),this.backgroundPosition=CA(e,Gt,t.backgroundPosition),this.backgroundRepeat=CA(e,zt,t.backgroundRepeat),this.backgroundSize=CA(e,Xt,t.backgroundSize),this.borderTopColor=CA(e,Zt,t.borderTopColor),this.borderRightColor=CA(e,$t,t.borderRightColor),this.borderBottomColor=CA(e,en,t.borderBottomColor),this.borderLeftColor=CA(e,tn,t.borderLeftColor),this.borderTopLeftRadius=CA(e,An,t.borderTopLeftRadius),this.borderTopRightRadius=CA(e,on,t.borderTopRightRadius),this.borderBottomRightRadius=CA(e,rn,t.borderBottomRightRadius),this.borderBottomLeftRadius=CA(e,an,t.borderBottomLeftRadius),this.borderTopStyle=CA(e,cn,t.borderTopStyle),this.borderRightStyle=CA(e,ln,t.borderRightStyle),this.borderBottomStyle=CA(e,dn,t.borderBottomStyle),this.borderLeftStyle=CA(e,pn,t.borderLeftStyle),this.borderTopWidth=CA(e,hn,t.borderTopWidth),this.borderRightWidth=CA(e,gn,t.borderRightWidth),this.borderBottomWidth=CA(e,mn,t.borderBottomWidth),this.borderLeftWidth=CA(e,fn,t.borderLeftWidth),this.boxShadow=CA(e,fA,t.boxShadow),this.color=CA(e,vn,t.color),this.direction=CA(e,Bn,t.direction),this.display=CA(e,wn,t.display),this.float=CA(e,yn,t.cssFloat),this.fontFamily=CA(e,iA,t.fontFamily),this.fontSize=CA(e,rA,t.fontSize),this.fontStyle=CA(e,cA,t.fontStyle),this.fontVariant=CA(e,sA,t.fontVariant),this.fontWeight=CA(e,aA,t.fontWeight),this.letterSpacing=CA(e,xn,t.letterSpacing),this.lineBreak=CA(e,Qn,t.lineBreak),this.lineHeight=CA(e,Fn,t.lineHeight),this.listStyleImage=CA(e,Sn,t.listStyleImage),this.listStylePosition=CA(e,kn,t.listStylePosition),this.listStyleType=CA(e,En,t.listStyleType),this.marginTop=CA(e,Tn,t.marginTop),this.marginRight=CA(e,Hn,t.marginRight),this.marginBottom=CA(e,_n,t.marginBottom),this.marginLeft=CA(e,Dn,t.marginLeft),this.opacity=CA(e,nA,t.opacity);var o=CA(e,Mn,t.overflow);this.overflowX=o[0],this.overflowY=o[o.length>1?1:0],this.overflowWrap=CA(e,Pn,t.overflowWrap),this.paddingTop=CA(e,Rn,t.paddingTop),this.paddingRight=CA(e,Kn,t.paddingRight),this.paddingBottom=CA(e,On,t.paddingBottom),this.paddingLeft=CA(e,Vn,t.paddingLeft),this.paintOrder=CA(e,vA,t.paintOrder),this.position=CA(e,jn,t.position),this.textAlign=CA(e,Nn,t.textAlign),this.textDecorationColor=CA(e,AA,null!==(n=t.textDecorationColor)&&void 0!==n?n:t.color),this.textDecorationLine=CA(e,oA,null!==(A=t.textDecorationLine)&&void 0!==A?A:t.textDecoration),this.textShadow=CA(e,Gn,t.textShadow),this.textTransform=CA(e,zn,t.textTransform),this.transform=CA(e,Wn,t.transform),this.transformOrigin=CA(e,Jn,t.transformOrigin),this.visibility=CA(e,Zn,t.visibility),this.webkitTextStrokeColor=CA(e,BA,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=CA(e,wA,t.webkitTextStrokeWidth),this.wordBreak=CA(e,$n,t.wordBreak),this.zIndex=CA(e,eA,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return ut(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return lA(this.display,4)||lA(this.display,33554432)||lA(this.display,268435456)||lA(this.display,536870912)||lA(this.display,67108864)||lA(this.display,134217728)},e}(),yA=function(e,t){this.content=CA(e,dA,t.content),this.quotes=CA(e,gA,t.quotes)},xA=function(e,t){this.counterIncrement=CA(e,pA,t.counterIncrement),this.counterReset=CA(e,uA,t.counterReset)},CA=function(e,t,n){var A=new Oe,o=null!=n?n.toString():t.initialValue;A.write(o);var i=new Ve(A.read());switch(t.type){case 2:var r=i.parseComponentValue();return t.parse(e,Ge(r)?r.value:t.initialValue);case 0:return t.parse(e,i.parseComponentValue());case 1:return t.parse(e,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(t.format){case"angle":return st(e,i.parseComponentValue());case"color":return pt(e,i.parseComponentValue());case"image":return Kt(e,i.parseComponentValue());case"length":var a=i.parseComponentValue();return Ze(a)?a:tt;case"length-percentage":var s=i.parseComponentValue();return $e(s)?s:tt;case"time":return tA.parse(e,i.parseComponentValue())}}},QA=function(e,t){var n=function(e){switch(e.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}}(e);return 1===n||t===n},FA=function(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,QA(t,3),this.styles=new bA(e,window.getComputedStyle(t,null)),Io(t)&&(this.styles.animationDuration.some(function(e){return e>0})&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=a(this.context,t),QA(t,4)&&(this.flags|=16)},UA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",SA="undefined"==typeof Uint8Array?[]:new Uint8Array(256),kA=0;kA<64;kA++)SA[UA.charCodeAt(kA)]=kA;for(var EA=function(e,t,n){return e.slice?e.slice(t,n):new Uint16Array(Array.prototype.slice.call(e,t,n))},IA=function(){function e(e,t,n,A,o,i){this.initialValue=e,this.errorValue=t,this.highStart=n,this.highValueIndex=A,this.index=o,this.data=i}return e.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e<this.highStart)return t=2080+(e>>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),TA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",HA="undefined"==typeof Uint8Array?[]:new Uint8Array(256),_A=0;_A<64;_A++)HA[TA.charCodeAt(_A)]=_A;var DA,MA=8,PA=9,LA=11,RA=12,KA=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var n=e.length;if(!n)return"";for(var A=[],o=-1,i="";++o<n;){var r=e[o];r<=65535?A.push(r):(r-=65536,A.push(55296+(r>>10),r%1024+56320)),(o+1===n||A.length>16384)&&(i+=String.fromCharCode.apply(String,A),A.length=0)}return i},OA=function(e){var t,n,A,o=function(e){var t,n,A,o,i,r=.75*e.length,a=e.length,s=0;"="===e[e.length-1]&&(r--,"="===e[e.length-2]&&r--);var c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(r):new Array(r),l=Array.isArray(c)?c:new Uint8Array(c);for(t=0;t<a;t+=4)n=SA[e.charCodeAt(t)],A=SA[e.charCodeAt(t+1)],o=SA[e.charCodeAt(t+2)],i=SA[e.charCodeAt(t+3)],l[s++]=n<<2|A>>4,l[s++]=(15&A)<<4|o>>2,l[s++]=(3&o)<<6|63&i;return c}(e),i=Array.isArray(o)?function(e){for(var t=e.length,n=[],A=0;A<t;A+=4)n.push(e[A+3]<<24|e[A+2]<<16|e[A+1]<<8|e[A]);return n}(o):new Uint32Array(o),r=Array.isArray(o)?function(e){for(var t=e.length,n=[],A=0;A<t;A+=2)n.push(e[A+1]<<8|e[A]);return n}(o):new Uint16Array(o),a=EA(r,12,i[4]/2),s=2===i[5]?EA(r,(24+i[4])/2):(t=i,n=Math.ceil((24+i[4])/4),t.slice?t.slice(n,A):new Uint32Array(Array.prototype.slice.call(t,n,A)));return new IA(i[0],i[1],i[2],i[3],a,s)}("AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA="),VA="×",NA=function(e){return OA.get(e)},jA=function(e,t,n){var A=n-2,o=t[A],i=t[n-1],r=t[n];if(2===i&&3===r)return VA;if(2===i||3===i||4===i)return"÷";if(2===r||3===r||4===r)return"÷";if(i===MA&&-1!==[MA,PA,LA,RA].indexOf(r))return VA;if(!(i!==LA&&i!==PA||r!==PA&&10!==r))return VA;if((i===RA||10===i)&&10===r)return VA;if(13===r||5===r)return VA;if(7===r)return VA;if(1===i)return VA;if(13===i&&14===r){for(;5===o;)o=t[--A];if(14===o)return VA}if(15===i&&15===r){for(var a=0;15===o;)a++,o=t[--A];if(a%2==0)return VA}return"÷"},GA=function(e){var t=function(e){for(var t=[],n=0,A=e.length;n<A;){var o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<A){var i=e.charCodeAt(n++);56320==(64512&i)?t.push(((1023&o)<<10)+(1023&i)+65536):(t.push(o),n--)}else t.push(o)}return t}(e),n=t.length,A=0,o=0,i=t.map(NA);return{next:function(){if(A>=n)return{done:!0,value:null};for(var e=VA;A<n&&(e=jA(0,i,++A))===VA;);if(e!==VA||A===n){var r=KA.apply(null,t.slice(o,A));return o=A,{value:r,done:!1}}return{done:!0,value:null}}}},zA=function(e){return 0===e[0]&&255===e[1]&&0===e[2]&&255===e[3]},WA=function(e,t,n,A,o){var i="http://www.w3.org/2000/svg",r=document.createElementNS(i,"svg"),a=document.createElementNS(i,"foreignObject");return r.setAttributeNS(null,"width",e.toString()),r.setAttributeNS(null,"height",t.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",n.toString()),a.setAttributeNS(null,"y",A.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),r.appendChild(a),a.appendChild(o),r},qA=function(e){return new Promise(function(t,n){var A=new Image;A.onload=function(){return t(A)},A.onerror=n,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(e))})},XA={get SUPPORT_RANGE_BOUNDS(){var e=function(e){if(e.createRange){var t=e.createRange();if(t.getBoundingClientRect){var n=e.createElement("boundtest");n.style.height="123px",n.style.display="block",e.body.appendChild(n),t.selectNode(n);var A=t.getBoundingClientRect(),o=Math.round(A.height);if(e.body.removeChild(n),123===o)return!0}}return!1}(document);return Object.defineProperty(XA,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=XA.SUPPORT_RANGE_BOUNDS&&function(e){var t=e.createElement("boundtest");t.style.width="50px",t.style.display="block",t.style.fontSize="12px",t.style.letterSpacing="0px",t.style.wordSpacing="0px",e.body.appendChild(t);var n=e.createRange();t.innerHTML="function"==typeof"".repeat?"👨".repeat(10):"";var A=t.firstChild,o=s(A.data).map(function(e){return c(e)}),i=0,r={},a=o.every(function(e,t){n.setStart(A,i),n.setEnd(A,i+e.length);var o=n.getBoundingClientRect();i+=e.length;var a=o.x>r.x||o.y>r.y;return r=o,0===t||a});return e.body.removeChild(t),a}(document);return Object.defineProperty(XA,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=function(e){var t=new Image,n=e.createElement("canvas"),A=n.getContext("2d");if(!A)return!1;t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{A.drawImage(t,0,0),n.toDataURL()}catch(e){return!1}return!0}(document);return Object.defineProperty(XA,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?function(e){var t=e.createElement("canvas"),n=100;t.width=n,t.height=n;var A=t.getContext("2d");if(!A)return Promise.reject(!1);A.fillStyle="rgb(0, 255, 0)",A.fillRect(0,0,n,n);var o=new Image,i=t.toDataURL();o.src=i;var r=WA(n,n,0,0,o);return A.fillStyle="red",A.fillRect(0,0,n,n),qA(r).then(function(t){A.drawImage(t,0,0);var o=A.getImageData(0,0,n,n).data;A.fillStyle="red",A.fillRect(0,0,n,n);var r=e.createElement("div");return r.style.backgroundImage="url("+i+")",r.style.height=n+"px",zA(o)?qA(WA(n,n,0,0,r)):Promise.reject(!1)}).then(function(e){return A.drawImage(e,0,0),zA(A.getImageData(0,0,n,n).data)}).catch(function(){return!1})}(document):Promise.resolve(!1);return Object.defineProperty(XA,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=void 0!==(new Image).crossOrigin;return Object.defineProperty(XA,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(XA,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(XA,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(XA,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},YA=function(e,t){this.text=e,this.bounds=t},JA=function(e,t){var n=t.ownerDocument;if(n){var A=n.createElement("html2canvaswrapper");A.appendChild(t.cloneNode(!0));var o=t.parentNode;if(o){o.replaceChild(A,t);var i=a(e,A);return A.firstChild&&o.replaceChild(A.firstChild,A),i}}return r.EMPTY},ZA=function(e,t,n){var A=e.ownerDocument;if(!A)throw new Error("Node has no owner document");var o=A.createRange();return o.setStart(e,t),o.setEnd(e,t+n),o},$A=function(e){if(XA.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map(function(e){return e.segment})}return function(e){for(var t,n=GA(e),A=[];!(t=n.next()).done;)t.value&&A.push(t.value.slice());return A}(e)},eo=function(e,t){return 0!==t.letterSpacing?$A(e):function(e,t){if(XA.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(n.segment(e)).map(function(e){return e.segment})}return no(e,t)}(e,t)},to=[32,160,4961,65792,65793,4153,4241],no=function(e,t){for(var n,A=function(e,t){var n=s(e),A=ie(n,t),o=A[0],i=A[1],r=A[2],a=n.length,c=0,l=0;return{next:function(){if(l>=a)return{done:!0,value:null};for(var e=z;l<a&&(e=oe(n,i,o,++l,r))===z;);if(e!==z||l===a){var t=new re(n,e,c,l);return c=l,{value:t,done:!1}}return{done:!0,value:null}}}}(e,{lineBreak:t.lineBreak,wordBreak:"break-word"===t.overflowWrap?"break-word":t.wordBreak}),o=[],i=function(){if(n.value){var e=n.value.slice(),t=s(e),A="";t.forEach(function(e){-1===to.indexOf(e)?A+=c(e):(A.length&&o.push(A),o.push(c(e)),A="")}),A.length&&o.push(A)}};!(n=A.next()).done;)i();return o},Ao=function(e,t,n){this.text=oo(t.data,n.textTransform),this.textBounds=function(e,t,n,A){var o=eo(t,n),i=[],a=0;return o.forEach(function(t){if(n.textDecorationLine.length||t.trim().length>0)if(XA.SUPPORT_RANGE_BOUNDS){var o=ZA(A,a,t.length).getClientRects();if(o.length>1){var s=$A(t),c=0;s.forEach(function(t){i.push(new YA(t,r.fromDOMRectList(e,ZA(A,c+a,t.length).getClientRects()))),c+=t.length})}else i.push(new YA(t,r.fromDOMRectList(e,o)))}else{var l=A.splitText(t.length);i.push(new YA(t,JA(e,A))),A=l}else XA.SUPPORT_RANGE_BOUNDS||(A=A.splitText(t.length));a+=t.length}),i}(e,this.text,n,t)},oo=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(io,ro);case 2:return e.toUpperCase();default:return e}},io=/(^|\s|:|-|\(|\))([a-z])/g,ro=function(e,t,n){return e.length>0?t+n.toUpperCase():e},ao=function(e){function n(t,n){var A=e.call(this,t,n)||this;return A.src=n.currentSrc||n.src,A.intrinsicWidth=n.naturalWidth,A.intrinsicHeight=n.naturalHeight,A.context.cache.addImage(A.src),A}return t(n,e),n}(FA),so=function(e){function n(t,n){var A=e.call(this,t,n)||this;return A.canvas=n,A.intrinsicWidth=n.width,A.intrinsicHeight=n.height,A}return t(n,e),n}(FA),co=function(e){function n(t,n){var A=e.call(this,t,n)||this,o=new XMLSerializer,i=a(t,n);return n.setAttribute("width",i.width+"px"),n.setAttribute("height",i.height+"px"),A.svg="data:image/svg+xml,"+encodeURIComponent(o.serializeToString(n)),A.intrinsicWidth=n.width.baseVal.value,A.intrinsicHeight=n.height.baseVal.value,A.context.cache.addImage(A.svg),A}return t(n,e),n}(FA),lo=function(e){function n(t,n){var A=e.call(this,t,n)||this;return A.value=n.value,A}return t(n,e),n}(FA),po=function(e){function n(t,n){var A=e.call(this,t,n)||this;return A.start=n.start,A.reversed="boolean"==typeof n.reversed&&!0===n.reversed,A}return t(n,e),n}(FA),uo=[{type:15,flags:0,unit:"px",number:3}],ho=[{type:16,flags:0,number:50}],go="checkbox",mo="radio",fo="password",vo=707406591,Bo=function(e){function n(t,n){var A,o,i,a=e.call(this,t,n)||this;switch(a.type=n.type.toLowerCase(),a.checked=n.checked,a.value=0===(i=(o=n).type===fo?new Array(o.value.length+1).join("•"):o.value).length?o.placeholder||"":i,a.type!==go&&a.type!==mo||(a.styles.backgroundColor=3739148031,a.styles.borderTopColor=a.styles.borderRightColor=a.styles.borderBottomColor=a.styles.borderLeftColor=2779096575,a.styles.borderTopWidth=a.styles.borderRightWidth=a.styles.borderBottomWidth=a.styles.borderLeftWidth=1,a.styles.borderTopStyle=a.styles.borderRightStyle=a.styles.borderBottomStyle=a.styles.borderLeftStyle=1,a.styles.backgroundClip=[0],a.styles.backgroundOrigin=[0],a.bounds=(A=a.bounds).width>A.height?new r(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width<A.height?new r(A.left,A.top+(A.height-A.width)/2,A.width,A.width):A),a.type){case go:a.styles.borderTopRightRadius=a.styles.borderTopLeftRadius=a.styles.borderBottomRightRadius=a.styles.borderBottomLeftRadius=uo;break;case mo:a.styles.borderTopRightRadius=a.styles.borderTopLeftRadius=a.styles.borderBottomRightRadius=a.styles.borderBottomLeftRadius=ho}return a}return t(n,e),n}(FA),wo=function(e){function n(t,n){var A=e.call(this,t,n)||this,o=n.options[n.selectedIndex||0];return A.value=o&&o.text||"",A}return t(n,e),n}(FA),bo=function(e){function n(t,n){var A=e.call(this,t,n)||this;return A.value=n.value,A}return t(n,e),n}(FA),yo=function(e){function n(t,n){var A=e.call(this,t,n)||this;A.src=n.src,A.width=parseInt(n.width,10)||0,A.height=parseInt(n.height,10)||0,A.backgroundColor=A.styles.backgroundColor;try{if(n.contentWindow&&n.contentWindow.document&&n.contentWindow.document.documentElement){A.tree=Fo(t,n.contentWindow.document.documentElement);var o=n.contentWindow.document.documentElement?bt(t,getComputedStyle(n.contentWindow.document.documentElement).backgroundColor):yt.TRANSPARENT,i=n.contentWindow.document.body?bt(t,getComputedStyle(n.contentWindow.document.body).backgroundColor):yt.TRANSPARENT;A.backgroundColor=ut(o)?ut(i)?A.styles.backgroundColor:i:o}}catch(e){}return A}return t(n,e),n}(FA),xo=["OL","UL","MENU"],Co=function(e,t,n,A){for(var o=t.firstChild,i=void 0;o;o=i)if(i=o.nextSibling,ko(o)&&o.data.trim().length>0)n.textNodes.push(new Ao(e,o,n.styles));else if(Eo(o))if(Go(o)&&o.assignedNodes)o.assignedNodes().forEach(function(t){return Co(e,t,n,A)});else{var r=Qo(e,o);r.styles.isVisible()&&(Uo(o,r,A)?r.flags|=4:So(r.styles)&&(r.flags|=2),-1!==xo.indexOf(o.tagName)&&(r.flags|=8),n.elements.push(r),o.slot,o.shadowRoot?Co(e,o.shadowRoot,r,A):No(o)||Mo(o)||jo(o)||Co(e,o,r,A))}},Qo=function(e,t){return Ko(t)?new ao(e,t):Lo(t)?new so(e,t):Mo(t)?new co(e,t):Ho(t)?new lo(e,t):_o(t)?new po(e,t):Do(t)?new Bo(e,t):jo(t)?new wo(e,t):No(t)?new bo(e,t):Oo(t)?new yo(e,t):new FA(e,t)},Fo=function(e,t){var n=Qo(e,t);return n.flags|=4,Co(e,t,n,n),n},Uo=function(e,t,n){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Po(e)&&n.styles.isTransparent()},So=function(e){return e.isPositioned()||e.isFloating()},ko=function(e){return e.nodeType===Node.TEXT_NODE},Eo=function(e){return e.nodeType===Node.ELEMENT_NODE},Io=function(e){return Eo(e)&&void 0!==e.style&&!To(e)},To=function(e){return"object"==typeof e.className},Ho=function(e){return"LI"===e.tagName},_o=function(e){return"OL"===e.tagName},Do=function(e){return"INPUT"===e.tagName},Mo=function(e){return"svg"===e.tagName},Po=function(e){return"BODY"===e.tagName},Lo=function(e){return"CANVAS"===e.tagName},Ro=function(e){return"VIDEO"===e.tagName},Ko=function(e){return"IMG"===e.tagName},Oo=function(e){return"IFRAME"===e.tagName},Vo=function(e){return"STYLE"===e.tagName},No=function(e){return"TEXTAREA"===e.tagName},jo=function(e){return"SELECT"===e.tagName},Go=function(e){return"SLOT"===e.tagName},zo=function(e){return e.tagName.indexOf("-")>0},Wo=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){return this.counters[e]||[]},e.prototype.pop=function(e){var t=this;e.forEach(function(e){return t.counters[e].pop()})},e.prototype.parse=function(e){var t=this,n=e.counterIncrement,A=e.counterReset,o=!0;null!==n&&n.forEach(function(e){var n=t.counters[e.counter];n&&0!==e.increment&&(o=!1,n.length||n.push(1),n[Math.max(0,n.length-1)]+=e.increment)});var i=[];return o&&A.forEach(function(e){var n=t.counters[e.counter];i.push(e.counter),n||(n=t.counters[e.counter]=[]),n.push(e.reset)}),i},e}(),qo={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Xo={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Yo={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Jo={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Zo=function(e,t,n,A,o,i){return e<t||e>n?ai(e,o,i.length>0):A.integers.reduce(function(t,n,o){for(;e>=n;)e-=n,t+=A.values[o];return t},"")+i},$o=function(e,t,n,A){var o="";do{n||e--,o=A(e)+o,e/=t}while(e*t>=t);return o},ei=function(e,t,n,A,o){var i=n-t+1;return(e<0?"-":"")+($o(Math.abs(e),i,A,function(e){return c(Math.floor(e%i)+t)})+o)},ti=function(e,t,n){void 0===n&&(n=". ");var A=t.length;return $o(Math.abs(e),A,!1,function(e){return t[Math.floor(e%A)]})+n},ni=function(e,t,n,A,o,i){if(e<-9999||e>9999)return ai(e,4,o.length>0);var r=Math.abs(e),a=o;if(0===r)return t[0]+a;for(var s=0;r>0&&s<=4;s++){var c=r%10;0===c&&lA(i,1)&&""!==a?a=t[c]+a:c>1||1===c&&0===s||1===c&&1===s&&lA(i,2)||1===c&&1===s&&lA(i,4)&&e>100||1===c&&s>1&&lA(i,8)?a=t[c]+(s>0?n[s-1]:"")+a:1===c&&s>0&&(a=n[s-1]+a),r=Math.floor(r/10)}return(e<0?A:"")+a},Ai="十百千萬",oi="拾佰仟萬",ii="マイナス",ri="마이너스",ai=function(e,t,n){var A=n?". ":"",o=n?"、":"",i=n?", ":"",r=n?" ":"";switch(t){case 0:return"•"+r;case 1:return"◦"+r;case 2:return"◾"+r;case 5:var a=ei(e,48,57,!0,A);return a.length<4?"0"+a:a;case 4:return ti(e,"〇一二三四五六七八九",o);case 6:return Zo(e,1,3999,qo,3,A).toLowerCase();case 7:return Zo(e,1,3999,qo,3,A);case 8:return ei(e,945,969,!1,A);case 9:return ei(e,97,122,!1,A);case 10:return ei(e,65,90,!1,A);case 11:return ei(e,1632,1641,!0,A);case 12:case 49:return Zo(e,1,9999,Xo,3,A);case 35:return Zo(e,1,9999,Xo,3,A).toLowerCase();case 13:return ei(e,2534,2543,!0,A);case 14:case 30:return ei(e,6112,6121,!0,A);case 15:return ti(e,"子丑寅卯辰巳午未申酉戌亥",o);case 16:return ti(e,"甲乙丙丁戊己庚辛壬癸",o);case 17:case 48:return ni(e,"零一二三四五六七八九",Ai,"負",o,14);case 47:return ni(e,"零壹貳參肆伍陸柒捌玖",oi,"負",o,15);case 42:return ni(e,"零一二三四五六七八九",Ai,"负",o,14);case 41:return ni(e,"零壹贰叁肆伍陆柒捌玖",oi,"负",o,15);case 26:return ni(e,"〇一二三四五六七八九","十百千万",ii,o,0);case 25:return ni(e,"零壱弐参四伍六七八九","拾百千万",ii,o,7);case 31:return ni(e,"영일이삼사오육칠팔구","십백천만",ri,i,7);case 33:return ni(e,"零一二三四五六七八九","十百千萬",ri,i,0);case 32:return ni(e,"零壹貳參四五六七八九","拾百千",ri,i,7);case 18:return ei(e,2406,2415,!0,A);case 20:return Zo(e,1,19999,Jo,3,A);case 21:return ei(e,2790,2799,!0,A);case 22:return ei(e,2662,2671,!0,A);case 22:return Zo(e,1,10999,Yo,3,A);case 23:return ti(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ti(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return ei(e,3302,3311,!0,A);case 28:return ti(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",o);case 29:return ti(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",o);case 34:return ei(e,3792,3801,!0,A);case 37:return ei(e,6160,6169,!0,A);case 38:return ei(e,4160,4169,!0,A);case 39:return ei(e,2918,2927,!0,A);case 40:return ei(e,1776,1785,!0,A);case 43:return ei(e,3046,3055,!0,A);case 44:return ei(e,3174,3183,!0,A);case 45:return ei(e,3664,3673,!0,A);case 46:return ei(e,3872,3881,!0,A);default:return ei(e,48,57,!0,A)}},si="data-html2canvas-ignore",ci=function(){function e(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new Wo,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var n=this,i=di(e,t);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var r=e.defaultView.pageXOffset,a=e.defaultView.pageYOffset,s=i.contentWindow,c=s.document,l=hi(i).then(function(){return A(n,void 0,void 0,function(){var e,n;return o(this,function(A){switch(A.label){case 0:return this.scrolledElements.forEach(Bi),s&&(s.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||s.scrollY===t.top&&s.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(s.scrollX-t.left,s.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(n=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:c.fonts&&c.fonts.ready?[4,c.fonts.ready]:[3,2];case 1:A.sent(),A.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,ui(c)]:[3,4];case 3:A.sent(),A.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then(function(){return e(c,n)}).then(function(){return i})]:[2,i]}})})});return c.open(),c.write(fi(document.doctype)+"<html></html>"),vi(this.referenceElement.ownerDocument,r,a),c.replaceChild(c.adoptNode(this.documentElement),c.documentElement),c.close(),l},e.prototype.createElementClone=function(e){if(QA(e,2),Lo(e))return this.createCanvasClone(e);if(Ro(e))return this.createVideoClone(e);if(Vo(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Ko(t)&&(Ko(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),zo(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return mi(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce(function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e},""),A=e.cloneNode(!1);return A.textContent=n,A}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var n=e.ownerDocument.createElement("img");try{return n.src=e.toDataURL(),n}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var A=e.cloneNode(!1);try{A.width=e.width,A.height=e.height;var o=e.getContext("2d"),i=A.getContext("2d");if(i)if(!this.options.allowTaint&&o)i.putImageData(o.getImageData(0,0,e.width,e.height),0,0);else{var r=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(r){var a=r.getContextAttributes();!1===(null==a?void 0:a.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}i.drawImage(e,0,0)}return A}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return A},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext("2d");try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var A=e.ownerDocument.createElement("canvas");return A.width=e.offsetWidth,A.height=e.offsetHeight,A},e.prototype.appendChildNode=function(e,t,n){Eo(t)&&("SCRIPT"===t.tagName||t.hasAttribute(si)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&Eo(t)&&Vo(t)||e.appendChild(this.cloneNode(t,n))},e.prototype.cloneChildNodes=function(e,t,n){for(var A=this,o=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;o;o=o.nextSibling)if(Eo(o)&&Go(o)&&"function"==typeof o.assignedNodes){var i=o.assignedNodes();i.length&&i.forEach(function(e){return A.appendChildNode(t,e,n)})}else this.appendChildNode(t,o,n)},e.prototype.cloneNode=function(e,t){if(ko(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&Eo(e)&&(Io(e)||To(e))){var A=this.createElementClone(e);A.style.transitionProperty="none";var o=n.getComputedStyle(e),i=n.getComputedStyle(e,":before"),r=n.getComputedStyle(e,":after");this.referenceElement===e&&Io(A)&&(this.clonedReferenceElement=A),Po(A)&&xi(A);var a=this.counters.parse(new xA(this.context,o)),s=this.resolvePseudoContent(e,A,i,DA.BEFORE);zo(e)&&(t=!0),Ro(e)||this.cloneChildNodes(e,A,t),s&&A.insertBefore(s,A.firstChild);var c=this.resolvePseudoContent(e,A,r,DA.AFTER);return c&&A.appendChild(c),this.counters.pop(a),(o&&(this.options.copyStyles||To(e))&&!Oo(e)||t)&&mi(o,A),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([A,e.scrollLeft,e.scrollTop]),(No(e)||jo(e))&&(No(A)||jo(A))&&(A.value=e.value),A}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,n,A){var o=this;if(n){var i=n.content,r=t.ownerDocument;if(r&&i&&"none"!==i&&"-moz-alt-content"!==i&&"none"!==n.display){this.counters.parse(new xA(this.context,n));var a=new yA(this.context,n),s=r.createElement("html2canvaspseudoelement");mi(n,s),a.content.forEach(function(t){if(0===t.type)s.appendChild(r.createTextNode(t.value));else if(22===t.type){var n=r.createElement("img");n.src=t.value,n.style.opacity="1",s.appendChild(n)}else if(18===t.type){if("attr"===t.name){var A=t.values.filter(Ge);A.length&&s.appendChild(r.createTextNode(e.getAttribute(A[0].value)||""))}else if("counter"===t.name){var i=t.values.filter(Xe),c=i[0],l=i[1];if(c&&Ge(c)){var d=o.counters.getCounterValue(c.value),p=l&&Ge(l)?En.parse(o.context,l.value):3;s.appendChild(r.createTextNode(ai(d,p,!1)))}}else if("counters"===t.name){var u=t.values.filter(Xe),h=(c=u[0],u[1]);if(l=u[2],c&&Ge(c)){var g=o.counters.getCounterValues(c.value),m=l&&Ge(l)?En.parse(o.context,l.value):3,f=h&&0===h.type?h.value:"",v=g.map(function(e){return ai(e,m,!1)}).join(f);s.appendChild(r.createTextNode(v))}}}else if(20===t.type)switch(t.value){case"open-quote":s.appendChild(r.createTextNode(mA(a.quotes,o.quoteDepth++,!0)));break;case"close-quote":s.appendChild(r.createTextNode(mA(a.quotes,--o.quoteDepth,!1)));break;default:s.appendChild(r.createTextNode(t.value))}}),s.className=wi+" "+bi;var c=A===DA.BEFORE?" "+wi:" "+bi;return To(t)?t.className.baseValue+=c:t.className+=c,s}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(DA||(DA={}));var li,di=function(e,t){var n=e.createElement("iframe");return n.className="html2canvas-container",n.style.visibility="hidden",n.style.position="fixed",n.style.left="-10000px",n.style.top="0px",n.style.border="0",n.width=t.width.toString(),n.height=t.height.toString(),n.scrolling="no",n.setAttribute(si,"true"),e.body.appendChild(n),n},pi=function(e){return new Promise(function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()})},ui=function(e){return Promise.all([].slice.call(e.images,0).map(pi))},hi=function(e){return new Promise(function(t,n){var A=e.contentWindow;if(!A)return n("No window assigned for iframe");var o=A.document;A.onload=e.onload=function(){A.onload=e.onload=null;var n=setInterval(function(){o.body.childNodes.length>0&&"complete"===o.readyState&&(clearInterval(n),t(e))},50)}})},gi=["all","d","content"],mi=function(e,t){for(var n=e.length-1;n>=0;n--){var A=e.item(n);-1===gi.indexOf(A)&&t.style.setProperty(A,e.getPropertyValue(A))}return t},fi=function(e){var t="";return e&&(t+="<!DOCTYPE ",e.name&&(t+=e.name),e.internalSubset&&(t+=e.internalSubset),e.publicId&&(t+='"'+e.publicId+'"'),e.systemId&&(t+='"'+e.systemId+'"'),t+=">"),t},vi=function(e,t,n){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||n!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,n)},Bi=function(e){var t=e[0],n=e[1],A=e[2];t.scrollLeft=n,t.scrollTop=A},wi="___html2canvas___pseudoelement_before",bi="___html2canvas___pseudoelement_after",yi='{\n content: "" !important;\n display: none !important;\n}',xi=function(e){Ci(e,"."+wi+":before"+yi+"\n ."+bi+":after"+yi)},Ci=function(e,t){var n=e.ownerDocument;if(n){var A=n.createElement("style");A.textContent=t,e.appendChild(A)}},Qi=function(){function e(){}return e.getOrigin=function(t){var n=e._link;return n?(n.href=t,n.href=n.href,n.protocol+n.hostname+n.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),Fi=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:Hi(e)||Ei(e)?((this._cache[e]=this.loadImage(e)).catch(function(){}),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return A(this,void 0,void 0,function(){var t,n,A,i,r=this;return o(this,function(o){switch(o.label){case 0:return t=Qi.isSameOrigin(e),n=!Ii(e)&&!0===this._options.useCORS&&XA.SUPPORT_CORS_IMAGES&&!t,A=!Ii(e)&&!t&&!Hi(e)&&"string"==typeof this._options.proxy&&XA.SUPPORT_CORS_XHR&&!n,t||!1!==this._options.allowTaint||Ii(e)||Hi(e)||A||n?(i=e,A?[4,this.proxy(i)]:[3,2]):[2];case 1:i=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(e,t){var A=new Image;A.onload=function(){return e(A)},A.onerror=t,(Ti(i)||n)&&(A.crossOrigin="anonymous"),A.src=i,!0===A.complete&&setTimeout(function(){return e(A)},500),r._options.imageTimeout>0&&setTimeout(function(){return t("Timed out ("+r._options.imageTimeout+"ms) loading image")},r._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var A=e.substring(0,256);return new Promise(function(o,i){var r=XA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(200===a.status)if("text"===r)o(a.response);else{var e=new FileReader;e.addEventListener("load",function(){return o(e.result)},!1),e.addEventListener("error",function(e){return i(e)},!1),e.readAsDataURL(a.response)}else i("Failed to proxy resource "+A+" with status code "+a.status)},a.onerror=i;var s=n.indexOf("?")>-1?"&":"?";if(a.open("GET",""+n+s+"url="+encodeURIComponent(e)+"&responseType="+r),"text"!==r&&a instanceof XMLHttpRequest&&(a.responseType=r),t._options.imageTimeout){var c=t._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return i("Timed out ("+c+"ms) proxying "+A)}}a.send()})},e}(),Ui=/^data:image\/svg\+xml/i,Si=/^data:image\/.*;base64,/i,ki=/^data:image\/.*/i,Ei=function(e){return XA.SUPPORT_SVG_DRAWING||!_i(e)},Ii=function(e){return ki.test(e)},Ti=function(e){return Si.test(e)},Hi=function(e){return"blob"===e.substr(0,4)},_i=function(e){return"svg"===e.substr(-3).toLowerCase()||Ui.test(e)},Di=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,n){return new e(this.x+t,this.y+n)},e}(),Mi=function(e,t,n){return new Di(e.x+(t.x-e.x)*n,e.y+(t.y-e.y)*n)},Pi=function(){function e(e,t,n,A){this.type=1,this.start=e,this.startControl=t,this.endControl=n,this.end=A}return e.prototype.subdivide=function(t,n){var A=Mi(this.start,this.startControl,t),o=Mi(this.startControl,this.endControl,t),i=Mi(this.endControl,this.end,t),r=Mi(A,o,t),a=Mi(o,i,t),s=Mi(r,a,t);return n?new e(this.start,A,r,s):new e(s,a,i,this.end)},e.prototype.add=function(t,n){return new e(this.start.add(t,n),this.startControl.add(t,n),this.endControl.add(t,n),this.end.add(t,n))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Li=function(e){return 1===e.type},Ri=function(e){var t=e.styles,n=e.bounds,A=ot(t.borderTopLeftRadius,n.width,n.height),o=A[0],i=A[1],r=ot(t.borderTopRightRadius,n.width,n.height),a=r[0],s=r[1],c=ot(t.borderBottomRightRadius,n.width,n.height),l=c[0],d=c[1],p=ot(t.borderBottomLeftRadius,n.width,n.height),u=p[0],h=p[1],g=[];g.push((o+a)/n.width),g.push((u+l)/n.width),g.push((i+h)/n.height),g.push((s+d)/n.height);var m=Math.max.apply(Math,g);m>1&&(o/=m,i/=m,a/=m,s/=m,l/=m,d/=m,u/=m,h/=m);var f=n.width-a,v=n.height-d,B=n.width-l,w=n.height-h,b=t.borderTopWidth,y=t.borderRightWidth,x=t.borderBottomWidth,C=t.borderLeftWidth,Q=it(t.paddingTop,e.bounds.width),F=it(t.paddingRight,e.bounds.width),U=it(t.paddingBottom,e.bounds.width),S=it(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=o>0||i>0?Ki(n.left+C/3,n.top+b/3,o-C/3,i-b/3,li.TOP_LEFT):new Di(n.left+C/3,n.top+b/3),this.topRightBorderDoubleOuterBox=o>0||i>0?Ki(n.left+f,n.top+b/3,a-y/3,s-b/3,li.TOP_RIGHT):new Di(n.left+n.width-y/3,n.top+b/3),this.bottomRightBorderDoubleOuterBox=l>0||d>0?Ki(n.left+B,n.top+v,l-y/3,d-x/3,li.BOTTOM_RIGHT):new Di(n.left+n.width-y/3,n.top+n.height-x/3),this.bottomLeftBorderDoubleOuterBox=u>0||h>0?Ki(n.left+C/3,n.top+w,u-C/3,h-x/3,li.BOTTOM_LEFT):new Di(n.left+C/3,n.top+n.height-x/3),this.topLeftBorderDoubleInnerBox=o>0||i>0?Ki(n.left+2*C/3,n.top+2*b/3,o-2*C/3,i-2*b/3,li.TOP_LEFT):new Di(n.left+2*C/3,n.top+2*b/3),this.topRightBorderDoubleInnerBox=o>0||i>0?Ki(n.left+f,n.top+2*b/3,a-2*y/3,s-2*b/3,li.TOP_RIGHT):new Di(n.left+n.width-2*y/3,n.top+2*b/3),this.bottomRightBorderDoubleInnerBox=l>0||d>0?Ki(n.left+B,n.top+v,l-2*y/3,d-2*x/3,li.BOTTOM_RIGHT):new Di(n.left+n.width-2*y/3,n.top+n.height-2*x/3),this.bottomLeftBorderDoubleInnerBox=u>0||h>0?Ki(n.left+2*C/3,n.top+w,u-2*C/3,h-2*x/3,li.BOTTOM_LEFT):new Di(n.left+2*C/3,n.top+n.height-2*x/3),this.topLeftBorderStroke=o>0||i>0?Ki(n.left+C/2,n.top+b/2,o-C/2,i-b/2,li.TOP_LEFT):new Di(n.left+C/2,n.top+b/2),this.topRightBorderStroke=o>0||i>0?Ki(n.left+f,n.top+b/2,a-y/2,s-b/2,li.TOP_RIGHT):new Di(n.left+n.width-y/2,n.top+b/2),this.bottomRightBorderStroke=l>0||d>0?Ki(n.left+B,n.top+v,l-y/2,d-x/2,li.BOTTOM_RIGHT):new Di(n.left+n.width-y/2,n.top+n.height-x/2),this.bottomLeftBorderStroke=u>0||h>0?Ki(n.left+C/2,n.top+w,u-C/2,h-x/2,li.BOTTOM_LEFT):new Di(n.left+C/2,n.top+n.height-x/2),this.topLeftBorderBox=o>0||i>0?Ki(n.left,n.top,o,i,li.TOP_LEFT):new Di(n.left,n.top),this.topRightBorderBox=a>0||s>0?Ki(n.left+f,n.top,a,s,li.TOP_RIGHT):new Di(n.left+n.width,n.top),this.bottomRightBorderBox=l>0||d>0?Ki(n.left+B,n.top+v,l,d,li.BOTTOM_RIGHT):new Di(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=u>0||h>0?Ki(n.left,n.top+w,u,h,li.BOTTOM_LEFT):new Di(n.left,n.top+n.height),this.topLeftPaddingBox=o>0||i>0?Ki(n.left+C,n.top+b,Math.max(0,o-C),Math.max(0,i-b),li.TOP_LEFT):new Di(n.left+C,n.top+b),this.topRightPaddingBox=a>0||s>0?Ki(n.left+Math.min(f,n.width-y),n.top+b,f>n.width+y?0:Math.max(0,a-y),Math.max(0,s-b),li.TOP_RIGHT):new Di(n.left+n.width-y,n.top+b),this.bottomRightPaddingBox=l>0||d>0?Ki(n.left+Math.min(B,n.width-C),n.top+Math.min(v,n.height-x),Math.max(0,l-y),Math.max(0,d-x),li.BOTTOM_RIGHT):new Di(n.left+n.width-y,n.top+n.height-x),this.bottomLeftPaddingBox=u>0||h>0?Ki(n.left+C,n.top+Math.min(w,n.height-x),Math.max(0,u-C),Math.max(0,h-x),li.BOTTOM_LEFT):new Di(n.left+C,n.top+n.height-x),this.topLeftContentBox=o>0||i>0?Ki(n.left+C+S,n.top+b+Q,Math.max(0,o-(C+S)),Math.max(0,i-(b+Q)),li.TOP_LEFT):new Di(n.left+C+S,n.top+b+Q),this.topRightContentBox=a>0||s>0?Ki(n.left+Math.min(f,n.width+C+S),n.top+b+Q,f>n.width+C+S?0:a-C+S,s-(b+Q),li.TOP_RIGHT):new Di(n.left+n.width-(y+F),n.top+b+Q),this.bottomRightContentBox=l>0||d>0?Ki(n.left+Math.min(B,n.width-(C+S)),n.top+Math.min(v,n.height+b+Q),Math.max(0,l-(y+F)),d-(x+U),li.BOTTOM_RIGHT):new Di(n.left+n.width-(y+F),n.top+n.height-(x+U)),this.bottomLeftContentBox=u>0||h>0?Ki(n.left+C+S,n.top+w,Math.max(0,u-(C+S)),h-(x+U),li.BOTTOM_LEFT):new Di(n.left+C+S,n.top+n.height-(x+U))};!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(li||(li={}));var Ki=function(e,t,n,A,o){var i=(Math.sqrt(2)-1)/3*4,r=n*i,a=A*i,s=e+n,c=t+A;switch(o){case li.TOP_LEFT:return new Pi(new Di(e,c),new Di(e,c-a),new Di(s-r,t),new Di(s,t));case li.TOP_RIGHT:return new Pi(new Di(e,t),new Di(e+r,t),new Di(s,c-a),new Di(s,c));case li.BOTTOM_RIGHT:return new Pi(new Di(s,t),new Di(s,t+a),new Di(e+r,c),new Di(e,c));case li.BOTTOM_LEFT:default:return new Pi(new Di(s,c),new Di(s-r,c),new Di(e,t+a),new Di(e,t))}},Oi=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Vi=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ni=function(e,t,n){this.offsetX=e,this.offsetY=t,this.matrix=n,this.type=0,this.target=6},ji=function(e,t){this.path=e,this.target=t,this.type=1},Gi=function(e){this.opacity=e,this.type=2,this.target=6},zi=function(e){return 1===e.type},Wi=function(e,t){return e.length===t.length&&e.some(function(e,n){return e===t[n]})},qi=function(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},Xi=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Ri(this.container),this.container.styles.opacity<1&&this.effects.push(new Gi(this.container.styles.opacity)),null!==this.container.styles.transform){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,A=this.container.bounds.top+this.container.styles.transformOrigin[1].number,o=this.container.styles.transform;this.effects.push(new Ni(n,A,o))}if(0!==this.container.styles.overflowX){var i=Oi(this.curves),r=Vi(this.curves);Wi(i,r)?this.effects.push(new ji(i,6)):(this.effects.push(new ji(i,2)),this.effects.push(new ji(r,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),n=this.parent,A=this.effects.slice(0);n;){var o=n.effects.filter(function(e){return!zi(e)});if(t||0!==n.container.styles.position||!n.parent){if(A.unshift.apply(A,o),t=-1===[2,3].indexOf(n.container.styles.position),0!==n.container.styles.overflowX){var i=Oi(n.curves),r=Vi(n.curves);Wi(i,r)||A.unshift(new ji(r,6))}}else A.unshift.apply(A,o);n=n.parent}return A.filter(function(t){return lA(t.target,e)})},e}(),Yi=function(e,t,n,A){e.container.elements.forEach(function(o){var i=lA(o.flags,4),r=lA(o.flags,2),a=new Xi(o,e);lA(o.styles.display,2048)&&A.push(a);var s=lA(o.flags,8)?[]:A;if(i||r){var c=i||o.styles.isPositioned()?n:t,l=new qi(a);if(o.styles.isPositioned()||o.styles.opacity<1||o.styles.isTransformed()){var d=o.styles.zIndex.order;if(d<0){var p=0;c.negativeZIndex.some(function(e,t){return d>e.element.container.styles.zIndex.order?(p=t,!1):p>0}),c.negativeZIndex.splice(p,0,l)}else if(d>0){var u=0;c.positiveZIndex.some(function(e,t){return d>=e.element.container.styles.zIndex.order?(u=t+1,!1):u>0}),c.positiveZIndex.splice(u,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else o.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);Yi(a,l,i?l:n,s)}else o.styles.isInlineLevel()?t.inlineLevel.push(a):t.nonInlineLevel.push(a),Yi(a,t,n,s);lA(o.flags,8)&&Ji(o,s)})},Ji=function(e,t){for(var n=e instanceof po?e.start:1,A=e instanceof po&&e.reversed,o=0;o<t.length;o++){var i=t[o];i.container instanceof lo&&"number"==typeof i.container.value&&0!==i.container.value&&(n=i.container.value),i.listValue=ai(n,i.container.styles.listStyleType,!0),n+=A?-1:1}},Zi=function(e,t){switch(t){case 0:return er(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return er(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return er(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);default:return er(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},$i=function(e,t){var n=[];return Li(e)?n.push(e.subdivide(.5,!1)):n.push(e),Li(t)?n.push(t.subdivide(.5,!0)):n.push(t),n},er=function(e,t,n,A){var o=[];return Li(e)?o.push(e.subdivide(.5,!1)):o.push(e),Li(n)?o.push(n.subdivide(.5,!0)):o.push(n),Li(A)?o.push(A.subdivide(.5,!0).reverse()):o.push(A),Li(t)?o.push(t.subdivide(.5,!1).reverse()):o.push(t),o},tr=function(e){var t=e.bounds,n=e.styles;return t.add(n.borderLeftWidth,n.borderTopWidth,-(n.borderRightWidth+n.borderLeftWidth),-(n.borderTopWidth+n.borderBottomWidth))},nr=function(e){var t=e.styles,n=e.bounds,A=it(t.paddingLeft,n.width),o=it(t.paddingRight,n.width),i=it(t.paddingTop,n.width),r=it(t.paddingBottom,n.width);return n.add(A+t.borderLeftWidth,i+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+A+o),-(t.borderTopWidth+t.borderBottomWidth+i+r))},Ar=function(e,t,n){var A=function(e,t){return 0===e?t.bounds:2===e?nr(t):tr(t)}(ar(e.styles.backgroundOrigin,t),e),o=function(e,t){return 0===e?t.bounds:2===e?nr(t):tr(t)}(ar(e.styles.backgroundClip,t),e),i=rr(ar(e.styles.backgroundSize,t),n,A),r=i[0],a=i[1],s=ot(ar(e.styles.backgroundPosition,t),A.width-r,A.height-a);return[sr(ar(e.styles.backgroundRepeat,t),s,i,A,o),Math.round(A.left+s[0]),Math.round(A.top+s[1]),r,a]},or=function(e){return Ge(e)&&e.value===Ot.AUTO},ir=function(e){return"number"==typeof e},rr=function(e,t,n){var A=t[0],o=t[1],i=t[2],r=e[0],a=e[1];if(!r)return[0,0];if($e(r)&&a&&$e(a))return[it(r,n.width),it(a,n.height)];var s=ir(i);if(Ge(r)&&(r.value===Ot.CONTAIN||r.value===Ot.COVER))return ir(i)?n.width/n.height<i!=(r.value===Ot.COVER)?[n.width,n.width/i]:[n.height*i,n.height]:[n.width,n.height];var c=ir(A),l=ir(o),d=c||l;if(or(r)&&(!a||or(a)))return c&&l?[A,o]:s||d?d&&s?[c?A:o*i,l?o:A/i]:[c?A:n.width,l?o:n.height]:[n.width,n.height];if(s){var p=0,u=0;return $e(r)?p=it(r,n.width):$e(a)&&(u=it(a,n.height)),or(r)?p=u*i:a&&!or(a)||(u=p/i),[p,u]}var h=null,g=null;if($e(r)?h=it(r,n.width):a&&$e(a)&&(g=it(a,n.height)),null===h||a&&!or(a)||(g=c&&l?h/A*o:n.height),null!==g&&or(r)&&(h=c&&l?g/o*A:n.width),null!==h&&null!==g)return[h,g];throw new Error("Unable to calculate background-size for element")},ar=function(e,t){var n=e[t];return void 0===n?e[0]:n},sr=function(e,t,n,A,o){var i=t[0],r=t[1],a=n[0],s=n[1];switch(e){case 2:return[new Di(Math.round(A.left),Math.round(A.top+r)),new Di(Math.round(A.left+A.width),Math.round(A.top+r)),new Di(Math.round(A.left+A.width),Math.round(s+A.top+r)),new Di(Math.round(A.left),Math.round(s+A.top+r))];case 3:return[new Di(Math.round(A.left+i),Math.round(A.top)),new Di(Math.round(A.left+i+a),Math.round(A.top)),new Di(Math.round(A.left+i+a),Math.round(A.height+A.top)),new Di(Math.round(A.left+i),Math.round(A.height+A.top))];case 1:return[new Di(Math.round(A.left+i),Math.round(A.top+r)),new Di(Math.round(A.left+i+a),Math.round(A.top+r)),new Di(Math.round(A.left+i+a),Math.round(A.top+r+s)),new Di(Math.round(A.left+i),Math.round(A.top+r+s))];default:return[new Di(Math.round(o.left),Math.round(o.top)),new Di(Math.round(o.left+o.width),Math.round(o.top)),new Di(Math.round(o.left+o.width),Math.round(o.height+o.top)),new Di(Math.round(o.left),Math.round(o.height+o.top))]}},cr="Hidden Text",lr=function(){function e(e){this._data={},this._document=e}return e.prototype.parseMetrics=function(e,t){var n=this._document.createElement("div"),A=this._document.createElement("img"),o=this._document.createElement("span"),i=this._document.body;n.style.visibility="hidden",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",i.appendChild(n),A.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",A.width=1,A.height=1,A.style.margin="0",A.style.padding="0",A.style.verticalAlign="baseline",o.style.fontFamily=e,o.style.fontSize=t,o.style.margin="0",o.style.padding="0",o.appendChild(this._document.createTextNode(cr)),n.appendChild(o),n.appendChild(A);var r=A.offsetTop-o.offsetTop+2;n.removeChild(o),n.appendChild(this._document.createTextNode(cr)),n.style.lineHeight="normal",A.style.verticalAlign="super";var a=A.offsetTop-n.offsetTop+2;return i.removeChild(n),{baseline:r,middle:a}},e.prototype.getMetrics=function(e,t){var n=e+" "+t;return void 0===this._data[n]&&(this._data[n]=this.parseMetrics(e,t)),this._data[n]},e}(),dr=function(e,t){this.context=e,this.options=t},pr=function(e){function n(t,n){var A=e.call(this,t,n)||this;return A._activeEffects=[],A.canvas=n.canvas?n.canvas:document.createElement("canvas"),A.ctx=A.canvas.getContext("2d"),n.canvas||(A.canvas.width=Math.floor(n.width*n.scale),A.canvas.height=Math.floor(n.height*n.scale),A.canvas.style.width=n.width+"px",A.canvas.style.height=n.height+"px"),A.fontMetrics=new lr(document),A.ctx.scale(A.options.scale,A.options.scale),A.ctx.translate(-n.x,-n.y),A.ctx.textBaseline="bottom",A._activeEffects=[],A.context.logger.debug("Canvas renderer initialized ("+n.width+"x"+n.height+") with scale "+n.scale),A}return t(n,e),n.prototype.applyEffects=function(e){for(var t=this;this._activeEffects.length;)this.popEffect();e.forEach(function(e){return t.applyEffect(e)})},n.prototype.applyEffect=function(e){this.ctx.save(),function(e){return 2===e.type}(e)&&(this.ctx.globalAlpha=e.opacity),function(e){return 0===e.type}(e)&&(this.ctx.translate(e.offsetX,e.offsetY),this.ctx.transform(e.matrix[0],e.matrix[1],e.matrix[2],e.matrix[3],e.matrix[4],e.matrix[5]),this.ctx.translate(-e.offsetX,-e.offsetY)),zi(e)&&(this.path(e.path),this.ctx.clip()),this._activeEffects.push(e)},n.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},n.prototype.renderStack=function(e){return A(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return e.element.container.styles.isVisible()?[4,this.renderStackContent(e)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.renderNode=function(e){return A(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return lA(e.container.flags,16),e.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(e)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},n.prototype.renderTextWithLetterSpacing=function(e,t,n){var A=this;0===t?this.ctx.fillText(e.text,e.bounds.left,e.bounds.top+n):$A(e.text).reduce(function(t,o){return A.ctx.fillText(o,t,e.bounds.top+n),t+A.ctx.measureText(o).width},e.bounds.left)},n.prototype.createFontStyle=function(e){var t=e.fontVariant.filter(function(e){return"normal"===e||"small-caps"===e}).join(""),n=fr(e.fontFamily).join(", "),A=Ne(e.fontSize)?""+e.fontSize.number+e.fontSize.unit:e.fontSize.number+"px";return[[e.fontStyle,t,e.fontWeight,A,n].join(" "),n,A]},n.prototype.renderTextNode=function(e,t){return A(this,void 0,void 0,function(){var n,A,i,r,a,s,c,l,d=this;return o(this,function(o){return n=this.createFontStyle(t),A=n[0],i=n[1],r=n[2],this.ctx.font=A,this.ctx.direction=1===t.direction?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(i,r),s=a.baseline,c=a.middle,l=t.paintOrder,e.textBounds.forEach(function(e){l.forEach(function(n){switch(n){case 0:d.ctx.fillStyle=ht(t.color),d.renderTextWithLetterSpacing(e,t.letterSpacing,s);var A=t.textShadow;A.length&&e.text.trim().length&&(A.slice(0).reverse().forEach(function(n){d.ctx.shadowColor=ht(n.color),d.ctx.shadowOffsetX=n.offsetX.number*d.options.scale,d.ctx.shadowOffsetY=n.offsetY.number*d.options.scale,d.ctx.shadowBlur=n.blur.number,d.renderTextWithLetterSpacing(e,t.letterSpacing,s)}),d.ctx.shadowColor="",d.ctx.shadowOffsetX=0,d.ctx.shadowOffsetY=0,d.ctx.shadowBlur=0),t.textDecorationLine.length&&(d.ctx.fillStyle=ht(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(t){switch(t){case 1:d.ctx.fillRect(e.bounds.left,Math.round(e.bounds.top+s),e.bounds.width,1);break;case 2:d.ctx.fillRect(e.bounds.left,Math.round(e.bounds.top),e.bounds.width,1);break;case 3:d.ctx.fillRect(e.bounds.left,Math.ceil(e.bounds.top+c),e.bounds.width,1)}}));break;case 1:t.webkitTextStrokeWidth&&e.text.trim().length&&(d.ctx.strokeStyle=ht(t.webkitTextStrokeColor),d.ctx.lineWidth=t.webkitTextStrokeWidth,d.ctx.lineJoin=window.chrome?"miter":"round",d.ctx.strokeText(e.text,e.bounds.left,e.bounds.top+s)),d.ctx.strokeStyle="",d.ctx.lineWidth=0,d.ctx.lineJoin="miter"}})}),[2]})})},n.prototype.renderReplacedElement=function(e,t,n){if(n&&e.intrinsicWidth>0&&e.intrinsicHeight>0){var A=nr(e),o=Vi(t);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,e.intrinsicWidth,e.intrinsicHeight,A.left,A.top,A.width,A.height),this.ctx.restore()}},n.prototype.renderNodeContent=function(e){return A(this,void 0,void 0,function(){var t,A,i,a,s,c,l,d,p,u,h,g,m,f,v,B,w,b;return o(this,function(o){switch(o.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,A=e.curves,i=t.styles,a=0,s=t.textNodes,o.label=1;case 1:return a<s.length?(c=s[a],[4,this.renderTextNode(c,i)]):[3,4];case 2:o.sent(),o.label=3;case 3:return a++,[3,1];case 4:if(!(t instanceof ao))return[3,8];o.label=5;case 5:return o.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return v=o.sent(),this.renderReplacedElement(t,A,v),[3,8];case 7:return o.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof so&&this.renderReplacedElement(t,A,t.canvas),!(t instanceof co))return[3,12];o.label=9;case 9:return o.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return v=o.sent(),this.renderReplacedElement(t,A,v),[3,12];case 11:return o.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof yo&&t.tree?[4,new n(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}).render(t.tree)]:[3,14];case 13:l=o.sent(),t.width&&t.height&&this.ctx.drawImage(l,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),o.label=14;case 14:if(t instanceof Bo&&(d=Math.min(t.bounds.width,t.bounds.height),t.type===go?t.checked&&(this.ctx.save(),this.path([new Di(t.bounds.left+.39363*d,t.bounds.top+.79*d),new Di(t.bounds.left+.16*d,t.bounds.top+.5549*d),new Di(t.bounds.left+.27347*d,t.bounds.top+.44071*d),new Di(t.bounds.left+.39694*d,t.bounds.top+.5649*d),new Di(t.bounds.left+.72983*d,t.bounds.top+.23*d),new Di(t.bounds.left+.84*d,t.bounds.top+.34085*d),new Di(t.bounds.left+.39363*d,t.bounds.top+.79*d)]),this.ctx.fillStyle=ht(vo),this.ctx.fill(),this.ctx.restore()):t.type===mo&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+d/2,t.bounds.top+d/2,d/4,0,2*Math.PI,!0),this.ctx.fillStyle=ht(vo),this.ctx.fill(),this.ctx.restore())),ur(t)&&t.value.length){switch(p=this.createFontStyle(i),w=p[0],u=p[1],h=this.fontMetrics.getMetrics(w,u).baseline,this.ctx.font=w,this.ctx.fillStyle=ht(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=gr(t.styles.textAlign),b=nr(t),g=0,t.styles.textAlign){case 1:g+=b.width/2;break;case 2:g+=b.width}m=b.add(g,0,0,-b.height/2+1),this.ctx.save(),this.path([new Di(b.left,b.top),new Di(b.left+b.width,b.top),new Di(b.left+b.width,b.top+b.height),new Di(b.left,b.top+b.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new YA(t.value,m),i.letterSpacing,h),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!lA(t.styles.display,2048))return[3,20];if(null===t.styles.listStyleImage)return[3,19];if(0!==(f=t.styles.listStyleImage).type)return[3,18];v=void 0,B=f.url,o.label=15;case 15:return o.trys.push([15,17,,18]),[4,this.context.cache.match(B)];case 16:return v=o.sent(),this.ctx.drawImage(v,t.bounds.left-(v.width+10),t.bounds.top),[3,18];case 17:return o.sent(),this.context.logger.error("Error loading list-style-image "+B),[3,18];case 18:return[3,20];case 19:e.listValue&&-1!==t.styles.listStyleType&&(w=this.createFontStyle(i)[0],this.ctx.font=w,this.ctx.fillStyle=ht(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",b=new r(t.bounds.left,t.bounds.top+it(t.styles.paddingTop,t.bounds.width),t.bounds.width,Un(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new YA(e.listValue,b),i.letterSpacing,Un(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),o.label=20;case 20:return[2]}})})},n.prototype.renderStackContent=function(e){return A(this,void 0,void 0,function(){var t,n,A,i,r,a,s,c,l,d,p,u,h,g,m;return o(this,function(o){switch(o.label){case 0:return lA(e.element.container.flags,16),[4,this.renderNodeBackgroundAndBorders(e.element)];case 1:o.sent(),t=0,n=e.negativeZIndex,o.label=2;case 2:return t<n.length?(m=n[t],[4,this.renderStack(m)]):[3,5];case 3:o.sent(),o.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(e.element)];case 6:o.sent(),A=0,i=e.nonInlineLevel,o.label=7;case 7:return A<i.length?(m=i[A],[4,this.renderNode(m)]):[3,10];case 8:o.sent(),o.label=9;case 9:return A++,[3,7];case 10:r=0,a=e.nonPositionedFloats,o.label=11;case 11:return r<a.length?(m=a[r],[4,this.renderStack(m)]):[3,14];case 12:o.sent(),o.label=13;case 13:return r++,[3,11];case 14:s=0,c=e.nonPositionedInlineLevel,o.label=15;case 15:return s<c.length?(m=c[s],[4,this.renderStack(m)]):[3,18];case 16:o.sent(),o.label=17;case 17:return s++,[3,15];case 18:l=0,d=e.inlineLevel,o.label=19;case 19:return l<d.length?(m=d[l],[4,this.renderNode(m)]):[3,22];case 20:o.sent(),o.label=21;case 21:return l++,[3,19];case 22:p=0,u=e.zeroOrAutoZIndexOrTransformedOrOpacity,o.label=23;case 23:return p<u.length?(m=u[p],[4,this.renderStack(m)]):[3,26];case 24:o.sent(),o.label=25;case 25:return p++,[3,23];case 26:h=0,g=e.positiveZIndex,o.label=27;case 27:return h<g.length?(m=g[h],[4,this.renderStack(m)]):[3,30];case 28:o.sent(),o.label=29;case 29:return h++,[3,27];case 30:return[2]}})})},n.prototype.mask=function(e){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(e.slice(0).reverse()),this.ctx.closePath()},n.prototype.path=function(e){this.ctx.beginPath(),this.formatPath(e),this.ctx.closePath()},n.prototype.formatPath=function(e){var t=this;e.forEach(function(e,n){var A=Li(e)?e.start:e;0===n?t.ctx.moveTo(A.x,A.y):t.ctx.lineTo(A.x,A.y),Li(e)&&t.ctx.bezierCurveTo(e.startControl.x,e.startControl.y,e.endControl.x,e.endControl.y,e.end.x,e.end.y)})},n.prototype.renderRepeat=function(e,t,n,A){this.path(e),this.ctx.fillStyle=t,this.ctx.translate(n,A),this.ctx.fill(),this.ctx.translate(-n,-A)},n.prototype.resizeImage=function(e,t,n){var A;if(e.width===t&&e.height===n)return e;var o=(null!==(A=this.canvas.ownerDocument)&&void 0!==A?A:document).createElement("canvas");return o.width=Math.max(1,t),o.height=Math.max(1,n),o.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t,n),o},n.prototype.renderBackgroundImage=function(e){return A(this,void 0,void 0,function(){var t,n,A,i,r,a;return o(this,function(s){switch(s.label){case 0:t=e.styles.backgroundImage.length-1,n=function(n){var i,r,a,s,c,l,d,p,u,h,g,m,f,v,B,w,b,y,x,C,Q,F,U,S,k,E,I,T,H,_,D;return o(this,function(o){switch(o.label){case 0:if(0!==n.type)return[3,5];i=void 0,r=n.url,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,A.context.cache.match(r)];case 2:return i=o.sent(),[3,4];case 3:return o.sent(),A.context.logger.error("Error loading background-image "+r),[3,4];case 4:return i&&(a=Ar(e,t,[i.width,i.height,i.width/i.height]),w=a[0],F=a[1],U=a[2],x=a[3],C=a[4],v=A.ctx.createPattern(A.resizeImage(i,x,C),"repeat"),A.renderRepeat(w,v,F,U)),[3,6];case 5:1===n.type?(s=Ar(e,t,[null,null,null]),w=s[0],F=s[1],U=s[2],x=s[3],C=s[4],c=Ut(n.angle,x,C),l=c[0],d=c[1],p=c[2],u=c[3],h=c[4],(g=document.createElement("canvas")).width=x,g.height=C,m=g.getContext("2d"),f=m.createLinearGradient(d,u,p,h),Ft(n.stops,l).forEach(function(e){return f.addColorStop(e.stop,ht(e.color))}),m.fillStyle=f,m.fillRect(0,0,x,C),x>0&&C>0&&(v=A.ctx.createPattern(g,"repeat"),A.renderRepeat(w,v,F,U))):function(e){return 2===e.type}(n)&&(B=Ar(e,t,[null,null,null]),w=B[0],b=B[1],y=B[2],x=B[3],C=B[4],Q=0===n.position.length?[nt]:n.position,F=it(Q[0],x),U=it(Q[Q.length-1],C),S=function(e,t,n,A,o){var i=0,r=0;switch(e.size){case 0:0===e.shape?i=r=Math.min(Math.abs(t),Math.abs(t-A),Math.abs(n),Math.abs(n-o)):1===e.shape&&(i=Math.min(Math.abs(t),Math.abs(t-A)),r=Math.min(Math.abs(n),Math.abs(n-o)));break;case 2:if(0===e.shape)i=r=Math.min(St(t,n),St(t,n-o),St(t-A,n),St(t-A,n-o));else if(1===e.shape){var a=Math.min(Math.abs(n),Math.abs(n-o))/Math.min(Math.abs(t),Math.abs(t-A)),s=kt(A,o,t,n,!0),c=s[0],l=s[1];r=a*(i=St(c-t,(l-n)/a))}break;case 1:0===e.shape?i=r=Math.max(Math.abs(t),Math.abs(t-A),Math.abs(n),Math.abs(n-o)):1===e.shape&&(i=Math.max(Math.abs(t),Math.abs(t-A)),r=Math.max(Math.abs(n),Math.abs(n-o)));break;case 3:if(0===e.shape)i=r=Math.max(St(t,n),St(t,n-o),St(t-A,n),St(t-A,n-o));else if(1===e.shape){a=Math.max(Math.abs(n),Math.abs(n-o))/Math.max(Math.abs(t),Math.abs(t-A));var d=kt(A,o,t,n,!1);c=d[0],l=d[1],r=a*(i=St(c-t,(l-n)/a))}}return Array.isArray(e.size)&&(i=it(e.size[0],A),r=2===e.size.length?it(e.size[1],o):i),[i,r]}(n,F,U,x,C),k=S[0],E=S[1],k>0&&E>0&&(I=A.ctx.createRadialGradient(b+F,y+U,0,b+F,y+U,k),Ft(n.stops,2*k).forEach(function(e){return I.addColorStop(e.stop,ht(e.color))}),A.path(w),A.ctx.fillStyle=I,k!==E?(T=e.bounds.left+.5*e.bounds.width,H=e.bounds.top+.5*e.bounds.height,D=1/(_=E/k),A.ctx.save(),A.ctx.translate(T,H),A.ctx.transform(1,0,0,_,0,0),A.ctx.translate(-T,-H),A.ctx.fillRect(b,D*(y-H)+H,x,C*D),A.ctx.restore()):A.ctx.fill())),o.label=6;case 6:return t--,[2]}})},A=this,i=0,r=e.styles.backgroundImage.slice(0).reverse(),s.label=1;case 1:return i<r.length?(a=r[i],[5,n(a)]):[3,4];case 2:s.sent(),s.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},n.prototype.renderSolidBorder=function(e,t,n){return A(this,void 0,void 0,function(){return o(this,function(A){return this.path(Zi(n,t)),this.ctx.fillStyle=ht(e),this.ctx.fill(),[2]})})},n.prototype.renderDoubleBorder=function(e,t,n,i){return A(this,void 0,void 0,function(){var A,r;return o(this,function(o){switch(o.label){case 0:return t<3?[4,this.renderSolidBorder(e,n,i)]:[3,2];case 1:return o.sent(),[2];case 2:return A=function(e,t){switch(t){case 0:return er(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return er(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return er(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);default:return er(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}}(i,n),this.path(A),this.ctx.fillStyle=ht(e),this.ctx.fill(),r=function(e,t){switch(t){case 0:return er(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return er(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return er(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);default:return er(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}}(i,n),this.path(r),this.ctx.fill(),[2]}})})},n.prototype.renderNodeBackgroundAndBorders=function(e){return A(this,void 0,void 0,function(){var t,n,A,i,r,a,s,c,l=this;return o(this,function(o){switch(o.label){case 0:return this.applyEffects(e.getEffects(2)),t=e.container.styles,n=!ut(t.backgroundColor)||t.backgroundImage.length,A=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],i=hr(ar(t.backgroundClip,0),e.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),ut(t.backgroundColor)||(this.ctx.fillStyle=ht(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(e.container)]):[3,2];case 1:o.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(t){l.ctx.save();var n,A,o,i,r,a=Oi(e.curves),s=t.inset?0:1e4,c=(n=a,A=-s+(t.inset?1:-1)*t.spread.number,o=(t.inset?1:-1)*t.spread.number,i=t.spread.number*(t.inset?-2:2),r=t.spread.number*(t.inset?-2:2),n.map(function(e,t){switch(t){case 0:return e.add(A,o);case 1:return e.add(A+i,o);case 2:return e.add(A+i,o+r);case 3:return e.add(A,o+r)}return e}));t.inset?(l.path(a),l.ctx.clip(),l.mask(c)):(l.mask(a),l.ctx.clip(),l.path(c)),l.ctx.shadowOffsetX=t.offsetX.number+s,l.ctx.shadowOffsetY=t.offsetY.number,l.ctx.shadowColor=ht(t.color),l.ctx.shadowBlur=t.blur.number,l.ctx.fillStyle=t.inset?ht(t.color):"rgba(0,0,0,1)",l.ctx.fill(),l.ctx.restore()}),o.label=2;case 2:r=0,a=0,s=A,o.label=3;case 3:return a<s.length?0!==(c=s[a]).style&&!ut(c.color)&&c.width>0?2!==c.style?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,r,e.curves,2)]:[3,11]:[3,13];case 4:return o.sent(),[3,11];case 5:return 3!==c.style?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,r,e.curves,3)];case 6:return o.sent(),[3,11];case 7:return 4!==c.style?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,r,e.curves)];case 8:return o.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,r,e.curves)];case 10:o.sent(),o.label=11;case 11:r++,o.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},n.prototype.renderDashedDottedBorder=function(e,t,n,i,r){return A(this,void 0,void 0,function(){var A,a,s,c,l,d,p,u,h,g,m,f,v,B,w,b;return o(this,function(o){return this.ctx.save(),A=function(e,t){switch(t){case 0:return $i(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return $i(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return $i(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);default:return $i(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}}(i,n),a=Zi(i,n),2===r&&(this.path(a),this.ctx.clip()),Li(a[0])?(s=a[0].start.x,c=a[0].start.y):(s=a[0].x,c=a[0].y),Li(a[1])?(l=a[1].end.x,d=a[1].end.y):(l=a[1].x,d=a[1].y),p=0===n||2===n?Math.abs(s-l):Math.abs(c-d),this.ctx.beginPath(),3===r?this.formatPath(A):this.formatPath(a.slice(0,2)),u=t<3?3*t:2*t,h=t<3?2*t:t,3===r&&(u=t,h=t),g=!0,p<=2*u?g=!1:p<=2*u+h?(u*=m=p/(2*u+h),h*=m):(f=Math.floor((p+h)/(u+h)),v=(p-f*u)/(f-1),h=(B=(p-(f+1)*u)/f)<=0||Math.abs(h-v)<Math.abs(h-B)?v:B),g&&(3===r?this.ctx.setLineDash([0,u+h]):this.ctx.setLineDash([u,h])),3===r?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=2*t+1.1,this.ctx.strokeStyle=ht(e),this.ctx.stroke(),this.ctx.setLineDash([]),2===r&&(Li(a[0])&&(w=a[3],b=a[0],this.ctx.beginPath(),this.formatPath([new Di(w.end.x,w.end.y),new Di(b.start.x,b.start.y)]),this.ctx.stroke()),Li(a[1])&&(w=a[1],b=a[2],this.ctx.beginPath(),this.formatPath([new Di(w.end.x,w.end.y),new Di(b.start.x,b.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},n.prototype.render=function(e){return A(this,void 0,void 0,function(){var t;return o(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=ht(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=new Xi(e,null),o=new qi(A),Yi(A,o,o,i=[]),Ji(A.container,i),t=o,[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}var A,o,i})})},n}(dr),ur=function(e){return e instanceof bo||e instanceof wo||e instanceof Bo&&e.type!==mo&&e.type!==go},hr=function(e,t){switch(e){case 0:return Oi(t);case 2:return function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]}(t);default:return Vi(t)}},gr=function(e){switch(e){case 1:return"center";case 2:return"right";default:return"left"}},mr=["-apple-system","system-ui"],fr=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(e){return-1===mr.indexOf(e)}):e},vr=function(e){function n(t,n){var A=e.call(this,t,n)||this;return A.canvas=n.canvas?n.canvas:document.createElement("canvas"),A.ctx=A.canvas.getContext("2d"),A.options=n,A.canvas.width=Math.floor(n.width*n.scale),A.canvas.height=Math.floor(n.height*n.scale),A.canvas.style.width=n.width+"px",A.canvas.style.height=n.height+"px",A.ctx.scale(A.options.scale,A.options.scale),A.ctx.translate(-n.x,-n.y),A.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+n.width+"x"+n.height+" at "+n.x+","+n.y+") with scale "+n.scale),A}return t(n,e),n.prototype.render=function(e){return A(this,void 0,void 0,function(){var t,n;return o(this,function(A){switch(A.label){case 0:return t=WA(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e),[4,Br(t)];case 1:return n=A.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=ht(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},n}(dr),Br=function(e){return new Promise(function(t,n){var A=new Image;A.onload=function(){t(A)},A.onerror=n,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(e))})},wr=function(){function e(e){var t=e.id,n=e.enabled;this.id=t,this.enabled=n,this.start=Date.now()}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.debug?console.debug.apply(console,i([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},e.prototype.getTime=function(){return Date.now()-this.start},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&"undefined"!=typeof window&&window.console&&"function"==typeof console.info&&console.info.apply(console,i([this.id,this.getTime()+"ms"],e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.warn?console.warn.apply(console,i([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.error?console.error.apply(console,i([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},e.instances={},e}(),br=function(){function e(t,n){var A;this.windowBounds=n,this.instanceName="#"+e.instanceCount++,this.logger=new wr({id:this.instanceName,enabled:t.logging}),this.cache=null!==(A=t.cache)&&void 0!==A?A:new Fi(this,t)}return e.instanceCount=1,e}();"undefined"!=typeof window&&Qi.setContext(window);var yr=function(e,t){return A(void 0,void 0,void 0,function(){var A,i,s,c,l,d,p,u,h,g,m,f,v,B,w,b,y,x,C,Q,F,U,S,k,E,I,T,H,_,D,M,P,L,R,K,O,V,N;return o(this,function(o){switch(o.label){case 0:if(!e||"object"!=typeof e)return[2,Promise.reject("Invalid element provided as first argument")];if(!(A=e.ownerDocument))throw new Error("Element is not attached to a Document");if(!(i=A.defaultView))throw new Error("Document is not attached to a Window");return s={allowTaint:null!==(U=t.allowTaint)&&void 0!==U&&U,imageTimeout:null!==(S=t.imageTimeout)&&void 0!==S?S:15e3,proxy:t.proxy,useCORS:null!==(k=t.useCORS)&&void 0!==k&&k},c=n({logging:null===(E=t.logging)||void 0===E||E,cache:t.cache},s),l={windowWidth:null!==(I=t.windowWidth)&&void 0!==I?I:i.innerWidth,windowHeight:null!==(T=t.windowHeight)&&void 0!==T?T:i.innerHeight,scrollX:null!==(H=t.scrollX)&&void 0!==H?H:i.pageXOffset,scrollY:null!==(_=t.scrollY)&&void 0!==_?_:i.pageYOffset},d=new r(l.scrollX,l.scrollY,l.windowWidth,l.windowHeight),p=new br(c,d),u=null!==(D=t.foreignObjectRendering)&&void 0!==D&&D,h={allowTaint:null!==(M=t.allowTaint)&&void 0!==M&&M,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:u,copyStyles:u},p.logger.debug("Starting document clone with size "+d.width+"x"+d.height+" scrolled to "+-d.left+","+-d.top),g=new ci(p,e,h),(m=g.clonedReferenceElement)?[4,g.toIFrame(A,d)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return f=o.sent(),v=Po(m)||"HTML"===m.tagName?function(e){var t=e.body,n=e.documentElement;if(!t||!n)throw new Error("Unable to get document size");var A=Math.max(Math.max(t.scrollWidth,n.scrollWidth),Math.max(t.offsetWidth,n.offsetWidth),Math.max(t.clientWidth,n.clientWidth)),o=Math.max(Math.max(t.scrollHeight,n.scrollHeight),Math.max(t.offsetHeight,n.offsetHeight),Math.max(t.clientHeight,n.clientHeight));return new r(0,0,A,o)}(m.ownerDocument):a(p,m),B=v.width,w=v.height,b=v.left,y=v.top,x=xr(p,m,t.backgroundColor),C={canvas:t.canvas,backgroundColor:x,scale:null!==(L=null!==(P=t.scale)&&void 0!==P?P:i.devicePixelRatio)&&void 0!==L?L:1,x:(null!==(R=t.x)&&void 0!==R?R:0)+b,y:(null!==(K=t.y)&&void 0!==K?K:0)+y,width:null!==(O=t.width)&&void 0!==O?O:Math.ceil(B),height:null!==(V=t.height)&&void 0!==V?V:Math.ceil(w)},u?(p.logger.debug("Document cloned, using foreign object rendering"),[4,new vr(p,C).render(m)]):[3,3];case 2:return Q=o.sent(),[3,5];case 3:return p.logger.debug("Document cloned, element located at "+b+","+y+" with size "+B+"x"+w+" using computed rendering"),p.logger.debug("Starting DOM parsing"),F=Fo(p,m),x===F.styles.backgroundColor&&(F.styles.backgroundColor=yt.TRANSPARENT),p.logger.debug("Starting renderer for element at "+C.x+","+C.y+" with size "+C.width+"x"+C.height),[4,new pr(p,C).render(F)];case 4:Q=o.sent(),o.label=5;case 5:return(null===(N=t.removeContainer)||void 0===N||N)&&(ci.destroy(f)||p.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),p.logger.debug("Finished rendering"),[2,Q]}})})},xr=function(e,t,n){var A=t.ownerDocument,o=A.documentElement?bt(e,getComputedStyle(A.documentElement).backgroundColor):yt.TRANSPARENT,i=A.body?bt(e,getComputedStyle(A.body).backgroundColor):yt.TRANSPARENT,r="string"==typeof n?bt(e,n):null===n?yt.TRANSPARENT:4294967295;return t===A.documentElement?ut(o)?ut(i)?r:i:o:r};return function(e,t){return void 0===t&&(t={}),yr(e,t)}}()}},i={};function r(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return o[e].call(n.exports,n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};r.r(a),r.d(a,{checkPermissionState:()=>Je,getDeviceInfo:()=>Ye,getPermissionInstructions:()=>$e,openSettings:()=>et});var s={};r.r(s),r.d(s,{showBlockedModal:()=>it,showNoMicrophoneModal:()=>rt,showPrePromptModal:()=>ot});const c=class{constructor(){this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),this}off(e,t){return this.events[e]?(this.events[e]=this.events[e].filter(e=>e!==t),this):this}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),A=1;A<t;A++)n[A-1]=arguments[A];return!!this.events[e]&&(this.events[e].forEach(e=>{e(...n)}),!0)}once(e,t){var n=this,A=function(){t(...arguments),n.off(e,A)};return this.on(e,A)}removeAllListeners(e){return e?delete this.events[e]:this.events={},this}},l=class{constructor(){this.name="PCM"}decode(e){if(e instanceof ArrayBuffer)return e;if(e instanceof Uint8Array)return e.buffer;throw new Error("Invalid PCM data type")}encode(e){return e}},d=class{constructor(){this.name="PCMU"}decode(e){for(var t=e instanceof Uint8Array?e:new Uint8Array(e),n=new Int16Array(t.length),A=0;A<t.length;A++)n[A]=this.mulawToLinear(t[A]);return n.buffer}encode(e){for(var t=e instanceof Int16Array?e:new Int16Array(e),n=new Uint8Array(t.length),A=0;A<t.length;A++)n[A]=this.linearToMulaw(t[A]);return n}mulawToLinear(e){var t=1<<3+(e>>4&7);return(128&e?-1:1)*(132+(15&e)*t+(t>>1)-4)}linearToMulaw(e){var t=e>>8&128;t&&(e=-e),e>32635&&(e=32635),e+=132;for(var n=7,A=16384;0===(e&A)&&n>0;n--,A>>=1);return 255&~(t|n<<4|e>>n+3&15)}},p=class{constructor(){this.name="PCMA"}decode(e){for(var t=e instanceof Uint8Array?e:new Uint8Array(e),n=new Int16Array(t.length),A=0;A<t.length;A++)n[A]=this.alawToLinear(t[A]);return n.buffer}encode(e){for(var t=e instanceof Int16Array?e:new Int16Array(e),n=new Uint8Array(t.length),A=0;A<t.length;A++)n[A]=this.linearToAlaw(t[A]);return n}alawToLinear(e){var t=(e^=85)>>4&7,n=15&e;return(128&e?-1:1)*(0===t?8+(n<<4):264+(n<<4)<<t-1)}linearToAlaw(e){var t,n,A=e>>8&128;if(A&&(e=-e),e>32635&&(e=32635),e<256)t=0,n=e>>4;else{t=7;for(var o=16384;0===(e&o)&&t>0;t--,o>>=1);n=e>>t+3&15}return 85^(A|t<<4|n)}};function u(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){u(i,A,o,r,a,"next",e)}function a(e){u(i,A,o,r,a,"throw",e)}r(void 0)})}}var g=null,m=null;const f=class extends c{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),console.log("%c✅ TTP Agent SDK loaded","background: #10b981; color: white; font-size: 14px; font-weight: bold; padding: 4px 8px; border-radius: 4px;"),console.log(""),this.config=e,this.audioContext=null,this.gainNode=null,this._audioContextPrimed=!1,this._waitForReadyStateHandler=null,this.audioQueue=[],this.isPlaying=!1,this.isProcessingQueue=!1,this.currentSource=null,this.outputFormat=null,this.nextStartTime=0,this.scheduledBuffers=0,this.scheduledSources=new Set,this.pcmChunkQueue=[],this.preparedBuffer=[],this.MAX_PREPARED_BUFFER_SIZE=200,this.MAX_PCM_CHUNK_QUEUE_SIZE=50,this.isProcessingPcmQueue=!1,this.isSchedulingFrames=!1,this._emptySentenceTimeout=null,this.MAX_LOOKAHEAD_SECONDS=.02,this.pendingSentenceText=null,this.pendingSynced=null,this.sentenceTimings=[],this.isCheckingTranscripts=!1,this._isStopped=!1,this._currentSentenceId=0,this.codecs={pcm:new l,pcmu:new d,pcma:new p},this.SUPPORTED_CONTAINERS=["wav","raw"],this.SUPPORTED_ENCODINGS=["pcm","pcmu","pcma"],this.SUPPORTED_SAMPLE_RATES=[8e3,16e3,22050,24e3,44100,48e3],this.SUPPORTED_BIT_DEPTHS=[8,16,24],this.SUPPORTED_CHANNELS=[1],console.log("🎵 AudioPlayer v2 initialized")}setOutputFormat(e){var t;this.validateFormat(e)||(console.warn("⚠️ AudioPlayer: Invalid format, using defaults:",e),e=this.getDefaultFormat());var n=null===(t=this.outputFormat)||void 0===t?void 0:t.sampleRate,A=e.sampleRate;this.outputFormat=e,console.log("✅ AudioPlayer v2: Format set:",e),this.audioContext&&n&&n!==A&&(console.warn("⚠️ AudioPlayer: Sample rate changed, recreating AudioContext"),console.warn(" Old: ".concat(n,"Hz → New: ").concat(A,"Hz")),this.stopImmediate(),this._cleanupAudioContext(),console.log("ℹ️ AudioContext will be recreated on next audio chunk with correct sample rate"))}validateFormat(e){var t,n;if(!e)return!1;var A=null===(t=e.container)||void 0===t?void 0:t.toLowerCase(),o=null===(n=e.encoding)||void 0===n?void 0:n.toLowerCase();return A&&o&&this.SUPPORTED_CONTAINERS.includes(A)&&this.SUPPORTED_ENCODINGS.includes(o)&&this.SUPPORTED_SAMPLE_RATES.includes(e.sampleRate)&&this.SUPPORTED_BIT_DEPTHS.includes(e.bitDepth)&&(!e.channels||this.SUPPORTED_CHANNELS.includes(e.channels))}getDefaultFormat(){return{container:"raw",encoding:"pcm",sampleRate:16e3,channels:1,bitDepth:16}}playAudio(e){if(this._isStopped)console.log("🛑 AudioPlayer: Ignoring audio chunk - playback was stopped (barge-in)");else try{var t=this.createAudioBlob(e);this.audioQueue.push(t),this.isPlaying||this.isProcessingQueue||this.currentSource||setTimeout(()=>this.processQueue(),50)}catch(e){console.error("❌ AudioPlayer v2: Playback error:",e),this.emit("playbackError",e)}}playChunk(e){var t=this;return h(function*(){if(t._isStopped)console.log("🛑 AudioPlayer: Ignoring PCM chunk - playback was stopped (barge-in)");else{var n,A=t.prepareChunk(e);if(A)t._emptySentenceTimeout&&(clearTimeout(t._emptySentenceTimeout),t._emptySentenceTimeout=null),t.preparedBuffer.length>=t.MAX_PREPARED_BUFFER_SIZE&&(t.preparedBuffer.shift(),console.warn("⚠️ AudioPlayer: preparedBuffer at max size (".concat(t.MAX_PREPARED_BUFFER_SIZE,"), dropped oldest frame"))),t.preparedBuffer.push(A),t.isSchedulingFrames||t._isStopped?setTimeout(()=>{t.preparedBuffer.length>0&&!t.isSchedulingFrames&&!t._isStopped&&t.schedulePreparedFrames()},5):t.schedulePreparedFrames(),t.pcmChunkQueue.length>0&&!t.isProcessingPcmQueue&&t.processPcmQueue();else console.error("❌ AudioPlayer: playChunk failed - prepareChunk returned null"),console.error(" pcmData length:",(null==e?void 0:e.byteLength)||"undefined"),console.error(" outputFormat:",t.outputFormat),console.error(" audioContext:",t.audioContext?"initialized":"not initialized"),console.error(" audioContext state:",(null===(n=t.audioContext)||void 0===n?void 0:n.state)||"N/A"),t.emit("playbackError",new Error("Failed to prepare PCM chunk for playback"))}})()}prepareChunk(e){try{var t;if(!this.outputFormat)return console.error("❌ AudioPlayer: Cannot prepare chunk - outputFormat not set"),console.error(" Call setOutputFormat() before playing audio chunks"),null;if(this.audioContext||this.initializeAudioContext(),!this.audioContext)return console.error("❌ AudioPlayer: Cannot prepare chunk - AudioContext not available"),null;var n=e;if(e.byteLength%2!=0){console.warn("⚠️ Odd PCM chunk size, padding:",e.byteLength);var A=new Uint8Array(e.byteLength+1);A.set(new Uint8Array(e),0),A[e.byteLength]=0,n=A.buffer}for(var o=new Int16Array(n),i=new Float32Array(o.length),r=1/32768,a=o.length,s=0;s<a;s++)i[s]=o[s]*r;var c=(null===(t=this.outputFormat)||void 0===t?void 0:t.sampleRate)||this.audioContext.sampleRate,l=this.audioContext.sampleRate,d=this.audioContext.createBuffer(1,i.length,c);d.getChannelData(0).set(i);var p=d.duration,u=i.length,h=p;return l!==c&&(h=u/l),{buffer:d,duration:h,sampleRate:c,contextSampleRate:l}}catch(e){return console.error("❌ AudioPlayer: Error preparing chunk:",e),null}}applyFadeOut(e){return e}schedulePreparedFrames(){var e=this;return h(function*(){if(e._isStopped)console.log("🛑 AudioPlayer: Not scheduling frames - playback was stopped (barge-in)");else if(!e.isSchedulingFrames){e.isSchedulingFrames=!0;var t=e.preparedBuffer.length,n=Math.min(t,5);0===n&&t>0&&(n=1);try{e.audioContext||e.initializeAudioContext(),yield e.waitForAudioContextReady();for(var A=0,o=function*(){if(e._isStopped)return console.log("🛑 AudioPlayer: Stopping frame scheduling - playback was stopped"),0;var t=e.preparedBuffer.shift();if(!t)return 0;var n=e.audioContext.createBufferSource();n.buffer=t.buffer,n.connect(e.gainNode||e.audioContext.destination),e.scheduledSources.add(n);var o=e.audioContext.currentTime;if(0===e.scheduledBuffers){var i=.03;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(e._audioContextPrimed?i=0:(i=2,console.warn("⚠️ AudioPlayer: Audio not primed yet, using 2000ms fallback buffer"))),e.nextStartTime=o+i,console.log("🎵 [scheduleWAV] FIRST FRAME - primed: ".concat(e._audioContextPrimed,", buffer: ").concat(1e3*i,"ms"))}else{var r=o+e.MAX_LOOKAHEAD_SECONDS;e.nextStartTime<r&&(e.nextStartTime=r,console.warn("⚠️ AudioPlayer: Fell behind schedule, adjusting nextStartTime to ".concat(e.nextStartTime.toFixed(4),"s")))}e.pendingSentenceText&&(e.sentenceTimings.push({startTime:e.nextStartTime,text:e.pendingSentenceText,synced:e.pendingSynced,displayed:!1}),console.log("📝 AudioPlayer: Sentence scheduled at ".concat(e.nextStartTime.toFixed(3),'s: "').concat(e.pendingSentenceText.substring(0,40),'..." (synced: ').concat(e.pendingSynced?e.pendingSynced.length:0,")")),e.pendingSentenceText=null,e.pendingSynced=null,e.isCheckingTranscripts||e.startTranscriptChecker()),n.start(e.nextStartTime),e.nextStartTime+=t.duration,e.nextStartTime=Math.round(1e6*e.nextStartTime)/1e6;var a=e.nextStartTime-t.duration;e.scheduledBuffers<5&&(console.log("🎵 AudioPlayer: Scheduled frame ".concat(e.scheduledBuffers+1," at ").concat(a.toFixed(4),"s, next at ").concat(e.nextStartTime.toFixed(4),"s")),console.log(" Duration: ".concat(t.duration.toFixed(4),"s (").concat((1e3*t.duration).toFixed(2),"ms), Queued: ").concat(e.preparedBuffer.length,", Scheduled: ").concat(e.scheduledBuffers))),e.scheduledBuffers++,A++,n.onended=()=>{if(!e._isStopped&&e.scheduledSources.has(n))if(e.scheduledSources.delete(n),!e._isStopped&&e.scheduledBuffers>0&&e.scheduledBuffers--,0!==e.scheduledBuffers||0!==e.preparedBuffer.length||0!==e.pcmChunkQueue.length||e._isStopped){if(e.preparedBuffer.length>0&&!e._isStopped)setTimeout(()=>{e.preparedBuffer.length>0&&!e.isSchedulingFrames&&!e._isStopped&&e.schedulePreparedFrames()},0);else if(e.scheduledBuffers>0&&!e._isStopped){var t=()=>{e._isStopped||(e.preparedBuffer.length>0&&!e.isSchedulingFrames&&e.scheduledBuffers>0?e.schedulePreparedFrames():e.scheduledBuffers>0&&!e._isStopped&&setTimeout(t,10))};setTimeout(t,10)}}else e.isPlaying=!1,e.isSchedulingFrames=!1,console.log("🛑 AudioPlayer: Emitting playbackStopped event (all buffers finished)"),e.emit("playbackStopped")},e.isPlaying||(e.isPlaying=!0,console.log("🎵 AudioPlayer: Emitting playbackStarted event"),e.emit("playbackStarted"))};e.preparedBuffer.length>0&&A<n&&0!==(yield*o()););e.isSchedulingFrames=!1,e.preparedBuffer.length>0&&!e._isStopped&&requestAnimationFrame(()=>{e.preparedBuffer.length>0&&!e.isSchedulingFrames&&!e._isStopped&&e.schedulePreparedFrames()}),e.scheduledBuffers>0&&!e._isStopped&&setTimeout(()=>{e.preparedBuffer.length>0&&!e.isSchedulingFrames&&e.scheduledBuffers>0&&!e._isStopped?e.schedulePreparedFrames():e.scheduledBuffers>0&&!e._isStopped&&setTimeout(()=>{e.preparedBuffer.length>0&&!e.isSchedulingFrames&&e.scheduledBuffers>0&&!e._isStopped&&e.schedulePreparedFrames()},10)},10)}catch(t){console.error("❌ AudioPlayer v2: Error scheduling frames:",t),e.emit("playbackError",t),e.isSchedulingFrames=!1}}})()}processPcmQueue(){var e=this;return h(function*(){if(e._isStopped)console.log("🛑 AudioPlayer: Not processing PCM queue - playback was stopped (barge-in)");else if(!e.isProcessingPcmQueue){e.isProcessingPcmQueue=!0;try{for(e.audioContext||e.initializeAudioContext(),yield e.waitForAudioContextReady();e.pcmChunkQueue.length>0;){var t,n;if(e._isStopped){console.log("🛑 AudioPlayer: Stopping PCM queue processing - playback was stopped");break}var A=e.pcmChunkQueue.shift();if(A){var o=A;if(A.byteLength%2!=0){console.warn("⚠️ Odd PCM chunk size, padding:",A.byteLength);var i=new Uint8Array(A.byteLength+1);i.set(new Uint8Array(A),0),i[A.byteLength]=0,o=i.buffer}for(var r=new Int16Array(o),a=new Float32Array(r.length),s=1/32768,c=r.length,l=0;l<c;l++)a[l]=r[l]*s;var d=(null===(t=e.outputFormat)||void 0===t?void 0:t.sampleRate)||e.audioContext.sampleRate,p=e.audioContext.sampleRate;null!==(n=e.outputFormat)&&void 0!==n&&n.sampleRate?e.scheduledBuffers<3&&console.log("🎵 AudioPlayer: Creating buffer at ".concat(d,"Hz (AudioContext: ").concat(p,"Hz)")):console.warn("⚠️ AudioPlayer: outputFormat.sampleRate not set! Using AudioContext sample rate:",p);var u=e.audioContext.createBuffer(1,a.length,d);u.getChannelData(0).set(a);var h=e.audioContext.createBufferSource();h.buffer=u,h.connect(e.gainNode||e.audioContext.destination);var g=e.audioContext.currentTime;e.nextStartTime<g&&(e.nextStartTime=g,0===e.scheduledBuffers&&console.log("🎵 Starting playback at current time:",g));var m=u.duration,f=a.length,v=m;if(p!==d&&(v=f/p,e.scheduledBuffers<3&&(console.log("🔄 Resampling detected: ".concat(d,"Hz → ").concat(p,"Hz")),console.log(" Buffer duration: ".concat(m.toFixed(4),"s, Calculated: ").concat(v.toFixed(4),"s")))),h.start(e.nextStartTime),e.nextStartTime+=v,e.nextStartTime=Math.round(1e6*e.nextStartTime)/1e6,e.scheduledBuffers<3){var B=e.nextStartTime-v;console.log("🎵 AudioPlayer: Scheduled chunk ".concat(e.scheduledBuffers+1," at ").concat(B.toFixed(4),"s, next at ").concat(e.nextStartTime.toFixed(4),"s")),console.log(" Duration: ".concat(v.toFixed(4),"s (").concat((1e3*v).toFixed(2),"ms)"))}e.scheduledBuffers++,h.onended=()=>{e.scheduledBuffers--,0===e.scheduledBuffers&&0===e.pcmChunkQueue.length&&(e.isPlaying=!1,e.isProcessingPcmQueue=!1,e.emit("playbackStopped"))},e.isPlaying||(e.isPlaying=!0,e.emit("playbackStarted"))}}e.isProcessingPcmQueue=!1}catch(t){console.error("❌ AudioPlayer v2: Error playing chunk:",t),e.emit("playbackError",t),e.isProcessingPcmQueue=!1}}})()}createAudioBlob(e){var t=new Uint8Array(e);console.log("🎵 AudioPlayer: Processing ".concat(t.length," bytes")),console.log("🎵 AudioPlayer: Negotiated format:",this.outputFormat);var n=this.outputFormat&&this.outputFormat.container&&"wav"===this.outputFormat.container.toLowerCase(),A=this.outputFormat&&this.outputFormat.container&&"raw"===this.outputFormat.container.toLowerCase(),o=this.isWavFile(t);if(o&&console.log("🎵 AudioPlayer: Data has WAV header (RIFF)"),A&&o)return console.error("❌ AudioPlayer: CRITICAL MISMATCH!"),console.error(" Negotiated format: RAW"),console.error(" Actual data: WAV (RIFF header detected)"),console.error(" Backend is ignoring format request and sending WAV anyway."),console.warn("⚠️ AudioPlayer: Processing as WAV to avoid playback failure, but UI configuration was bypassed."),this.handleWavFile(t);if(A&&!o)console.log("🎵 AudioPlayer: Processing as RAW data (as negotiated)");else{if(n&&o)return console.log("✅ AudioPlayer: Processing as WAV file (matches negotiation)"),this.handleWavFile(t);if(n&&!o)return console.warn("⚠️ AudioPlayer: Negotiated WAV but data lacks WAV header. Attempting WAV processing anyway."),this.handleWavFile(t);if(!this.outputFormat&&o)return console.log("🎵 AudioPlayer: No format negotiated, auto-detecting WAV"),this.handleWavFile(t);this.outputFormat||o||(console.warn("⚠️ AudioPlayer: No format negotiated and data not WAV, using defaults"),this.outputFormat=this.getDefaultFormat())}return this.outputFormat||(console.warn("⚠️ AudioPlayer: No format set, using defaults"),this.outputFormat=this.getDefaultFormat()),console.log("🎵 AudioPlayer: Processing as RAW data with encoding:",this.outputFormat.encoding),this.handleRawData(t)}isWavFile(e){return e.length>=44&&82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]}handleWavFile(e){var t=this.parseWavHeader(e);if(console.log("🎵 WAV file detected:",{format:t.audioFormat,encoding:this.getEncodingName(t.audioFormat),sampleRate:t.sampleRate,channels:t.channels,bitDepth:t.bitsPerSample}),1===t.audioFormat)return console.log("✅ PCM WAV - using directly"),new Blob([e],{type:"audio/wav"});var n=this.getCodecForWavFormat(t.audioFormat);if(!n)throw new Error("Unsupported WAV format code: ".concat(t.audioFormat));console.log("🔄 Non-PCM WAV - converting to PCM WAV");var A=e.slice(44),o=n.decode(A),i=this.createWavHeader(o.byteLength,t.sampleRate,t.channels,16);return new Blob([i,o],{type:"audio/wav"})}handleRawData(e){var t,n,A=this.outputFormat.encoding.toLowerCase(),o=this.getCodec(A);if(!o)throw new Error("No codec found for encoding: ".concat(A));if(console.log("🎵 AudioPlayer: Decoding ".concat(A.toUpperCase()," to PCM")),console.log("🎵 AudioPlayer: Input format - bitDepth: ".concat(this.outputFormat.bitDepth,", sampleRate: ").concat(this.outputFormat.sampleRate)),"pcm"===A){var i=this.outputFormat.bitDepth||16;e.length,24===i?(console.warn("⚠️ AudioPlayer: Format says 24-bit PCM, but browser support is limited."),console.warn(" Treating as 16-bit PCM. If audio sounds wrong, backend should send 16-bit instead."),t=this.convert24BitTo16Bit(e),n=16):8===i?(console.log("🔄 AudioPlayer: Converting 8-bit PCM to 16-bit PCM"),t=this.convert8BitTo16Bit(e),n=16):(t=e.buffer,n=i,console.log("✅ AudioPlayer: Using native ".concat(i,"-bit PCM (no conversion needed)")))}else t=o.decode(e),n=16,console.log("🔄 AudioPlayer: Decoded ".concat(A.toUpperCase()," to 16-bit PCM"));var r=this.createWavHeader(t.byteLength,this.outputFormat.sampleRate,this.outputFormat.channels,n);return new Blob([r,t],{type:"audio/wav"})}convert24BitTo16Bit(e){for(var t=Math.floor(e.length/3),n=new Int16Array(t),A=0;A<t;A++){var o=e[3*A],i=e[3*A+1],r=e[3*A+2],a=o|i<<8|(255&r)<<16;128&r&&(a|=4278190080),n[A]=Math.max(-32768,Math.min(32767,Math.round(a/256)))}return n.buffer}convert8BitTo16Bit(e){for(var t=e.length,n=new Int16Array(t),A=0;A<t;A++){var o=e[A];n[A]=256*(o-128)}return n.buffer}getCodec(e){var t={pcm:"pcm",linear:"pcm",l16:"pcm",pcmu:"pcmu",ulaw:"pcmu",mulaw:"pcmu",g711u:"pcmu",pcma:"pcma",alaw:"pcma",g711a:"pcma"}[e.toLowerCase()];return this.codecs[t]}getCodecForWavFormat(e){switch(e){case 1:return this.codecs.pcm;case 6:return this.codecs.pcma;case 7:return this.codecs.pcmu;default:return null}}getEncodingName(e){switch(e){case 1:return"PCM";case 6:return"A-law";case 7:return"μ-law";default:return"Unknown (".concat(e,")")}}parseWavHeader(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{audioFormat:t.getUint16(20,!0),channels:t.getUint16(22,!0),sampleRate:t.getUint32(24,!0),byteRate:t.getUint32(28,!0),blockAlign:t.getUint16(32,!0),bitsPerSample:t.getUint16(34,!0)}}createWavHeader(e,t,n,A){var o=new ArrayBuffer(44),i=new DataView(o);return i.setUint32(0,1380533830,!1),i.setUint32(4,36+e,!0),i.setUint32(8,1463899717,!1),i.setUint32(12,1718449184,!1),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,n,!0),i.setUint32(24,t,!0),i.setUint32(28,t*n*A/8,!0),i.setUint16(32,n*A/8,!0),i.setUint16(34,A,!0),i.setUint32(36,1684108385,!1),i.setUint32(40,e,!0),o}waitForAudioContextReady(){var e=this;return h(function*(){if(e.audioContext||e.initializeAudioContext(),!e.audioContext)return console.error("❌ AudioPlayer: Failed to create AudioContext"),Promise.resolve();var t=e.audioContext;return"running"===t.state?Promise.resolve():"suspended"===t.state&&(yield t.resume(),"running"!==t.state)?new Promise(n=>{var A=setTimeout(()=>{t&&e._waitForReadyStateHandler&&(t.removeEventListener("statechange",e._waitForReadyStateHandler),e._waitForReadyStateHandler=null),console.warn("⚠️ AudioPlayer: AudioContext did not become running within timeout - proceeding anyway"),n()},2e3),o=()=>{if(!t)return clearTimeout(A),e._waitForReadyStateHandler=null,console.warn("⚠️ AudioPlayer: AudioContext became null during state change"),void n();"running"===t.state&&(clearTimeout(A),e._waitForReadyStateHandler&&(t.removeEventListener("statechange",e._waitForReadyStateHandler),e._waitForReadyStateHandler=null),n())};e._waitForReadyStateHandler=o,t.addEventListener("statechange",o),t&&"running"===t.state&&(clearTimeout(A),e._waitForReadyStateHandler&&(t.removeEventListener("statechange",e._waitForReadyStateHandler),e._waitForReadyStateHandler=null),n())}):"closed"===t.state?(console.warn("⚠️ AudioPlayer: AudioContext was closed, recreating..."),e.initializeAudioContext(),e.waitForAudioContextReady()):Promise.resolve()})()}initializeAudioContext(){var e,t,n=(null===(e=this.outputFormat)||void 0===e?void 0:e.sampleRate)||44100;if(48e3!==n&&44100!==n&&(console.log("ℹ️ AudioPlayer: Backend requested ".concat(n,"Hz, but browser may resample")),console.log(" Consider requesting 44100Hz or 48000Hz from backend to avoid resampling and improve quality")),this.audioContext){var A=this.audioContext.sampleRate;if(!(Math.abs(A-n)>100))return;console.warn("⚠️ AudioPlayer: AudioContext sample rate (".concat(A,"Hz) doesn't match format (").concat(n,"Hz), recreating...")),this.stopImmediate(),this._cleanupAudioContext()}if(g&&"closed"!==g.state&&m===n){console.log("♻️ AudioPlayer: Reusing shared AudioContext at ".concat(n,"Hz (iOS-safe)")),this.audioContext=g;var o=()=>{if(this.setupAudioContextStateMonitoring(),this.gainNode)try{this.gainNode.disconnect()}catch(e){console.warn("⚠️ AudioPlayer: Error disconnecting old GainNode:",e)}this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.gainNode.connect(this.audioContext.destination),this._audioContextPrimed||this._primeAudioContext()};"suspended"===this.audioContext.state?this.audioContext.resume().then(()=>o()).catch(e=>{console.warn("⚠️ AudioPlayer: Error resuming shared context:",e),o()}):o()}else{if(console.log("🎵 AudioPlayer: Creating AudioContext at ".concat(n,"Hz (from outputFormat: ").concat((null===(t=this.outputFormat)||void 0===t?void 0:t.sampleRate)||"not set",")")),g&&"closed"!==g.state){console.log("🔄 AudioPlayer: Closing old shared AudioContext (sample rate changed)");try{g.close()}catch(e){console.warn("⚠️ AudioPlayer: Error closing old shared context:",e)}}try{this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n,latencyHint:"playback"}),g=this.audioContext,m=n,console.log("✅ AudioContext created at ".concat(this.audioContext.sampleRate,"Hz (requested: ").concat(n,"Hz)")),Math.abs(this.audioContext.sampleRate-n)>100?(console.error("❌ CRITICAL: Browser sample rate mismatch!"),console.error(" Requested: ".concat(n,"Hz")),console.error(" Got: ".concat(this.audioContext.sampleRate,"Hz")),console.error(" This WILL cause audio distortion/noise!"),console.error(" Solution: Backend should send ".concat(this.audioContext.sampleRate,"Hz audio instead"))):this.audioContext.sampleRate!==n&&(console.warn("⚠️ Browser adjusted sample rate: ".concat(n,"Hz → ").concat(this.audioContext.sampleRate,"Hz")),console.warn(" Browser will automatically resample audio.")),this.setupAudioContextStateMonitoring(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.gainNode.connect(this.audioContext.destination),console.log("✅ AudioPlayer: GainNode created for volume control"),this._primeAudioContext()}catch(e){console.error("❌ Failed to create AudioContext:",e),this.audioContext=new(window.AudioContext||window.webkitAudioContext),g=this.audioContext,m=this.audioContext.sampleRate,console.log("ℹ️ Using browser default: ".concat(this.audioContext.sampleRate,"Hz")),this.setupAudioContextStateMonitoring(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.gainNode.connect(this.audioContext.destination),console.log("✅ AudioPlayer: GainNode created for volume control (fallback)"),this._primeAudioContext()}}}_primeAudioContext(){var e=this;return h(function*(){try{if(!e.audioContext||e._audioContextPrimed)return;var t=e.audioContext.sampleRate,n=e.audioContext.createBuffer(1,.15*t,t),A=e.audioContext.createBufferSource();A.buffer=n,A.connect(e.audioContext.destination),A.start(),yield new Promise(e=>setTimeout(e,150)),e._audioContextPrimed=!0,console.log("✅ AudioPlayer: Audio hardware primed with silent buffer")}catch(e){console.error("❌ AudioPlayer: Audio priming failed:",e)}})()}_cleanupAudioContext(){if(console.log("[TTP AudioPlayer] 🧹 Cleaning up AudioContext (iOS-safe: keeping shared context alive)"),this.gainNode){try{this.gainNode.disconnect()}catch(e){}this.gainNode=null}this._audioContextStateChangeHandler&&this.audioContext&&(this.audioContext.removeEventListener("statechange",this._audioContextStateChangeHandler),this._audioContextStateChangeHandler=null),this._waitForReadyStateHandler&&this.audioContext&&(this.audioContext.removeEventListener("statechange",this._waitForReadyStateHandler),this._waitForReadyStateHandler=null),this.audioContext&&"running"===this.audioContext.state&&this.audioContext.suspend().catch(e=>{console.warn("⚠️ AudioPlayer: Error suspending AudioContext during cleanup:",e)}),this.audioContext=null,this._audioContextPrimed=!1}static closeSharedContext(){g&&"closed"!==g.state&&(console.log("🗑️ AudioPlayer: Closing shared AudioContext"),g.close()),g=null,m=null}setupAudioContextStateMonitoring(){this.audioContext&&(this._audioContextStateChangeHandler&&this.audioContext.removeEventListener("statechange",this._audioContextStateChangeHandler),this._audioContextStateChangeHandler=()=>{this.audioContext?(console.log("🎵 AudioPlayer: AudioContext state changed to: ".concat(this.audioContext.state)),"suspended"===this.audioContext.state&&this.isPlaying?console.warn("⚠️ AudioPlayer: AudioContext suspended during playback"):"running"===this.audioContext.state&&!this.isPlaying&&(this.audioQueue.length>0||this.pcmChunkQueue.length>0||this.preparedBuffer.length>0)&&(console.log("✅ AudioPlayer: AudioContext resumed - resuming queue processing"),this.audioQueue.length>0&&!this.isProcessingQueue&&setTimeout(()=>this.processQueue(),50),this.pcmChunkQueue.length>0&&!this.isProcessingPcmQueue&&setTimeout(()=>this.processPcmQueue(),50),this.preparedBuffer.length>0&&!this.isSchedulingFrames&&setTimeout(()=>this.scheduleFrames(),50))):console.warn("⚠️ AudioPlayer: State change handler fired but AudioContext is null")},this.audioContext.addEventListener("statechange",this._audioContextStateChangeHandler))}processQueue(){var e=this;return h(function*(){if(e._isStopped)console.log("🛑 AudioPlayer: Not processing queue - playback was stopped (barge-in)");else if(!e.isProcessingQueue&&0!==e.audioQueue.length){e.isProcessingQueue=!0;var t=e.audioQueue.shift();if(t)try{var n=!e.isPlaying&&null===e.currentSource;e.audioContext||e.initializeAudioContext(),yield e.waitForAudioContextReady();var A=e.audioContext,o=yield t.arrayBuffer(),i=yield A.decodeAudioData(o),r=n&&!e.isPlaying&&null===e.currentSource,a=A.createBufferSource();a.buffer=i,a.connect(e.gainNode||A.destination),e.currentSource=a,e.isPlaying=!0,r&&e.emit("playbackStarted"),a.onended=()=>{e.currentSource=null,e.isProcessingQueue=!1,e.audioQueue.length>0?setTimeout(()=>e.processQueue(),50):setTimeout(()=>{0!==e.audioQueue.length||e.currentSource||(e.isPlaying=!1,e.emit("playbackStopped"))},100)},a.start()}catch(t){console.error("❌ AudioPlayer v2: Error processing queue:",t),e.currentSource=null,e.emit("playbackError",t),e.audioQueue.length>0?(e.isProcessingQueue=!1,setTimeout(()=>e.processQueue(),100)):(e.isPlaying=!1,e.isProcessingQueue=!1,e.emit("playbackStopped"))}else e.isProcessingQueue=!1}})()}stop(){this.stopImmediate()}reset(){this.stop(),this.audioQueue=[],this.pcmChunkQueue=[]}stopImmediate(){var e=this.isPlaying||null!==this.currentSource||this.scheduledSources.size>0;if(console.log("🛑 AudioPlayer.stopImmediate() called"),console.log(" isPlaying:",this.isPlaying),console.log(" currentSource:",null!==this.currentSource),console.log(" scheduledSources.size:",this.scheduledSources.size),console.log(" scheduledBuffers:",this.scheduledBuffers),this._isStopped=!0,this.isSchedulingFrames=!1,this.currentSource){try{console.log(" Stopping currentSource..."),this.currentSource.stop()}catch(e){console.log(" currentSource already stopped or error:",e.message)}this.currentSource=null}if(this.scheduledSources.size>0){console.log(" Stopping ".concat(this.scheduledSources.size," scheduled sources..."));var t=0,n=Array.from(this.scheduledSources),A=n.length;for(var o of(this.scheduledSources.clear(),this.scheduledBuffers=0,n))try{o.stop(),t++}catch(e){console.log(" Source already stopped or not started:",e.message)}console.log(" Stopped ".concat(t," sources (cleared ").concat(A," from scheduledSources)"))}this.isPlaying=!1,this.isProcessingQueue=!1,this.audioQueue=[],this.pcmChunkQueue=[],this.preparedBuffer=[],this.isProcessingPcmQueue=!1,this.isSchedulingFrames=!1,this._emptySentenceTimeout&&(clearTimeout(this._emptySentenceTimeout),this._emptySentenceTimeout=null),this.nextStartTime=0,this.clearTranscriptState(),e&&(console.log("🛑 AudioPlayer: Emitting playbackStopped event (stopImmediate called)"),this.emit("playbackStopped"))}markNewSentence(e,t){var n=this._isStopped,A=this.isPlaying||this.scheduledSources.size>0;this._isStopped?(console.log("🛑 AudioPlayer: Clearing stopped flag - new audio starting after barge-in"),this._isStopped=!1,this.nextStartTime=0,this.scheduledBuffers<0&&console.log("🔄 AudioPlayer: scheduledBuffers was negative (".concat(this.scheduledBuffers,"), resetting to 0")),this.scheduledBuffers=0,this.preparedBuffer.length>0&&console.log("🔄 AudioPlayer: Clearing ".concat(this.preparedBuffer.length," prepared frames from previous sentence (after barge-in)")),this.preparedBuffer=[],this.pcmChunkQueue.length>0&&console.log("🔄 AudioPlayer: Clearing ".concat(this.pcmChunkQueue.length," raw PCM chunks from previous sentence (after barge-in)")),this.pcmChunkQueue=[],this.isProcessingPcmQueue=!1,console.log("🔄 AudioPlayer: Reset scheduling state for new sentence (after barge-in)")):A&&console.log("📝 AudioPlayer: New sentence queued while audio playing - will start after current sentence finishes"),this.pendingSentenceText=e,this.pendingSynced=t||null,console.log('📝 AudioPlayer: New sentence marked: "'.concat(e.substring(0,40),'..." (wasStopped: ').concat(n,", isPlaying: ").concat(A,", synced: ").concat(t?t.length:0,")")),this._emptySentenceTimeout&&clearTimeout(this._emptySentenceTimeout);var o=e;this._emptySentenceTimeout=setTimeout(()=>{this.pendingSentenceText!==o||0!==this.scheduledBuffers||0!==this.preparedBuffer.length||0!==this.pcmChunkQueue.length||this._isStopped||(console.warn('⚠️ AudioPlayer: Empty sentence detected after 5s timeout - no chunks received for: "'.concat(o.substring(0,40),'..."')),this.pendingSentenceText===o&&(this.pendingSentenceText=null),this.isPlaying||0!==this.scheduledSources.size||(console.log("🛑 AudioPlayer: Emitting playbackStopped for empty sentence timeout"),this.emit("playbackStopped"))),this._emptySentenceTimeout=null},5e3)}startTranscriptChecker(){if(!this.isCheckingTranscripts){this.isCheckingTranscripts=!0,console.log("📝 AudioPlayer: Transcript checker started");var e=()=>{if(this.isCheckingTranscripts&&this.audioContext){var t=this.audioContext.currentTime;for(var n of this.sentenceTimings)if(!n.displayed&&t>=n.startTime){n.displayed=!0;var A={text:n.text};n.synced&&(A.synced=n.synced),console.log("📝 AudioPlayer: Display transcript at ".concat(t.toFixed(3),'s: "').concat(n.text.substring(0,40),'..." (synced: ').concat(n.synced?n.synced.length:0,")")),this.emit("transcriptDisplay",A)}this.isPlaying||this.scheduledBuffers>0?requestAnimationFrame(e):(this.isCheckingTranscripts=!1,console.log("📝 AudioPlayer: Transcript checker stopped"))}};requestAnimationFrame(e)}}clearTranscriptState(){this.pendingSentenceText=null,this.pendingSynced=null,this.sentenceTimings=[],this.isCheckingTranscripts=!1,console.log("📝 AudioPlayer: Transcript state cleared")}resumeAudioContext(){var e=this;return h(function*(){if(e.audioContext&&"closed"!==e.audioContext.state){if("suspended"===e.audioContext.state)try{yield e.audioContext.resume(),console.log("✅ AudioPlayer v2: AudioContext resumed after mic permission")}catch(e){console.warn("⚠️ AudioPlayer v2: Failed to resume AudioContext:",e)}}else yield e.initializeAudioContext()})()}setVolume(e){this.gainNode?(this.gainNode.gain.value=Math.max(0,Math.min(1,e)),console.log("🔊 AudioPlayer: Volume set to ".concat(this.gainNode.gain.value))):console.warn("⚠️ AudioPlayer: Cannot set volume - gainNode not initialized")}setMuted(e){this.setVolume(e?0:1)}getStatus(){return{isPlaying:this.isPlaying,isProcessingQueue:this.isProcessingQueue,queueLength:this.audioQueue.length,audioContextState:this.audioContext?this.audioContext.state:"closed",outputFormat:this.outputFormat,scheduledBuffers:this.scheduledBuffers,preparedBufferLength:this.preparedBuffer.length,scheduledSourcesCount:this.scheduledSources.size}}destroy(){this.stop(),this._cleanupAudioContext(),this.removeAllListeners()}};class v{constructor(){this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(e=>e!==t))}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),A=1;A<t;A++)n[A-1]=arguments[A];this.events[e]&&this.events[e].forEach(t=>{try{t(...n)}catch(t){console.error("Error in event listener for ".concat(e,":"),t)}})}removeAllListeners(e){e?delete this.events[e]:this.events={}}}function B(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function w(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){B(i,A,o,r,a,"next",e)}function a(e){B(i,A,o,r,a,"throw",e)}r(void 0)})}}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Q(e){var t,n,A,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null!==(t=null===(n=navigator.mediaDevices)||void 0===n||null===(A=n.getSupportedConstraints)||void 0===A?void 0:A.call(n))&&void 0!==t?t:{},r={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:i.channelCount?{ideal:1}:1};return i.sampleRate&&e&&(r.sampleRate={ideal:e}),C()&&i.voiceIsolation&&(r.voiceIsolation=!0),y(y({},r),o)}var F=null,U=null,S=!1,k=null;class E extends v{constructor(e){super(),this.config=e,this.audioContext=null,this.audioWorkletNode=null,this.mediaStream=null,this.isRecording=!1,this._starting=!1}getAudioProcessorPath(){if(this.config.audioProcessorPath)return this.config.audioProcessorPath;var e=document.getElementsByTagName("script");for(var t of e){var n=t.src;if(n&&(n.includes("agent-widget.js")||n.includes("ttp-agent-sdk")))try{new URL(n);var A=n.substring(0,n.lastIndexOf("/"));return"".concat(A,"/audio-processor.js")}catch(e){var o=n.substring(0,n.lastIndexOf("/"));return"".concat(o,"/audio-processor.js")}}return"https://cdn.talktopc.com/audio-processor.js"}checkPermissionState(){return w(function*(){try{if(navigator.permissions&&navigator.permissions.query)return(yield navigator.permissions.query({name:"microphone"})).state}catch(e){console.log("⚠️ AudioRecorder: Permissions API not available or not supported for microphone")}return null})()}requestPermission(){var e=this;return w(function*(){try{if("granted"===(yield e.checkPermissionState()))return console.log("✅ AudioRecorder: Microphone permission already granted"),!0;console.log("🎤 AudioRecorder: Requesting microphone permission...");var t=Q(e.config.sampleRate||e.config.outputSampleRate||44100,e.config.audioConstraints);return(yield navigator.mediaDevices.getUserMedia({audio:t})).getTracks().forEach(e=>e.stop()),console.log("✅ AudioRecorder: Microphone permission granted"),!0}catch(e){return console.error("❌ AudioRecorder: Failed to get microphone permission:",e),!1}})()}_getUserMediaStream(e){var t=this;return w(function*(){var n=Q(e,t.config.audioConstraints);return navigator.mediaDevices.getUserMedia({audio:n})})()}start(){var e=arguments,t=this;return w(function*(){var n=e.length>0&&void 0!==e[0]?e[0]:{};if(t._starting)console.warn("⚠️ AudioRecorder: start() already in progress, ignoring duplicate call");else{t._starting=!0;try{var A=t.config.sampleRate||t.config.outputSampleRate||44100,o=n.existingMediaStream;if(o&&o.getTracks){var i,r,a,s=null!==(i=null===(r=o.getAudioTracks)||void 0===r?void 0:r.call(o))&&void 0!==i?i:null===(a=o.getTracks)||void 0===a?void 0:a.call(o);s&&s.length>0&&s.some(e=>"live"===e.readyState)?(console.log("🎤 AudioRecorder: Using existing MediaStream (iOS single-stream fix)"),t.mediaStream=o):(console.warn("⚠️ AudioRecorder: Existing stream has no live tracks, falling back to getUserMedia"),t.mediaStream=yield t._getUserMediaStream(A))}else{console.log("🎤 AudioRecorder: Requesting microphone access...");var c=yield t.checkPermissionState();c&&console.log("📋 AudioRecorder: Current permission state: ".concat(c)),t.mediaStream=yield t._getUserMediaStream(A)}if(t.config.checkConnection&&"function"==typeof t.config.checkConnection&&!t.config.checkConnection()){t.mediaStream.getTracks().forEach(e=>e.stop()),t.mediaStream=null;var l=new Error("Connection lost - server may have rejected the call");throw l.name="ServerRejected",l.isServerRejection=!0,l}if(F&&"closed"!==F.state&&U===A)console.log("♻️ AudioRecorder: Reusing shared AudioContext (iOS-safe)"),t.audioContext=F,"suspended"===t.audioContext.state&&(yield t.audioContext.resume());else{if(F&&"closed"!==F.state){console.log("🔄 AudioRecorder: Sample rate changed, closing old shared AudioContext");try{yield F.close()}catch(e){console.warn("⚠️ AudioRecorder: Error closing old shared context:",e)}S=!1,k=null}t.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:A}),F=t.audioContext,U=A,S=!1,console.log("🎵 AudioRecorder: Created new shared AudioContext at",A,"Hz")}if("suspended"===t.audioContext.state&&(yield t.audioContext.resume()),t.config.checkConnection&&"function"==typeof t.config.checkConnection&&!t.config.checkConnection()){t.mediaStream.getTracks().forEach(e=>e.stop()),t.mediaStream=null,t.audioContext=null;var d=new Error("Connection lost - server may have rejected the call");throw d.name="ServerRejected",d.isServerRejection=!0,d}var p=t.getAudioProcessorPath();if(S&&k===p?console.log("♻️ AudioRecorder: AudioWorklet module already loaded, skipping"):(yield t.audioContext.audioWorklet.addModule(p),S=!0,k=p,console.log("✅ AudioRecorder: AudioWorklet module loaded")),t.config.checkConnection&&"function"==typeof t.config.checkConnection&&!t.config.checkConnection()){t.mediaStream.getTracks().forEach(e=>e.stop()),t.mediaStream=null,t.audioContext=null;var u=new Error("Connection lost - server may have rejected the call");throw u.name="ServerRejected",u.isServerRejection=!0,u}t.audioWorkletNode=new AudioWorkletNode(t.audioContext,"audio-processor",{processorOptions:{sampleRate:A,outputSampleRate:t.config.outputSampleRate}});var h=t.audioContext.createMediaStreamSource(t.mediaStream);h.connect(t.audioWorkletNode),t.mediaStreamSource=h,t.audioWorkletNode.port.onmessage=e=>{var{type:n,data:A}=e.data;"pcm_audio_data"===n&&t.emit("audioData",A)},t.audioWorkletNode.port.postMessage({type:"setForceContinuous",data:{enabled:!0,bypassVad:C()}}),console.log("✅ AudioRecorder: Microphone access granted"),t.isRecording=!0,t.emit("recordingStarted")}catch(l){if(l.isServerRejection||"ServerRejected"===l.name)throw l;var g=l.message;if("NotAllowedError"===l.name||"PermissionDeniedError"===l.name){var m=yield t.checkPermissionState();"denied"===m?(g='Microphone access was blocked. To enable it: 1) Click the lock icon (🔒) in your browser\'s address bar, 2) Find "Microphone" and change it to "Allow", 3) Refresh this page and try again.',console.error("❌ AudioRecorder: Permission explicitly denied. User must change in browser settings.")):"prompt"===m?(g='Microphone permission was denied. Click the "Voice Call" button again to see the permission prompt.',console.error('❌ AudioRecorder: Permission denied but state is "prompt" - user can try again.')):(g="Microphone permission was denied. Click the button again to retry, or enable microphone access in your browser settings (lock icon 🔒 in address bar).",console.error("❌ AudioRecorder: Permission denied. User can try again or change in browser settings."))}else"NotFoundError"===l.name||"DevicesNotFoundError"===l.name?(g="No microphone found. Please connect a microphone and try again.",console.error("❌ AudioRecorder: No microphone device found.")):"NotReadableError"===l.name||"TrackStartError"===l.name?(g="Microphone is already in use by another application. Please close other apps using the microphone and try again.",console.error("❌ AudioRecorder: Microphone is busy or not readable.")):"SecurityError"!==l.name&&"PermissionDeniedError"!==l.name||(g="Microphone access blocked. On mobile devices, please tap the recording button directly (not from an iframe or popup).",console.error("❌ AudioRecorder: User agent blocked microphone access. This often happens on mobile when not called from direct user interaction."));var f=new Error(g);throw f.name=l.name,f.originalError=l,t.emit("error",f),f}finally{t._starting=!1}}})()}stop(){var e=this;return w(function*(){if(e.isRecording)try{if(e.mediaStreamSource)try{console.log("🛑 AudioRecorder: Disconnecting media stream source to stop audio flow..."),e.mediaStreamSource.disconnect(),e.mediaStreamSource=null,console.log("✅ AudioRecorder: Media stream source disconnected")}catch(e){console.warn("⚠️ AudioRecorder: Error disconnecting source:",e)}if(e.audioWorkletNode){console.log("🛑 AudioRecorder: Sending stop message to AudioWorklet to stop VAD..."),e.audioWorkletNode.port.postMessage({type:"stop"}),yield new Promise(e=>setTimeout(e,150)),e.audioWorkletNode.port.postMessage({type:"flush"}),yield new Promise(e=>setTimeout(e,50));try{e.audioWorkletNode.disconnect(),console.log("✅ AudioRecorder: AudioWorkletNode disconnected")}catch(e){console.log("⚠️ AudioRecorder: AudioWorkletNode already disconnected")}}e.mediaStream&&(console.log("🛑 AudioRecorder: Stopping media stream tracks..."),e.mediaStream.getTracks().forEach(e=>{e.stop(),console.log("✅ AudioRecorder: Stopped track:",e.kind)}),e.mediaStream=null),e.audioContext&&"running"===e.audioContext.state&&(console.log("🛑 AudioRecorder: Suspending AudioContext (kept alive for reuse)..."),yield e.audioContext.suspend(),console.log("✅ AudioRecorder: AudioContext suspended")),e.audioContext=null,e.audioWorkletNode=null,e.isRecording=!1,e.emit("recordingStopped"),console.log("✅ AudioRecorder: Recording stopped, VAD should be stopped")}catch(t){throw e.emit("error",t),t}})()}resumeAudioContext(){var e=this;return w(function*(){if(e.isRecording&&e.audioContext)try{if("suspended"===e.audioContext.state&&(console.log("🔄 AudioRecorder: Resuming suspended AudioContext..."),yield e.audioContext.resume(),console.log("✅ AudioRecorder: AudioContext resumed")),e.mediaStream){var t=e.mediaStream.getAudioTracks();0===t.filter(e=>"live"===e.readyState).length&&t.length>0&&(console.warn("⚠️ AudioRecorder: All audio tracks are inactive. Recording may have stopped."),e.emit("tracksInactive"))}}catch(t){console.error("❌ AudioRecorder: Failed to resume AudioContext:",t),e.emit("error",t)}})()}getStatus(){return{isRecording:this.isRecording,audioContextState:this.audioContext?this.audioContext.state:"closed"}}destroy(){this.stop()}static closeSharedContext(){F&&"closed"!==F.state&&(console.log("🗑️ AudioRecorder: Closing shared AudioContext"),F.close()),F=null,U=null,S=!1,k=null}}class I{static extractPcmFromWav(e){var t=e instanceof Uint8Array?e:new Uint8Array(e);if(t.length<44)throw new Error("WAV data too short (< 44 bytes)");if("RIFF"!==String.fromCharCode(t[0],t[1],t[2],t[3]))throw new Error("Not a valid WAV file - missing RIFF header");if("WAVE"!==String.fromCharCode(t[8],t[9],t[10],t[11]))throw new Error("Not a valid WAV file - missing WAVE format");for(var n=t[22]|t[23]<<8,A=t[24]|t[25]<<8|t[26]<<16|t[27]<<24,o=t[34]|t[35]<<8,i=-1,r=12;r<t.length-8;r+=4){if("data"===String.fromCharCode(t[r],t[r+1],t[r+2],t[r+3])){i=r;break}r+=4+(t[r+4]|t[r+5]<<8|t[r+6]<<16|t[r+7]<<24)}if(-1===i)throw new Error("No data chunk found in WAV");var a=t[i+4]|t[i+5]<<8|t[i+6]<<16|t[i+7]<<24,s=i+8,c=Math.min(a,t.length-s);return{pcmData:t.slice(s,s+c).buffer,format:{sampleRate:A,channels:n,bitDepth:o}}}static isWavFile(e){return e.length>=44&&82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]}static createWavHeader(e,t,n,A){var o=new ArrayBuffer(44),i=new DataView(o);return i.setUint32(0,1380533830,!1),i.setUint32(4,36+e,!0),i.setUint32(8,1463899717,!1),i.setUint32(12,1718449184,!1),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,n,!0),i.setUint32(24,t,!0),i.setUint32(28,t*n*A/8,!0),i.setUint16(32,n*A/8,!0),i.setUint16(34,A,!0),i.setUint32(36,1684108385,!1),i.setUint32(40,e,!0),o}static wrapPcmInWav(e,t){var n=I.createWavHeader(e.byteLength,t.sampleRate,t.channels||1,t.bitDepth||16),A=new Uint8Array(n.byteLength+e.byteLength);return A.set(new Uint8Array(n),0),A.set(new Uint8Array(e),n.byteLength),A.buffer}}const T=I,H=class{constructor(){this.codecs={pcm:new l,pcmu:new d,pcma:new p}}decodeToPcm(e,t){var n=null==t?void 0:t.toLowerCase();if(!n||"pcm"===n)return e instanceof ArrayBuffer?e:e instanceof Uint8Array?e.buffer:e;var A=this.codecs[n];if(!A)throw new Error("Unsupported encoding: ".concat(t));var o=e instanceof Uint8Array?e:new Uint8Array(e);return A.decode(o)}encodeFromPcm(e,t){var n=null==t?void 0:t.toLowerCase();if(!n||"pcm"===n)return e;var A=this.codecs[n];if(!A)throw new Error("Unsupported target encoding: ".concat(t));var o=A.encode(e);return o instanceof Uint8Array?o.buffer:o}getCodec(e){var t=null==e?void 0:e.toLowerCase();return this.codecs[t]||null}};class _{static convert(e,t,n){if(t===n)return e;if(8===t)throw new Error("Source bit depth cannot be 8-bit (only 16-bit or 24-bit supported)");var A=t/8,o=n/8,i=e.byteLength/A;if(new ArrayBuffer(i*o),16===t&&16===n)return e;if(24===t&&16===n)return _.convert24To16(e);if(16===t&&24===n)return _.convert16To24(e);if(16===t&&8===n)return _.convert16To8(e);if(24===t&&8===n)return _.convert24To8(e);throw new Error("Unsupported bit depth conversion: ".concat(t,"-bit → ").concat(n,"-bit"))}static convert24To16(e){for(var t=new Uint8Array(e),n=Math.floor(t.length/3),A=new Int16Array(n),o=0;o<n;o++){var i=t[3*o],r=t[3*o+1],a=t[3*o+2],s=i|r<<8|(255&a)<<16;128&a&&(s|=4278190080),A[o]=Math.max(-32768,Math.min(32767,Math.round(s/256)))}return A.buffer}static convert16To24(e){for(var t=new Int16Array(e),n=new Uint8Array(3*t.length),A=0;A<t.length;A++){var o=256*t[A];n[3*A]=255&o,n[3*A+1]=o>>8&255,n[3*A+2]=o>>16&255}return n.buffer}static convert16To8(e){for(var t=new Int16Array(e),n=new Uint8Array(t.length),A=0;A<t.length;A++){var o=t[A];n[A]=Math.max(0,Math.min(255,Math.round(o/256+128)))}return n.buffer}static convert24To8(e){var t=_.convert24To16(e);return _.convert16To8(t)}}const D=_;function M(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}const P=class{static resample(e,t,n){return(A=function*(){if(t===n)return e;for(var A=new Int16Array(e),o=new Float32Array(A.length),i=1/32768,r=0;r<A.length;r++)o[r]=A[r]*i;var a=Math.ceil(o.length*n/t),s=new OfflineAudioContext(1,a,n),c=s.createBuffer(1,o.length,t);c.getChannelData(0).set(o);var l=s.createBufferSource();l.buffer=c,l.connect(s.destination),l.start();for(var d=(yield s.startRendering()).getChannelData(0),p=new Int16Array(d.length),u=0;u<d.length;u++){var h=Math.max(-1,Math.min(1,d[u]));p[u]=Math.round(32767*h)}return p.buffer},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=A.apply(e,t);function r(e){M(i,n,o,r,a,"next",e)}function a(e){M(i,n,o,r,a,"throw",e)}r(void 0)})})();var A}};class L{static convert(e,t,n){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16;if(t===n)return e;if(1===t&&1===n)return e;if(1===t&&2===n)return L.monoToStereo(e,A);if(2===t&&1===n)return L.stereoToMono(e,A);throw new Error("Unsupported channel conversion: ".concat(t," → ").concat(n))}static monoToStereo(e,t){for(var n=t/8,A=e.byteLength/n,o=new ArrayBuffer(A*n*2),i=new Uint8Array(e),r=new Uint8Array(o),a=0;a<A;a++)for(var s=a*n,c=a*n*2,l=0;l<n;l++)r[c+l]=i[s+l],r[c+n+l]=i[s+l];return o}static stereoToMono(e,t){var n=t/8,A=e.byteLength/(2*n),o=new ArrayBuffer(A*n),i=new Uint8Array(e),r=new Uint8Array(o);if(16===t)for(var a=0;a<A;a++){var s=a*n*2,c=s+n,l=(i[s]|i[s+1]<<8)<<16>>16,d=(i[c]|i[c+1]<<8)<<16>>16,p=Math.round((l+d)/2),u=a*n;r[u]=255&p,r[u+1]=p>>8&255}else for(var h=0;h<A;h++)for(var g=h*n*2,m=h*n,f=0;f<n;f++)r[m+f]=i[g+f];return o}}const R=L;function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function V(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}const j=class{constructor(e,t){this.requestedFormat=e,this.actualFormat=t,this.encodingConverter=new H,this.conversionSteps=[],this._analyzeConversions()}_analyzeConversions(){this.conversionSteps=[],this.actualFormat.container!==this.requestedFormat.container&&("wav"===this.actualFormat.container?this.conversionSteps.push("extract_wav"):"wav"===this.requestedFormat.container&&this.conversionSteps.push("wrap_wav")),this.actualFormat.encoding!==this.requestedFormat.encoding&&("pcm"!==this.actualFormat.encoding&&this.conversionSteps.push("decode_encoding"),"pcm"!==this.requestedFormat.encoding&&this.conversionSteps.push("encode_encoding")),this.actualFormat.sampleRate!==this.requestedFormat.sampleRate&&this.conversionSteps.push("resample"),this.actualFormat.bitDepth!==this.requestedFormat.bitDepth&&this.conversionSteps.push("convert_bitdepth"),this.actualFormat.channels!==this.requestedFormat.channels&&this.conversionSteps.push("convert_channels")}needsConversion(){return this.conversionSteps.length>0}getConversionSteps(){var e=[];return this.conversionSteps.includes("extract_wav")&&e.push("Extract PCM from WAV (".concat(this.actualFormat.container," → raw)")),this.conversionSteps.includes("decode_encoding")&&e.push("Decode ".concat(this.actualFormat.encoding.toUpperCase()," → PCM")),this.conversionSteps.includes("resample")&&e.push("Resample ".concat(this.actualFormat.sampleRate,"Hz → ").concat(this.requestedFormat.sampleRate,"Hz")),this.conversionSteps.includes("convert_bitdepth")&&e.push("Convert bit depth ".concat(this.actualFormat.bitDepth,"-bit → ").concat(this.requestedFormat.bitDepth,"-bit")),this.conversionSteps.includes("convert_channels")&&e.push("Convert channels ".concat(this.actualFormat.channels," → ").concat(this.requestedFormat.channels)),this.conversionSteps.includes("encode_encoding")&&e.push("Encode PCM → ".concat(this.requestedFormat.encoding.toUpperCase())),this.conversionSteps.includes("wrap_wav")&&e.push("Wrap in WAV container (raw → ".concat(this.requestedFormat.container,")")),e}convert(e){var t,n=this;return(t=function*(){if(!n.needsConversion())return e instanceof ArrayBuffer?e:e.buffer;var t=e instanceof ArrayBuffer?e:e.buffer,A=O({},n.actualFormat);if(n.conversionSteps.includes("extract_wav")){var o=T.extractPcmFromWav(t);t=o.pcmData,A=O(O({},A),{},{container:"raw",sampleRate:o.format.sampleRate,channels:o.format.channels,bitDepth:o.format.bitDepth}),console.log("🔄 AudioFormatConverter: Extracted PCM from WAV",o.format)}if(n.conversionSteps.includes("decode_encoding")&&(t=n.encodingConverter.decodeToPcm(t,A.encoding),A.encoding="pcm",A.bitDepth=16,console.log("🔄 AudioFormatConverter: Decoded ".concat(n.actualFormat.encoding.toUpperCase()," → PCM"))),24===A.bitDepth&&A.bitDepth!==n.requestedFormat.bitDepth&&(n.conversionSteps.includes("resample")||n.conversionSteps.includes("convert_channels")||24!==n.requestedFormat.bitDepth)&&(t=D.convert(t,24,16),A.bitDepth=16,console.log("🔄 AudioFormatConverter: Normalized 24-bit → 16-bit PCM")),n.conversionSteps.includes("resample")&&(t=yield P.resample(t,A.sampleRate,n.requestedFormat.sampleRate),A.sampleRate=n.requestedFormat.sampleRate,console.log("🔄 AudioFormatConverter: Resampled ".concat(n.actualFormat.sampleRate,"Hz → ").concat(n.requestedFormat.sampleRate,"Hz"))),n.conversionSteps.includes("convert_channels")&&(t=R.convert(t,A.channels,n.requestedFormat.channels,A.bitDepth),A.channels=n.requestedFormat.channels,console.log("🔄 AudioFormatConverter: Converted channels ".concat(n.actualFormat.channels," → ").concat(n.requestedFormat.channels))),n.conversionSteps.includes("convert_bitdepth")&&(t=D.convert(t,A.bitDepth,n.requestedFormat.bitDepth),A.bitDepth=n.requestedFormat.bitDepth,console.log("🔄 AudioFormatConverter: Converted bit depth ".concat(n.actualFormat.bitDepth,"-bit → ").concat(n.requestedFormat.bitDepth,"-bit"))),n.conversionSteps.includes("encode_encoding")){var i=n.encodingConverter.encodeFromPcm(t,n.requestedFormat.encoding);t=i instanceof ArrayBuffer?i:i.buffer,A.encoding=n.requestedFormat.encoding,console.log("🔄 AudioFormatConverter: Encoded PCM → ".concat(n.requestedFormat.encoding.toUpperCase()))}return n.conversionSteps.includes("wrap_wav")&&(t=T.wrapPcmInWav(t,A),A.container="wav",console.log("🔄 AudioFormatConverter: Wrapped in WAV container")),console.log("✅ AudioFormatConverter: Conversion complete"),t},function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(e){N(i,A,o,r,a,"next",e)}function a(e){N(i,A,o,r,a,"throw",e)}r(void 0)})})()}};function G(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}const z=class{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>null;this.handlers=new Map,this.sendMessage=e,this.getConversationId=t}registerHandler(e,t){if("function"!=typeof t)throw new Error("Handler for tool '".concat(e,"' must be a function"));this.handlers.set(e,t),console.log("🔧 ClientTools: Registered handler for '".concat(e,"'"))}unregisterHandler(e){this.handlers.delete(e),console.log("🔧 ClientTools: Unregistered handler for '".concat(e,"'"))}hasHandler(e){return this.handlers.has(e)}getRegisteredTools(){return Array.from(this.handlers.keys())}handleToolCall(e){var t,n=this;return(t=function*(){var{toolCallId:t,toolName:A,parameters:o}=e,i=Date.now(),r=(new Date).toISOString();console.log("🔧 ClientTools: [".concat(r,"] Received tool call '").concat(A,"' (id: ").concat(t,")")),console.log(" 📋 Full message received:",JSON.stringify(e,null,2)),console.log(" ⏱️ Start time: ".concat(i,"ms (").concat(new Date(i).toISOString(),")"));var a=n.handlers.get(A);if(!a){var s=Array.from(n.handlers.keys());return console.error("🔧 ClientTools: No handler registered for '".concat(A,"'")),console.error(" 📋 Currently registered tools:",s),console.error(" 📋 Total registered: ".concat(s.length)),void n.sendError(t,A,"No handler registered for tool '".concat(A,"'"),"NO_HANDLER",i)}try{var c=yield a(o),l=Date.now()-i;console.log("🔧 ClientTools: Tool '".concat(A,"' completed in ").concat(l,"ms")),n.sendResult(t,A,c,l)}catch(e){var d,p,u=Date.now()-i;console.error("🔧 ClientTools: Tool '".concat(A,"' failed:"),e);var h="EXECUTION_ERROR";"NotAllowedError"===e.name||null!==(d=e.message)&&void 0!==d&&d.includes("permission")?h="PERMISSION_DENIED":("NotSupportedError"===e.name||null!==(p=e.message)&&void 0!==p&&p.includes("not supported"))&&(h="API_UNAVAILABLE"),n.sendError(t,A,e.message||"Unknown error",h,u)}},function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(e){G(i,A,o,r,a,"next",e)}function a(e){G(i,A,o,r,a,"throw",e)}r(void 0)})})()}sendResult(e,t,n,A){var o=this.getConversationId(),i=(new Date).toISOString(),r={t:"client_tool_result",toolCallId:e,toolName:t,conversationId:o,result:n,executionTimeMs:A};console.log("🔧 ClientTools: [".concat(i,"] Sending result for tool '").concat(t,"'")),console.log(" 📋 toolCallId: ".concat(e)),console.log(" 📋 conversationId: ".concat(o||"null")),console.log(" 📋 toolName: ".concat(t)),console.log(" 📋 result:",n),console.log(" 📋 Full message:",JSON.stringify(r,null,2)),this.sendMessage(r),console.log("✅ ClientTools: Result message sent at ".concat(i))}sendError(e,t,n,A,o){var i="number"==typeof o?Date.now()-o:o,r=(new Date).toISOString(),a=this.getConversationId(),s={t:"client_tool_error",toolCallId:e,toolName:t,conversationId:a,error:n,errorCode:A,executionTimeMs:i};console.log("🔧 ClientTools: [".concat(r,"] Sending error for tool '").concat(t,"'")),console.log(" 📋 toolCallId: ".concat(e)),console.log(" 📋 conversationId: ".concat(a||"null")),console.log(" 📋 toolName: ".concat(t)),console.log(" 📋 error: ".concat(n,", errorCode: ").concat(A)),console.log(" 📋 Full message:",JSON.stringify(s,null,2)),this.sendMessage(s),console.log("✅ ClientTools: Error message sent at ".concat(r))}setSendMessage(e){this.sendMessage=e}};var W=r(354),q=r.n(W);function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach(function(t){J(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function J(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}var $={useCORS:!0,allowTaint:!1,backgroundColor:"#ffffff",scale:1,logging:!1,imageTimeout:15e3};function ee(){return te.apply(this,arguments)}function te(){var e;return e=function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:t=null,format:n="jpeg",quality:A=.85,scale:o=1,maxWidth:i=1280,maxHeight:r=1280,fullPage:a=!1}=e;console.log("📸 SDK Screenshot: Starting capture with options:",e);var s=Date.now();try{var c=document.body;if(t){var l=document.querySelector(t);if(!l)throw new Error("Element not found: ".concat(t));c=l,console.log("📸 SDK Screenshot: Capturing element: ".concat(t))}else console.log("📸 SDK Screenshot: Capturing entire page");var d=Y(Y({},$),{},{scale:o});a&&!t&&(d.windowHeight=document.documentElement.scrollHeight,d.height=document.documentElement.scrollHeight,d.y=0);var p=yield q()(c,d);console.log("📸 SDK Screenshot: Canvas created (".concat(p.width,"x").concat(p.height,")"));var u=p;(i||r)&&(u=function(e,t,n){var{width:A,height:o}=e,i=1;if(t&&A>t&&(i=Math.min(i,t/A)),n&&o>n&&(i=Math.min(i,n/o)),1===i)return e;var r=Math.round(A*i),a=Math.round(o*i),s=document.createElement("canvas");return s.width=r,s.height=a,s.getContext("2d").drawImage(e,0,0,r,a),s}(p,i,r),u!==p&&console.log("📸 SDK Screenshot: Resized to ".concat(u.width,"x").concat(u.height)));var h="jpeg"===n?"image/jpeg":"image/png",g=u.toDataURL(h,"jpeg"===n?A:void 0).split(",")[1],m=Date.now()-s;return console.log("📸 SDK Screenshot: Capture completed in ".concat(m,"ms")),console.log("📸 SDK Screenshot: Size: ".concat(Math.round(g.length/1024),"KB")),{image:g,mimeType:h,width:u.width,height:u.height,captureTimeMs:m,selector:t||"body"}}catch(e){throw console.error("📸 SDK Screenshot: Capture failed:",e),new Error("Screenshot capture failed: ".concat(e.message))}},te=function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){Z(i,A,o,r,a,"next",e)}function a(e){Z(i,A,o,r,a,"throw",e)}r(void 0)})},te.apply(this,arguments)}var ne={types:["password"],names:["cc","card","credit","cvv","cvc","csc","expir","cardnumber","card-number","card_number","cardholder","card-holder","card_holder","password","pwd","passwd","pass","secret","token","auth","api-key","apikey","api_key","access-key","accesskey","access_key","secret-key","secretkey","secret_key","private-key","privatekey","private_key","bearer","jwt","ssn","social-security","social_security","socialsecurity","tax-id","taxid","tax_id","national-id","nationalid","national_id","credential","private","secure"],autocomplete:["cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc","cc-name","cc-type","current-password","new-password"],dataAttributes:["data-secret","data-sensitive","data-private","data-api-key","data-token","data-auth"]};function Ae(e){if(!e)return!1;var t=(e.type||"").toLowerCase(),n=(e.name||"").toLowerCase(),A=(e.id||"").toLowerCase(),o=(e.className||"").toLowerCase(),i=(e.autocomplete||"").toLowerCase(),r=(e.placeholder||"").toLowerCase(),a=(e.getAttribute("aria-label")||"").toLowerCase(),s="".concat(n," ").concat(A," ").concat(o," ").concat(r," ").concat(a);if(ne.types.includes(t))return!0;if(ne.autocomplete.includes(i))return!0;for(var c of ne.names)if(s.includes(c))return!0;for(var l of ne.dataAttributes)if(e.hasAttribute(l))return!0;return"password"===(e.inputMode||"").toLowerCase()}function oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(n),!0).forEach(function(t){re(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function re(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ae(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}var se={buttons:20,links:30,forms:5,fieldsPerForm:15,sections:10,headings:15,maxTextLength:100,maxSummaryLength:150};function ce(e){var t,n;if(!e||!e.tagName)return null;if(null!==(t=e.dataset)&&void 0!==t&&t.testid)return'[data-testid="'.concat(e.dataset.testid,'"]');if(null!==(n=e.dataset)&&void 0!==n&&n.cy)return'[data-cy="'.concat(e.dataset.cy,'"]');var A=e.getAttribute("aria-label");if(A&&A.length<50)return'[aria-label="'.concat(A.replace(/"/g,'\\"'),'"]');if(e.id&&!le(e.id))return"#".concat(CSS.escape(e.id));if(e.name){var o=e.tagName.toLowerCase();return"".concat(o,'[name="').concat(e.name,'"]')}if(["BUTTON","A"].includes(e.tagName)){var i,r=null===(i=e.innerText)||void 0===i?void 0:i.trim();if(r&&r.length<30&&r.length>0){var a=e.tagName.toLowerCase(),s=document.querySelectorAll("".concat(a));if(1===Array.from(s).filter(e=>{var t;return(null===(t=e.innerText)||void 0===t?void 0:t.trim())===r}).length)return"".concat(a,':contains("').concat(r.replace(/"/g,'\\"'),'")')}}return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=[],A=e,o=0;A&&A!==document.body&&o<t;){var i=A.tagName.toLowerCase();if(A.id&&!le(A.id)){n.unshift("#".concat(CSS.escape(A.id)));break}var r=de(A);if(r)n.unshift("".concat(i,".").concat(r));else{var a,s=null===(a=A.parentElement)||void 0===a?void 0:a.children;if(s&&s.length>1){var c=Array.from(s).indexOf(A)+1;n.unshift("".concat(i,":nth-child(").concat(c,")"))}else n.unshift(i)}A=A.parentElement,o++}return n.join(" > ")}(e)}function le(e){return[/^:r[0-9a-z]+:$/,/^react-/i,/^ng-/i,/^vue-/i,/^ember[0-9]+/i,/^_[a-z0-9]{8,}$/i,/^[a-f0-9]{8}-[a-f0-9]{4}/i,/^uid-/i,/^id[0-9]+$/i].some(t=>t.test(e))}function de(e){var t=Array.from(e.classList||[]),n=[/^(flex|grid|block|inline|hidden)$/,/^(m|p|w|h|min|max)-/,/^(text|font|bg|border)-/,/^(col|row)-/,/^(sm|md|lg|xl|2xl):/,/^hover:|focus:|active:/,/^[a-z]{1,3}-[0-9]+$/];return t.filter(e=>!n.some(t=>t.test(e))&&e.length>2&&e.length<30)[0]||null}function pe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=e.getBoundingClientRect();return n.bottom>=-t&&n.top<=window.innerHeight+t&&n.right>=0&&n.left<=window.innerWidth}function ue(e){if(!e)return!1;var t=window.getComputedStyle(e);return"none"!==t.display&&"hidden"!==t.visibility&&"0"!==t.opacity&&e.offsetWidth>0&&e.offsetHeight>0}function he(){return ge.apply(this,arguments)}function ge(){return e=function*(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=ie(ie({},se),t.limits),A=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,t=[],n=document.querySelectorAll('button, [type="submit"], [type="button"], [role="button"], .btn, .button');for(var A of n){if(t.length>=e.buttons)break;if(ue(A)){var o=(A.innerText||A.value||A.getAttribute("aria-label")||"").trim();o&&t.push({selector:ce(A),text:o.substring(0,e.maxTextLength),type:A.type||"button",disabled:A.disabled||!1,inViewport:pe(A,0)})}}return t}(n),o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,t=[],n=document.querySelectorAll("a[href]"),A=window.location.origin;for(var o of n){if(t.length>=e.links)break;if(ue(o)){var i=(o.innerText||o.getAttribute("aria-label")||"").trim();if(i&&!(i.length<2)){var r=o.href;if(r&&!r.startsWith("javascript:")&&"#"!==r){var a=!1;try{a=new URL(r).origin===A}catch(e){}t.push({selector:ce(o),text:i.substring(0,e.maxTextLength),href:r,internal:a,inViewport:pe(o,0)})}}}}return t}(n),{forms:i,sensitiveCount:r}=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,t=[],n=document.querySelectorAll("form"),A=0;for(var o of n){if(t.length>=e.forms)break;if(ue(o)){var i=[],r=o.querySelectorAll("input, textarea, select");for(var a of r){var s,c;if(i.length>=e.fieldsPerForm)break;if("hidden"!==a.type)if(Ae(a))A++;else{var l=null;if(a.id){var d,p=document.querySelector('label[for="'.concat(a.id,'"]'));l=null==p||null===(d=p.innerText)||void 0===d?void 0:d.trim()}!l&&a.getAttribute("aria-label")&&(l=a.getAttribute("aria-label")),!l&&a.placeholder&&(l=a.placeholder),i.push({selector:ce(a),name:a.name||null,type:a.type||"text",label:(null===(s=l)||void 0===s?void 0:s.substring(0,50))||null,placeholder:(null===(c=a.placeholder)||void 0===c?void 0:c.substring(0,50))||null,required:a.required||!1})}}0!==i.length&&t.push({selector:ce(o),id:o.id||null,action:o.action||null,method:(o.method||"get").toUpperCase(),fields:i})}}return{forms:t,sensitiveCount:A}}(n),a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,t=[],n=document.querySelectorAll('section, article, main, [role="main"], [role="region"], .section');for(var A of n){var o,i,r;if(t.length>=e.sections)break;if(ue(A)){var a=A.querySelector("h1, h2, h3"),s=(null==a||null===(o=a.innerText)||void 0===o?void 0:o.trim())||"",c=A.querySelector("p"),l=s||(null==c||null===(i=c.innerText)||void 0===i?void 0:i.trim().substring(0,e.maxSummaryLength))||(null===(r=A.innerText)||void 0===r?void 0:r.trim().substring(0,e.maxSummaryLength))||"";t.push({selector:ce(A),id:A.id||null,tagName:A.tagName.toLowerCase(),summary:l.substring(0,e.maxSummaryLength),inViewport:pe(A,0)})}}return t}(n),s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,t=[],n=document.querySelectorAll("h1, h2, h3");for(var A of n){var o;if(t.length>=e.headings)break;if(ue(A)){var i=null===(o=A.innerText)||void 0===o?void 0:o.trim();i&&t.push({selector:ce(A),level:A.tagName.toLowerCase(),text:i.substring(0,e.maxTextLength),inViewport:pe(A,0)})}}return t}(n),c=A.length+o.length+i.reduce((e,t)=>e+t.fields.length,0)+a.length+s.length,l=A.filter(e=>e.inViewport).length+o.filter(e=>e.inViewport).length+a.filter(e=>e.inViewport).length+s.filter(e=>e.inViewport).length,d=document.documentElement.lang||(null===(e=document.querySelector("html"))||void 0===e?void 0:e.getAttribute("lang"))||null,p=navigator.language||navigator.languages&&navigator.languages[0]||null,u=d||p||null;return{url:window.location.href,title:document.title,timestamp:Date.now(),language:u,viewport:{width:window.innerWidth,height:window.innerHeight,scrollX:window.scrollX,scrollY:window.scrollY,pageHeight:document.documentElement.scrollHeight},buttons:A,links:o,forms:i,sections:a,headings:s,metadata:{totalElements:c,visibleInViewport:l,formsCount:i.length,sensitiveFieldsFiltered:r}}},ge=function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){ae(i,A,o,r,a,"next",e)}function a(e){ae(i,A,o,r,a,"throw",e)}r(void 0)})},ge.apply(this,arguments);var e}function me(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function fe(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){me(i,A,o,r,a,"next",e)}function a(e){me(i,A,o,r,a,"throw",e)}r(void 0)})}}function ve(){return ve=fe(function*(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:n,color:A="#6366f1",duration:o=3e3}=t;if(!n)return{success:!1,error:"Selector is required"};var i=document.querySelector(n);if(!i)return{success:!1,error:"Element not found: ".concat(n)};i.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),yield Ce(400);var r=i.getBoundingClientRect();Be();var a=document.createElement("div");return a.className="ttp-highlight-overlay",a.style.cssText="\n position: fixed;\n top: ".concat(r.top-4,"px;\n left: ").concat(r.left-4,"px;\n width: ").concat(r.width+8,"px;\n height: ").concat(r.height+8,"px;\n --ttp-highlight-color: ").concat(A,";\n border-color: ").concat(A,";\n box-shadow: 0 0 20px ").concat(A,"80, 0 0 40px ").concat(A,"40;\n pointer-events: none;\n z-index: 2147483647;\n "),document.body.appendChild(a),setTimeout(()=>{a.classList.add("ttp-fade-out"),setTimeout(()=>{a.remove()},300)},o),{success:!0,selector:n,elementInfo:{tag:i.tagName.toLowerCase(),id:i.id||null,text:(null===(e=i.innerText)||void 0===e?void 0:e.trim().substring(0,100))||null,position:{top:r.top,left:r.left,width:r.width,height:r.height}}}}),ve.apply(this,arguments)}function Be(){if(!document.getElementById("ttp-highlight-styles")){var e=document.createElement("style");e.id="ttp-highlight-styles",e.textContent="\n @keyframes ttp-pulse {\n 0%, 100% {\n box-shadow: 0 0 20px var(--ttp-highlight-color, #6366f1)80,\n 0 0 40px var(--ttp-highlight-color, #6366f1)40;\n }\n 50% {\n box-shadow: 0 0 30px var(--ttp-highlight-color, #6366f1)99,\n 0 0 60px var(--ttp-highlight-color, #6366f1)60;\n }\n }\n \n .ttp-highlight-overlay {\n border: 3px solid var(--ttp-highlight-color, #6366f1);\n border-radius: 8px;\n animation: ttp-pulse 1s ease-in-out infinite;\n transition: opacity 0.3s ease;\n }\n \n .ttp-highlight-overlay.ttp-fade-out {\n opacity: 0;\n }\n \n .ttp-fill-success {\n outline: 3px solid #22c55e !important;\n outline-offset: 2px;\n transition: outline 0.3s ease;\n }\n ",document.head.appendChild(e)}}function we(){return we=fe(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:t,x:n,y:A,direction:o,amount:i=500,position:r="center",behavior:a="smooth"}=e;if(t){var s=document.querySelector(t);if(!s)return{success:!1,error:"Element not found: ".concat(t)};var c="top"===r?"start":"bottom"===r?"end":"center";s.scrollIntoView({behavior:a,block:c,inline:"nearest"}),yield Ce("smooth"===a?500:100);var l=s.getBoundingClientRect();return{success:!0,scrollType:"element",selector:t,elementPosition:{top:l.top,left:l.left}}}if("up"===o||"down"===o){var d,p=i||500,u=window.scrollY,h=document.documentElement.scrollHeight-window.innerHeight;return d="up"===o?Math.max(0,u-p):Math.min(h,u+p),window.scrollTo({top:d,left:window.scrollX,behavior:a}),yield Ce("smooth"===a?500:100),{success:!0,scrollType:"relative",direction:o,amount:p,scrolledFrom:{y:u},scrolledTo:{y:window.scrollY},atTop:0===window.scrollY,atBottom:window.scrollY>=h-1}}return void 0!==n||void 0!==A?(window.scrollTo({top:null!=A?A:window.scrollY,left:null!=n?n:window.scrollX,behavior:a}),yield Ce("smooth"===a?500:100),{success:!0,scrollType:"position",scrolledTo:{x:null!=n?n:window.scrollX,y:null!=A?A:window.scrollY}}):{success:!1,error:"Either selector, x/y position, or direction (up/down) required"}}),we.apply(this,arguments)}function be(){return be=fe(function*(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{url:n}=t;if(!n)return{success:!1,error:"URL is required"};try{e=new URL(n,window.location.origin)}catch(e){return{success:!1,error:"Invalid URL: ".concat(n)}}if(!["http:","https:"].includes(e.protocol))return{success:!1,error:"Invalid protocol: ".concat(e.protocol)};if(e.origin!==window.location.origin)try{return window.open(e.href,"_blank","noopener,noreferrer"),{success:!0,openedInNewTab:!0,navigatedTo:e.href,message:"Opened external link in a new tab"}}catch(t){return{success:!1,error:"Failed to open external link in new tab: "+t.message,attempted:e.href}}var A=window.location.href;return window.location.href=e.href,{success:!0,navigatedTo:e.href,from:A}}),be.apply(this,arguments)}function ye(){return ye=fe(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:t,value:n,triggerEvents:A=!0}=e;if(!t)return{success:!1,error:"Selector is required"};if(null==n)return{success:!1,error:"Value is required"};var o=document.querySelector(t);if(!o)return{success:!1,error:"Element not found: ".concat(t)};var i=o.tagName.toLowerCase();if(!["input","textarea","select"].includes(i))return{success:!1,error:"Element is not a form field: ".concat(i)};if(Ae(o))return{success:!1,error:"Cannot fill sensitive fields (password, credit card, etc.)",blocked:!0,fieldType:o.type,fieldName:o.name};if(o.scrollIntoView({behavior:"smooth",block:"center"}),yield Ce(300),o.focus(),"select"===i){var r=Array.from(o.options).find(e=>e.value===n||e.text.toLowerCase()===n.toLowerCase());o.value=r?r.value:n}else if("checkbox"===o.type||"radio"===o.type){var a=!0===n||"true"===n||"1"===n;o.checked=a}else o.value=n;if(A){var s;o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0}));var c=null===(s=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))||void 0===s?void 0:s.set;c&&(c.call(o,n),o.dispatchEvent(new Event("input",{bubbles:!0})))}return Be(),o.classList.add("ttp-fill-success"),setTimeout(()=>{o.classList.remove("ttp-fill-success")},2e3),{success:!0,selector:t,fieldType:o.type||i,fieldName:o.name||null,filled:!0}}),ye.apply(this,arguments)}function xe(){return xe=fe(function*(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:n,waitForNavigation:A=!1,openInNewTab:o=!1,isExternal:i=!1,href:r=null}=t;if(!n)return{success:!1,error:"Selector is required"};var a=document.querySelector(n);if(!a)return{success:!1,error:"Element not found: ".concat(n)};var s=a.getBoundingClientRect();if(0===s.width||0===s.height)return{success:!1,error:"Element is not visible (zero size)"};if(a.disabled)return{success:!1,error:"Element is disabled"};a.scrollIntoView({behavior:"smooth",block:"center"}),yield Ce(300);var c=document.createElement("div");if(c.style.cssText="\n position: fixed;\n top: ".concat(s.top-2,"px;\n left: ").concat(s.left-2,"px;\n width: ").concat(s.width+4,"px;\n height: ").concat(s.height+4,"px;\n border: 2px solid #22c55e;\n border-radius: 4px;\n pointer-events: none;\n z-index: 2147483647;\n transition: opacity 0.2s;\n "),document.body.appendChild(c),yield Ce(200),c.remove(),o||i){var l=r||a.href||("A"===a.tagName?a.getAttribute("href"):null);if(l&&"#"!==l&&!l.startsWith("javascript:"))try{var d;return window.open(l,"_blank","noopener,noreferrer"),{success:!0,selector:n,clicked:!0,openedInNewTab:!0,url:l,elementInfo:{tag:a.tagName.toLowerCase(),text:(null===(d=a.innerText)||void 0===d?void 0:d.trim().substring(0,50))||null},message:"Opened link in a new tab"}}catch(e){console.warn("[TTP] Failed to open in new tab:",e)}}if(A){var p,u=window.location.href,h=new Promise(e=>{var t=setTimeout(()=>{e({navigated:!1})},5e3),n=()=>{clearTimeout(t),window.removeEventListener("beforeunload",n),e({navigated:!0})};window.addEventListener("beforeunload",n)});a.click();var g=yield h;return{success:!0,selector:n,clicked:!0,elementInfo:{tag:a.tagName.toLowerCase(),text:(null===(p=a.innerText)||void 0===p?void 0:p.trim().substring(0,50))||null},navigated:g.navigated||window.location.href!==u}}return a.click(),{success:!0,selector:n,clicked:!0,elementInfo:{tag:a.tagName.toLowerCase(),text:(null===(e=a.innerText)||void 0===e?void 0:e.trim().substring(0,50))||null}}}),xe.apply(this,arguments)}function Ce(e){return new Promise(t=>setTimeout(t,e))}function Qe(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function Fe(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){Qe(i,A,o,r,a,"next",e)}function a(e){Qe(i,A,o,r,a,"throw",e)}r(void 0)})}}function Ue(e){e.registerHandler("read_page",Fe(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] 📋 Reading page structure...");var t=yield he(e);return console.log("[TTP] ✅ Page structure extracted:",{buttons:t.buttons.length,links:t.links.length,forms:t.forms.length,headings:t.headings.length}),t})),e.registerHandler("highlight_element",Fe(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] ✨ Highlighting element:",e.selector);var t=yield function(){return ve.apply(this,arguments)}(e);return t.success?console.log("[TTP] ✅ Element highlighted"):console.warn("[TTP] ⚠️ Highlight failed:",t.error),t})),e.registerHandler("scroll_to_element",Fe(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.selector)console.log("[TTP] 📜 Scrolling to element:",e.selector);else if(e.direction)console.log("[TTP] 📜 Scrolling",e.direction,"by",e.amount||500,"px");else if(void 0!==e.x||void 0!==e.y){var t,n;console.log("[TTP] 📜 Scrolling to position:","(".concat(null!==(t=e.x)&&void 0!==t?t:"current",", ").concat(null!==(n=e.y)&&void 0!==n?n:"current",")"))}else console.log("[TTP] 📜 Scroll called with params:",e);var A=yield function(){return we.apply(this,arguments)}(e);return A.success?console.log("[TTP] ✅ Scrolled successfully"):console.warn("[TTP] ⚠️ Scroll failed:",A.error),A})),e.registerHandler("navigate_to",Fe(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] 🔗 Navigating to:",e.url);var t=yield function(){return be.apply(this,arguments)}(e);return t.success?console.log("[TTP] ✅ Navigation initiated"):console.warn("[TTP] ⚠️ Navigation blocked:",t.error),t})),e.registerHandler("fill_field",Fe(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] 📝 Filling field:",e.selector);var t=yield function(){return ye.apply(this,arguments)}(e);return t.success?console.log("[TTP] ✅ Field filled"):console.warn("[TTP] ⚠️ Fill failed:",t.error),t})),e.registerHandler("click_element",Fe(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] 👆 Clicking element:",e.selector);var t=yield function(){return xe.apply(this,arguments)}(e);return t.success?console.log("[TTP] ✅ Element clicked"):console.warn("[TTP] ⚠️ Click failed:",t.error),t}));var t=e.getRegisteredTools(),n=["read_page","highlight_element","scroll_to_element","navigate_to","fill_field","click_element"].filter(e=>!t.includes(e));n.length>0&&console.error("[TTP] ❌ Some visual tools failed to register:",n)}function Se(){return(Se=Fe(function*(){var e=yield he();return{url:e.url,title:e.title,timestamp:e.timestamp,language:e.language,viewport:e.viewport,dom:{buttons:e.buttons,links:e.links,forms:e.forms,sections:e.sections,headings:e.headings,metadata:e.metadata}}})).apply(this,arguments)}function ke(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function Ee(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){ke(i,A,o,r,a,"next",e)}function a(e){ke(i,A,o,r,a,"throw",e)}r(void 0)})}}function Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function Te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(n),!0).forEach(function(t){He(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function He(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class _e extends c{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.version="2.0.0",e.signedUrl&&!e.websocketUrl&&(console.warn("⚠️ VoiceSDK: signedUrl is deprecated — use websocketUrl for custom backend URLs, or just provide agentId + appId"),e.websocketUrl=e.signedUrl),this.config={websocketUrl:e.websocketUrl||"wss://speech.talktopc.com/ws/conv",agentId:e.agentId,appId:e.appId,sampleRate:e.sampleRate||16e3,channels:e.channels||1,bitDepth:e.bitDepth||16,audioProcessorPath:e.audioProcessorPath,outputContainer:e.outputContainer||this.getDefaultContainer(e),outputEncoding:e.outputEncoding||e.outputCodec||"pcm",outputSampleRate:e.outputSampleRate||16e3,outputChannels:e.outputChannels||1,outputBitDepth:e.outputBitDepth||16,outputFrameDurationMs:e.outputFrameDurationMs||600,outputCodec:e.outputCodec,agentSettingsOverride:e.agentSettingsOverride||null,visualAssistant:e.visualAssistant||null,variables:e.variables||null,autoReconnect:!1!==e.autoReconnect,audioConstraints:e.audioConstraints||null,protocolVersion:e.protocolVersion||2,flavor:e.flavor||null},this.isConnected=!1,this.hasEverConnected=!1,this.isRecording=!1,this.isPlaying=!1,this.isDestroyed=!1,this.outputAudioFormat=null,this.requestedOutputFormat=null,this.formatConverter=null,this.websocket=null,this.conversationId=null,this.transcriptQueue=[],this.currentPlayingSentenceId=null,this.audioFrameCount=0,this.lastAudioStartTime=0,this.wakeLock=null,this._wakeLockRequesting=!1,this.pendingInjections=new Map,this.injectionCounter=0,this.audioPlayer=new f(this.config);var t=Te(Te({},this.config),{},{checkConnection:()=>this.isConnected&&this.websocket&&this.websocket.readyState===WebSocket.OPEN});this.audioRecorder=new E(t),this.setupAudioPlayerEvents(),this.setupAudioRecorderEvents(),this.clientToolsRegistry=new z(e=>this.sendMessage(e),()=>this.conversationId),this._registerBuiltInTools(),this.validateConfig(),this._setupPageUnloadHandler()}_registerBuiltInTools(){var e=this;console.log("📸 VoiceSDK: _registerBuiltInTools() called"),console.log("📸 VoiceSDK: captureScreenshot available?",void 0!==ee);try{if(void 0===ee)return console.error("❌ VoiceSDK: captureScreenshot is undefined - import may have failed"),void console.error(" This will prevent capture_screen tool from working");console.log("📸 VoiceSDK: Registering capture_screen tool, captureScreenshot type:",typeof ee),this.clientToolsRegistry.registerHandler("capture_screen",Ee(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("📸 VoiceSDK: capture_screen tool called with params:",t);var{selector:n=null,format:A="jpeg",quality:o=.85,scale:i=1,fullPage:r=!1,maxWidth:a=1280,maxHeight:s=1280}=t;try{var c=yield ee({selector:n,format:A,quality:o,scale:i,fullPage:r,maxWidth:a,maxHeight:s});return console.log("📸 VoiceSDK: Screenshot captured: ".concat(c.width,"x").concat(c.height,", ").concat(Math.round(c.image.length/1024),"KB")),e.emit("screenshotCaptured",{width:c.width,height:c.height,sizeKB:Math.round(c.image.length/1024),selector:c.selector}),c}catch(t){throw console.error("📸 VoiceSDK: Screenshot capture failed:",t),e.emit("screenshotError",{error:t.message}),t}})),console.log("📸 VoiceSDK: Built-in capture_screen tool registered")}catch(e){console.error("❌ VoiceSDK: Error registering built-in tools:",e),console.error(" Error details:",e.message,e.stack)}try{Ue(this.clientToolsRegistry);var t=this.clientToolsRegistry.getRegisteredTools(),n=["read_page","click_element","fill_field","highlight_element","scroll_to_element","navigate_to"],A=t.filter(e=>n.includes(e));if(A.length!==n.length){var o=n.filter(e=>!A.includes(e));console.error("❌ VoiceSDK: Some visual tools failed to register:",o),console.error(" Registered visual tools:",A)}}catch(e){console.error("❌ VoiceSDK: Error registering visual assistant tools:",e),console.error(" Error details:",e.message,e.stack)}var i=this.clientToolsRegistry.getRegisteredTools(),r=["read_page","capture_screen","highlight_element","click_element","fill_field","scroll_to_element","navigate_to"],a=i.filter(e=>r.includes(e));if(a.length!==r.length){var s=r.filter(e=>!a.includes(e));console.error("❌ VoiceSDK: Missing internal tools:",s),console.error(" Expected 7 internal tools:",r),console.error(" Registered:",a)}}getStoredConversationId(){try{if("undefined"==typeof sessionStorage)return console.warn("⚠️ VoiceSDK v2: sessionStorage not available (private mode?)"),null;var e=sessionStorage.getItem(_e.RESUME_STORAGE_KEY);if(e){var t=JSON.parse(e);if(t&&t.conversationId)return console.log("📦 VoiceSDK v2: Found stored conversationId:",t.conversationId),t.conversationId}return null}catch(e){return console.warn("⚠️ VoiceSDK v2: Error reading sessionStorage:",e),null}}storeConversationId(e){if(e)try{if("undefined"==typeof sessionStorage)return void console.warn("⚠️ VoiceSDK v2: sessionStorage not available (private mode?)");var t={},n=sessionStorage.getItem(_e.RESUME_STORAGE_KEY);if(n)try{t=JSON.parse(n)}catch(e){}t.conversationId=e,t.timestamp=Date.now(),t.fromPage=t.fromPage||window.location.pathname+window.location.search,sessionStorage.setItem(_e.RESUME_STORAGE_KEY,JSON.stringify(t)),console.log("💾 VoiceSDK v2: Stored conversationId:",e)}catch(e){console.warn("⚠️ VoiceSDK v2: Error writing to sessionStorage:",e)}}clearStoredConversationId(){try{if("undefined"==typeof sessionStorage)return;sessionStorage.removeItem(_e.RESUME_STORAGE_KEY),console.log("🗑️ VoiceSDK v2: Cleared stored conversationId")}catch(e){console.warn("⚠️ VoiceSDK v2: Error clearing sessionStorage:",e)}}_getResumeState(){try{if("undefined"==typeof sessionStorage)return null;var e=sessionStorage.getItem(_e.RESUME_STORAGE_KEY);if(!e)return null;var t=JSON.parse(e),n=Date.now()-t.timestamp;return n>_e.RESUME_TTL_MS?(console.log("[VoiceSDK] Resume state expired:",n,"ms"),this._clearResumeState(),null):(console.log("[VoiceSDK] Found valid resume state:",t,"age:",n,"ms"),t)}catch(e){return console.warn("[VoiceSDK] Failed to get resume state:",e),null}}_clearResumeState(){try{if("undefined"==typeof sessionStorage)return;sessionStorage.removeItem(_e.RESUME_STORAGE_KEY)}catch(e){}}_setupPageUnloadHandler(){window.addEventListener("beforeunload",()=>{this.conversationId&&this.websocket&&this.websocket.readyState===WebSocket.OPEN&&this.storeConversationId(this.conversationId)}),document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&(this.isRecording&&this.isConnected&&this._requestWakeLock(),this.isRecording&&this.audioRecorder&&this.audioRecorder.resumeAudioContext().catch(e=>{console.error("VoiceSDK v2: Error resuming AudioContext on visibility change:",e)}),this.audioPlayer&&this.audioPlayer.resumeAudioContext().catch(e=>{console.error("VoiceSDK v2: Error resuming playback AudioContext on visibility change:",e)})),"hidden"===document.visibilityState&&this.conversationId&&this.websocket&&this.websocket.readyState===WebSocket.OPEN&&this.storeConversationId(this.conversationId)})}checkAndResume(){var e=this._getResumeState();if(!e)return null;var t=window.location.pathname+window.location.search;return console.log("[VoiceSDK] Auto-resuming conversation:",e.conversationId),console.log("[VoiceSDK] Page change:",e.fromPage,"→",t),{conversationId:e.conversationId,fromPage:e.fromPage,toPage:t}}getDefaultContainer(e){return"wav"===e.outputCodec?"wav":"raw"}validateInputFormat(e){var t;if(!e)return"Input format is required";var n=null===(t=e.encoding)||void 0===t?void 0:t.toLowerCase();return n&&_e.SUPPORTED_INPUT_ENCODINGS.includes(n)?e.sampleRate&&_e.SUPPORTED_INPUT_SAMPLE_RATES.includes(e.sampleRate)?e.bitDepth&&_e.SUPPORTED_INPUT_BIT_DEPTHS.includes(e.bitDepth)?e.channels&&_e.SUPPORTED_INPUT_CHANNELS.includes(e.channels)?null:"Unsupported input channels: ".concat(e.channels,". Supported: ").concat(_e.SUPPORTED_INPUT_CHANNELS.join(", ")):"Unsupported input bit depth: ".concat(e.bitDepth,". Supported: ").concat(_e.SUPPORTED_INPUT_BIT_DEPTHS.join(", ")):"Unsupported input sample rate: ".concat(e.sampleRate,". Supported: ").concat(_e.SUPPORTED_INPUT_SAMPLE_RATES.join(", ")):"Unsupported input encoding: ".concat(e.encoding,". Supported: ").concat(_e.SUPPORTED_INPUT_ENCODINGS.join(", "))}validateOutputFormat(e){var t,n;if(!e)return"Output format is required";var A=null===(t=e.encoding)||void 0===t?void 0:t.toLowerCase();if(!A||!_e.SUPPORTED_OUTPUT_ENCODINGS.includes(A))return"Unsupported output encoding: ".concat(e.encoding,". Supported: ").concat(_e.SUPPORTED_OUTPUT_ENCODINGS.join(", "));if(!e.sampleRate||!_e.SUPPORTED_OUTPUT_SAMPLE_RATES.includes(e.sampleRate))return"Unsupported output sample rate: ".concat(e.sampleRate,". Supported: ").concat(_e.SUPPORTED_OUTPUT_SAMPLE_RATES.join(", "));if(!e.bitDepth||!_e.SUPPORTED_OUTPUT_BIT_DEPTHS.includes(e.bitDepth))return"Unsupported output bit depth: ".concat(e.bitDepth,". Supported: ").concat(_e.SUPPORTED_OUTPUT_BIT_DEPTHS.join(", "));if(!e.channels||!_e.SUPPORTED_OUTPUT_CHANNELS.includes(e.channels))return"Unsupported output channels: ".concat(e.channels,". Supported: ").concat(_e.SUPPORTED_OUTPUT_CHANNELS.join(", "));var o=null===(n=e.container)||void 0===n?void 0:n.toLowerCase();return o&&_e.SUPPORTED_OUTPUT_CONTAINERS.includes(o)?null:"Unsupported output container: ".concat(e.container,". Supported: ").concat(_e.SUPPORTED_OUTPUT_CONTAINERS.join(", "))}validateConfig(){var e={encoding:"pcm",sampleRate:this.config.sampleRate,channels:this.config.channels,bitDepth:this.config.bitDepth},t=this.validateInputFormat(e);if(t)return console.error("❌ VoiceSDK v2: Invalid input format:",t),void this.emit("error",new Error(t));var n={encoding:this.config.outputEncoding,sampleRate:this.config.outputSampleRate,channels:this.config.outputChannels,bitDepth:this.config.outputBitDepth,container:this.config.outputContainer},A=this.validateOutputFormat(n);return A?(console.error("❌ VoiceSDK v2: Invalid output format:",A),void this.emit("error",new Error(A))):void 0}setupAudioPlayerEvents(){this.audioPlayer.on("playbackStarted",()=>{this.isPlaying=!0,this.emit("playbackStarted"),this.isConnected?(console.log("📤 VoiceSDK v2: Sending audio_started_playing message to server"),this.sendMessage({t:"audio_started_playing"})):console.warn("⚠️ VoiceSDK v2: Cannot send audio_started_playing - not connected")}),this.audioPlayer.on("transcriptDisplay",e=>{var t=this.currentPlayingSentenceId?this.currentPlayingSentenceId+1:1;this.currentPlayingSentenceId=t;var n={text:e.text,role:"assistant",sentenceId:t,final:!0,timestamp:Date.now()};if(console.log("📝 VoiceSDK v2: Emitting synced transcriptDisplay from AudioPlayer:",n),this.emit("transcriptDisplay",n),this.emit("transcript",n),e.synced&&Array.isArray(e.synced))for(var A of(console.log("📝 VoiceSDK v2: Emitting ".concat(e.synced.length," synced action(s) as message events")),e.synced))this.emit("message",A)}),this.audioPlayer.on("playbackStopped",()=>{this.isPlaying=!1,this.emit("playbackStopped"),this.isConnected?(console.log("📤 VoiceSDK v2: Sending audio_stopped_playing message to server"),this.sendMessage({t:"audio_stopped_playing"})):console.warn("⚠️ VoiceSDK v2: Cannot send audio_stopped_playing - not connected")}),this.audioPlayer.on("playbackError",e=>{this.emit("playbackError",e),this.emit("error",e)})}setupAudioRecorderEvents(){this.audioRecorder.on("recordingStarted",()=>{this.isRecording=!0,this.emit("recordingStarted")}),this.audioRecorder.on("recordingStopped",()=>{this.isRecording&&(this.isRecording=!1,this.emit("recordingStopped"),console.log("🛑 VoiceSDK v2: Recording stopped (from audioRecorder event)"))}),this.audioRecorder.on("audioData",e=>{this.isConnected&&this.sendBinary(e)}),this.audioRecorder.on("error",e=>{e.isServerRejection||"ServerRejected"===e.name||(console.error("❌ AudioRecorder error:",e),this.emit("error",e))})}buildWebSocketUrl(){var e=this.config.websocketUrl,t=new URL(e,"wss://placeholder.com"),n=t.searchParams;n.delete("signed_token"),this.config.agentId&&!n.has("agentId")&&n.append("agentId",this.config.agentId),this.config.appId&&!n.has("appId")&&n.append("appId",this.config.appId);var A=this.getStoredConversationId();A&&!n.has("conversationId")&&(n.append("conversationId",A),console.log("🔄 VoiceSDK v2: Attempting resume via query param:",A));var o=window.location.pathname+window.location.search;o&&!n.has("currentPage")&&n.append("currentPage",o);var i=n.toString();return i?"".concat(t.origin).concat(t.pathname,"?").concat(i):"".concat(t.origin).concat(t.pathname)}connect(){var e=this;return Ee(function*(){if(e.isDestroyed)return console.warn("VoiceSDK v2: Cannot connect - SDK is destroyed"),!1;if(e.isConnected)return console.warn("VoiceSDK v2: Already connected"),!0;try{var t=e.buildWebSocketUrl();return"undefined"!=typeof __DEV__&&__DEV__&&(console.log("[TTPAgentSDK] WebSocket URL:",t),console.log("🔌 VoiceSDK v2: Connecting to",t)),yield new Promise((n,A)=>{e.websocket=new WebSocket(t),e.websocket.onopen=()=>{if(e.isConnected=!0,e.hasEverConnected=!0,e.clientToolsRegistry){e.clientToolsRegistry.setSendMessage(t=>e.sendMessage(t));var t=e.clientToolsRegistry.getRegisteredTools(),A=["read_page","capture_screen","highlight_element","click_element","fill_field","scroll_to_element","navigate_to"].filter(e=>!t.includes(e));if(A.length>0){console.warn("⚠️ VoiceSDK v2: Missing tools detected, re-registering:",A),e._registerBuiltInTools();var o=e.clientToolsRegistry.getRegisteredTools();console.log("🔧 VoiceSDK v2: Tools after re-registration:",o)}}e.sendHelloMessage(),e.emit("connected"),n(!0)},e.websocket.onerror=e=>{console.error("❌ VoiceSDK v2: WebSocket error:",e),A(e)},e.websocket.onclose=t=>{if(console.log("🔌 VoiceSDK v2: WebSocket closed:",t.code,t.reason),e.isConnected=!1,e.isRecording&&e.stopRecording().catch(e=>console.error("Error stopping recording:",e)),e._releaseWakeLock(),e.pendingInjections.size>0){console.warn("VoiceSDK v2: Rejecting ".concat(e.pendingInjections.size," pending data injections due to disconnect"));var n=new Error("Connection closed - data injection cancelled");n.error="CONNECTION_CLOSED",e.pendingInjections.forEach((t,A)=>{clearTimeout(t.timeout),t.reject(n),e.emit("dataInjectionError",{error:"CONNECTION_CLOSED",message:"Connection closed - data injection cancelled",correlationId:A})}),e.pendingInjections.clear()}e.emit("disconnected",t),e.config.autoReconnect&&!e.isDestroyed&&e.hasEverConnected?(console.log("🔄 VoiceSDK v2: Auto-reconnecting in 3s..."),setTimeout(()=>{e.isDestroyed||e.isConnected||e.connect()},3e3)):e.config.autoReconnect&&!e.hasEverConnected&&console.log("⚠️ VoiceSDK v2: Initial connection failed. Auto-reconnect disabled to prevent retry loop.")},e.websocket.onmessage=t=>{e.handleMessage(t)}})}catch(t){return console.error("🔌 VoiceSDK v2: Connection failed:",t),e.emit("error",t),!1}})()}detectBrowserLocale(){var e,t,n=navigator.language||(null===(e=navigator.languages)||void 0===e?void 0:e[0])||"en-US";return{language:(null===(t=n.split("-")[0])||void 0===t?void 0:t.toLowerCase())||"en",fullLocale:n}}sendHelloMessage(){var e=this;return Ee(function*(){if(e.isConnected){var t={encoding:"pcm",sampleRate:e.config.sampleRate,channels:e.config.channels,bitDepth:e.config.bitDepth},n={encoding:e.config.outputEncoding,sampleRate:e.config.outputSampleRate,channels:e.config.outputChannels,bitDepth:e.config.outputBitDepth,container:e.config.outputContainer},A=e.validateInputFormat(t);if(A)return console.error("❌ VoiceSDK v2: Cannot send hello - invalid input format:",A),void e.emit("error",new Error("Invalid input format: ".concat(A)));var o=e.validateOutputFormat(n);if(o)return console.error("❌ VoiceSDK v2: Cannot send hello - invalid output format:",o),void e.emit("error",new Error("Invalid output format: ".concat(o)));var i={t:"hello",v:e.config.protocolVersion,inputFormat:t,requestedOutputFormat:n,outputFrameDurationMs:e.config.outputFrameDurationMs};e.config.agentSettingsOverride&&(i.agentSettingsOverride=e.config.agentSettingsOverride),i.locale=e.detectBrowserLocale(),console.log("🌍 VoiceSDK v2: Auto-detected locale:",i.locale),console.log("🔍 VoiceSDK v2: Checking variables:",{hasVariables:!!e.config.variables,variables:e.config.variables,keys:e.config.variables?Object.keys(e.config.variables):[]}),e.config.variables&&Object.keys(e.config.variables).length>0?(i.variables=e.config.variables,console.log("📝 VoiceSDK v2: Including variables in hello:",Object.keys(e.config.variables))):console.log("⚠️ VoiceSDK v2: Variables NOT included - condition failed"),e.config.flavor&&(i.flavor=e.config.flavor),console.log("📤 VoiceSDK v2: Sending hello:",{version:i.v,requestedFormat:i.requestedOutputFormat,variables:i.variables?Object.keys(i.variables):void 0}),console.log("📤 VoiceSDK v2: Requested output format:",{container:i.requestedOutputFormat.container,encoding:i.requestedOutputFormat.encoding,sampleRate:i.requestedOutputFormat.sampleRate,bitDepth:i.requestedOutputFormat.bitDepth}),console.log("📤 VoiceSDK v2: Full hello message being sent:",JSON.stringify(i,null,2));try{e.sendMessage(i)}catch(t){console.error("VoiceSDK v2: Failed to send hello:",t),e.emit("error",t)}}else console.warn("VoiceSDK v2: Cannot send hello - not connected")})()}handleMessage(e){var t;if(e.data instanceof ArrayBuffer||e.data instanceof Blob)this.handleBinaryMessage(e.data);else try{var n=JSON.parse(e.data);switch("audio"!==n.t&&console.log("📥 VoiceSDK v2: Received message type:",n.t,"Full message:",JSON.stringify(n).substring(0,200)),!this.conversationId&&n.conversationId&&(this.conversationId=n.conversationId,console.log("🔍 VoiceSDK v2: Captured conversationId from message:",this.conversationId),this.emit("conversationIdChanged",this.conversationId)),"audio"!==n.t&&console.log("📨 VoiceSDK v2: Received message type:",n.t,n),n.t){case"hello_ack":this.handleHelloAck(n);break;case"transcript":console.log("📝 VoiceSDK v2: Processing transcript message:",n),this.handleTranscript(n);break;case"user_transcript":console.log("📝 VoiceSDK v2: Received user_transcript:",n),this.emit("user_transcript",{text:n.text,final:!1!==n.final,timestamp:n.timestamp||Date.now()});break;case"agent_response":if(console.log("📝 VoiceSDK v2: Received agent_response:",n),(n.text||n.transcript)&&(console.log("📝 VoiceSDK v2: agent_response contains transcript data:",n.text||n.transcript),n.sentenceId&&(n.text||n.transcript))){var A={t:"transcript",sentenceId:n.sentenceId,text:n.text||n.transcript,role:n.role||"assistant",final:!1!==n.final,timestamp:n.timestamp||Date.now()};console.log("📝 VoiceSDK v2: Converting agent_response to transcript:",A),this.handleTranscript(A)}this.emit("message",n);break;case"error":case"show_products":case"cart_updated":case"add_to_store_cart":this.emit("message",n);break;case"barge_in":this.emit("bargeIn",n),this.stopAudioPlayback();break;case"stop_playing":var o=Date.now()-this.lastAudioStartTime;if(o<200){console.warn("⚠️ VoiceSDK v2: Ignoring premature stop_playing (".concat(o,"ms after audio_start, minimum ").concat(200,"ms required)"));break}this.emit("stopPlaying",n),this.stopAudioPlayback();break;case"audio_start":if(console.log("📝 VoiceSDK v2: Received audio_start with text:",n.text),this.lastAudioStartTime=Date.now(),this.audioPlayer&&(this.audioPlayer.isPlaying||(null===(t=this.audioPlayer.scheduledSources)||void 0===t?void 0:t.size)>0)&&console.log("📝 VoiceSDK v2: New sentence received while audio playing - will queue and wait for current sentence to finish"),n.text&&this.audioPlayer){var i=Array.isArray(n.synced)?n.synced:null;i&&console.log("📝 VoiceSDK v2: audio_start carries ".concat(i.length," synced action(s)")),this.audioPlayer.markNewSentence(n.text,i)}this.emit("message",n);break;case"client_tool_call":this.clientToolsRegistry.handleToolCall(n);break;case"text_inject_ack":this.handleTextInjectAck(n);break;case"data_inject_ack":this.handleDataInjectAck(n);break;case"data_inject_error":this.handleDataInjectError(n);break;case"hangup_ack":console.log("📞 VoiceSDK v2: Hangup acknowledged by server"),this.websocket&&this.websocket.readyState===WebSocket.OPEN&&(this.websocket.close(1e3,"User hangup"),this.websocket=null),this.isConnected=!1,this.emit("hangupAcknowledged");break;case"get_page_context":console.log("📖 [VISUAL ASSISTANT] Backend requested page context"),function(){return Se.apply(this,arguments)}().then(e=>{this.sendMessage({t:"page_context",pageContext:e}),console.log("📖 [VISUAL ASSISTANT] Page context sent:",e.url)}).catch(e=>{console.error("❌ [VISUAL ASSISTANT] Failed to scan page:",e),this.sendMessage({t:"page_context",pageContext:null,error:e.message})});break;case"get_screenshot":console.log("📸 [VISUAL ASSISTANT] Backend requested screenshot");try{ee().then(e=>{this.sendMessage({t:"screenshot",screenshot:{image:e.base64,mimeType:e.mimeType||"image/png",width:e.width,height:e.height}}),console.log("📸 [VISUAL ASSISTANT] Screenshot sent:",e.width+"x"+e.height)}).catch(e=>{console.error("❌ [VISUAL ASSISTANT] Screenshot capture failed:",e),this.sendMessage({t:"screenshot",screenshot:null,error:e.message})})}catch(e){console.error("❌ [VISUAL ASSISTANT] Screenshot error:",e),this.sendMessage({t:"screenshot",screenshot:null,error:e.message})}break;case"page_context_ack":n.ok?console.log("✅ [VISUAL ASSISTANT] Page context acknowledged"):console.warn("⚠️ [VISUAL ASSISTANT] Page context error:",n.error);break;case"screenshot_ack":n.ok?console.log("✅ [VISUAL ASSISTANT] Screenshot acknowledged"):console.warn("⚠️ [VISUAL ASSISTANT] Screenshot error:",n.error);break;default:if(console.log("VoiceSDK v2: Unknown message type:",n.t,"Full message:",JSON.stringify(n).substring(0,300)),(n.text||n.transcript||n.transcription)&&(console.log("📝 VoiceSDK v2: Unknown message contains transcript-like data:",{text:n.text,transcript:n.transcript,transcription:n.transcription,sentenceId:n.sentenceId,role:n.role}),n.sentenceId&&(n.text||n.transcript||n.transcription))){var r={t:"transcript",sentenceId:n.sentenceId,text:n.text||n.transcript||n.transcription,role:n.role||"assistant",final:!1!==n.final,timestamp:n.timestamp||Date.now()};console.log("📝 VoiceSDK v2: Attempting to process unknown message as transcript:",r),this.handleTranscript(r)}this.emit("message",n)}}catch(t){var a,s,c="string"==typeof e.data?e.data:String(e.data),l=(null===(a=t.message)||void 0===a||null===(a=a.match(/position (\d+)/))||void 0===a?void 0:a[1])||"unknown",d=parseInt(l,10);if(console.error("VoiceSDK v2: Error parsing message:",t),console.error("VoiceSDK v2: Raw message length:",c.length),console.error("VoiceSDK v2: Error at position:",d),"unknown"!==d&&d>0){var p=Math.max(0,d-50),u=Math.min(c.length,d+50),h=c.substring(p,u),g=" ".repeat(d-p)+"^";console.error("VoiceSDK v2: Context around error:"),console.error(h),console.error(g);var m=c.charAt(d),f=m.charCodeAt(0);console.error('VoiceSDK v2: Problematic character: "'.concat(m,'" (charCode: ').concat(f,")")),f<32&&9!==f&&10!==f&&13!==f&&console.error("VoiceSDK v2: This is an unescaped control character. The backend should escape it in JSON strings.")}var v=c.includes("client_tool_call")||c.includes('"t":"client_tool_call"');if(v){console.error("⚠️ VoiceSDK v2: CRITICAL - Failed to parse client_tool_call message!"),console.error("⚠️ VoiceSDK v2: This means a tool execution (like form filling) was lost due to JSON parsing error."),console.error("⚠️ VoiceSDK v2: The backend sent malformed JSON with unescaped control characters.");var B=c.match(/"toolName"\s*:\s*"([^"]+)"/);B&&console.error('⚠️ VoiceSDK v2: Attempted tool: "'.concat(B[1],'"'));var w=c.match(/"toolCallId"\s*:\s*"([^"]+)"/);w&&console.error('⚠️ VoiceSDK v2: Tool call ID: "'.concat(w[1],'"'))}if(null!==(s=t.message)&&void 0!==s&&s.includes("Bad control character")){console.warn("VoiceSDK v2: Attempting to recover by sanitizing control characters...");try{var b=c;b=b.replace(/([^\\])([\x00-\x08\x0B\x0C\x0E-\x1F])/g,(e,t,n)=>{var A=n.charCodeAt(0);return t+({0:"\\u0000",1:"\\u0001",2:"\\u0002",3:"\\u0003",4:"\\u0004",5:"\\u0005",6:"\\u0006",7:"\\u0007",8:"\\b",11:"\\u000B",12:"\\f",14:"\\u000E",15:"\\u000F",16:"\\u0010",17:"\\u0011",18:"\\u0012",19:"\\u0013",20:"\\u0014",21:"\\u0015",22:"\\u0016",23:"\\u0017",24:"\\u0018",25:"\\u0019",26:"\\u001A",27:"\\u001B",28:"\\u001C",29:"\\u001D",30:"\\u001E",31:"\\u001F"}[A]||"\\u".concat(A.toString(16).padStart(4,"0")))});var y=JSON.parse(b);if(console.warn("✅ VoiceSDK v2: Successfully recovered message after sanitization!"),console.warn("✅ VoiceSDK v2: Processing recovered message..."),"client_tool_call"===y.t&&this.clientToolsRegistry)console.warn("✅ VoiceSDK v2: Recovered client_tool_call - executing tool"),this.clientToolsRegistry.handleToolCall(y);else{var x=y;"audio"!==x.t&&console.log("📥 VoiceSDK v2: Received message type:",x.t,"Full message:",JSON.stringify(x).substring(0,200)),!this.conversationId&&x.conversationId&&(this.conversationId=x.conversationId,console.log("🔍 VoiceSDK v2: Captured conversationId from message:",this.conversationId),this.emit("conversationIdChanged",this.conversationId)),"audio"!==x.t&&console.log("📨 VoiceSDK v2: Received message type:",x.t,x),"client_tool_call"===x.t?this.clientToolsRegistry.handleToolCall(x):this.emit("message",x)}return}catch(e){console.error("❌ VoiceSDK v2: Recovery attempt failed:",e)}}console.error("VoiceSDK v2: First 500 chars of raw message:",c.substring(0,500)),this.emit("error",{type:"json_parse_error",error:t,rawMessage:c.substring(0,1e3),position:d,wasToolCall:v})}}handleHelloAck(e){if(console.log("📥 VoiceSDK v2: Received hello_ack:",{hasOutputFormat:!!e.outputAudioFormat,outputFormat:e.outputAudioFormat,hasConversationId:!!e.conversationId,messageType:e.t}),e.conversationId&&(this.conversationId=e.conversationId,console.log("🔍 VoiceSDK v2: Received conversationId:",this.conversationId),this.emit("conversationIdChanged",this.conversationId),this.storeConversationId(this.conversationId)),!0===e.resumed?(console.log("✅ VoiceSDK v2: Conversation resumed successfully"),this.emit("callResumed",{conversationId:this.conversationId,timestamp:Date.now()})):!1===e.resumed&&e.resumeRejectedReason&&(console.warn("⚠️ VoiceSDK v2: Resume rejected:",e.resumeRejectedReason),this.clearStoredConversationId(),this.emit("resumeRejected",{reason:e.resumeRejectedReason,conversationId:e.conversationId||null,timestamp:Date.now()})),e.outputAudioFormat){this.outputAudioFormat=e.outputAudioFormat,this.audioPlayer.setOutputFormat(e.outputAudioFormat),console.log("✅ VoiceSDK v2: Format negotiated by server:",this.outputAudioFormat),this.requestedOutputFormat={container:this.config.outputContainer||"wav",encoding:this.config.outputEncoding||"pcm",sampleRate:this.config.outputSampleRate||16e3,bitDepth:this.config.outputBitDepth||16,channels:this.config.outputChannels||1};var t={container:this.outputAudioFormat.container||"unknown",encoding:this.outputAudioFormat.encoding||"unknown",sampleRate:this.outputAudioFormat.sampleRate||0,bitDepth:this.outputAudioFormat.bitDepth||0,channels:this.outputAudioFormat.channels||0},n=[];if(this.requestedOutputFormat.container!==t.container&&n.push('container: "'.concat(this.requestedOutputFormat.container,'" → "').concat(t.container,'"')),this.requestedOutputFormat.encoding!==t.encoding&&n.push('encoding: "'.concat(this.requestedOutputFormat.encoding,'" → "').concat(t.encoding,'"')),this.requestedOutputFormat.sampleRate!==t.sampleRate&&n.push("sampleRate: ".concat(this.requestedOutputFormat.sampleRate,"Hz → ").concat(t.sampleRate,"Hz")),this.requestedOutputFormat.bitDepth!==t.bitDepth&&n.push("bitDepth: ".concat(this.requestedOutputFormat.bitDepth,"-bit → ").concat(t.bitDepth,"-bit")),this.requestedOutputFormat.channels!==t.channels&&n.push("channels: ".concat(this.requestedOutputFormat.channels," → ").concat(t.channels)),n.length>0){console.warn("⚠️ VoiceSDK v2: Format negotiation mismatch!"),console.warn(" Requested:",this.requestedOutputFormat),console.warn(" Negotiated:",t),console.warn(" Differences:",n.join(", "));try{if(this.formatConverter=new j(this.requestedOutputFormat,t),this.formatConverter.needsConversion()){var A=this.formatConverter.getConversionSteps();console.log("🔄 VoiceSDK v2: Format conversion enabled"),console.log(" Conversion steps:",A.join(", ")),console.log(" Audio will be automatically converted to requested format")}}catch(e){console.error("❌ VoiceSDK v2: Failed to create format converter:",e),console.warn(" Will use backend format without conversion"),this.formatConverter=null}}else console.log("✅ VoiceSDK v2: Format perfectly matched!",t),this.formatConverter=null;this.emit("formatNegotiated",this.outputAudioFormat)}else{this.config.protocolVersion>=2&&(console.warn("⚠️ VoiceSDK v2: hello_ack received but no outputAudioFormat in response."),console.warn(" This may happen if:"),console.warn(" 1. Backend is not sending outputAudioFormat (check backend logs)"),console.warn(" 2. Hello message missing v2 fields (v, inputFormat, requestedOutputFormat)"),console.warn(" 3. Backend validation failed (check backend error logs)"),console.warn(" Using default format from config..."));var o={container:this.config.outputContainer||"wav",encoding:this.config.outputEncoding||"pcm",sampleRate:this.config.outputSampleRate||16e3,channels:this.config.outputChannels||1,bitDepth:this.config.outputBitDepth||16};this.outputAudioFormat=o,this.requestedOutputFormat=o,this.audioPlayer.setOutputFormat(o),this.formatConverter=null}}handleTextInjectAck(e){console.log("📝 VoiceSDK v2: Text inject ack received:",e),this.emit("textInjectAck",e)}injectData(e){var t=arguments,n=this;return Ee(function*(){var A=t.length>1&&void 0!==t[1]?t[1]:{},o=null==e?void 0:e.trim();if(!o){var i={error:"EMPTY_DATA",message:"Cannot inject empty data"};throw console.warn("VoiceSDK v2: Cannot inject empty data"),n.emit("dataInjectionError",i),new Error(i.message)}if(!n.isConnected||!n.websocket){var r={error:"NOT_CONNECTED",message:"Voice call is not active"};throw console.warn("VoiceSDK v2: Cannot inject data - not connected"),n.emit("dataInjectionError",r),new Error(r.message)}if(o.length>5e3){var a={error:"DATA_TOO_LONG",message:"Data exceeds maximum length of 5000 characters",maxLength:5e3,currentLength:o.length};throw console.warn("VoiceSDK v2: Data too long (max 5000 characters)"),n.emit("dataInjectionError",a),new Error(a.message)}var s=n.generateCorrelationId(),c=A.timeout||1e4,l=A.source||"programmatic",d={t:"data_inject",data:o,correlationId:s,source:l,timestamp:Date.now()};return A.metadata&&(d.metadata=A.metadata),new Promise((e,t)=>{var A=setTimeout(()=>{n.pendingInjections.delete(s);var e={error:"TIMEOUT",message:"Data injection timeout - no response from server",correlationId:s,timeout:c};console.warn("VoiceSDK v2: Data injection timeout:",s),n.emit("dataInjectionError",e),t(new Error(e.message))},c);if(n.pendingInjections.set(s,{resolve:t=>{clearTimeout(A),e(t)},reject:e=>{clearTimeout(A),t(e)},timeout:A}),n.sendMessage(d))console.log("📤 VoiceSDK v2: Sent data_inject message:",{correlationId:s,dataLength:o.length,source:l});else{n.pendingInjections.delete(s),clearTimeout(A);var i={error:"SEND_FAILED",message:"Failed to send data injection message"};console.warn("VoiceSDK v2: Failed to send data injection message"),n.emit("dataInjectionError",i),t(new Error(i.message))}})})()}handleDataInjectAck(e){var t=e.correlationId;if(t){var n=this.pendingInjections.get(t);n?(this.pendingInjections.delete(t),n.resolve(e),this.emit("dataInjected",{correlationId:t,data:e.data,metadata:e.metadata}),console.log("✅ VoiceSDK v2: Data injection acknowledged:",t)):console.warn("VoiceSDK v2: data_inject_ack received for unknown correlationId:",t)}else console.warn("VoiceSDK v2: data_inject_ack received without correlationId")}handleDataInjectError(e){var t=e.correlationId;if(t){var n=this.pendingInjections.get(t);if(n){this.pendingInjections.delete(t);var A=new Error(e.message||"Data injection failed");A.error=e.error,A.correlationId=t,n.reject(A),this.emit("dataInjectionError",{error:e.error,message:e.message,correlationId:t}),console.warn("❌ VoiceSDK v2: Data injection error:",t,e.error)}else console.warn("VoiceSDK v2: data_inject_error received for unknown correlationId:",t)}else console.warn("VoiceSDK v2: data_inject_error received without correlationId")}handleTranscript(e){if(e.sentenceId&&e.text){var t=e.sentenceId,n={text:e.text,role:e.role||"assistant",sentenceId:t,final:!1!==e.final,timestamp:e.timestamp||Date.now()};this.transcriptQueue.push(n),console.log("📝 VoiceSDK v2: Received transcript for sentence",t,":",n.text),console.log(" Transcript queue length:",this.transcriptQueue.length),console.log(" Current playing sentence:",this.currentPlayingSentenceId),console.log("📝 VoiceSDK v2: Displaying transcript for completed sentence",t),this.emit("transcriptDisplay",n),this.currentPlayingSentenceId=t,this.emit("transcript",n)}else console.warn("⚠️ VoiceSDK v2: Invalid transcript message:",e)}handleBinaryMessage(e){var t=this;return Ee(function*(){var n,A=n=e instanceof Blob?yield e.arrayBuffer():e;if(t.formatConverter&&t.formatConverter.needsConversion())try{A=yield t.formatConverter.convert(n),console.log("✅ VoiceSDK v2: Audio converted to requested format")}catch(e){console.error("❌ VoiceSDK v2: Format conversion failed:",e),console.warn(" Using backend format without conversion"),A=n}var o=t.formatConverter&&t.formatConverter.needsConversion()?t.requestedOutputFormat:t.outputAudioFormat||{container:t.config.outputContainer||"raw",encoding:t.config.outputEncoding||"pcm",sampleRate:t.config.outputSampleRate||16e3,bitDepth:t.config.outputBitDepth||16,channels:t.config.outputChannels||1},i=o.container||"raw",r=(o.encoding||"pcm").toLowerCase();if("raw"===i){var a=A;if("pcm"!==r){var s=t.audioPlayer.getCodec(r);if(s){var c=s.decode(new Uint8Array(A));a=c.buffer,console.log("🔄 VoiceSDK v2: Decoded ".concat(r.toUpperCase()," to PCM (").concat(c.byteLength," bytes)"))}else console.warn("⚠️ VoiceSDK v2: No codec for ".concat(r,", treating as PCM"))}t.audioPlayer.outputFormat||(console.warn("⚠️ VoiceSDK v2: outputFormat not set on AudioPlayer, setting from playbackFormat"),t.audioPlayer.setOutputFormat(o)),t.audioFrameCount++,t.audioPlayer.playChunk(a)}else t.audioFrameCount++,t.audioPlayer.playAudio(A)})()}sendMessage(e){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return console.warn("VoiceSDK v2: Cannot send message - not connected"),!1;try{var t=(new Date).toISOString(),n=this.websocket?this.websocket.readyState:"NO_WEBSOCKET",A=this.websocket?{0:"CONNECTING",1:"OPEN",2:"CLOSING",3:"CLOSED"}[n]:"NO_WEBSOCKET";if("client_tool_result"!==e.t&&"client_tool_error"!==e.t||(console.log("📤 VoiceSDK v2: [".concat(t,"] Sending tool ").concat(e.t)),console.log(" 🔌 WebSocket state: ".concat(A," (").concat(n,")")),console.log(" 📋 toolCallId: ".concat(e.toolCallId)),console.log(" 📋 conversationId: ".concat(e.conversationId||"null")),console.log(" 📋 toolName: ".concat(e.toolName)),"client_tool_result"===e.t?console.log(" 📋 result:",e.result):console.log(" 📋 error: ".concat(e.error,", errorCode: ").concat(e.errorCode)),console.log(" 📋 Full message:",JSON.stringify(e,null,2))),!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return console.error("❌ VoiceSDK v2: Cannot send message - WebSocket not open (state: ".concat(A,")")),!1;var o=JSON.stringify(e);return this.websocket.send(o),"client_tool_result"!==e.t&&"client_tool_error"!==e.t||console.log("✅ VoiceSDK v2: [".concat(t,"] Tool ").concat(e.t," message sent successfully (").concat(o.length," bytes)")),!0}catch(e){return console.error("VoiceSDK v2: Error sending message:",e),this.emit("error",e),!1}}sendBinary(e){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return console.warn("VoiceSDK v2: Cannot send audio - not connected"),!1;try{return this.websocket.send(e),!0}catch(e){return console.error("VoiceSDK v2: Error sending audio:",e),this.emit("error",e),!1}}hangup(){if(this.websocket&&this.websocket.readyState===WebSocket.OPEN){console.log("📞 VoiceSDK v2: Hanging up call..."),this.clearStoredConversationId(),this.stopRecording(),this._releaseWakeLock(),this.audioPlayer&&this.stopAudioPlayback();try{this.sendMessage({t:"hangup"}),setTimeout(()=>{this.websocket&&this.websocket.readyState===WebSocket.OPEN&&(this.websocket.close(1e3,"User hangup"),this.websocket=null),this.isConnected=!1},100)}catch(e){console.error("VoiceSDK v2: Error sending hangup message:",e),this.websocket&&(this.websocket.close(1e3,"User hangup"),this.websocket=null),this.isConnected=!1}}}startRecording(){var e=arguments,t=this;return Ee(function*(){var n=e.length>0&&void 0!==e[0]?e[0]:null;if(!t.isConnected){var A=new Error("Not connected to voice server");throw t.emit("error",A),A}if(t.isRecording)return console.warn("VoiceSDK v2: Already recording"),!0;console.log("🎤 VoiceSDK v2: Starting recording...");try{if(console.log("🎤 VoiceSDK v2: Requesting microphone permission (mobile-friendly)..."),yield t.audioRecorder.start(n?{existingMediaStream:n}:{}),!t.isConnected||!t.websocket||t.websocket.readyState!==WebSocket.OPEN){try{yield t.audioRecorder.stop()}catch(e){}var o=new Error("Connection lost - server may have rejected the call");throw o.name="ServerRejected",o.isServerRejection=!0,o}return yield t.audioPlayer.resumeAudioContext(),t.sendMessage({t:"start_continuous_mode",ttpId:t.generateTtpId()}),t._requestWakeLock(),!0}catch(A){if(t.audioRecorder&&t.audioRecorder.isRecording)try{yield t.audioRecorder.stop()}catch(e){}if(A.isServerRejection||"ServerRejected"===A.name)return!1;if(console.error("❌ VoiceSDK v2: Failed to start recording:",A),"NotAllowedError"===A.name||"PermissionDeniedError"===A.name){var i=new Error("Microphone permission denied. Please allow microphone access in your browser settings and try again.");i.name=A.name,i.originalError=A,t.emit("error",i)}else t.emit("error",A);return!1}})()}stopRecording(){var e=this;return Ee(function*(){if(!e.isRecording)return console.warn("VoiceSDK v2: Not recording"),!0;console.log("🛑 VoiceSDK v2: Stopping recording...");try{return e.sendMessage({t:"stop_continuous_mode",ttpId:e.generateTtpId()}),e.isRecording=!1,e.emit("recordingStopped"),console.log("🛑 VoiceSDK v2: Recording stopped (emitted before audioRecorder.stop())"),e._releaseWakeLock(),yield e.audioRecorder.stop(),e.stopAudioPlayback(),!0}catch(t){return console.error("VoiceSDK v2: Error stopping recording:",t),e.emit("error",t),!1}})()}toggleRecording(){var e=this;return Ee(function*(){return e.isRecording?yield e.stopRecording():yield e.startRecording()})()}clearTranscriptState(){this.currentPlayingSentenceId=null,console.log("📝 VoiceSDK v2: Cleared transcript state")}_requestWakeLock(){var e=this;return Ee(function*(){if("wakeLock"in navigator)if(null!==e.wakeLock||e._wakeLockRequesting)console.log("📱 VoiceSDK v2: Wake lock already active or being requested");else try{e._wakeLockRequesting=!0,e.wakeLock=yield navigator.wakeLock.request("screen"),console.log("📱 VoiceSDK v2: Screen wake lock activated - screen will stay on during call"),e.wakeLock.addEventListener("release",()=>{console.log("📱 VoiceSDK v2: Wake lock released by system"),e.wakeLock=null})}catch(t){console.warn("📱 VoiceSDK v2: Failed to request wake lock:",t.message),e.wakeLock=null}finally{e._wakeLockRequesting=!1}else console.log("📱 VoiceSDK v2: Wake Lock API not available in this browser")})()}_releaseWakeLock(){var e=this;return Ee(function*(){if(null!==e.wakeLock)try{yield e.wakeLock.release(),e.wakeLock=null,console.log("📱 VoiceSDK v2: Screen wake lock released")}catch(t){console.warn("📱 VoiceSDK v2: Error releasing wake lock:",t.message),e.wakeLock=null}})()}stopAudioPlayback(){this.audioPlayer.stopImmediate(),this.clearTranscriptState()}handleBargeIn(){var e=this;return Ee(function*(){e.stopAudioPlayback(),e.isRecording||(yield e.startRecording())})()}getStatus(){return{version:this.version,isConnected:this.isConnected,isRecording:this.isRecording,isPlaying:this.isPlaying,outputFormat:this.outputAudioFormat,conversationId:this.conversationId,audioPlayer:this.audioPlayer.getStatus(),audioRecorder:this.audioRecorder.getStatus()}}updateConfig(e){this.config=Te(Te({},this.config),e)}generateTtpId(){return"sdk_"+Math.random().toString(36).substr(2,9)+"_"+Date.now()}generateCorrelationId(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();this.injectionCounter++;var e=Date.now(),t=Math.random().toString(36).substr(2,9);return"inj_".concat(e,"_").concat(this.injectionCounter,"_").concat(t)}registerToolHandler(e,t){return this.clientToolsRegistry.registerHandler(e,t)}unregisterToolHandler(e){return this.clientToolsRegistry.unregisterHandler(e)}hasToolHandler(e){return this.clientToolsRegistry.hasHandler(e)}getRegisteredTools(){return this.clientToolsRegistry.getRegisteredTools()}destroy(){if(!this.isDestroyed){if(console.log("🗑️ VoiceSDK v2: Destroying..."),this.isDestroyed=!0,this.isRecording&&this.stopRecording(),this._releaseWakeLock(),this._wakeLockRequesting=!1,this.audioPlayer&&this.stopAudioPlayback(),this.websocket&&(this.websocket.close(),this.websocket=null),this.isConnected=!1,this.pendingInjections.size>0){console.warn("VoiceSDK v2: Rejecting ".concat(this.pendingInjections.size," pending data injections due to destroy"));var e=new Error("SDK destroyed - data injection cancelled");e.error="SDK_DESTROYED",this.pendingInjections.forEach((t,n)=>{clearTimeout(t.timeout),t.reject(e)}),this.pendingInjections.clear()}this.audioPlayer&&this.audioPlayer.destroy(),this.audioRecorder&&this.audioRecorder.destroy(),f.closeSharedContext(),E.closeSharedContext(),this.clientToolsRegistry&&this.clientToolsRegistry.getRegisteredTools().forEach(e=>this.clientToolsRegistry.unregisterHandler(e)),this.removeAllListeners()}}}He(_e,"RESUME_STORAGE_KEY","voice_resume_state"),He(_e,"RESUME_TTL_MS",1e4),He(_e,"SUPPORTED_INPUT_ENCODINGS",["pcm","pcmu","pcma"]),He(_e,"SUPPORTED_INPUT_SAMPLE_RATES",[8e3,16e3,22050,24e3,44100,48e3]),He(_e,"SUPPORTED_INPUT_BIT_DEPTHS",[8,16,24]),He(_e,"SUPPORTED_INPUT_CHANNELS",[1]),He(_e,"SUPPORTED_OUTPUT_ENCODINGS",["pcm","pcmu","pcma"]),He(_e,"SUPPORTED_OUTPUT_SAMPLE_RATES",[8e3,16e3,22050,24e3,44100,48e3]),He(_e,"SUPPORTED_OUTPUT_BIT_DEPTHS",[8,16,24]),He(_e,"SUPPORTED_OUTPUT_CHANNELS",[1]),He(_e,"SUPPORTED_OUTPUT_CONTAINERS",["raw","wav"]);const De=_e;function Me(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function Pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pe(Object(n),!0).forEach(function(t){Re(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Re(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ke extends v{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var t=this.readScriptTagConfig();this.config=Le({baseWsUrl:"wss://backend.talktopc.com/chat/websocket",appId:e.appId||t.appId,agentId:e.agentId||t.agentId,conversationId:void 0!==e.conversationId?e.conversationId:this.getPersistedConversationId(),forceConversationId:e.forceConversationId,queue:[],inFlight:!1},e),this.fullResponseBuffer=""}readScriptTagConfig(){try{var e=Array.from(document.getElementsByTagName("script")).reverse().find(e=>e.dataset&&(e.dataset.appId||e.dataset.agentId)||e.src&&e.src.includes("agent-widget"));return e?{appId:e.dataset.appId,agentId:e.dataset.agentId}:{}}catch(e){return{}}}buildWebSocketUrl(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.baseWsUrl,t=new URLSearchParams;return this.config.appId&&t.append("appId",this.config.appId),this.config.agentId&&t.append("agentId",this.config.agentId),this.config.conversationId&&t.append("conversationId",this.config.conversationId),"".concat(e,"?").concat(t.toString())}sendMessage(e){var t,n=this;return(t=function*(){return new Promise((t,A)=>{if(e&&e.trim())if(n.config.appId&&n.config.agentId){var o={text:e,resolve:t,reject:A};n.config.inFlight?n.config.queue.push(o):n.executeTask(o)}else A(new Error("Missing appId or agentId"));else A(new Error("Message is empty"))})},function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(e){Me(i,A,o,r,a,"next",e)}function a(e){Me(i,A,o,r,a,"throw",e)}r(void 0)})})()}executeTask(e){if(this.config.inFlight=!0,this.fullResponseBuffer="",!this.config.conversationId){var t=this.getPersistedConversationId();t&&(this.config.conversationId=t,console.log("🔍 TextChatSDK hydrated conversationId from storage:",t))}var n=this.buildWebSocketUrl(this.config.baseWsUrl);"undefined"!=typeof __DEV__&&__DEV__&&console.log("[TTPAgentSDK] WebSocket URL:",n);var A=this.config.baseWsUrl.endsWith("/websocket")?this.config.baseWsUrl.replace(/\/websocket$/,""):"".concat(this.config.baseWsUrl,"/websocket"),o=this.buildWebSocketUrl(A),i=!1,r=!1,a=null,s=t=>{if(!r)try{var n={message:e.text},A=this.config.forceConversationId||this.config.conversationId;A&&(n.conversationId=A,this.config.forceConversationId&&!this.config.conversationId&&(this.config.conversationId=A,this.persistConversationId(A))),console.log("🔍 TextChatSDK sending payload:",n,"conversationId in config:",this.config.conversationId),t.send(JSON.stringify(n)),r=!0}catch(n){e.reject(n),this.emit("error",n);try{t.close()}catch(e){}}},c=e=>()=>{this.config.conversationId?s(e):a=setTimeout(()=>s(e),200)},l=t=>n=>{try{try{console.log("🔎 [TextChatSDK] WS <= raw:",n.data)}catch(e){}var A=JSON.parse(n.data);try{console.log("🔎 [TextChatSDK] WS <= parsed:",A)}catch(e){}if("hello"===A.type&&A.conversationId){if(console.log("🔍 TextChatSDK received conversationId:",A.conversationId),this.config.conversationId=A.conversationId,this.persistConversationId(A.conversationId),this.emit&&this.emit("conversationIdChanged",A.conversationId),!r&&t&&1===t.readyState){if(a)try{clearTimeout(a)}catch(e){}s(t)}return}if(!this.config.conversationId&&A.conversationId&&(console.log("🔍 TextChatSDK captured conversationId from message:",A.conversationId),this.config.conversationId=A.conversationId,this.persistConversationId(A.conversationId)),"chunk"===A.type&&"string"==typeof A.content)this.fullResponseBuffer+=A.content,this.emit("chunk",A.content);else if("done"===A.type){try{var o=A.text||A.content||A.answer||A.message||"";o&&!this.fullResponseBuffer&&(this.fullResponseBuffer=o)}catch(e){}!this.config.conversationId&&A.conversationId&&(console.log("🔍 TextChatSDK captured conversationId from done:",A.conversationId),this.config.conversationId=A.conversationId),this.persistConversationId(this.config.conversationId),this.emit("done",{text:this.fullResponseBuffer}),e.resolve({conversationId:this.config.conversationId,fullText:this.fullResponseBuffer});try{t.close()}catch(e){}}else if("error"===A.type){var i=new Error(A.message||"Server error");this.emit("error",i),e.reject(i);try{t.close()}catch(e){}}}catch(e){}},d=t=>{if(1008===t.code&&t.reason&&(t.reason.includes("Domain not whitelisted")||t.reason.includes("domain")||t.reason.includes("whitelist"))){var n=new Error("DOMAIN_NOT_WHITELISTED");return n.reason=t.reason,n.code=t.code,this.emit("domainError",n),e.reject(n),this.config.inFlight=!1,void this.drainQueue()}this.config.inFlight=!1,this.drainQueue()},p=new WebSocket(n);p.onopen=c(p),p.onmessage=l(p),p.onerror=(t=>n=>{if(!i){i=!0;try{t.close()}catch(e){}var A=new WebSocket(o);return A.onopen=c(A),A.onmessage=l(A),A.onerror=t=>{this.emit("error",t),e.reject(t)},void(A.onclose=d)}this.emit("error",n),e.reject(n)})(p),p.onclose=d}drainQueue(){if(0!==this.config.queue.length&&!this.config.inFlight){var e=this.config.queue.shift();this.executeTask(e)}}persistConversationId(e){try{e&&localStorage.setItem("ttp_text_chat_conversation_id",e)}catch(e){}}getPersistedConversationId(){try{return localStorage.getItem("ttp_text_chat_conversation_id")||null}catch(e){return null}}updateConfig(e){this.config=Le(Le({},this.config),e)}destroy(){this.config.queue=[],this.config.inFlight=!1,this.removeAllListeners()}}function Oe(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}var Ve=new class extends v{constructor(){super(),this.connections=new Map,this.connectionCounts=new Map,this.creatingConnections=new Set}getConnection(e){var t,n=this;return(t=function*(){if(n.connections.has(e)){var t=n.connections.get(e);return n.connectionCounts.set(e,(n.connectionCounts.get(e)||0)+1),t}if(n.creatingConnections&&n.creatingConnections.has(e))return new Promise(t=>{var A=()=>{if(n.connections.has(e)){var o=n.connections.get(e);n.connectionCounts.set(e,(n.connectionCounts.get(e)||0)+1),t(o)}else setTimeout(A,50)};A()});n.creatingConnections.add(e);var A=new WebSocket(e);return n.connections.set(e,A),n.connectionCounts.set(e,1),A.addEventListener("open",t=>{n.creatingConnections.delete(e),n.emit("open",t,e)}),A.addEventListener("close",t=>{n.creatingConnections.delete(e),n.connections.delete(e),n.connectionCounts.delete(e),n.emit("close",t,e)}),A.addEventListener("error",t=>{n.creatingConnections.delete(e),n.emit("error",t,e)}),A.addEventListener("message",t=>{n.emit("message",t,e)}),A},function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(e){Oe(i,A,o,r,a,"next",e)}function a(e){Oe(i,A,o,r,a,"throw",e)}r(void 0)})})()}releaseConnection(e){if(this.connections.has(e)){var t=this.connectionCounts.get(e)||0,n=Math.max(0,t-1);if(this.connectionCounts.set(e,n),0===n){var A=this.connections.get(e);A&&A.readyState===WebSocket.OPEN&&A.close(1e3,"No more subscribers"),this.connections.delete(e),this.connectionCounts.delete(e)}}}forceClose(e){if(this.connections.has(e)){var t=this.connections.get(e);t&&t.readyState===WebSocket.OPEN&&t.close(1e3,"Force close"),this.connections.delete(e),this.connectionCounts.delete(e)}}getConnectionStatus(e){return this.connections.has(e)?{exists:!0,readyState:this.connections.get(e).readyState,subscribers:this.connectionCounts.get(e)||0}:{exists:!1,readyState:null,subscribers:0}}getAllConnections(){var e={};for(var[t,n]of this.connections.entries())e[t]={readyState:n.readyState,subscribers:this.connectionCounts.get(t)||0};return e}clearAll(){for(var[e,t]of this.connections.entries())t&&t.readyState===WebSocket.OPEN&&t.close(1e3,"Clear all");this.connections.clear(),this.connectionCounts.clear(),this.creatingConnections.clear()}};const Ne=Ve;function je(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}class Ge extends v{constructor(e){super(),this.config=e,this.ws=null,this.isConnected=!1,this.connectionId=null}connect(){var e,t=this;return(e=function*(){return new Promise((e,n)=>{try{t.connectionId=Date.now()+"_"+Math.random().toString(36).substr(2,9),t.connectResolve=e,t.connectReject=n;var A=t.config.websocketUrl;Ne.getConnection(A,t.config).then(n=>{t.ws=n,t.setupEventListeners(),n.readyState===WebSocket.OPEN&&(t.isConnected=!0,t.emit("connected"),e(),t.connectResolve=null,t.connectReject=null)}).catch(e=>{console.error("🔌 WebSocketManager: Connection failed ".concat(t.connectionId),e),n(e),t.connectResolve=null,t.connectReject=null})}catch(e){console.error("🔌 WebSocketManager: Connection error ".concat(t.connectionId),e),n(e),t.connectResolve=null,t.connectReject=null}})},function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){je(i,A,o,r,a,"next",e)}function a(e){je(i,A,o,r,a,"throw",e)}r(void 0)})})()}setupEventListeners(){if(this.ws){var e=(e,t)=>{t===this.config.websocketUrl&&(this.isConnected=!0,this.emit("connected"),this.connectResolve&&(this.connectResolve(),this.connectResolve=null,this.connectReject=null))},t=(e,t)=>{t===this.config.websocketUrl&&(this.isConnected=!1,this.emit("disconnected",e))},n=(e,t)=>{t===this.config.websocketUrl&&(this.emit("error",e),this.connectReject&&(this.connectReject(e),this.connectResolve=null,this.connectReject=null))},A=(e,t)=>{t===this.config.websocketUrl&&this.handleMessage(e)};Ne.on("open",e),Ne.on("close",t),Ne.on("error",n),Ne.on("message",A),this.eventHandlers={open:e,close:t,error:n,message:A}}}disconnect(){this.eventHandlers&&(Ne.off("open",this.eventHandlers.open),Ne.off("close",this.eventHandlers.close),Ne.off("error",this.eventHandlers.error),Ne.off("message",this.eventHandlers.message));var e=this.config.websocketUrl;e&&Ne.releaseConnection(e),this.ws=null,this.isConnected=!1}sendMessage(e){if(this.isConnected&&this.ws)try{this.ws.send(JSON.stringify(e))}catch(e){console.warn("🔌 WebSocketManager: Failed to send message:",e.message)}}sendBinary(e){if(this.isConnected&&this.ws)try{this.ws.send(e)}catch(e){console.warn("🔌 WebSocketManager: Failed to send binary data:",e.message)}}handleMessage(e){if(e.data instanceof ArrayBuffer)this.emit("binaryAudio",e.data);else if(e.data instanceof Blob)e.data.arrayBuffer().then(e=>{this.emit("binaryAudio",e)}).catch(e=>{console.error("🔌 WebSocketManager: Error converting Blob to ArrayBuffer:",e)});else try{var t=JSON.parse(e.data);"barge_in_ack"!==t.t&&"stop_sending"!==t.t||this.emit("bargeIn",t),"stop_playing"===t.t&&this.emit("stopPlaying",t),this.emit("message",t)}catch(e){this.emit("error",e)}}getStatus(){return{isConnected:this.isConnected,readyState:this.ws?this.ws.readyState:null,connectionId:this.connectionId}}static getSingletonStatus(){return Ne.getAllConnections()}static clearAllConnections(){Ne.clearAll()}}function ze(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function We(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){ze(i,A,o,r,a,"next",e)}function a(e){ze(i,A,o,r,a,"throw",e)}r(void 0)})}}class qe extends v{constructor(e){super(),this.config=e,this.audioContext=null,this.audioQueue=[],this.isPlaying=!1,this.isProcessingQueue=!1,this.currentSource=null,this.audioContextReady=!1,this.initializeAudioContext().catch(()=>{})}initializeAudioContext(){var e=this;return We(function*(){if(!e.audioContext||"closed"===e.audioContext.state)try{var t={sampleRate:e.config.sampleRate||e.config.outputSampleRate||44100};if(e.audioContext=new(window.AudioContext||window.webkitAudioContext)(t),"suspended"===e.audioContext.state&&(yield e.audioContext.resume()),"running"===e.audioContext.state)try{var n=e.audioContext.sampleRate,A=e.audioContext.createBuffer(1,.01*n,n),o=e.audioContext.createBufferSource();o.buffer=A,o.connect(e.audioContext.destination),o.start(0),o.stop(e.audioContext.currentTime+.01)}catch(e){console.debug("AudioPlayer: AudioContext warmup skipped:",e)}e.audioContextReady=!0}catch(t){console.warn("AudioPlayer: Failed to pre-initialize AudioContext:",t),e.audioContextReady=!1}})()}playAudio(e){try{var t=this.createAudioBlob(e);if(this.audioQueue.push(t),!this.isPlaying&&!this.isProcessingQueue&&!this.currentSource){var n=this.audioContextReady?0:50;setTimeout(()=>this.processQueue(),n)}}catch(e){this.emit("playbackError",e)}}createAudioBlob(e){var t=new Uint8Array(e);if(t.length>=4){if(82===t[0]&&73===t[1]&&70===t[2]&&70===t[3])return new Blob([e],{type:"audio/wav"});if(255===t[0]&&!(224&~t[1]))return new Blob([e],{type:"audio/mpeg"});if(79===t[0]&&103===t[1]&&103===t[2]&&83===t[3])return new Blob([e],{type:"audio/ogg"})}return new Blob([e],{type:"audio/wav"})}processQueue(){var e=this;return We(function*(){if(!e.isProcessingQueue&&0!==e.audioQueue.length){e.isProcessingQueue=!0;var t=e.audioQueue.shift();if(t)try{var n=!e.isPlaying&&null===e.currentSource;e.audioContext&&"closed"!==e.audioContext.state||(yield e.initializeAudioContext());var A=e.audioContext;"suspended"===A.state&&(yield A.resume(),n&&(yield new Promise(e=>setTimeout(e,10)))),"running"!==A.state&&(console.warn("AudioPlayer: AudioContext not in running state:",A.state),"suspended"===A.state&&(yield A.resume(),yield new Promise(e=>setTimeout(e,10))));var o=yield t.arrayBuffer(),i=yield A.decodeAudioData(o),r=n&&!e.isPlaying&&null===e.currentSource,a=A.createBufferSource();a.buffer=i,a.connect(A.destination),e.currentSource=a,e.isPlaying=!0,r&&e.emit("playbackStarted"),a.onended=()=>{e.currentSource=null,e.isProcessingQueue=!1,e.audioQueue.length>0?setTimeout(()=>e.processQueue(),0):setTimeout(()=>{0!==e.audioQueue.length||e.currentSource||(e.isPlaying=!1,e.emit("playbackStopped"))},100)},a.start()}catch(t){e.currentSource=null,e.emit("playbackError",t),e.audioQueue.length>0?(e.isProcessingQueue=!1,setTimeout(()=>e.processQueue(),100)):(e.isPlaying=!1,e.isProcessingQueue=!1,e.emit("playbackStopped"))}else e.isProcessingQueue=!1}})()}stop(){this.stopImmediate()}stopImmediate(){var e=this.isPlaying||null!==this.currentSource;if(this.currentSource){try{this.currentSource.stop()}catch(e){}this.currentSource=null}this.isPlaying=!1,this.isProcessingQueue=!1,this.audioQueue=[],e&&this.emit("playbackStopped")}resumeAudioContext(){var e=this;return We(function*(){if(e.audioContext&&"closed"!==e.audioContext.state){if("suspended"===e.audioContext.state)try{yield e.audioContext.resume(),console.log("✅ AudioPlayer: AudioContext resumed after mic permission")}catch(e){console.warn("⚠️ AudioPlayer: Failed to resume AudioContext:",e)}}else yield e.initializeAudioContext()})()}getStatus(){return{isPlaying:this.isPlaying,isProcessingQueue:this.isProcessingQueue,queueLength:this.audioQueue.length,audioContextState:this.audioContext?this.audioContext.state:"closed"}}destroy(){this.stop(),this.audioContext&&"closed"!==this.audioContext.state&&(this.audioContext.close(),this.audioContext=null),this.audioContextReady=!1}}function Xe(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function Ye(){var e=navigator.userAgent,t=/iPad|iPhone|iPod/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,n=/Android/.test(e),A=/Mac/.test(e)&&!t,o=/Win/.test(e),i=/Chrome/.test(e)&&!/Edg|OPR/.test(e),r=/Safari/.test(e)&&!/Chrome/.test(e),a=/Firefox/.test(e),s=/Edg/.test(e),c=/SamsungBrowser/.test(e),l="unknown";t?l="safari":c?l="samsung":i?l="chrome":r?l="safari":a?l="firefox":s&&(l="edge");var d="unknown";return t?d="ios":n?d="android":A?d="mac":o&&(d="windows"),{platform:d,browser:l,isIOS:t,isAndroid:n,isMac:A,isWindows:o,isMobile:t||n,isDesktop:!t&&!n}}function Je(){return Ze.apply(this,arguments)}function Ze(){var e;return e=function*(){try{if(navigator.permissions&&navigator.permissions.query)return(yield navigator.permissions.query({name:"microphone"})).state}catch(e){console.log("⚠️ MicPermissionUtils: Permissions API not available or not supported for microphone")}return"unknown"},Ze=function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){Xe(i,A,o,r,a,"next",e)}function a(e){Xe(i,A,o,r,a,"throw",e)}r(void 0)})},Ze.apply(this,arguments)}function $e(e){var{platform:t,browser:n}=e,A={ios:{title:"Enable Microphone on iPhone/iPad",icon:"📱",steps:["Tap the <strong>lock icon 🔒</strong>, <strong>information icon ℹ️</strong>, or <strong>AA icon</strong> in the address bar","Tap <strong>Website Settings</strong> or <strong>Permissions</strong>","Find <strong>Microphone</strong> and set it to <strong>Allow</strong>","Return to this page and refresh"],altTitle:"Alternative Method",altSteps:["Open the <strong>Settings</strong> app on your device","Scroll down and tap <strong>Safari</strong> (or your browser app)",'Tap <strong>Microphone</strong> under "Settings for Websites"',"Set it to <strong>Allow</strong> or <strong>Ask</strong>","Return to this page and refresh"],note:"On iOS, you can also change permissions in the browser address bar or in device Settings.",canOpenSettings:!0,settingsButtonText:"Open Settings App"},android_chrome:{title:"Enable Microphone in Chrome",icon:"🤖",steps:["Tap the <strong>lock icon 🔒</strong>, <strong>information icon ℹ️</strong>, or <strong>settings icon ⋮</strong> in the address bar","Tap <strong>Permissions</strong>","Tap <strong>Microphone</strong>","Select <strong>Allow</strong>","The page will refresh automatically"],altTitle:"Alternative Method",altSteps:["Tap the <strong>⋮ menu</strong> (three dots)","Tap <strong>Settings → Site settings → Microphone</strong>","Find this website and set to <strong>Allow</strong>"],canOpenSettings:!0,settingsButtonText:"Open App Settings"},android_firefox:{title:"Enable Microphone in Firefox",icon:"🦊",steps:["Tap the <strong>lock icon 🔒</strong> or <strong>information icon ℹ️</strong> in the address bar","Tap <strong>Edit Site Permissions</strong>","Toggle <strong>Microphone</strong> to enabled","Refresh the page"],canOpenSettings:!1},android_samsung:{title:"Enable Microphone in Samsung Browser",icon:"📱",steps:["Tap the <strong>menu icon</strong> (three lines)","Tap <strong>Settings → Sites and downloads</strong>","Tap <strong>Site permissions → Microphone</strong>","Find this website and set to <strong>Allow</strong>","Return and refresh the page"],canOpenSettings:!1},desktop_chrome:{title:"Enable Microphone in Chrome",icon:"🌐",steps:["Click the <strong>lock icon 🔒</strong> or <strong>information icon ℹ️</strong> in the address bar (left side)","Find <strong>Microphone</strong> in the dropdown menu",'Change it from "Block" to <strong>Allow</strong>',"Click the <strong>Refresh</strong> button or press F5"],showAddressBarHint:!0,canOpenSettings:!1},desktop_safari:{title:"Enable Microphone in Safari",icon:"🧭",steps:["Click <strong>Safari</strong> in the menu bar (top of screen)","Click <strong>Settings for This Website...</strong>","Find <strong>Microphone</strong> in the popup","Change it to <strong>Allow</strong>","Close settings and refresh the page"],canOpenSettings:!1},desktop_firefox:{title:"Enable Microphone in Firefox",icon:"🦊",steps:["Click the <strong>lock icon 🔒</strong> in the address bar",'Click the <strong>X</strong> next to "Blocked" for Microphone',"Refresh the page (press F5)","Click <strong>Allow</strong> when prompted again"],note:"Firefox requires you to clear the block and then re-allow on the next prompt.",showAddressBarHint:!0,canOpenSettings:!1},desktop_edge:{title:"Enable Microphone in Edge",icon:"🌐",steps:["Click the <strong>lock icon 🔒</strong> in the address bar","Find <strong>Microphone</strong> in the permissions list","Change it to <strong>Allow</strong>","Refresh the page"],showAddressBarHint:!0,canOpenSettings:!1},unknown:{title:"Enable Microphone Access",icon:"🎤",steps:["Look for a <strong>lock icon 🔒</strong>, <strong>information icon ℹ️</strong>, or <strong>settings icon</strong> in your browser's address bar","Find the <strong>Microphone</strong> permission setting","Change it to <strong>Allow</strong>","Refresh this page"],canOpenSettings:!1}};return"ios"===t?A.ios:"android"===t?A["android_".concat(n)]||A.android_chrome:A["desktop_".concat(n)]||A.desktop_chrome}function et(e){var{isIOS:t,isAndroid:n,browser:A}=e;if(t)try{return window.location.href="app-settings:",!0}catch(e){return console.warn("Could not open iOS settings:",e),!1}if(n&&"chrome"===A)try{return window.location.href="intent:#Intent;action=android.settings.APPLICATION_DETAILS_SETTINGS;data=package:com.android.chrome;end",!0}catch(e){return console.warn("Could not open Android settings:",e),!1}return!1}function tt(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function nt(){var e;return e=function*(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{default:0,android:3e3,ios:0},{isIOS:A,isAndroid:o}=Ye(),i=null!==(e=n.default)&&void 0!==e?e:0;if(o)i=null!==(t=n.android)&&void 0!==t?t:i;else if(A){var r;i=null!==(r=n.ios)&&void 0!==r?r:i}i>0&&(console.log("📱 applyDelay: waiting ".concat(i,"ms for mobile audio session (").concat(o?"Android":"iOS",")")),yield new Promise(e=>setTimeout(e,i)))},nt=function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){tt(i,A,o,r,a,"next",e)}function a(e){tt(i,A,o,r,a,"throw",e)}r(void 0)})},nt.apply(this,arguments)}class At{constructor(){this.overlay=null,this.modal=null}createOverlay(){var e=document.createElement("div");return e.className="mic-permission-overlay",e.style.cssText="\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.6);\n backdrop-filter: blur(4px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 100001;\n padding: 20px;\n animation: mic-fadeIn 0.2s ease-out;\n ",document.getElementById("mic-permission-styles")||this.injectStyles(),e}injectStyles(){if(!document.getElementById("mic-permission-styles")){var e=document.createElement("style");e.id="mic-permission-styles",e.textContent="\n @keyframes mic-fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n @keyframes mic-slideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n \n @keyframes mic-bounce {\n 0%, 100% { transform: translateY(0); }\n 50% { transform: translateY(-5px); }\n }\n \n .mic-permission-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.6);\n backdrop-filter: blur(4px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 100001;\n padding: 20px;\n animation: mic-fadeIn 0.2s ease-out;\n }\n \n .mic-permission-modal {\n background: #ffffff;\n border-radius: 16px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n max-width: 480px;\n width: 100%;\n padding: 32px;\n position: relative;\n animation: mic-slideUp 0.3s ease-out;\n max-height: 90vh;\n overflow-y: auto;\n }\n \n .mic-permission-modal__close {\n position: absolute;\n top: 16px;\n right: 16px;\n background: none;\n border: none;\n font-size: 20px;\n cursor: pointer;\n color: #6b7280;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.2s;\n }\n \n .mic-permission-modal__close:hover {\n background: #e5e7eb;\n }\n \n .mic-permission-modal__icon {\n font-size: 48px;\n text-align: center;\n margin-bottom: 16px;\n }\n \n .mic-permission-modal__title {\n font-size: 24px;\n font-weight: 700;\n color: #111827;\n margin: 0 0 12px;\n line-height: 1.3;\n text-align: center;\n }\n \n .mic-permission-modal__description {\n color: #6b7280;\n font-size: 16px;\n line-height: 1.6;\n margin: 0 0 20px;\n text-align: center;\n }\n \n .mic-permission-modal__highlight {\n display: flex;\n align-items: center;\n gap: 12px;\n background: linear-gradient(135deg, #dbeafe, #ede9fe);\n padding: 16px 20px;\n border-radius: 8px;\n margin-bottom: 20px;\n border: 1px solid #bfdbfe;\n }\n \n .mic-permission-modal__highlight-icon {\n font-size: 24px;\n animation: mic-bounce 1s infinite;\n }\n \n .mic-permission-modal__status {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: #fef2f2;\n color: #ef4444;\n padding: 12px 16px;\n border-radius: 8px;\n margin-bottom: 20px;\n font-weight: 500;\n }\n \n .mic-permission-modal__note {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n background: #fffbeb;\n color: #92400e;\n padding: 12px 16px;\n border-radius: 8px;\n margin-bottom: 20px;\n font-size: 14px;\n line-height: 1.5;\n border: 1px solid #fde68a;\n }\n \n .mic-permission-modal__steps {\n margin-bottom: 20px;\n }\n \n .mic-permission-modal__steps h3 {\n font-size: 14px;\n font-weight: 600;\n color: #6b7280;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin: 0 0 12px;\n }\n \n .mic-permission-modal__steps ol {\n margin: 0;\n padding-left: 24px;\n counter-reset: step-counter;\n list-style: none;\n }\n \n .mic-permission-modal__steps li {\n position: relative;\n padding: 12px 0 12px 16px;\n border-left: 2px solid #e5e7eb;\n color: #111827;\n font-size: 15px;\n line-height: 1.5;\n counter-increment: step-counter;\n }\n \n .mic-permission-modal__steps li::before {\n content: counter(step-counter);\n position: absolute;\n left: -14px;\n top: 10px;\n width: 24px;\n height: 24px;\n background: #4f46e5;\n color: white;\n border-radius: 50%;\n font-size: 12px;\n font-weight: 600;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .mic-permission-modal__steps li:last-child {\n border-left-color: transparent;\n }\n \n .mic-permission-modal__actions {\n display: flex;\n flex-direction: column;\n gap: 10px;\n margin-top: 24px;\n }\n \n .mic-permission-modal__btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 14px 24px;\n border-radius: 8px;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n border: none;\n width: 100%;\n }\n \n .mic-permission-modal__btn--primary {\n background: #4f46e5;\n color: white;\n }\n \n .mic-permission-modal__btn--primary:hover {\n background: #4338ca;\n transform: translateY(-1px);\n }\n \n .mic-permission-modal__btn--secondary {\n background: #e5e7eb;\n color: #111827;\n }\n \n .mic-permission-modal__btn--secondary:hover {\n background: #d1d5db;\n }\n \n .mic-permission-modal__footer {\n text-align: center;\n font-size: 13px;\n color: #6b7280;\n margin-top: 20px;\n margin-bottom: 0;\n }\n \n .mic-permission-modal__visual-guide {\n width: 100%;\n max-width: 380px;\n height: auto;\n margin: 20px auto;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n display: block;\n }\n \n .mic-permission-modal__visual-guide-container {\n text-align: center;\n margin: 20px 0;\n }\n \n @media (max-width: 480px) {\n .mic-permission-modal {\n padding: 24px 20px;\n margin: 10px;\n max-height: 85vh;\n }\n \n .mic-permission-modal__title {\n font-size: 20px;\n }\n \n .mic-permission-modal__icon {\n font-size: 40px;\n }\n \n .mic-permission-modal__visual-guide {\n max-width: 100%;\n }\n }\n \n /* Mobile pre-prompt: compact, action-first layout - buttons always visible above safe area */\n .mic-permission-modal--mobile {\n max-height: none;\n padding: 20px 20px 24px;\n padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));\n margin: 12px;\n align-self: flex-end;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__icon {\n font-size: 36px;\n margin-bottom: 12px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__title {\n font-size: 18px;\n margin-bottom: 8px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__description {\n font-size: 14px;\n margin-bottom: 12px;\n line-height: 1.5;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__highlight {\n padding: 12px 16px;\n margin-bottom: 12px;\n font-size: 14px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__note {\n padding: 10px 14px;\n margin-bottom: 16px;\n font-size: 13px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__actions {\n margin-top: 16px;\n gap: 10px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__btn {\n padding: 16px 24px;\n font-size: 16px;\n min-height: 48px;\n }\n ",document.head.appendChild(e)}}close(){this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay),this.overlay=null,this.modal=null}show(){this.overlay&&this.modal&&document.body.appendChild(this.overlay)}}function ot(e,t){var n=new At,A=n.createOverlay(),o=Ye(),i=function(){var e=Ye();return e.isIOS||e.isAndroid}();A.style.background="rgba(0, 0, 0, 0.3)",A.style.backdropFilter="none",A.style.webkitBackdropFilter="none";var r=document.createElement("div");r.className="mic-permission-modal"+(i?" mic-permission-modal--mobile":"");var a=i?"Allow Microphone":"Enable Your Microphone",s=i?"Tap Continue, then tap Allow when your browser asks.":"To start a voice call with our agent, we need access to your microphone.",c=i?'Tap <strong>"Allow"</strong> on the popup':'Please click <strong>"Allow"</strong> on the next popup';return r.innerHTML='\n <div class="mic-permission-modal__icon">🎤</div>\n <h2 class="mic-permission-modal__title">'.concat(a,'</h2>\n <p class="mic-permission-modal__description">').concat(s,'</p>\n <div class="mic-permission-modal__highlight">\n <span class="mic-permission-modal__highlight-icon">👆</span>\n <span>').concat(c,"</span>\n </div>\n ").concat(o.isIOS?'\n <div class="mic-permission-modal__note">\n <span>ℹ️</span>\n <span>'.concat(i?"If blocked, enable in Settings → Safari/App → Microphone":"On iPhone/iPad, you may need to allow microphone access in your device Settings.","</span>\n </div>\n "):"",'\n <div class="mic-permission-modal__actions">\n <button class="mic-permission-modal__btn mic-permission-modal__btn--primary" data-action="accept">\n Continue\n </button>\n <button class="mic-permission-modal__btn mic-permission-modal__btn--secondary" data-action="cancel">\n Not Now\n </button>\n </div>\n '),i&&(A.style.alignItems="flex-end",A.style.paddingBottom="max(20px, env(safe-area-inset-bottom, 20px))",A.style.paddingTop="20px"),A.appendChild(r),n.overlay=A,n.modal=r,r.querySelector('[data-action="accept"]').addEventListener("click",()=>{n.close(),e()}),r.querySelector('[data-action="cancel"]').addEventListener("click",()=>{n.close(),t()}),A.addEventListener("click",e=>{e.target===A&&(n.close(),t())}),n.show(),n}function it(e,t){var n,A,o,i=new At,r=i.createOverlay(),a=Ye(),s=$e(a),c=document.createElement("div");c.className="mic-permission-modal";var l="";s.altSteps&&s.altSteps.length>0&&(l='\n <div style="margin-top: 20px; border-top: 1px solid #e5e7eb; padding-top: 16px;">\n <button class="mic-permission-modal__alt-toggle" style="background: none; border: none; color: #4f46e5; font-size: 14px; font-weight: 500; cursor: pointer; padding: 0; margin-bottom: 12px;">\n ▼ '.concat(s.altTitle||"Alternative method",'\n </button>\n <ol style="margin: 0; padding-left: 20px; display: none;">\n ').concat(s.altSteps.map(e=>'<li style="padding: 8px 0; font-size: 14px; color: #6b7280;">'.concat(e,"</li>")).join(""),"\n </ol>\n </div>\n "));var d=function(e){var{platform:t,browser:n}=e,A=document.getElementsByTagName("script"),o="";for(var i of A){var r=i.src;if(r&&(r.includes("agent-widget.js")||r.includes("ttp-agent-sdk")||r.includes("ttp-sdk-front")))try{new URL(r),o=r.substring(0,r.lastIndexOf("/"));break}catch(e){var a=r.match(/^(.*\/)[^\/]+$/);if(a){o=a[1];break}}}var s;if(s="ios"===t?"ios-settings.svg":"android"===t?"android-chrome.svg":"chrome"===n?"desktop-chrome.svg":"safari"===n?"desktop-safari.svg":"firefox"===n?"desktop-firefox.svg":"edge"===n?"desktop-edge.svg":"desktop-chrome.svg",!o||""===o||o.startsWith("/")){for(var c of A){var l=c.src;if(l&&(l.includes("cdn.talktopc.com")||l.includes("talktopc.com"))){if(l.includes("/ttp-agent-sdk/")||l.includes("/ttp-sdk-front/")){var d=l.match(/(https?:\/\/[^\/]+(?:\/[^\/]+)*)/);if(d){o=d[1].replace(/\/[^\/]+\.js$/,"");break}}if(!o&&(l.includes("cdn.talktopc.com")||l.includes("talktopc.com"))){o="https://cdn.talktopc.com/ttp-agent-sdk";break}}}if(!o||""===o)if(window.location.hostname.includes("cdn.talktopc.com")||window.location.hostname.includes("talktopc.com"))o="https://cdn.talktopc.com/ttp-agent-sdk";else{var p=window.location.pathname.split("/");p.pop(),(o=window.location.origin+p.join("/"))&&o!==window.location.origin||(o=window.location.origin)}}o=o.replace(/\/$/,"");var u="".concat(o,"/shared/mic-permission-assets/").concat(s);return"undefined"!=typeof console&&console.log&&console.log("[MicPermission] Visual guide path:",u,"Base path:",o,"Platform:",t,"Browser:",n),u}(a);c.innerHTML='\n <button class="mic-permission-modal__close" data-action="close">✕</button>\n <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 20px;">\n <span style="font-size: 32px;">'.concat(s.icon,'</span>\n <h2 class="mic-permission-modal__title" style="text-align: left; margin: 0;">').concat(s.title,'</h2>\n </div>\n <div class="mic-permission-modal__status">\n <span>🚫</span>\n <span>Microphone access is currently blocked</span>\n </div>\n ').concat(s.note?'\n <div class="mic-permission-modal__note">\n <span>ℹ️</span>\n <span>'.concat(s.note,"</span>\n </div>\n "):"",'\n <div class="mic-permission-modal__visual-guide-container">\n <img src="').concat(d,'" alt="Visual guide for enabling microphone" class="mic-permission-modal__visual-guide" \n onerror="console.error(\'[MicPermission] Failed to load image:\', this.src); this.style.display=\'none\';" \n onload="console.log(\'[MicPermission] Image loaded successfully:\', this.src);" />\n </div>\n <div class="mic-permission-modal__steps">\n <h3>Follow these steps:</h3>\n <ol>\n ').concat(s.steps.map(e=>"<li>".concat(e,"</li>")).join(""),"\n </ol>\n </div>\n ").concat(l,'\n <div class="mic-permission-modal__actions">\n ').concat(s.canOpenSettings?'\n <button class="mic-permission-modal__btn mic-permission-modal__btn--primary" data-action="open-settings">\n '.concat(s.settingsButtonText||"Open Settings","\n </button>\n "):"","\n ").concat(s.showAddressBarHint?'\n <button class="mic-permission-modal__btn mic-permission-modal__btn--primary" data-action="show-hint">\n Show Me Where\n </button>\n ':"",'\n <button class="mic-permission-modal__btn mic-permission-modal__btn--secondary" data-action="refresh">\n 🔄 Refresh Page\n </button>\n </div>\n <p class="mic-permission-modal__footer">\n After enabling microphone access, return here and click "Refresh Page"\n </p>\n '),r.appendChild(c),i.overlay=r,i.modal=c,null===(n=c.querySelector('[data-action="close"]'))||void 0===n||n.addEventListener("click",()=>{i.close(),e()}),null===(A=c.querySelector('[data-action="open-settings"]'))||void 0===A||A.addEventListener("click",()=>{et(a)}),null===(o=c.querySelector('[data-action="refresh"]'))||void 0===o||o.addEventListener("click",()=>{window.location.reload()});var p=c.querySelector('[data-action="show-hint"]');p&&p.addEventListener("click",()=>{i.close(),e(),function(){var e=document.getElementById("mic-address-bar-hint");e&&e.remove(),Ye();var t=document.getElementsByTagName("script"),n="";for(var A of t){var o=A.src;if(o&&(o.includes("agent-widget.js")||o.includes("ttp-agent-sdk")||o.includes("ttp-sdk-front")))try{new URL(o),n=o.substring(0,o.lastIndexOf("/"));break}catch(e){var i=o.match(/^(.*\/)[^\/]+$/);if(i){n=i[1];break}}}if(!n||""===n||n.startsWith("/")){for(var r of t){var a=r.src;if(a&&(a.includes("cdn.talktopc.com")||a.includes("talktopc.com"))){if(a.includes("/ttp-agent-sdk/")||a.includes("/ttp-sdk-front/")){var s=a.match(/(https?:\/\/[^\/]+(?:\/[^\/]+)*)/);if(s){n=s[1].replace(/\/[^\/]+\.js$/,"");break}}if(!n&&(a.includes("cdn.talktopc.com")||a.includes("talktopc.com"))){n="https://cdn.talktopc.com/ttp-agent-sdk";break}}}if(!n||""===n)if(window.location.hostname.includes("cdn.talktopc.com")||window.location.hostname.includes("talktopc.com"))n="https://cdn.talktopc.com/ttp-agent-sdk";else{var c=window.location.pathname.split("/");c.pop(),(n=window.location.origin+c.join("/"))&&n!==window.location.origin||(n=window.location.origin)}}n=n.replace(/\/$/,"");var l="".concat(n,"/shared/mic-permission-assets/address-bar-hint.svg"),d=document.createElement("div");d.id="mic-address-bar-hint",d.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n z-index: 10001;\n padding: 10px 20px;\n pointer-events: none;\n animation: mic-fadeIn 0.3s ease-out;\n display: flex;\n justify-content: center;\n ";var p=document.createElement("div");p.style.cssText="\n display: flex;\n align-items: center;\n gap: 12px;\n background: #f59e0b;\n color: white;\n padding: 12px 20px;\n border-radius: 0 0 8px 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n pointer-events: all;\n animation: mic-slideDown 0.3s ease-out;\n max-width: 540px;\n ";var u=document.createElement("div");u.style.cssText="\n flex-shrink: 0;\n ";var h=document.createElement("img");h.src=l,h.alt="Address bar hint",h.style.cssText="\n width: auto;\n height: 80px;\n display: block;\n ",h.onerror=()=>{u.style.display="none"},u.appendChild(h);var g=document.createElement("div");g.style.cssText="\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n ";var m=document.createElement("div");m.style.cssText="\n font-size: 15px;\n font-weight: 500;\n ",m.innerHTML="Click the <strong>lock icon 🔒</strong>, <strong>information icon ℹ️</strong>, or <strong>settings icon ⋮</strong> in the address bar to enable microphone";var f=document.createElement("button");if(f.style.cssText="\n background: rgba(255, 255, 255, 0.2);\n border: none;\n color: white;\n width: 28px;\n height: 28px;\n border-radius: 50%;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n transition: background 0.2s;\n flex-shrink: 0;\n ",f.textContent="✕",f.addEventListener("click",()=>{d.remove()}),f.addEventListener("mouseenter",()=>{f.style.background="rgba(255, 255, 255, 0.3)"}),f.addEventListener("mouseleave",()=>{f.style.background="rgba(255, 255, 255, 0.2)"}),!document.getElementById("mic-address-bar-hint-styles")){var v=document.createElement("style");v.id="mic-address-bar-hint-styles",v.textContent="\n @keyframes mic-slideDown {\n from {\n opacity: 0;\n transform: translateY(-100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n \n @keyframes mic-pointUp {\n 0%, 100% {\n transform: translate(0, 0);\n }\n 50% {\n transform: translate(-5px, -5px);\n }\n }\n ",document.head.appendChild(v)}g.appendChild(m),p.appendChild(u),p.appendChild(g),p.appendChild(f),d.appendChild(p),document.body.appendChild(d),setTimeout(()=>{d.parentNode&&(d.style.opacity="0",d.style.transition="opacity 0.3s ease-out",setTimeout(()=>{d.parentNode&&d.remove()},300))},1e4)}()});var u=c.querySelector(".mic-permission-modal__alt-toggle");if(u&&s.altSteps){var h=u.nextElementSibling;h&&(h.style.display="none",u.addEventListener("click",()=>{"none"===h.style.display?(h.style.display="block",u.innerHTML="▼ ".concat(s.altTitle||"Alternative method")):(h.style.display="none",u.innerHTML="▶ ".concat(s.altTitle||"Alternative method"))}))}return r.addEventListener("click",t=>{t.target===r&&(i.close(),e())}),i.show(),i}function rt(e){var t=new At,n=t.createOverlay(),A=document.createElement("div");return A.className="mic-permission-modal",A.innerHTML='\n <div class="mic-permission-modal__icon">🎤❌</div>\n <h2 class="mic-permission-modal__title">No Microphone Found</h2>\n <p class="mic-permission-modal__description">\n We couldn\'t detect a microphone on your device. Please make sure:\n </p>\n <ul style="list-style: none; padding: 0; margin: 0 0 24px;">\n <li style="padding: 10px 0 10px 32px; position: relative; color: #111827; border-bottom: 1px solid #e5e7eb;">\n <span style="position: absolute; left: 0; font-size: 18px;">☐</span>\n Your microphone is properly connected\n </li>\n <li style="padding: 10px 0 10px 32px; position: relative; color: #111827; border-bottom: 1px solid #e5e7eb;">\n <span style="position: absolute; left: 0; font-size: 18px;">☐</span>\n Your microphone is not muted at the hardware level\n </li>\n <li style="padding: 10px 0 10px 32px; position: relative; color: #111827;">\n <span style="position: absolute; left: 0; font-size: 18px;">☐</span>\n No other app is exclusively using the microphone\n </li>\n </ul>\n <div class="mic-permission-modal__actions">\n <button class="mic-permission-modal__btn mic-permission-modal__btn--primary" data-action="retry">\n Retry\n </button>\n <button class="mic-permission-modal__btn mic-permission-modal__btn--secondary" data-action="close">\n Close\n </button>\n </div>\n ',n.appendChild(A),t.overlay=n,t.modal=A,A.querySelector('[data-action="retry"]').addEventListener("click",()=>{window.location.reload()}),A.querySelector('[data-action="close"]').addEventListener("click",()=>{t.close(),e()}),n.addEventListener("click",A=>{A.target===n&&(t.close(),e())}),t.show(),t}class at{constructor(e){this.voiceInterface=e,this.config=e.config}t(e){return this.voiceInterface.t(e)}getText(e,t){return this.voiceInterface.getText(e,t)}getTooltip(e){return this.voiceInterface.getTooltip(e)}generateHTML(){return this.voiceInterface.isMobile?this.generateMobileHTML():'<div class="voice-interface" id="voiceInterface">\n \x3c!-- Before Call State --\x3e\n <div id="voiceIdleState">\n <div class="voice-avatar" id="voiceAvatar">🤖</div>\n <div class="voice-status">\n <div class="voice-status-title">'.concat(this.getText("startCallTitle","clickToStartCall"),'</div>\n <div class="voice-status-subtitle">').concat(this.getText("startCallSubtitle","realTimeVoice"),'</div>\n </div>\n <button type="button" class="start-call-btn" id="startCallBtn">\n <svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">\n <path d="M20.01 15.38c-1.23 0-2.42-.2-3.53-.56-.35-.12-.74-.03-1.01.24l-1.57 1.97c-2.83-1.35-5.48-3.9-6.89-6.83l1.95-1.66c.27-.28.35-.67.24-1.02-.37-1.11-.56-2.3-.56-3.53 0-.54-.45-.99-.99-.99H4.19C3.65 3 3 3.24 3 3.99 3 13.28 10.73 21 20.01 21c.71 0 .99-.63.99-1.18v-3.45c0-.54-.45-.99-.99-.99z"/>\n </svg>\n <span>').concat(this.getText("startCallButtonText","startCall"),'</span>\n </button>\n </div>\n \x3c!-- During Call State - Desktop View --\x3e\n <div id="voiceActiveState" style="display: none;">\n \x3c!-- Original Multi-Row Voice Section (shown when history is collapsed) --\x3e\n <div class="desktop-voice-section" id="desktopVoiceSection">\n \x3c!-- Timer --\x3e\n <div class="desktop-timer">\n <div class="timer-dot"></div>\n <span id="desktopTimerText">00:00</span>\n </div>\n\n \x3c!-- Main Waveform --\x3e\n <div class="desktop-main-waveform" id="desktopMainWaveform">\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n </div>\n\n \x3c!-- Status --\x3e\n <div class="desktop-status" id="desktopStatus">\n <div class="status-dot"></div>\n <span id="desktopStatusText">').concat(this.t("listening")||"Listening...",'</span>\n </div>\n\n \x3c!-- Controls --\x3e\n <div class="desktop-controls">\n <button type="button" class="desktop-control-btn secondary" id="desktopMuteBtn" title="').concat(this.getTooltip("mute"),'">\n <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" class="desktop-mic-icon">\n <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n <line x1="12" y1="19" x2="12" y2="23"/>\n </svg>\n <svg fill="none" viewBox="0 0 24 24" class="desktop-mic-off-icon" style="display: none; position: absolute;">\n \x3c!-- Original mic icon (same as normal state) --\x3e\n <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" stroke="currentColor" stroke-width="2" fill="none"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2" stroke="currentColor" stroke-width="2" fill="none"/>\n <line x1="12" y1="19" x2="12" y2="23" stroke="currentColor" stroke-width="2"/>\n \x3c!-- Red circle surrounding the icon --\x3e\n <circle cx="12" cy="12" r="11.8" fill="none" stroke="#ef4444" stroke-width="2"/>\n \x3c!-- Red diagonal strike line --\x3e\n <line x1="4" y1="4" x2="20" y2="20" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round"/>\n </svg>\n </button>\n <button type="button" class="desktop-control-btn danger" id="desktopEndCallBtn" title="').concat(this.getTooltip("endCall"),'">\n <svg fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24" style="overflow: visible;">\n <path d="M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.5 19.5 0 01-6-6 19.79 19.79 0 01-3.07-8.67A2 2 0 014.11 2h3a2 2 0 012 1.72c.127.96.361 1.903.7 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0122 16.92z" transform="rotate(135 12 12)"/>\n </svg>\n </button>\n <button type="button" class="desktop-control-btn secondary" id="desktopSpeakerBtn" title="').concat(this.getTooltip("speaker"),'">\n <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" class="desktop-speaker-icon">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M19.07 4.93a10 10 0 010 14.14M15.54 8.46a5 5 0 010 7.07"/>\n </svg>\n <svg fill="none" viewBox="0 0 24 24" class="desktop-speaker-off-icon" style="display: none; position: absolute;">\n \x3c!-- Original speaker icon (same as normal state) --\x3e\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" stroke="currentColor" stroke-width="2" fill="none"/>\n <path d="M19.07 4.93a10 10 0 010 14.14" stroke="currentColor" stroke-width="2" fill="none"/>\n <path d="M15.54 8.46a5 5 0 010 7.07" stroke="currentColor" stroke-width="2" fill="none"/>\n \x3c!-- Red circle surrounding the icon --\x3e\n <circle cx="12" cy="12" r="11.8" fill="none" stroke="#ef4444" stroke-width="2"/>\n \x3c!-- Red diagonal strike line --\x3e\n <line x1="4" y1="4" x2="20" y2="20" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round"/>\n </svg>\n </button>\n </div>\n </div>\n\n \x3c!-- Compact Voice Section - Single Row Layout (shown only when history is expanded) --\x3e\n <div class="compact-voice-section" id="compactVoiceSection" style="display: none;">\n \x3c!-- Left side: Avatar + Info --\x3e\n <div class="compact-left">\n \x3c!-- Avatar container with waveform --\x3e\n <div class="compact-avatar" id="desktopAvatarCompact">\n \x3c!-- Main Waveform - Scaled down for compact view --\x3e\n <div class="desktop-main-waveform" id="desktopMainWaveformCompact">\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n <div class="waveform-bar"></div>\n </div>\n </div>\n \n \x3c!-- Timer and Status stacked vertically --\x3e\n <div class="compact-info">\n <div class="compact-timer" id="desktopTimerCompact">\n <span class="timer-dot"></span>\n <span id="compactTimerText">00:00</span>\n </div>\n <div class="compact-status" id="desktopStatusCompact">\n <span class="status-dot"></span>\n <span id="compactStatusText">').concat(this.t("listening")||"Listening",'</span>\n </div>\n </div>\n </div>\n \n \x3c!-- Right side: Control buttons (reuse same IDs, handlers will work for both) --\x3e\n <div class="compact-controls">\n <button type="button" class="compact-control-btn secondary" id="desktopMuteBtnCompact" title="').concat(this.getTooltip("mute"),'">\n <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" class="desktop-mic-icon">\n <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n <line x1="12" y1="19" x2="12" y2="23"/>\n </svg>\n <svg fill="none" viewBox="0 0 24 24" class="desktop-mic-off-icon" style="display: none; position: absolute;">\n \x3c!-- Original mic icon (same as normal state) --\x3e\n <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" stroke="currentColor" stroke-width="2" fill="none"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2" stroke="currentColor" stroke-width="2" fill="none"/>\n <line x1="12" y1="19" x2="12" y2="23" stroke="currentColor" stroke-width="2"/>\n \x3c!-- Red circle surrounding the icon --\x3e\n <circle cx="12" cy="12" r="11.8" fill="none" stroke="#ef4444" stroke-width="2"/>\n \x3c!-- Red diagonal strike line --\x3e\n <line x1="4" y1="4" x2="20" y2="20" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round"/>\n </svg>\n </button>\n <button type="button" class="compact-control-btn danger" id="desktopEndCallBtnCompact" title="').concat(this.getTooltip("endCall"),'">\n <svg fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24" style="overflow: visible;">\n <path d="M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.5 19.5 0 01-6-6 19.79 19.79 0 01-3.07-8.67A2 2 0 014.11 2h3a2 2 0 012 1.72c.127.96.361 1.903.7 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0122 16.92z" transform="rotate(135 12 12)"/>\n </svg>\n </button>\n <button type="button" class="compact-control-btn secondary" id="desktopSpeakerBtnCompact" title="').concat(this.getTooltip("speaker"),'">\n <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" class="desktop-speaker-icon">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M19.07 4.93a10 10 0 010 14.14M15.54 8.46a5 5 0 010 7.07"/>\n </svg>\n <svg fill="none" viewBox="0 0 24 24" class="desktop-speaker-off-icon" style="display: none; position: absolute;">\n \x3c!-- Original speaker icon (same as normal state) --\x3e\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" stroke="currentColor" stroke-width="2" fill="none"/>\n <path d="M19.07 4.93a10 10 0 010 14.14" stroke="currentColor" stroke-width="2" fill="none"/>\n <path d="M15.54 8.46a5 5 0 010 7.07" stroke="currentColor" stroke-width="2" fill="none"/>\n \x3c!-- Red circle surrounding the icon --\x3e\n <circle cx="12" cy="12" r="11.8" fill="none" stroke="#ef4444" stroke-width="2"/>\n \x3c!-- Red diagonal strike line --\x3e\n <line x1="4" y1="4" x2="20" y2="20" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round"/>\n </svg>\n </button>\n </div>\n </div>\n\n \x3c!-- Conversation Panel --\x3e\n <div class="desktop-conversation-panel collapsed" id="desktopConversationPanel">\n \x3c!-- Header --\x3e\n <div class="conversation-header" id="conversationHeader">\n <span class="conversation-label">').concat(this.t("conversation")||"Conversation",'</span>\n <span class="conversation-toggle">\n <span id="conversationToggleText">Show history</span>\n <svg width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">\n <path d="M6 9l6 6 6-6"/>\n </svg>\n </span>\n </div>\n\n \x3c!-- Collapsed: Live transcript only (2 lines) --\x3e\n <div class="live-transcript-collapsed" id="liveTranscriptCollapsed">\n <div class="live-indicator">\n <div class="live-dot"></div>\n <span>Live</span>\n </div>\n <div class="live-text-collapsed muted" id="liveTextCollapsed">\n ').concat(this.t("transcriptWillAppear")||"Transcript will appear here...",'<span class="typing-cursor"></span>\n </div>\n </div>\n\n \x3c!-- Expanded: Full conversation history --\x3e\n <div class="conversation-history" id="conversationHistory">\n <div class="conversation-messages" id="conversationMessages">\n \x3c!-- Messages will be rendered here --\x3e\n </div>\n \n \x3c!-- Live message at bottom --\x3e\n <div class="live-message-row" id="liveMessageRow" style="display: none;">\n <div class="message-avatar assistant">\n <div class="orb"></div>\n </div>\n <div class="message-bubble">\n <span class="live-badge">Live</span>\n <span id="liveMessageText"></span><span class="typing-cursor"></span>\n </div>\n </div>\n </div>\n\n \x3c!-- Text Input --\x3e\n <div class="voice-text-input-area">\n <div class="voice-input-wrapper">\n <input type="text" class="voice-text-input" id="voiceTextInput" placeholder="').concat(this.getText("inputPlaceholder","typeMessage")||"Type a message...",'">\n <button type="button" class="voice-send-btn" id="voiceSendBtn">\n <svg width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">\n <line x1="22" y1="2" x2="11" y2="13"/>\n <polygon points="22 2 15 22 11 13 2 9 22 2"/>\n </svg>\n </button>\n </div>\n <div class="voice-input-hint" id="voiceInputHint">\n <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">\n <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/>\n </svg>\n ').concat(this.getText("voiceActiveHint","voiceActive")||"Voice is still active • Type or speak","\n </div>\n </div>\n </div>\n </div>\n </div>")}generateMobileHTML(){return'<div class="voice-interface mobile-voice-interface" id="voiceInterface">\n \x3c!-- Before Call State (same as desktop) --\x3e\n <div id="voiceIdleState">\n <div class="voice-avatar" id="voiceAvatar">🤖</div>\n <div class="voice-status">\n <div class="voice-status-title">'.concat(this.getText("startCallTitle","clickToStartCall"),'</div>\n <div class="voice-status-subtitle">').concat(this.getText("startCallSubtitle","realTimeVoice"),'</div>\n </div>\n <button type="button" class="start-call-btn" id="startCallBtn">\n <svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">\n <path d="M20.01 15.38c-1.23 0-2.42-.2-3.53-.56-.35-.12-.74-.03-1.01.24l-1.57 1.97c-2.83-1.35-5.48-3.9-6.89-6.83l1.95-1.66c.27-.28.35-.67.24-1.02-.37-1.11-.56-2.3-.56-3.53 0-.54-.45-.99-.99-.99H4.19C3.65 3 3 3.24 3 3.99 3 13.28 10.73 21 20.01 21c.71 0 .99-.63.99-1.18v-3.45c0-.54-.45-.99-.99-.99z"/>\n </svg>\n <span>').concat(this.getText("startCallButtonText","startCall"),'</span>\n </button>\n </div>\n \n \x3c!-- Mobile Active Call State - Hidden placeholder (actual bar will be appended to body) --\x3e\n <div id="voiceActiveState" class="mobile-active-state" style="display: none;">\n \x3c!-- Duration Badge --\x3e\n <div class="mobile-duration-badge" id="mobileDurationBadge">\n <div class="mobile-duration-dot"></div>\n <span id="mobileDurationText">00:00</span>\n </div>\n \n \x3c!-- Main Bar --\x3e\n <div class="mobile-voice-bar">\n \x3c!-- Top Row: Status, Waveform, Controls --\x3e\n <div class="mobile-top-row">\n \x3c!-- Status Indicator --\x3e\n <div class="mobile-status-indicator">\n <div class="mobile-status-dot" id="mobileStatusDot"></div>\n <span class="mobile-status-text" id="mobileStatusText">Listening...</span>\n </div>\n \n \x3c!-- Centered Waveform --\x3e\n <div class="mobile-waveform-center" id="mobileWaveform">\n ').concat(Array(8).fill(0).map((e,t)=>'<div class="mobile-waveform-bar" data-index="'.concat(t,'"></div>')).join(""),'\n </div>\n \n \x3c!-- Controls --\x3e\n <div class="mobile-controls">\n <button type="button" class="mobile-control-btn" id="mobileMuteBtn" aria-label="Mute microphone">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-mic-icon">\n <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n <line x1="12" x2="12" y1="19" y2="22"/>\n </svg>\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-mic-off-icon" style="display: none;">\n <line x1="2" x2="22" y1="2" y2="22"/>\n <path d="M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"/>\n <path d="M5 10v2a7 7 0 0 0 12 5"/>\n <path d="M15 9.34V5a3 3 0 0 0-5.68-1.33"/>\n <path d="M9 9v3a3 3 0 0 0 5.12 2.12"/>\n <line x1="12" x2="12" y1="19" y2="22"/>\n </svg>\n </button>\n \n <button type="button" class="mobile-control-btn" id="mobileSpeakerBtn" aria-label="Toggle speaker">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-speaker-icon">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07"/>\n </svg>\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-speaker-off-icon" style="display: none;">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <line x1="22" x2="16" y1="9" y2="15"/>\n <line x1="16" x2="22" y1="9" y2="15"/>\n </svg>\n </button>\n \n <button type="button" class="mobile-end-call-btn" id="mobileEndCallBtn" aria-label="End call">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/>\n <line x1="22" x2="2" y1="2" y2="22"/>\n </svg>\n </button>\n </div>\n </div>\n \n \x3c!-- Bottom Row: Transcript (expandable) --\x3e\n <button type="button" class="mobile-transcript-row" id="mobileTranscriptRow">\n <p class="mobile-transcript-text" id="mobileTranscriptText">').concat(this.t("transcriptWillAppear"),'</p>\n <div class="mobile-transcript-footer">\n <span class="mobile-expand-hint">tap to expand & type</span>\n <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="opacity: 0.6;">\n <path d="M7 17L17 7M17 7H7M17 7V17"/>\n </svg>\n </div>\n </button>\n </div>\n </div>\n \n \x3c!-- Expanded Transcript Overlay --\x3e\n <div class="mobile-transcript-overlay" id="mobileTranscriptOverlay" style="display: none;">\n <div class="mobile-expanded-transcript" id="mobileExpandedTranscript">\n \x3c!-- Header --\x3e\n <div class="mobile-transcript-header">\n <div class="mobile-header-left">\n <div class="mobile-header-status">\n <div class="mobile-header-status-dot"></div>\n <span class="mobile-header-status-text" id="mobileHeaderStatusText">Listening...</span>\n <span class="mobile-header-duration" id="mobileHeaderDuration">00:00</span>\n </div>\n <span class="mobile-transcript-label">CONVERSATION</span>\n </div>\n <button type="button" class="mobile-close-transcript-btn" id="mobileCloseTranscriptBtn">\n <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n \x3c!-- Messages Container --\x3e\n <div class="mobile-messages-container" id="mobileMessagesContainer">\n \x3c!-- Messages will be dynamically added here --\x3e\n </div>\n \n \x3c!-- Text Input Area --\x3e\n <div class="mobile-input-area">\n <div class="mobile-input-wrapper">\n <input\n type="text"\n placeholder="Type a message..."\n id="mobileTextInput"\n class="mobile-text-input"\n />\n <button type="button" class="mobile-send-btn" id="mobileSendBtn" disabled>\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"/>\n </svg>\n </button>\n </div>\n <p class="mobile-input-hint">🎙️ Voice is still active • Type or speak</p>\n </div>\n </div>\n </div>\n </div>')}}class st{constructor(e){this.voiceInterface=e,this.config=e.config}generateCSS(){var e,t=this.config.avatarBackgroundColor||"#667eea",n=this.config.avatarActiveBackgroundColor||this.config.avatarBackgroundColor||"#667eea",A=this.config.statusTitleColor||"#1e293b",o=this.config.statusSubtitleColor||"#64748b",i=this.config.statusDotColor||"#10b981",r=(this.config.statusText,this.config.startCallButtonColor||"#667eea"),a=this.config.startCallButtonTextColor||"#FFFFFF",s=this.config.transcriptBackgroundColor||"#FFFFFF",c=this.config.transcriptTextColor||"#1e293b",l=this.config.transcriptLabelColor||"#94a3b8",d=this.config.controlButtonColor||"#FFFFFF",p=this.config.liveTranscriptTextColor||this.config.transcriptTextColor||"#64748b",u=this.config.liveTranscriptFontSize||"14px",h=this.config.controlButtonSecondaryColor||"#64748b",g=this.config.liveIndicatorDotColor||"#10b981",m=this.config.liveIndicatorTextColor||"#10b981",f=this.config.micButtonColor||d,v=this.config.speakerButtonColor||d,B=this.config.endCallButtonColor||"#ef4444",w=this.config.sendButtonColor||(null===(e=this.config.text)||void 0===e?void 0:e.sendButtonColor)||this.config.voiceSendButtonColor||"#7C3AED",b=" !important";return"\n /* Voice Interface Styles - Ultra-compact for Wix iframes */\n .voice-interface { \n display: none".concat(b,"; \n flex: 1; \n flex-direction: column;\n align-items: stretch; \n justify-content: flex-start; \n padding: 0; \n background: linear-gradient(180deg, #f8fafc 0%, #e0e7ff 100%);\n overflow: hidden;\n min-height: 0;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n }\n .voice-interface.active { display: flex").concat(b,'; }\n \n /* Voice States - Better scaling gaps */\n #voiceIdleState {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n height: 100%;\n min-height: 0;\n justify-content: center;\n overflow: hidden;\n flex: 1;\n box-sizing: border-box;\n gap: clamp(6px, 1.5vh, 12px);\n }\n \n #voiceActiveState {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n height: 100%;\n min-height: 0;\n justify-content: flex-start;\n overflow: hidden;\n flex: 1;\n box-sizing: border-box;\n gap: 0;\n padding: 0;\n }\n \n #voiceActiveState[style*="display: none"] {\n display: none !important;\n }\n \n /* Voice Avatar - Scales better from small to large */\n .voice-avatar,\n .voice-avatar-active {\n width: clamp(80px, 18vh, 160px);\n height: clamp(80px, 18vh, 160px);\n aspect-ratio: 1;\n border-radius: 50%;\n background: linear-gradient(135deg, ').concat(t," 0%, ").concat(n," 100%);\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: clamp(40px, 9vh, 80px);\n margin: 0;\n box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);\n transition: all 0.3s ease;\n flex-shrink: 0;\n position: relative;\n }\n \n .voice-avatar-active {\n animation: avatarPulse 2s ease-in-out infinite;\n }\n \n @keyframes avatarPulse {\n 0%, 100% { \n transform: scale(1);\n }\n 50% { \n transform: scale(1.05);\n }\n }\n \n .voice-avatar-active.speaking {\n animation: avatarSpeak 0.5s ease-in-out infinite;\n }\n \n @keyframes avatarSpeak {\n 0%, 100% { transform: scale(1); }\n 50% { transform: scale(1.08); }\n }\n \n /* Voice Rings Animation */\n .voice-rings {\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n }\n \n .voice-ring {\ndisplay: block !important;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n border: 2px solid rgba(102, 126, 234, 0.3);\n border-radius: 50%;\n opacity: 0;\n animation: ringExpand 2s ease-out infinite;\n }\n \n .voice-ring:nth-child(2) { animation-delay: 0.5s; }\n .voice-ring:nth-child(3) { animation-delay: 1s; }\n \n @keyframes ringExpand {\n 0% {\n width: 100%;\n height: 100%;\n opacity: 0.6;\n }\n 100% {\n width: 160%;\n height: 160%;\n opacity: 0;\n }\n }\n \n /* Voice Status - Scales with container */\n .voice-status {\n text-align: center;\n margin: 0;\n flex-shrink: 0;\n min-height: 0;\n }\n \n .voice-status-title {\n font-size: clamp(12px, 3vh, 20px);\n font-weight: 600;\n color: ").concat(A,";\n margin-bottom: clamp(2px, 0.5vh, 4px);\n line-height: 1.2;\n }\n \n .voice-status-subtitle {\n font-size: clamp(10px, 2vh, 14px);\n color: ").concat(o,";\n line-height: 1.2;\n }\n \n /* Start Call Button - Scales with container */\n .start-call-btn {\n margin: 0;\n width: min(280px, 70vw)").concat(b,";\n height: clamp(48px, 8vh, 64px)").concat(b,";\n border-radius: clamp(24px, 4vh, 32px)").concat(b,";\n border: none").concat(b,";\n background: ").concat(r).concat(b,";\n color: ").concat(a).concat(b,";\n font-size: clamp(14px, 2.5vh, 18px)").concat(b,";\n font-weight: 600").concat(b,";\n cursor: pointer").concat(b,";\n display: flex").concat(b,";\n align-items: center").concat(b,";\n justify-content: center").concat(b,";\n gap: clamp(8px, 1.5vh, 12px);\n box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);\n transition: all 0.3s ease;\n flex-shrink: 0;\n }\n \n .start-call-btn svg {\n display: block").concat(b,";\n visibility: visible").concat(b,";\n opacity: 1").concat(b,";\n width: auto").concat(b,";\n height: auto").concat(b,";\n }\n \n .start-call-btn svg {\n width: clamp(22px, 4vh, 32px);\n height: clamp(22px, 4vh, 32px);\n }\n \n .start-call-btn:hover {\n transform: translateY(-2px);\n box-shadow: 0 12px 28px rgba(102, 126, 234, 0.5);\n }\n \n .start-call-btn:active {\n transform: translateY(-1px);\n }\n .start-call-btn:disabled {\n cursor: not-allowed").concat(b,";\n opacity: 0.6").concat(b,";\n }\n \n /* Connecting Spinner */\n .connecting-spinner {\n display: inline-block;\n width: 16px;\n height: 16px;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-top-color: ").concat(a,";\n border-radius: 50%;\n animation: spin 1s linear infinite;\n margin-right: 8px;\n vertical-align: middle;\n }\n \n @keyframes spin {\n to { transform: rotate(360deg); }\n }\n\n \n /* Voice Transcript - Scales with container */\n .voice-transcript {\n background: ").concat(s,";\n padding: clamp(6px, 1.5vh, 12px);\n border-radius: 10px;\n width: min(360px, calc(100% - 40px));\n margin: 0;\n min-height: clamp(80px, 15vh, 120px);\n max-height: clamp(100px, 18vh, 140px);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);\n flex-shrink: 1;\n overflow-y: auto;\n overflow-x: hidden;\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n }\n \n .transcript-label {\n font-size: clamp(8px, 1.4vh, 11px);\n color: ").concat(l,";\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n margin-bottom: clamp(3px, 0.6vh, 6px);\n flex-shrink: 0;\n word-wrap: break-word;\n }\n \n .transcript-text {\n font-size: clamp(11px, 2vh, 15px);\n color: ").concat(c,";\n line-height: 1.4;\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n word-wrap: break-word;\n overflow-wrap: break-word;\n }\n \n .transcript-text.empty {\n color: #cbd5e1;\n font-style: italic;\n }\n \n /* Voice Text Input Area - Type while on voice call */\n .voice-text-input-area {\n width: 100%;\n padding: 14px 16px;\n margin: 0;\n flex-shrink: 0;\n background: #ffffff;\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n box-sizing: border-box;\n }\n \n .voice-input-wrapper {\n display: flex;\n align-items: center;\n gap: 10px;\n background: #f1f5f9;\n border-radius: 12px;\n padding: 4px 4px 4px 14px;\n border: 1px solid transparent;\n transition: all 0.2s ease;\n }\n \n .voice-input-wrapper:focus-within {\n background: #fff;\n border-color: #a855f7;\n box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);\n }\n \n .voice-text-input {\n flex: 1;\n border: none;\n outline: none;\n font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;\n font-size: 14px;\n color: ").concat(p).concat(b,";\n background: transparent;\n padding: 10px 0;\n }\n \n .voice-text-input::placeholder {\n color: #94a3b8;\n }\n \n .voice-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 38px;\n height: 38px;\n border-radius: 10px;\n border: none;\n background: ").concat(w).concat(b,";\n color: #fff;\n cursor: pointer;\n transition: transform 0.2s ease;\n flex-shrink: 0;\n }\n \n .voice-send-btn:hover:not(:disabled) {\n transform: scale(1.05);\n }\n \n .voice-send-btn:active:not(:disabled) {\n transform: scale(0.95);\n }\n \n .voice-send-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n transform: none;\n }\n \n .voice-send-btn svg {\n width: 16px;\n height: 16px;\n }\n \n .voice-input-hint {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n margin-top: 10px;\n font-size: 11px;\n color: #64748b;\n transition: color 0.2s ease;\n }\n \n .voice-input-hint svg {\n width: 12px;\n height: 12px;\n color: #10b981;\n }\n \n /* Text input status states */\n .voice-input-hint--sending {\n color: #666;\n }\n \n .voice-input-hint--success {\n color: #28a745;\n }\n \n .voice-input-hint--queued {\n color: #ffc107;\n }\n \n .voice-input-hint--error {\n color: #dc3545;\n }\n \n /* Disabled input styling */\n .voice-text-input:disabled,\n #mobileTextInput:disabled {\n background-color: #f5f5f5;\n cursor: not-allowed;\n }\n \n .voice-send-btn:disabled,\n #mobileSendBtn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n \n /* Voice Controls - Scales with container */\n .voice-controls {\n display: flex;\n gap: clamp(8px, 1.8vh, 14px);\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin: 0;\n padding-top: 0;\n }\n \n .voice-control-btn {\n width: clamp(48px, 9vh, 72px)").concat(b,";\n height: clamp(48px, 9vh, 72px)").concat(b,";\n min-width: clamp(48px, 9vh, 72px)").concat(b,";\n min-height: clamp(48px, 9vh, 72px)").concat(b,";\n max-width: clamp(48px, 9vh, 72px)").concat(b,";\n max-height: clamp(48px, 9vh, 72px)").concat(b,";\n aspect-ratio: 1").concat(b,";\n border-radius: 50%").concat(b,";\n border: none").concat(b,";\n cursor: pointer").concat(b,";\n display: flex").concat(b,";\n align-items: center").concat(b,";\n justify-content: center").concat(b,";\n transition: all 0.2s;\n position: relative").concat(b,";\n flex-shrink: 0;\n overflow: hidden").concat(b,";\n padding: 0").concat(b,";\n margin: 0").concat(b,";\n box-sizing: border-box").concat(b,";\n }\n \n .voice-control-btn svg {\n width: 48%").concat(b,";\n height: 48%").concat(b,";\n min-width: 48%").concat(b,";\n min-height: 48%").concat(b,";\n max-width: 48%").concat(b,";\n max-height: 48%").concat(b,";\n display: block").concat(b,";\n visibility: visible").concat(b,";\n opacity: 1").concat(b,";\n margin: 0").concat(b,";\n padding: 0").concat(b,";\n position: relative").concat(b,";\n flex-shrink: 0").concat(b,";\n }\n \n .voice-control-btn.primary {\n width: clamp(54px, 10vh, 80px)").concat(b,";\n height: clamp(54px, 10vh, 80px)").concat(b,";\n min-width: clamp(54px, 10vh, 80px)").concat(b,";\n min-height: clamp(54px, 10vh, 80px)").concat(b,";\n max-width: clamp(54px, 10vh, 80px)").concat(b,";\n max-height: clamp(54px, 10vh, 80px)").concat(b,";\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)").concat(b,";\n color: white").concat(b,";\n box-shadow: 0 6px 18px rgba(102, 126, 234, 0.4);\n }\n \n .voice-control-btn.primary:hover {\n transform: scale(1.05);\n }\n \n .voice-control-btn.primary.active {\n background: ").concat(B).concat(b,";\n animation: recordingPulse 1.5s ease-in-out infinite;\n }\n .voice-control-btn.primary.active svg {\n fill: white").concat(b,";\n }\n \n /* More specific selectors for WordPress compatibility */\n #endCallBtn.voice-control-btn.primary.active,\n #muteBtn.voice-control-btn.secondary,\n #speakerBtn.voice-control-btn.secondary {\n border-radius: 50% !important;\n width: clamp(48px, 9vh, 72px) !important;\n height: clamp(48px, 9vh, 72px) !important;\n min-width: clamp(48px, 9vh, 72px) !important;\n min-height: clamp(48px, 9vh, 72px) !important;\n max-width: clamp(48px, 9vh, 72px) !important;\n max-height: clamp(48px, 9vh, 72px) !important;\n aspect-ratio: 1 !important;\n overflow: hidden !important;\n }\n \n #endCallBtn.voice-control-btn.primary.active {\n width: clamp(54px, 10vh, 80px) !important;\n height: clamp(54px, 10vh, 80px) !important;\n min-width: clamp(54px, 10vh, 80px) !important;\n min-height: clamp(54px, 10vh, 80px) !important;\n max-width: clamp(54px, 10vh, 80px) !important;\n max-height: clamp(54px, 10vh, 80px) !important;\n }\n \n \n /* Microphone button specific background color */\n #muteBtn.voice-control-btn.secondary {\n background: ").concat(f).concat(b,";\n }\n \n /* Speaker button specific background color */\n #speakerBtn.voice-control-btn.secondary {\n background: ").concat(v).concat(b,";\n }\n \n #endCallBtn.voice-control-btn.primary.active svg,\n #muteBtn.voice-control-btn.secondary svg,\n #speakerBtn.voice-control-btn.secondary svg {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n width: 48% !important;\n height: 48% !important;\n margin: 0 !important;\n padding: 0 !important;\n position: relative !important;\n }\n \n @keyframes recordingPulse {\n 0%, 100% { \n box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);\n }\n 50% { \n box-shadow: 0 6px 24px rgba(239, 68, 68, 0.7);\n }\n }\n \n .voice-control-btn.secondary {\n background: ").concat(d).concat(b,";\n color: ").concat(h).concat(b,";\n box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);\n width: clamp(48px, 9vh, 72px)").concat(b,";\n height: clamp(48px, 9vh, 72px)").concat(b,";\n min-width: clamp(48px, 9vh, 72px)").concat(b,";\n min-height: clamp(48px, 9vh, 72px)").concat(b,";\n max-width: clamp(48px, 9vh, 72px)").concat(b,";\n max-height: clamp(48px, 9vh, 72px)").concat(b,";\n }\n \n .voice-control-btn.secondary:hover {\n background: #f8fafc").concat(b,";\n transform: scale(1.05);\n }\n \n .voice-control-btn.secondary.muted {\n background: #f3f4f6").concat(b,";\n }\n \n .voice-control-btn.secondary.muted .mute-icon {\n stroke: #9ca3af !important;\n }\n \n .voice-control-btn.secondary svg {\n width: 48%").concat(b,";\n height: 48%").concat(b,";\n display: block").concat(b,";\n visibility: visible").concat(b,";\n opacity: 1").concat(b,";\n margin: 0").concat(b,";\n padding: 0").concat(b,";\n position: relative").concat(b,";\n }\n \n .voice-timer {\n position: absolute;\n bottom: clamp(-18px, -3vh, -24px);\n font-size: clamp(9px, 1.6vh, 12px);\n color: #64748b;\n font-weight: 500;\n white-space: nowrap;\n }\n \n /* ===== DESKTOP VOICE SECTION - New Design ===== */\n .desktop-voice-section {\n padding: 16px 20px;\n background: linear-gradient(180deg, #ffffff 0%, rgba(168, 85, 247, 0.04) 100%);\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n box-sizing: border-box;\n text-align: center;\n }\n \n /* Ensure all children are centered */\n .desktop-voice-section > * {\n margin-left: auto;\n margin-right: auto;\n }\n \n .desktop-timer {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 6px !important;\n padding: 5px 10px !important;\n background: rgba(0, 0, 0, 0.05) !important;\n border-radius: 20px !important;\n font-family: 'JetBrains Mono', 'Courier New', monospace;\n font-size: 11px !important;\n color: #64748b !important;\n margin: 0 auto !important;\n }\n \n .desktop-timer .timer-dot {\n display: block !important;\n width: 5px").concat(b,";\n height: 5px").concat(b,";\n background: #ef4444").concat(b,";\n border-radius: 50%").concat(b,";\n animation: timerPulse 1s ease-in-out infinite").concat(b,";\n }\n \n @keyframes timerPulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.4; }\n }\n \n .desktop-avatar-container {\n margin-bottom: 12px;\n }\n \n .desktop-avatar-large {\n width: 80px !important;\n height: 80px !important;\n border-radius: 20px !important;\n margin: 0 auto 12px !important;\n box-shadow: 0 8px 24px rgba(168, 85, 247, 0.35) !important;\n background: linear-gradient(135deg, ").concat(t," 0%, ").concat(n,' 100%) !important;\n }\n \n .desktop-waveform {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 4px !important;\n height: 36px !important;\n width: 100% !important;\n }\n \n .desktop-waveform-bar {\n display: block !important;\n width: 4px !important;\n background: rgba(255, 255, 255, 0.9) !important;\n border-radius: 2px !important;\n animation: waveformAnimation 0.8s ease-in-out infinite !important;\n }\n \n .desktop-waveform-bar[data-index="0"] { height: 14px !important; animation-delay: 0s !important; }\n .desktop-waveform-bar[data-index="1"] { height: 26px !important; animation-delay: 0.1s !important; }\n .desktop-waveform-bar[data-index="2"] { height: 36px !important; animation-delay: 0.2s !important; }\n .desktop-waveform-bar[data-index="3"] { height: 22px !important; animation-delay: 0.3s !important; }\n .desktop-waveform-bar[data-index="4"] { height: 16px !important; animation-delay: 0.4s !important; }\n \n @keyframes waveformAnimation {\n 0%, 100% { transform: scaleY(0.5); }\n 50% { transform: scaleY(1); }\n }\n \n .desktop-waveform.paused .desktop-waveform-bar {\n animation-play-state: paused;\n }\n\n /* New main waveform (used in updated template) */\n .desktop-main-waveform {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 3px !important;\n height: 48px !important;\n width: 100% !important;\n max-width: 200px !important;\n margin: 0 auto !important;\n padding: 0 20px !important;\n }\n\n .desktop-main-waveform .waveform-bar {\n display: block !important;\n width: 3px !important;\n background: #a855f7 !important;\n border-radius: 2px !important;\n height: 8px !important;\n animation: waveformAnimation 0.8s ease-in-out infinite !important;\n }\n\n .desktop-main-waveform .waveform-bar:nth-child(1) { height: 12px !important; animation-delay: 0s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(2) { height: 20px !important; animation-delay: 0.05s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(3) { height: 28px !important; animation-delay: 0.1s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(4) { height: 36px !important; animation-delay: 0.15s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(5) { height: 44px !important; animation-delay: 0.2s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(6) { height: 50px !important; animation-delay: 0.25s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(7) { height: 54px !important; animation-delay: 0.3s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(8) { height: 56px !important; animation-delay: 0.35s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(9) { height: 54px !important; animation-delay: 0.4s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(10) { height: 50px !important; animation-delay: 0.45s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(11) { height: 44px !important; animation-delay: 0.5s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(12) { height: 36px !important; animation-delay: 0.55s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(13) { height: 28px !important; animation-delay: 0.6s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(14) { height: 20px !important; animation-delay: 0.65s !important; }\n .desktop-main-waveform .waveform-bar:nth-child(15) { height: 12px !important; animation-delay: 0.7s !important; }\n\n .desktop-status {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 5px !important;\n font-size: 12px !important;\n color: ').concat(A,";\n font-weight: 500;\n width: 100%;\n text-align: center;\n margin: 0 auto;\n }\n \n .desktop-status .status-dot {\n display: block !important;\n width: 5px !important;\n height: 5px !important;\n background: ").concat(i," !important;\n border-radius: 50% !important;\n animation: statusPulse 1.5s ease-in-out infinite !important;\n }\n \n @keyframes statusPulse {\n 0%, 100% { transform: scale(1); opacity: 1; }\n 50% { transform: scale(1.15); opacity: 0.8; }\n }\n \n .desktop-live-waveform {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 3px;\n height: 48px;\n margin-bottom: 20px;\n }\n \n .desktop-live-bar {\ndisplay: block !important;\n width: 3px;\n background: linear-gradient(180deg, ").concat(t,", ").concat(n,");\n border-radius: 2px;\n transition: height 0.1s ease;\n height: 8px;\n }\n \n .desktop-controls {\n display: flex;\n gap: 8px;\n align-items: center;\n justify-content: center;\n width: 100%;\n margin: 0 auto;\n }\n \n .desktop-control-btn {\n width: 46px;\n height: 46px;\n border-radius: 50%;\n border: none;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n .desktop-control-btn svg {\n width: 20px;\n height: 20px;\n }\n \n .desktop-mic-icon,\n .desktop-speaker-icon {\n width: 20px !important;\n height: 20px !important;\n display: block;\n flex-shrink: 0;\n }\n \n .desktop-control-btn.secondary.muted .desktop-mic-icon,\n .desktop-control-btn.secondary.muted .desktop-speaker-icon {\n width: 20px !important;\n height: 20px !important;\n }\n \n \n .desktop-control-btn.secondary:hover {\n background: rgba(0, 0, 0, 0.1);\n color: #1e293b;\n transform: scale(1.05);\n }\n .desktop-control-btn.secondary.muted {\n background: #f3f4f6;\n color: #9ca3af;\n }\n \n .desktop-control-btn.secondary.muted .desktop-mic-icon,\n .desktop-control-btn.secondary.muted .desktop-speaker-icon {\n stroke: #9ca3af;\n }\n \n .desktop-control-btn.secondary {\n position: relative;\n }\n \n \n /* Desktop microphone button background color */\n #desktopMuteBtn.desktop-control-btn.secondary,\n #desktopMuteBtnCompact.compact-control-btn.secondary {\n background: ").concat(f).concat(b,";\n }\n \n /* Desktop speaker button background color */\n #desktopSpeakerBtn.desktop-control-btn.secondary,\n #desktopSpeakerBtnCompact.compact-control-btn.secondary {\n background: ").concat(v).concat(b,";\n }\n .desktop-mic-off-icon,\n .desktop-speaker-off-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 46px;\n height: 46px;\n transform: translate(-50%, -50%);\n z-index: 10;\n }\n .desktop-control-btn.danger {\n width: 50px;\n height: 50px;\n background: ").concat(B).concat(b,";\n color: #ffffff;\n box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);\n overflow: visible;\n }\n \n .desktop-control-btn.danger svg {\n width: 20px;\n height: 20px;\n overflow: visible;\n }\n \n .desktop-control-btn.danger:hover {\n transform: scale(1.06);\n box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);\n }\n \n .desktop-control-btn.danger:hover {\n transform: scale(1.06);\n box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);\n }\n \n \n /* ===== COMPACT VOICE SECTION (Single-row layout) ===== */\n .compact-voice-section {\n padding: 10px 14px;\n background: linear-gradient(180deg, #ffffff, rgba(168, 85, 247, 0.04));\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\n min-height: 62px;\n flex-shrink: 0;\n }\n \n .compact-left {\n display: flex;\n align-items: center;\n gap: 10px;\n }\n \n .compact-avatar {\n width: 42px;\n height: 42px;\n min-width: 42px;\n min-height: 42px;\n border-radius: 12px;\n background: transparent;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: visible;\n position: relative;\n }\n \n /* Waveform container in compact avatar - ensure it's visible */\n .compact-avatar .desktop-main-waveform {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 2px !important;\n height: 100% !important;\n width: 100% !important;\n padding: 4px !important;\n transform: scale(0.75) !important;\n transform-origin: center !important;\n }\n \n /* Ensure waveform bars are visible and animated in compact mode */\n .compact-avatar .desktop-main-waveform .waveform-bar {\n display: block !important;\n width: 2px !important;\n min-width: 2px !important;\n background: #a855f7 !important;\n border-radius: 1px !important;\n flex-shrink: 0 !important;\n animation: waveformAnimation 0.8s ease-in-out infinite !important;\n }\n \n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(1) { height: 6px !important; animation-delay: 0s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(2) { height: 10px !important; animation-delay: 0.05s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(3) { height: 14px !important; animation-delay: 0.1s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(4) { height: 18px !important; animation-delay: 0.15s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(5) { height: 22px !important; animation-delay: 0.2s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(6) { height: 26px !important; animation-delay: 0.25s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(7) { height: 28px !important; animation-delay: 0.3s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(8) { height: 30px !important; animation-delay: 0.35s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(9) { height: 28px !important; animation-delay: 0.4s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(10) { height: 26px !important; animation-delay: 0.45s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(11) { height: 22px !important; animation-delay: 0.5s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(12) { height: 18px !important; animation-delay: 0.55s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(13) { height: 14px !important; animation-delay: 0.6s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(14) { height: 10px !important; animation-delay: 0.65s !important; }\n .compact-avatar .desktop-main-waveform .waveform-bar:nth-child(15) { height: 6px !important; animation-delay: 0.7s !important; }\n\n }\n \n .compact-info {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n \n .compact-timer {\n display: flex;\n align-items: center;\n gap: 5px;\n font-family: 'JetBrains Mono', 'Courier New', monospace;\n font-size: 13px;\n font-weight: 600;\n color: ").concat(p).concat(b,";\n }\n \n .compact-timer .timer-dot {\n display: block !important;\n width: 6px").concat(b,";\n height: 6px").concat(b,";\n background: #ef4444").concat(b,";\n border-radius: 50%").concat(b,";\n animation: timerPulse 1s ease-in-out infinite").concat(b,";\n }\n \n .compact-status {\n display: flex").concat(b,";\n align-items: center").concat(b,";\n gap: 4px").concat(b,";\n font-size: 11px").concat(b,";\n color: ").concat(A).concat(b,";\n }\n \n .compact-status .status-dot {\n display: block !important;\n width: 5px").concat(b,";\n height: 5px").concat(b,";\n background: ").concat(i).concat(b,";\n border-radius: 50%").concat(b,";\n animation: statusPulse 1.5s ease-in-out infinite").concat(b,";\n }\n \n @keyframes statusPulse {\n 0%, 100% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.7; transform: scale(1.1); }\n }\n \n .compact-controls {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n \n .compact-control-btn {\n width: 36px;\n height: 36px;\n min-width: 36px;\n min-height: 36px;\n border-radius: 50%;\n border: none;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: all 0.2s ease;\n padding: 0;\n position: relative;\n overflow: hidden;\n }\n \n .compact-control-btn svg {\n width: 16px;\n height: 16px;\n }\n \n .compact-control-btn .desktop-mic-off-icon,\n .compact-control-btn .desktop-speaker-off-icon {\n width: 34px;\n height: 34px;\n }\n \n .compact-control-btn.secondary {\n background: #f1f5f9;\n color: #64748b;\n }\n \n \n /* Compact speaker button background color */\n #desktopSpeakerBtnCompact.compact-control-btn.secondary {\n background: ").concat(v).concat(b,";\n }\n /* Compact microphone button background color */\n #desktopMuteBtnCompact.compact-control-btn.secondary {\n background: ").concat(f).concat(b,";\n }\n \n .compact-control-btn.secondary:hover {\n background: #e2e8f0;\n color: #475569;\n }\n \n .compact-control-btn.secondary.muted {\n background: rgba(239, 68, 68, 0.1);\n color: #ef4444;\n }\n \n \n .compact-control-btn.secondary.muted .desktop-mic-icon,\n .compact-control-btn.secondary.muted .desktop-speaker-icon {\n stroke: #ef4444;\n }\n \n .compact-control-btn.secondary.muted .desktop-mic-off-icon,\n .compact-control-btn.secondary.muted .desktop-speaker-off-icon {\n width: 34px;\n height: 34px;\n }\n\n .compact-control-btn.danger {\n width: 40px;\n height: 40px;\n min-width: 40px;\n min-height: 40px;\n background: ").concat(B).concat(b,";\n color: white;\n box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35);\n }\n \n .compact-control-btn.danger:hover {\n transform: scale(1.05);\n box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45);\n }\n \n .compact-control-btn.danger svg {\n width: 18px;\n height: 18px;\n overflow: visible;\n }\n \n/* ===== CONVERSATION PANEL ===== */\n /* Stick to bottom so transcript + input are always at bottom regardless of widget height */\n .desktop-conversation-panel {\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n width: 100%;\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n flex: 0 0 auto;\n margin-top: auto;\n }\n \n .conversation-header {\n padding: 10px 16px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n background: #fafafa;\n cursor: pointer;\n flex-shrink: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.04);\n transition: background 0.2s ease;\n }\n \n .conversation-header:hover {\n background: #f5f5f5;\n }\n \n .conversation-label {\n font-size: 11px;\n font-weight: 600;\n color: #64748b;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n }\n \n .conversation-toggle {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 11px;\n color: #94a3b8;\n font-weight: 500;\n }\n \n .conversation-toggle svg {\n transition: transform 0.2s ease;\n }\n \n .conversation-header.expanded .conversation-toggle svg {\n transform: rotate(180deg);\n }\n \n /* ===== COLLAPSED: Live Transcript Only (2 lines) ===== */\n .live-transcript-collapsed {\n padding: 12px 16px;\n background: #fafafa;\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex-shrink: 0;\n min-height: 50px;\n }\n \n .live-indicator {\n display: flex;\n align-items: center;\n gap: 5px;\n font-size: 9px;\n font-weight: 700;\n color: ").concat(m).concat(b,";\n text-transform: uppercase;\n letter-spacing: 0.08em;\n }\n \n .live-indicator .live-dot {\ndisplay: block !important;\n height: 5px;\n width: 5px;\n background: ").concat(g).concat(b,";\n border-radius: 50%;\n animation: statusPulse 1.5s ease-in-out infinite;\n }\n \n .live-text-collapsed {\n font-size: ").concat(u).concat(b,";\n color: ").concat(p).concat(b,";\n line-height: 1.5;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n \n .live-text-collapsed.muted {\n color: #94a3b8;\n font-style: italic;\n }\n \n .live-text-collapsed.user-text {\n color: #7c3aed").concat(b,";\n }\n \n .user-transcript-label {\n font-weight: 600").concat(b,";\n opacity: 0.7;\n }\n \n .typing-cursor {\n display: inline-block;\n width: 2px;\n height: 14px;\n background: #a855f7;\n margin-left: 2px;\n animation: blink 1s step-end infinite;\n vertical-align: middle;\n }\n \n @keyframes blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0; }\n }\n \n /* ===== EXPANDED: Full Conversation History ===== */\n .conversation-history {\n flex: 1;\n flex-direction: column;\n gap: 10px;\n overflow-y: auto;\n padding: 14px 16px;\n min-height: 0;\n }\n .conversation-history.visible {\n display: flex;\n }\n\n .conversation-messages {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n /* Message Rows */\n .message-row {\n display: flex;\n gap: 8px;\n animation: msgIn 0.25s ease;\n }\n \n @keyframes msgIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes slideIn {\n from { opacity: 0; transform: translateY(-10px); }\n to { opacity: 1; transform: translateY(0); }\n }\n \n @keyframes slideOut {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(-10px); }\n }\n \n .message-row.user {\n flex-direction: row-reverse;\n }\n \n .message-avatar {\n width: 28px;\n height: 28px;\n border-radius: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n\n .message-avatar.assistant {\n background: linear-gradient(135deg, #c084fc, #a855f7);\n }\n\n .message-avatar.assistant .orb {\n width: 12px;\n height: 12px;\n background: rgba(255, 255, 255, 0.9);\n border-radius: 50%;\n }\n\n .message-avatar.user {\n background: linear-gradient(135deg, #64748b, #475569);\n color: #fff;\n font-size: 11px;\n font-weight: 600;\n }\n\n .message-bubble {\n max-width: 80%;\n padding: 9px 13px;\n border-radius: 12px;\n font-size: 13px;\n line-height: 1.5;\n }\n \n .message-row.assistant .message-bubble {\n background: #fff;\n color: ").concat(p).concat(b,";\n border: 1px solid rgba(0, 0, 0, 0.06);\n border-bottom-left-radius: 4px;\n }\n \n .message-row.user .message-bubble {\n background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);\n color: #fff;\n border-bottom-right-radius: 4px;\n }\n \n /* Live message at bottom of history */\n .live-message-row {\n display: flex;\n gap: 8px;\n padding-top: 8px;\n border-top: 1px dashed rgba(0, 0, 0, 0.08);\n margin-top: auto;\n }\n \n .live-message-row .message-bubble {\n background: #fff;\n border: 1px solid rgba(16, 185, 129, 0.3);\n color: ").concat(p).concat(b,";\n position: relative;\n border-radius: 14px;\n border-bottom-left-radius: 4px;\n }\n \n .live-message-row .live-badge {\ndisplay: block !important;\n position: absolute;\n top: -8px;\n left: 10px;\n background: #10b981;\n color: #fff;\n font-size: 8px;\n font-weight: 700;\n padding: 2px 6px;\n border-radius: 4px;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n }\n \n /* Hide/show based on expanded state */\n .desktop-conversation-panel.collapsed .conversation-history {\n display: none;\n }\n \n .desktop-conversation-panel.collapsed .live-transcript-collapsed {\n display: flex;\n }\n \n .desktop-conversation-panel.expanded .conversation-history {\n display: flex;\n max-height: 400px;\n }\n \n .desktop-conversation-panel.expanded .live-transcript-collapsed {\n display: none;\n }\n \n /* ===== DARK MODE SUPPORT ===== */\n @media (prefers-color-scheme: dark) {\n .desktop-voice-section {\n background: linear-gradient(180deg, #1e1e2e 0%, rgba(168, 85, 247, 0.08) 100%);\n }\n\n .desktop-timer {\n color: #94a3b8;\n }\n\n .desktop-status {\n color: #34d399;\n }\n\n .desktop-status .status-dot {\n \n .desktop-control-btn.secondary.muted {\n background: rgba(255, 255, 255, 0.1);\n color: #9ca3af;\n \n .compact-voice-section {\n background: linear-gradient(180deg, #1e1e2e 0%, rgba(168, 85, 247, 0.08) 100%);\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n }\n \n .compact-timer {\n color: #e2e8f0;\n }\n \n .compact-status {\n color: #34d399;\n }\n \n .compact-status .status-dot {\n background: #34d399;\n }\n \n .compact-control-btn.secondary {\n background: rgba(255, 255, 255, 0.08);\n color: #94a3b8;\n }\n \n .compact-control-btn.secondary:hover {\n background: rgba(255, 255, 255, 0.15);\n color: #e2e8f0;\n }\n \n .compact-control-btn.secondary.muted {\n background: rgba(239, 68, 68, 0.2);\n color: #f87171;\n }\n\n }\n \n .desktop-control-btn.secondary.muted svg {\n \n .desktop-control-btn.secondary {\n position: relative;\n }\n \n /* Desktop microphone button background color */\n #desktopMuteBtn.desktop-control-btn.secondary,\n #desktopMuteBtnCompact.compact-control-btn.secondary {\n background: ").concat(f).concat(b,";\n }\n \n .desktop-mic-off-icon,\n .desktop-speaker-off-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 20px;\n height: 20px;\n }\n \n .desktop-control-btn.secondary.muted {\n background: #f3f4f6;\n color: #9ca3af;\n }\n \n .desktop-control-btn.secondary.muted svg {\n \n .desktop-control-btn.secondary {\n position: relative;\n }\n \n /* Desktop microphone button background color */\n #desktopMuteBtn.desktop-control-btn.secondary,\n #desktopMuteBtnCompact.compact-control-btn.secondary {\n background: ").concat(f).concat(b,";\n }\n \n .desktop-mic-off-icon,\n .desktop-speaker-off-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 20px;\n height: 20px;\n }\n stroke: #9ca3af;\n }\n stroke: #9ca3af;\n }\n background: #34d399;\n }\n\n .desktop-control-btn.secondary {\n background: rgba(255, 255, 255, 0.08);\n color: #94a3b8;\n }\n\n .desktop-control-btn.secondary:hover {\n background: rgba(255, 255, 255, 0.15);\n color: #e2e8f0;\n }\n\n .desktop-conversation-panel {\n border-top: 1px solid rgba(255, 255, 255, 0.08);\n }\n\n .conversation-header {\n background: #1a1a2e;\n }\n\n .conversation-header:hover {\n background: #252540;\n }\n\n .conversation-label {\n color: #94a3b8;\n }\n\n .conversation-toggle {\n color: #64748b;\n }\n\n .live-transcript-preview {\n background: #1a1a2e;\n }\n .live-indicator {\n color: ").concat(m).concat(b,";\n }\n .live-indicator .live-dot {\n background: ").concat(g).concat(b,";\n }\n\n .live-text {\n color: #e2e8f0;\n }\n\n .live-text.muted {\n color: #64748b;\n }\n\n .conversation-history {\n background: #1a1a2e;\n }\n\n .conversation-msg.assistant .conversation-msg-bubble {\n background: #252540;\n color: #e2e8f0;\n border: 1px solid rgba(255, 255, 255, 0.08);\n }\n\n .voice-text-input-area {\n background: #1a1a2e;\n }\n\n .voice-text-input {\n background: #252540 !important;\n color: #e2e8f0 !important;\n border-color: rgba(255, 255, 255, 0.1) !important;\n }\n\n .voice-text-input::placeholder {\n color: #64748b !important;\n }\n\n .voice-text-input:focus {\n border-color: ").concat(t," !important;\n box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2) !important;\n }\n\n .voice-input-hint {\n color: #64748b !important;\n }\n\n .voice-send-btn {\n background: ").concat(w," !important;\n }\n\n .voice-send-btn:disabled {\n background: #374151 !important;\n color: #4b5563 !important;\n }\n }\n\n /* Mobile optimization */\n @media (max-width: 768px) {\n .voice-interface {\n padding: 6px 10px;\n }\n }\n \n @media (max-width: 480px) {\n .voice-interface {\n padding: 5px 8px;\n }\n }\n \n /* Mobile Voice Call UI - Shared styles (also used in generateMobileCSS) */\n ").concat(this._getSharedMobileCSS(b),"\n\n ")}_getSharedMobileCSS(e){return"\n .mobile-duration-dot {\ndisplay: block !important;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background-color: #ef4444;\n animation: mobilePulse 1.5s ease-in-out infinite;\n }\n\n @keyframes mobilePulse {\n 0%, 100% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.5; transform: scale(0.95); }\n }\n\n .mobile-voice-bar {\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 14px;\n position: relative;\n background: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #c084fc 100%);\n border-radius: 24px 24px 0 0;\n box-shadow: 0 -8px 32px rgba(124, 58, 237, 0.5), 0 -2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);\n width: 100% !important;\n max-width: 100% !important;\n pointer-events: auto;\n overflow: hidden !important;\n margin: 0 !important;\n }\n\n .mobile-top-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n position: relative;\n }\n\n .mobile-status-indicator {\n display: flex;\n align-items: center;\n gap: 5px;\n min-width: 85px;\n }\n\n .mobile-status-dot {\ndisplay: block !important;\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: #22c55e;\n box-shadow: 0 0 8px #22c55e;\n transition: all 0.3s ease;\n }\n\n .mobile-status-text {\n font-size: 11px;\n font-weight: 700;\n color: rgba(255,255,255,0.95);\n text-transform: uppercase;\n letter-spacing: 0.3px;\n }\n\n .mobile-waveform-center {\n position: absolute !important;\n left: 50% !important;\n transform: translateX(-50%) !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 3px !important;\n height: 24px !important;\n visibility: visible !important;\n }\n\n .mobile-waveform-bars {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 3px !important;\n }\n\n .mobile-waveform-bar {\n display: block !important;\n width: 4px !important;\n min-height: 4px !important;\n background-color: #fff !important;\n border-radius: 2px !important;\n transition: height 0.12s ease-out !important;\n box-shadow: 0 0 8px rgba(255,255,255,0.5) !important;\n visibility: visible !important;\n }\n\n .mobile-controls {\n display: flex;\n align-items: center;\n gap: 6px;\n pointer-events: auto".concat(e,";\n touch-action: manipulation").concat(e,";\n position: relative").concat(e,";\n z-index: 120").concat(e,";\n }\n\n .mobile-control-btn {\n display: flex").concat(e,";\n align-items: center").concat(e,";\n justify-content: center").concat(e,";\n width: 32px").concat(e,";\n height: 32px").concat(e,";\n min-width: 32px").concat(e,";\n min-height: 32px").concat(e,";\n max-width: 32px").concat(e,";\n max-height: 32px").concat(e,";\n border-radius: 50%").concat(e,";\n border: none").concat(e,";\n cursor: pointer").concat(e,";\n transition: all 0.2s ease;\n background-color: rgba(255,255,255,0.15)").concat(e,";\n position: relative").concat(e,";\n overflow: hidden").concat(e,";\n padding: 0").concat(e,";\n margin: 0").concat(e,";\n box-sizing: border-box").concat(e,";\n }\n\n .mobile-control-btn:hover {\n background-color: rgba(255,255,255,0.25)").concat(e,";\n }\n\n .mobile-control-btn.muted {\n background-color: rgba(239, 68, 68, 0.3)").concat(e,";\n }\n\n .mobile-control-btn .mobile-mic-icon,\n .mobile-control-btn .mobile-speaker-icon {\n position: absolute").concat(e,";\n top: 50%").concat(e,";\n left: 50%").concat(e,";\n transform: translate(-50%, -50%)").concat(e,";\n display: block").concat(e,";\n visibility: visible").concat(e,";\n opacity: 1").concat(e,";\n width: 15px").concat(e,";\n height: 15px").concat(e,";\n margin: 0").concat(e,";\n padding: 0").concat(e,";\n }\n\n .mobile-control-btn .mobile-mic-off-icon,\n .mobile-control-btn .mobile-speaker-off-icon {\n position: absolute").concat(e,";\n top: 50%").concat(e,";\n left: 50%").concat(e,";\n transform: translate(-50%, -50%)").concat(e,";\n width: 15px").concat(e,";\n height: 15px").concat(e,";\n margin: 0").concat(e,";\n padding: 0").concat(e,";\n }\n\n .mobile-control-btn:not(.muted) .mobile-mic-off-icon,\n .mobile-control-btn:not(.muted) .mobile-speaker-off-icon {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n }\n\n .mobile-control-btn.muted .mobile-mic-icon,\n .mobile-control-btn.muted .mobile-speaker-icon {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n }\n\n .mobile-control-btn.muted .mobile-mic-off-icon,\n .mobile-control-btn.muted .mobile-speaker-off-icon {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n }\n\n .mobile-end-call-btn {\n display: flex").concat(e,";\n align-items: center").concat(e,";\n justify-content: center").concat(e,";\n width: 36px").concat(e,";\n height: 36px").concat(e,";\n min-width: 36px").concat(e,";\n min-height: 36px").concat(e,";\n max-width: 36px").concat(e,";\n max-height: 36px").concat(e,";\n border-radius: 50%").concat(e,";\n border: none").concat(e,";\n cursor: pointer").concat(e,";\n background-color: #ef4444").concat(e,";\n box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5);\n transition: all 0.2s ease;\n overflow: hidden").concat(e,";\n padding: 0").concat(e,";\n margin: 0").concat(e,";\n box-sizing: border-box").concat(e,";\n }\n\n .mobile-end-call-btn svg {\n display: block").concat(e,";\n visibility: visible").concat(e,";\n opacity: 1").concat(e,";\n width: 15px").concat(e,";\n height: 15px").concat(e,";\n margin: 0").concat(e,";\n padding: 0").concat(e,";\n position: relative").concat(e,";\n }\n\n /* ID-specific selectors for WordPress/Shopify compatibility */\n #mobileMuteBtn.mobile-control-btn,\n #mobileSpeakerBtn.mobile-control-btn,\n #mobileEndCallBtn.mobile-end-call-btn {\n border-radius: 50% !important;\n overflow: hidden !important;\n pointer-events: auto !important;\n touch-action: manipulation !important;\n -webkit-appearance: none !important;\n appearance: none !important;\n text-decoration: none !important;\n line-height: 1 !important;\n font-size: 0 !important;\n letter-spacing: 0 !important;\n text-indent: 0 !important;\n text-transform: none !important;\n color: transparent !important;\n }\n\n #mobileMuteBtn.mobile-control-btn,\n #mobileSpeakerBtn.mobile-control-btn {\n width: 32px !important;\n height: 32px !important;\n min-width: 32px !important;\n min-height: 32px !important;\n max-width: 32px !important;\n max-height: 32px !important;\n }\n\n #mobileEndCallBtn.mobile-end-call-btn {\n width: 36px !important;\n height: 36px !important;\n min-width: 36px !important;\n min-height: 36px !important;\n max-width: 36px !important;\n max-height: 36px !important;\n }\n\n #mobileMuteBtn.mobile-control-btn .mobile-mic-icon,\n #mobileMuteBtn.mobile-control-btn .mobile-mic-off-icon,\n #mobileSpeakerBtn.mobile-control-btn .mobile-speaker-icon,\n #mobileSpeakerBtn.mobile-control-btn .mobile-speaker-off-icon,\n #mobileEndCallBtn.mobile-end-call-btn svg {\n width: 15px !important;\n height: 15px !important;\n max-width: 15px !important;\n max-height: 15px !important;\n margin: 0 !important;\n padding: 0 !important;\n pointer-events: none !important;\n overflow: visible !important;\n }\n\n #mobile-voice-call-bar-container svg path,\n #mobile-voice-call-bar-container svg line,\n #mobile-voice-call-bar-container svg polygon,\n #mobile-voice-call-bar-container svg circle {\n pointer-events: none !important;\n vector-effect: none !important;\n }\n\n .mobile-end-call-btn:hover {\n transform: scale(1.05);\n }\n\n .mobile-transcript-row {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 10px 12px;\n background: rgba(255,255,255,0.18);\n border-radius: 14px;\n border: none;\n cursor: pointer;\n text-align: left;\n backdrop-filter: blur(4px);\n transition: background 0.2s ease;\n pointer-events: auto !important;\n position: relative !important;\n z-index: 100 !important;\n }\n\n .mobile-transcript-row:hover {\n background: rgba(255,255,255,0.25);\n }\n\n .mobile-transcript-text {\n margin: 0;\n font-size: 13px;\n color: #fff;\n line-height: 1.4;\n font-weight: 500;\n display: -webkit-box !important;\n -webkit-line-clamp: 2 !important;\n -webkit-box-orient: vertical !important;\n overflow: hidden !important;\n min-height: 2.8em !important;\n }\n\n .mobile-transcript-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .mobile-expand-hint {\n font-size: 10px;\n color: rgba(255,255,255,0.6);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n font-weight: 600;\n }\n\n .mobile-transcript-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0,0,0,0.6);\n display: flex;\n align-items: flex-end;\n padding: 12px;\n z-index: 2147483647;\n pointer-events: auto;\n }\n\n .mobile-expanded-transcript {\n width: 100%;\n max-height: 75%;\n background: #fff;\n border-radius: 24px 24px 16px 16px;\n overflow: hidden;\n box-shadow: 0 -8px 40px rgba(0,0,0,0.3);\n display: flex;\n flex-direction: column;\n }\n\n .mobile-transcript-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 14px 16px;\n background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);\n flex-shrink: 0;\n }\n\n .mobile-header-left {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n\n .mobile-header-status {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .mobile-header-status-dot {\ndisplay: block !important;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background-color: #22c55e;\n box-shadow: 0 0 6px #22c55e;\n }\n\n .mobile-header-status-text {\n font-size: 10px;\n font-weight: 700;\n color: rgba(255,255,255,0.9);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n }\n\n .mobile-header-duration {\n font-size: 10px;\n font-weight: 600;\n color: rgba(255,255,255,0.7);\n margin-left: 8px;\n }\n\n .mobile-transcript-label {\n font-size: 11px;\n font-weight: 800;\n color: rgba(255,255,255,0.7);\n letter-spacing: 1px;\n }\n\n .mobile-close-transcript-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n border: none;\n background: rgba(255,255,255,0.2);\n color: #fff;\n cursor: pointer;\n }\n\n .mobile-close-transcript-btn:hover {\n background: rgba(255,255,255,0.3);\n }\n\n .mobile-messages-container {\n flex: 1;\n padding: 16px;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .mobile-message-bubble {\n max-width: 85%;\n padding: 12px 16px;\n border-radius: 18px;\n font-size: 14px;\n line-height: 1.5;\n word-wrap: break-word;\n }\n\n .mobile-message-bubble.assistant {\n align-self: flex-start;\n background-color: #f3f4f6;\n color: #374151;\n border-bottom-left-radius: 4px;\n }\n\n .mobile-message-bubble.user {\n align-self: flex-end;\n background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);\n color: #fff;\n border-bottom-right-radius: 4px;\n }\n\n .mobile-input-area {\n padding: 12px 16px 16px;\n border-top: 1px solid #e5e7eb;\n background: #f9fafb;\n flex-shrink: 0;\n }\n\n .mobile-input-wrapper {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 4px 4px 16px;\n background: #fff;\n border-radius: 24px;\n border: 2px solid #e5e7eb;\n }\n\n .mobile-text-input {\n flex: 1;\n border: none;\n outline: none;\n font-size: 14px;\n color: #374151;\n background: transparent;\n padding: 10px 0;\n }\n\n .mobile-text-input::placeholder {\n color: #9ca3af;\n }\n\n .mobile-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n border-radius: 50%;\n border: none;\n background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);\n color: #fff;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .mobile-send-btn:hover:not(:disabled) {\n transform: scale(1.05);\n }\n\n .mobile-send-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .mobile-input-hint {\n margin: 8px 0 0;\n font-size: 11px;\n color: #9ca3af;\n text-align: center;\n transition: color 0.2s ease;\n }\n\n /* Mobile text input status states */\n .mobile-input-hint--sending {\n color: #666;\n }\n\n .mobile-input-hint--success {\n color: #28a745;\n }\n\n .mobile-input-hint--queued {\n color: #ffc107;\n }\n\n .mobile-input-hint--error {\n color: #dc3545;\n }\n\n /* Disabled mobile input styling */\n #mobileTextInput:disabled {\n background-color: #f5f5f5;\n cursor: not-allowed;\n }\n\n #mobileSendBtn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n ")}generateMobileCSS(){return"\n /* Mobile Voice Call UI - Container positioning */\n #mobile-voice-call-bar-container {\n position: fixed !important;\n bottom: 0 !important;\n left: 0 !important;\n right: 0 !important;\n z-index: 99999 !important;\n font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;\n padding: 0 12px 12px !important;\n pointer-events: none;\n box-sizing: border-box !important;\n width: 100% !important;\n max-width: 100vw !important;\n margin: 0 !important;\n overflow: visible !important;\n isolation: isolate !important;\n }\n\n #mobile-voice-call-bar-container *,\n #mobile-voice-call-bar-container *::before,\n #mobile-voice-call-bar-container *::after {\n box-sizing: border-box !important;\n }\n\n /* Mobile loading: small spinner in waveform area until first audio */\n .mobile-waveform-spinner {\n position: absolute !important;\n left: 50% !important;\n top: 50% !important;\n transform: translate(-50%, -50%) !important;\n width: 16px !important;\n height: 16px !important;\n }\n\n .mobile-waveform-spinner-inner {\n width: 100% !important;\n height: 100% !important;\n border: 2px solid rgba(255,255,255,0.3) !important;\n border-top-color: #fff !important;\n border-radius: 50% !important;\n animation: mobileLoadingSpin 0.8s linear infinite !important;\n }\n\n .mobile-waveform-spinner--hidden {\n display: none !important;\n }\n\n @keyframes mobileLoadingSpin {\n to { transform: rotate(360deg); }\n }\n\n .mobile-waveform-bars--hidden {\n visibility: hidden !important;\n opacity: 0 !important;\n }\n\n .mobile-duration-badge--hidden {\n visibility: hidden !important;\n opacity: 0 !important;\n pointer-events: none !important;\n }\n\n .mobile-duration-badge {\n position: absolute !important;\n top: -28px !important;\n left: 50% !important;\n transform: translateX(-50%) !important;\n display: flex !important;\n align-items: center !important;\n gap: 6px !important;\n padding: 5px 14px !important;\n background: rgba(0,0,0,0.75) !important;\n border-radius: 20px !important;\n font-size: 12px !important;\n font-weight: 700 !important;\n color: #fff !important;\n backdrop-filter: blur(8px) !important;\n -webkit-backdrop-filter: blur(8px) !important;\n z-index: 10 !important;\n pointer-events: auto !important;\n visibility: visible !important;\n opacity: 1 !important;\n }\n\n /* Fly-to-cart target: invisible anchor for animation when cart row is hidden */\n .ttp-fly-target {\n position: absolute;\n bottom: 14px;\n left: 30px;\n width: 24px;\n height: 24px;\n pointer-events: none;\n }\n\n /* ── Mobile Cart Row ── */\n\n .mobile-cart-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 7px 16px;\n background: rgba(255, 255, 255, 0.08);\n border-top: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 0 0 16px 16px;\n animation: mobileCartRowIn 0.25s ease-out;\n pointer-events: auto;\n }\n\n @keyframes mobileCartRowIn {\n from { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }\n to { opacity: 1; max-height: 50px; padding-top: 7px; padding-bottom: 7px; }\n }\n\n .mobile-cart-row__content {\n display: flex;\n align-items: center;\n gap: 8px;\n }\n\n .mobile-cart-row__icon {\n font-size: 13px;\n }\n\n .mobile-cart-row__text {\n font-size: 12px;\n font-weight: 600;\n color: rgba(255, 255, 255, 0.9);\n letter-spacing: 0.2px;\n }\n\n /* Shared mobile styles */\n ".concat(this._getSharedMobileCSS(" !important"),"\n ")}}class ct{constructor(e){this.voiceInterface=e,this.config=e.config,this.conversationMessages=[],this.currentLiveMessage=null}t(e){return this.voiceInterface.t(e)}escapeHtml(e){return this.voiceInterface.escapeHtml(e)}updateTranscript(e){console.log("📝 [TRANSCRIPT] updateTranscript() called with text:",e?e.substring(0,50)+"...":"null/empty");var t=document.getElementById("mobile-voice-call-bar-container");if(t){var n=t.querySelector("#mobileTranscriptText");n&&(n.textContent=e,n.style.color=""),this.voiceInterface.messages.length>0&&"assistant"===this.voiceInterface.messages[this.voiceInterface.messages.length-1].type?this.voiceInterface.messages[this.voiceInterface.messages.length-1].text=e:this.voiceInterface.messages.push({type:"assistant",text:e});var A=t.querySelector("#mobileMessagesContainer");if(A){var o=A.querySelector(".mobile-message-bubble.assistant:last-child");o?o.textContent=e:this.voiceInterface.addMobileMessage("assistant",e)}}else{var i=this.voiceInterface.shadowRoot.getElementById("liveTextCollapsed");if(i)if(i.style.color="",e&&e.trim()){i.textContent=e,i.classList.remove("muted");var r=document.createElement("span");r.className="typing-cursor",i.appendChild(r)}else i.textContent=this.t("transcriptWillAppear")||"Transcript will appear here...",i.classList.add("muted");if(e&&e.trim()?(this.currentLiveMessage&&"assistant"===this.currentLiveMessage.role&&e.startsWith(this.currentLiveMessage.content)?this.currentLiveMessage.content=e:(this.currentLiveMessage&&this.finalizeLiveMessage(),this.currentLiveMessage={role:"assistant",content:e}),this.updateLiveMessageRow()):(this.currentLiveMessage=null,this.updateLiveMessageRow()),this.voiceInterface.conversationExpanded){var a=this.voiceInterface.shadowRoot.getElementById("conversationHistory");a&&setTimeout(()=>{a.scrollTop=a.scrollHeight},10)}}}toggleConversationPanel(){if(!this.voiceInterface.isMobile){this.voiceInterface.conversationExpanded=!this.voiceInterface.conversationExpanded;var e=this.voiceInterface.shadowRoot.getElementById("desktopConversationPanel"),t=this.voiceInterface.shadowRoot.getElementById("conversationHeader"),n=this.voiceInterface.shadowRoot.getElementById("conversationToggleText"),A=this.voiceInterface.shadowRoot.querySelector(".voice-interface");if(e){var o,i=this.voiceInterface.shadowRoot.getElementById("desktopVoiceSection"),r=this.voiceInterface.shadowRoot.getElementById("compactVoiceSection");this.voiceInterface.conversationExpanded?(e.classList.remove("collapsed"),e.classList.add("expanded"),t&&t.classList.add("expanded"),n&&(n.textContent="Hide history"),A&&A.classList.add("expanded"),i&&(i.style.display="none"),r&&(r.style.display="flex"),console.log("📝 [TRANSCRIPT] Expanding panel, rendering",(null===(o=this.conversationMessages)||void 0===o?void 0:o.length)||0,"messages"),this.renderConversationMessages()):(e.classList.remove("expanded"),e.classList.add("collapsed"),t&&t.classList.remove("expanded"),n&&(n.textContent="Show history"),A&&A.classList.remove("expanded"),i&&(i.style.display=""),r&&(r.style.display="none"))}}}finalizeLiveMessage(){this.currentLiveMessage&&this.currentLiveMessage.content&&this.currentLiveMessage.content.trim()&&(this.conversationMessages||(this.conversationMessages=[]),this.conversationMessages.push({role:this.currentLiveMessage.role,content:this.currentLiveMessage.content}),console.log("📝 [TRANSCRIPT] Finalized live message:",this.currentLiveMessage.role,this.currentLiveMessage.content.substring(0,50)+"..."),this.currentLiveMessage=null,this.voiceInterface.conversationExpanded&&this.renderConversationMessages())}addConversationMessage(e,t){if(!this.voiceInterface.isMobile&&t&&t.trim()){if(this.currentLiveMessage&&this.finalizeLiveMessage(),this.conversationMessages||(this.conversationMessages=[]),"user"!==e)return this.currentLiveMessage={role:e,content:t},this.updateLiveMessageRow(),void console.log("📝 [TRANSCRIPT] Assistant message set as live (via addConversationMessage)");this.conversationMessages.push({role:e,content:t}),console.log("📝 [TRANSCRIPT] User message added to history"),this.voiceInterface.conversationExpanded&&this.renderConversationMessages()}}updateLiveMessageRow(){var e=this.voiceInterface.shadowRoot.getElementById("liveMessageRow"),t=this.voiceInterface.shadowRoot.getElementById("liveMessageText"),n=null==e?void 0:e.querySelector(".message-avatar");if(e&&t)if(this.currentLiveMessage&&this.currentLiveMessage.content&&this.currentLiveMessage.content.trim()){n&&("user"===this.currentLiveMessage.role?(n.textContent="U",n.className="message-avatar user"):(n.innerHTML='<div class="orb"></div>',n.className="message-avatar assistant")),t.textContent=this.currentLiveMessage.content,e.style.display="flex";var A=t.querySelector(".typing-cursor")||document.createElement("span");A.className="typing-cursor",t.querySelector(".typing-cursor")||t.appendChild(A)}else e.style.display="none"}clearConversationMessages(){this.conversationMessages=[],this.currentLiveMessage=null;var e=this.voiceInterface.shadowRoot.getElementById("liveMessageRow");e&&(e.style.display="none")}renderConversationMessages(){var e=this.voiceInterface.shadowRoot.getElementById("conversationMessages");if(e){if(!this.conversationMessages||0===this.conversationMessages.length)return console.log("📝 [TRANSCRIPT] No messages to render"),void(e.innerHTML="");var t=[...this.conversationMessages];if(this.currentLiveMessage&&t.length>0){var n=t[t.length-1];n.role===this.currentLiveMessage.role&&n.content===this.currentLiveMessage.content&&(t=t.slice(0,-1))}console.log("📝 [TRANSCRIPT] Rendering",t.length,"messages (live message excluded)"),e.innerHTML=t.map(e=>{var t="user"===e.role;return'\n <div class="message-row '.concat(e.role,'">\n <div class="message-avatar ').concat(e.role,'">\n ').concat(t?"U":'<div class="orb"></div>','\n </div>\n <div class="message-bubble">').concat(this.escapeHtml(e.content),"</div>\n </div>\n ")}).join("");var A=this.voiceInterface.shadowRoot.getElementById("conversationHistory");A&&setTimeout(()=>{A.scrollTop=A.scrollHeight},10)}else console.warn("📝 [TRANSCRIPT] conversationMessages container not found")}}class lt{constructor(e){this.voiceInterface=e,this.config=e.config,this.shadowRoot=e.shadowRoot,this._textInjectTimeout=null,this._mobileTextInjectTimeout=null,this._statusClearTimeout=null,this._mobileStatusClearTimeout=null,this._originalHintText=null,this._originalMobileHintText=null,this._textInjectAckHandler=null}t(e){return this.voiceInterface.t(e)}setupTextInjectAckHandler(){var e;null!==(e=this.voiceInterface.sdk)&&void 0!==e&&e.voiceSDK&&(this._textInjectAckHandler&&this.voiceInterface.sdk.voiceSDK.off("textInjectAck",this._textInjectAckHandler),this._textInjectAckHandler=e=>{this.handleTextInjectAck(e)},this.voiceInterface.sdk.voiceSDK.on("textInjectAck",this._textInjectAckHandler))}cleanup(){this._textInjectTimeout&&(clearTimeout(this._textInjectTimeout),this._textInjectTimeout=null),this._mobileTextInjectTimeout&&(clearTimeout(this._mobileTextInjectTimeout),this._mobileTextInjectTimeout=null),this._statusClearTimeout&&(clearTimeout(this._statusClearTimeout),this._statusClearTimeout=null),this._mobileStatusClearTimeout&&(clearTimeout(this._mobileStatusClearTimeout),this._mobileStatusClearTimeout=null),this._originalHintText=null,this._originalMobileHintText=null}handleTextInjectAck(e){var t,n;this._textInjectTimeout&&(clearTimeout(this._textInjectTimeout),this._textInjectTimeout=null),this._mobileTextInjectTimeout&&(clearTimeout(this._mobileTextInjectTimeout),this._mobileTextInjectTimeout=null);var A=this.shadowRoot.getElementById("voiceTextInput"),o=this.shadowRoot.getElementById("voiceSendBtn");A&&(A.disabled=!1),o&&(o.disabled=!(null!=A&&null!==(t=A.value)&&void 0!==t&&t.trim()));var i=document.getElementById("mobileTextInput"),r=document.getElementById("mobileSendBtn");if(i&&(i.disabled=!1),r&&(r.disabled=!(null!=i&&null!==(n=i.value)&&void 0!==n&&n.trim())),e.success){var a,s=null===(a=e.message)||void 0===a?void 0:a.toLowerCase().includes("queued"),c=s?"queued":"success",l=s?"Message queued":"Message sent";this.voiceInterface.isMobile?this.showMobileTextInputStatus(c,l):this.showDesktopTextInputStatus(c,l)}else{var d=e.message||"Failed to send";this.voiceInterface.isMobile?this.showMobileTextInputStatus("error",d):this.showDesktopTextInputStatus("error",d)}}sendDesktopTextMessage(){var e=this.shadowRoot.getElementById("voiceTextInput"),t=this.shadowRoot.getElementById("voiceSendBtn");if(e&&t){var n=e.value.trim();n&&this._sendTextMessage(n,e,t,!1)}else console.warn("VoiceInterface: Missing UI elements for desktop text send")}sendMobileTextMessage(){var e=document.getElementById("mobile-voice-call-bar-container"),t=null==e?void 0:e.querySelector("#mobileTextInput"),n=null==e?void 0:e.querySelector("#mobileSendBtn");t&&n?this._sendTextMessage(t.value.trim(),t,n,!0):console.warn("VoiceInterface: Missing UI elements for mobile text send")}_sendTextMessage(e,t,n,A){var o;if(this.voiceInterface.isActive&&null!==(o=this.voiceInterface.sdk)&&void 0!==o&&o.voiceSDK){var i=null==e?void 0:e.trim();if(i){t.value="",n&&(n.disabled=!0);try{var r=this.voiceInterface.sdk.voiceSDK;null!=r&&r.stopAudioPlayback&&r.stopAudioPlayback()}catch(e){}this.showTextInputStatus(A?"mobile":"desktop","sending","Sending...");try{if(this.voiceInterface.sdk.voiceSDK.sendMessage({t:"text_inject",text:i})){var a=setTimeout(()=>{A?this._mobileTextInjectTimeout=null:this._textInjectTimeout=null,t.disabled=!1,n&&(n.disabled=!1),this.showTextInputStatus(A?"mobile":"desktop","error","No response")},5e3);A?this._mobileTextInjectTimeout=a:this._textInjectTimeout=a,A?this.voiceInterface.addMobileMessage("user",i):this.voiceInterface.addConversationMessage("user",i)}else t.disabled=!1,n&&(n.disabled=!1),this.showTextInputStatus(A?"mobile":"desktop","error","Failed to send")}catch(e){console.error("Error sending text message:",e),t.disabled=!1,n&&(n.disabled=!1),this.showTextInputStatus(A?"mobile":"desktop","error","Error sending")}}else this.showTextInputStatus(A?"mobile":"desktop","error","Enter text first")}else console.warn("VoiceInterface: Cannot send text - call not active")}showTextInputStatus(e,t,n){"mobile"===e?this.showMobileTextInputStatus(t,n):this.showDesktopTextInputStatus(t,n)}showDesktopTextInputStatus(e,t){var n=this.shadowRoot.querySelector(".voice-input-hint");n&&(this._originalHintText||(this._originalHintText=n.textContent),n.classList.remove("voice-input-hint--sending","voice-input-hint--success","voice-input-hint--queued","voice-input-hint--error"),"sending"===e?(n.classList.add("voice-input-hint--sending"),n.textContent=t||"Sending..."):"success"===e?(n.classList.add("voice-input-hint--success"),n.textContent=t||"Sent",this.clearTextInputStatusAfterDelay(3e3)):"queued"===e?(n.classList.add("voice-input-hint--queued"),n.textContent=t||"Queued"):"error"===e?(n.classList.add("voice-input-hint--error"),n.textContent=t||"Error",this.clearTextInputStatusAfterDelay(3e3)):"clear"===e&&(n.textContent=this._originalHintText||this.t("voiceActive")||"Voice is still active • Type or speak",this._originalHintText=null))}showMobileTextInputStatus(e,t){var n=document.querySelector(".mobile-input-hint");n&&(this._originalMobileHintText||(this._originalMobileHintText=n.textContent),n.classList.remove("mobile-input-hint--sending","mobile-input-hint--success","mobile-input-hint--queued","mobile-input-hint--error"),"sending"===e?(n.classList.add("mobile-input-hint--sending"),n.textContent=t||"Sending..."):"success"===e?(n.classList.add("mobile-input-hint--success"),n.textContent=t||"Sent",this.clearMobileTextInputStatusAfterDelay(3e3)):"queued"===e?(n.classList.add("mobile-input-hint--queued"),n.textContent=t||"Queued"):"error"===e?(n.classList.add("mobile-input-hint--error"),n.textContent=t||"Error",this.clearMobileTextInputStatusAfterDelay(3e3)):"clear"===e&&(n.textContent=this._originalMobileHintText||"🎙️ Voice is still active • Type or speak",this._originalMobileHintText=null))}clearTextInputStatusAfterDelay(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;this._statusClearTimeout&&clearTimeout(this._statusClearTimeout),this._statusClearTimeout=setTimeout(()=>{this.showDesktopTextInputStatus("clear"),this._statusClearTimeout=null},e)}clearMobileTextInputStatusAfterDelay(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;this._mobileStatusClearTimeout&&clearTimeout(this._mobileStatusClearTimeout),this._mobileStatusClearTimeout=setTimeout(()=>{this.showMobileTextInputStatus("clear"),this._mobileStatusClearTimeout=null},e)}}class dt{constructor(e){this.voiceInterface=e,this.config=e.config,this.shadowRoot=e.shadowRoot}setupEventHandlers(e){var t=this.shadowRoot.getElementById("startCallBtn"),n=this.shadowRoot.getElementById("desktopEndCallBtn"),A=this.shadowRoot.getElementById("desktopMuteBtn"),o=this.shadowRoot.getElementById("desktopSpeakerBtn"),i=this.shadowRoot.getElementById("desktopEndCallBtnCompact"),r=this.shadowRoot.getElementById("desktopMuteBtnCompact"),a=this.shadowRoot.getElementById("desktopSpeakerBtnCompact");if(t&&(t.onclick=()=>this.voiceInterface.startVoiceCall()),n&&(n.onclick=()=>this.voiceInterface.endVoiceCall()),A&&(A.onclick=()=>this.voiceInterface.toggleMute()),o&&(o.onclick=()=>this.voiceInterface.toggleSpeaker()),i&&(i.onclick=()=>this.voiceInterface.endVoiceCall()),r&&(r.onclick=()=>this.voiceInterface.toggleMute()),a&&(a.onclick=()=>this.voiceInterface.toggleSpeaker()),!this.voiceInterface.isMobile){var s=this.shadowRoot.getElementById("voiceTextInput"),c=this.shadowRoot.getElementById("voiceSendBtn");s&&(s.addEventListener("input",()=>{c&&(c.disabled=!s.value.trim())}),s.addEventListener("keypress",e=>{"Enter"===e.key&&!e.shiftKey&&s.value.trim()&&(e.preventDefault(),c&&!c.disabled&&c.click())})),c&&(c.onclick=()=>{this.voiceInterface.sendDesktopTextMessage()});var l=this.shadowRoot.getElementById("conversationHeader");l&&l.addEventListener("click",()=>{this.voiceInterface.transcript.toggleConversationPanel()})}}setupMobileEventHandlers(){var e;if(this.voiceInterface.isMobile){var t=document.getElementById("mobile-voice-call-bar-container");if(t){var n=t.querySelector("#mobileMuteBtn"),A=t.querySelector("#mobileSpeakerBtn"),o=t.querySelector("#mobileEndCallBtn"),i=t.querySelector("#mobileTranscriptRow"),r=t.querySelector("#mobileCloseTranscriptBtn"),a=t.querySelector("#mobileTextInput"),s=t.querySelector("#mobileSendBtn"),c=(e,t,n)=>{if(!n)return!1;var A=n.getBoundingClientRect();return e>=A.left&&e<=A.right&&t>=A.top&&t<=A.bottom};null===(e=this._mobileTouchCleanup)||void 0===e||e.call(this);var l=null,d=e=>{document.getElementById("mobile-voice-call-bar-container")&&e.touches.length&&(l={x:e.touches[0].clientX,y:e.touches[0].clientY})},p=e=>{var t,n=document.getElementById("mobile-voice-call-bar-container");if(n&&l&&e.changedTouches.length){var A=e.changedTouches[0],o=A.clientX,i=A.clientY,r=Math.abs(o-l.x),a=Math.abs(i-l.y);if(l=null,!(r>15||a>15)){var s=n.querySelector("#mobileMuteBtn"),d=n.querySelector("#mobileSpeakerBtn"),p=n.querySelector("#mobileEndCallBtn"),u=n.querySelector("#mobileTranscriptRow"),h=n.querySelector("#mobileCloseTranscriptBtn"),g=n.querySelector("#mobileSendBtn"),m=n.querySelector("#mobileTextInput"),f=n.querySelector("#mobileTranscriptOverlay"),v=f&&("flex"===f.style.display||"flex"===getComputedStyle(f).display);c(o,i,p)?(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.voiceInterface.endVoiceCall()):c(o,i,s)?(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.voiceInterface.toggleMute()):c(o,i,d)?(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.voiceInterface.toggleSpeaker()):v&&c(o,i,h)?(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.voiceInterface.collapseMobileTranscript()):v&&c(o,i,g)&&null!=m&&null!==(t=m.value)&&void 0!==t&&t.trim()?(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.voiceInterface.sendMobileTextMessage()):!v&&c(o,i,u)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.voiceInterface.expandMobileTranscript())}}else l=null};document.addEventListener("touchstart",d,{passive:!0,capture:!0}),document.addEventListener("touchend",p,{passive:!1,capture:!0}),this._mobileTouchCleanup=()=>{document.removeEventListener("touchstart",d,{capture:!0}),document.removeEventListener("touchend",p,{capture:!0})},n&&n.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.voiceInterface.toggleMute()}),A&&A.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.voiceInterface.toggleSpeaker()}),o&&o.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.voiceInterface.endVoiceCall()}),i&&i.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.voiceInterface.expandMobileTranscript()}),r&&r.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.voiceInterface.collapseMobileTranscript()});var u=()=>{s&&a&&(s.disabled=!a.value.trim())};a&&(a.addEventListener("input",u),a.addEventListener("keyup",u),a.addEventListener("keypress",e=>{"Enter"===e.key&&!e.shiftKey&&a.value.trim()&&(e.preventDefault(),s&&!s.disabled&&s.click())})),s&&s.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.voiceInterface.sendMobileTextMessage()})}}}}class pt{constructor(e){this.voiceInterface=e,this.config=e.config,this.shadowRoot=e.shadowRoot,this._liveWaveformInterval=null}t(e){return this.voiceInterface.t(e)}adjustSizesForContainer(){var e=this.shadowRoot.getElementById("voiceInterface");if(e){var t,n,A,o,i,r,a=e.clientHeight||e.offsetHeight||400,s=e.clientWidth||e.offsetWidth||400;a<=350?(t=80,n=80,A=48,o=54,i=6,r=12):a<=450?(t=100,n=100,A=56,o=62,i=8,r=14):a<=550?(t=120,n=120,A=64,o=70,i=10,r=16):a<=700?(t=140,n=140,A=72,o=78,i=12,r=18):(t=160,n=160,A=80,o=86,i=14,r=20);var c=this.shadowRoot.querySelector(".voice-avatar, .voice-avatar-active");c&&(c.style.width="".concat(t,"px"),c.style.height="".concat(t,"px"),c.style.fontSize="".concat(.5*t,"px"));var l=this.shadowRoot.querySelector(".voice-status-title"),d=this.shadowRoot.querySelector(".voice-status-subtitle");l&&(l.style.fontSize="".concat(r,"px")),d&&(d.style.fontSize="".concat(Math.max(10,r-4),"px"));var p=this.shadowRoot.querySelector(".voice-transcript");p&&(p.style.minHeight="".concat(n,"px"),p.style.maxHeight="".concat(n,"px"),p.style.height="".concat(n,"px"),p.style.width="min(360px, ".concat(s-40,"px)"),p.style.boxSizing="border-box");var u=this.shadowRoot.querySelector(".transcript-label");u&&(u.style.fontSize="".concat(Math.max(8,r-4),"px"));var h=this.shadowRoot.querySelector(".transcript-text");h&&(h.style.fontSize="".concat(Math.max(10,r-2),"px"));var g=this.shadowRoot.querySelector(".voice-text-input-area");if(g){var m=g.querySelector(".voice-input-wrapper"),f=g.querySelector(".voice-text-input"),v=g.querySelector(".voice-send-btn"),B=g.querySelector(".voice-input-hint");if(m&&v){var w=Math.max(32,Math.min(40,.7*A));v.style.width="".concat(w,"px"),v.style.height="".concat(w,"px");var b=v.querySelector("svg");if(b){var y=Math.max(14,Math.min(18,.45*w));b.style.width="".concat(y,"px"),b.style.height="".concat(y,"px")}}f&&(f.style.fontSize="".concat(Math.max(11,Math.min(14,r)),"px"),f.style.padding="".concat(Math.max(6,Math.min(10,Math.floor(.15*A))),"px 0")),B&&(B.style.fontSize="".concat(Math.max(8,Math.min(11,r-4)),"px"),B.style.marginTop="".concat(Math.max(3,Math.min(6,Math.floor(.6*i))),"px"))}this.shadowRoot.querySelectorAll(".voice-control-btn.secondary").forEach(e=>{e.style.width="".concat(A,"px"),e.style.height="".concat(A,"px");var t=e.querySelector("svg");if(t){var n=.65*A;t.style.setProperty("width","".concat(n,"px"),"important"),t.style.setProperty("height","".concat(n,"px"),"important"),t.style.setProperty("min-width","".concat(n,"px"),"important"),t.style.setProperty("min-height","".concat(n,"px"),"important")}});var x=this.shadowRoot.querySelector(".voice-control-btn.primary");if(x){x.style.width="".concat(o,"px"),x.style.height="".concat(o,"px");var C=x.querySelector("svg");if(C){var Q=.7*o;C.style.setProperty("width","".concat(Q,"px"),"important"),C.style.setProperty("height","".concat(Q,"px"),"important"),C.style.setProperty("min-width","".concat(Q,"px"),"important"),C.style.setProperty("min-height","".concat(Q,"px"),"important")}}var F=this.shadowRoot.querySelector(".start-call-btn");if(F){var U,S;a<=350?(U=48,S=14):a<=450?(U=52,S=15):a<=550?(U=58,S=17):a<=700?(U=62,S=18):(U=64,S=18),F.style.height="".concat(U,"px"),F.style.fontSize="".concat(S,"px");var k=F.querySelector("svg");if(k){var E=Math.max(22,.5*U);k.style.width="".concat(E,"px"),k.style.height="".concat(E,"px")}}}}startDesktopWaveformAnimation(){if(!this.voiceInterface.isMobile){var e=this.shadowRoot.getElementById("desktopWaveform");e&&(e.classList.remove("paused"),this.updateDesktopStatus())}}stopDesktopWaveformAnimation(){if(!this.voiceInterface.isMobile){var e=this.shadowRoot.getElementById("desktopWaveform");e&&e.classList.add("paused")}}updateDesktopStatus(){if(!this.voiceInterface.isMobile){var e=this.shadowRoot.getElementById("compactStatusText")||this.shadowRoot.getElementById("desktopStatusText");if(e){var t,n=this.config.statusText;t=n||(this.voiceInterface.isActive&&!this.voiceInterface.isMicMuted?this.t("listening"):this.t("connected")),e.textContent=t;var A=this.shadowRoot.getElementById("desktopStatusText");A&&A!==e&&(A.textContent=t)}}}updateLiveWaveform(e){if(!this.voiceInterface.isMobile){var t=this.shadowRoot.getElementById("desktopLiveWaveform");t&&t.querySelectorAll(".desktop-live-bar").forEach((t,n)=>{if(e){var A=40*Math.random()+8;t.style.height="".concat(A,"px")}else t.style.height="8px"})}}showError(e){var t=this.shadowRoot.getElementById("transcriptText");t&&(t.textContent="".concat(this.t("error"),": ").concat(e),t.classList.remove("empty"))}showDomainError(){console.log("🚫 Showing domain error in widget UI...");var e=this.shadowRoot.getElementById("voiceIdleState");if(e){var t=e.querySelector(".voice-status-title"),n=e.querySelector(".voice-status-subtitle"),A=e.querySelector("#startCallBtn"),o=this.t("domainNotValidated"),i=this.t("domainErrorMessage");console.log("🚫 Domain error title:",o),console.log("🚫 Domain error message:",i),t?(t.textContent=o,t.style.color="#991B1B",t.style.fontSize="20px",t.style.fontWeight="600",t.style.marginLeft="20px",t.style.marginRight="20px",t.style.textAlign="center",console.log("✅ Updated statusTitle with domain error")):console.warn("⚠️ .voice-status-title element not found"),n?(n.textContent=i,n.style.color="#991B1B",n.style.fontSize="16px",n.style.marginLeft="20px",n.style.marginRight="20px",n.style.marginTop="12px",n.style.textAlign="center",n.style.lineHeight="1.5",console.log("✅ Updated statusSubtitle with domain error")):console.warn("⚠️ .voice-status-subtitle element not found"),A?(A.style.display="none",console.log("✅ Hidden start call button")):console.warn("⚠️ #startCallBtn element not found");var r=e.querySelector("#domainErrorBackBtn");if(r)r.style.display="flex";else{(r=document.createElement("button")).id="domainErrorBackBtn",r.className="domain-error-back-btn",r.innerHTML='\n <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" style="margin-right: 8px;">\n <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>\n </svg>\n <span>'.concat(this.t("back")||"Back","</span>\n ");var a=e.querySelector(".voice-status");a&&a.parentNode?a.parentNode.insertBefore(r,a.nextSibling):n&&n.parentNode?n.parentNode.insertBefore(r,n.nextSibling):e.appendChild(r),r.style.cssText="\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 24px auto 0;\n padding: 12px 24px;\n background-color: #7C3AED;\n color: white;\n border: none;\n border-radius: 8px;\n font-size: 16px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 0.2s;\n max-width: 200px;\n ",r.addEventListener("mouseenter",()=>{r.style.backgroundColor="#6D28D9"}),r.addEventListener("mouseleave",()=>{r.style.backgroundColor="#7C3AED"}),r.onclick=()=>{console.log("🔙 Domain error back button clicked"),this.voiceInterface.isShowingDomainError=!1,this.voiceInterface.resetConnectingState(),r&&r.parentNode&&r.parentNode.removeChild(r),this.voiceInterface.config.onShowLanding&&"function"==typeof this.voiceInterface.config.onShowLanding&&this.voiceInterface.config.onShowLanding()},console.log("✅ Created domain error back button")}e.style.display="flex",console.log("✅ Domain error displayed in widget UI");var s=this.shadowRoot.getElementById("transcriptText");if(s){var c=this.t("domainNotValidated"),l=this.t("domainErrorMessage");s.innerHTML='<div style="font-weight: 600; font-size: 16px; margin-bottom: 8px; color: #991B1B;">'.concat(c,'</div><div style="font-size: 14px; color: #991B1B; line-height: 1.5;">').concat(l,"</div>"),s.classList.remove("empty")}}else console.warn("⚠️ voiceIdleState element not found, cannot show domain error")}showBackButtonWarning(){var e=this.shadowRoot.getElementById("transcriptText"),t=this.shadowRoot.getElementById("liveTextCollapsed");if(e){var n=e.textContent,A=e.innerHTML;e.innerHTML='\n <div style="font-weight: 600; font-size: 16px; margin-bottom: 8px; color: #92400e; display: flex; align-items: center; gap: 8px;">\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="flex-shrink: 0;">\n <path d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>\n </svg>\n Please end the call first\n </div>\n <div style="font-size: 14px; color: #92400e; line-height: 1.5;">\n You need to end the current call before going back.\n </div>\n ',e.classList.remove("empty"),setTimeout(()=>{e&&(e.innerHTML=A,e.textContent=n,n&&""!==n.trim()||e.classList.add("empty"))},5e3)}else if(t){var o=t.textContent;t.innerHTML='\n <span style="color: #92400e; font-weight: 600;">⚠️ Please end the call first - You need to end the current call before going back.</span>\n ',setTimeout(()=>{t&&(t.textContent=o)},5e3)}}startLiveWaveformInterval(){this.voiceInterface.isMobile||(this._liveWaveformInterval&&clearInterval(this._liveWaveformInterval),this._liveWaveformInterval=setInterval(()=>{this.updateLiveWaveform(this.voiceInterface.isActive&&!this.voiceInterface.isMicMuted)},100))}stopLiveWaveformInterval(){this._liveWaveformInterval&&(clearInterval(this._liveWaveformInterval),this._liveWaveformInterval=null)}cleanup(){this.stopLiveWaveformInterval(),this.stopDesktopWaveformAnimation()}}class ut{constructor(e){this.voiceInterface=e,this.config=e.config,this.waveformBars=[.3,.5,.8,.4,.6,.9,.5,.7],this.waveformInterval=null,this.isTranscriptExpanded=!1,this._mobileTimerInterval=null,this._mobileCallStartTime=null,this.voiceInterface.messages||(this.voiceInterface.messages=[])}t(e){return this.voiceInterface.t(e)}createMobileMinimizedBar(){var e=document.getElementById("mobile-voice-call-bar-container");if(e&&e.remove(),!document.getElementById("mobile-voice-call-bar-styles")){var t=document.createElement("style");t.id="mobile-voice-call-bar-styles",t.textContent=this.voiceInterface.styles.generateMobileCSS(),document.head.appendChild(t)}var n=document.createElement("div");n.id="mobile-voice-call-bar-container",n.innerHTML='\n \x3c!-- Duration Badge (hidden until first audio) --\x3e\n <div class="mobile-duration-badge mobile-duration-badge--hidden" id="mobileDurationBadge">\n <div class="mobile-duration-dot"></div>\n <span id="mobileDurationText">00:00</span>\n </div>\n \n \x3c!-- Main Bar --\x3e\n <div class="mobile-voice-bar">\n \x3c!-- Top Row: Status, Waveform/Spinner, Controls --\x3e\n <div class="mobile-top-row">\n \x3c!-- Status Indicator --\x3e\n <div class="mobile-status-indicator">\n <div class="mobile-status-dot" id="mobileStatusDot"></div>\n <span class="mobile-status-text" id="mobileStatusText">'.concat(this.t("listening"),'</span>\n </div>\n \n \x3c!-- Centered: Spinner (loading) or Waveform (after first audio) --\x3e\n <div class="mobile-waveform-center" id="mobileWaveform">\n <div class="mobile-waveform-spinner" id="mobileWaveformSpinner" aria-hidden="false">\n <div class="mobile-waveform-spinner-inner"></div>\n </div>\n <div class="mobile-waveform-bars mobile-waveform-bars--hidden" id="mobileWaveformBars">\n ').concat(Array(8).fill(0).map((e,t)=>'<div class="mobile-waveform-bar" data-index="'.concat(t,'"></div>')).join(""),'\n </div>\n </div>\n \n \x3c!-- Controls --\x3e\n <div class="mobile-controls">\n <button type="button" class="mobile-control-btn" id="mobileMuteBtn" aria-label="Mute microphone">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-mic-icon">\n <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n <line x1="12" x2="12" y1="19" y2="22"/>\n </svg>\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-mic-off-icon" style="display: none;">\n <line x1="2" x2="22" y1="2" y2="22"/>\n <path d="M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"/>\n <path d="M5 10v2a7 7 0 0 0 12 5"/>\n <path d="M15 9.34V5a3 3 0 0 0-5.68-1.33"/>\n <path d="M9 9v3a3 3 0 0 0 5.12 2.12"/>\n <line x1="12" x2="12" y1="19" y2="22"/>\n </svg>\n </button>\n \n <button type="button" class="mobile-control-btn" id="mobileSpeakerBtn" aria-label="Toggle speaker">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-speaker-icon">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07"/>\n </svg>\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-speaker-off-icon" style="display: none;">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <line x1="22" x2="16" y1="9" y2="15"/>\n <line x1="16" x2="22" y1="9" y2="15"/>\n </svg>\n </button>\n \n <button type="button" class="mobile-end-call-btn" id="mobileEndCallBtn" aria-label="End call">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/>\n <line x1="22" x2="2" y1="2" y2="22"/>\n </svg>\n </button>\n </div>\n </div>\n \n \x3c!-- Bottom Row: Transcript (expandable) --\x3e\n <button type="button" class="mobile-transcript-row" id="mobileTranscriptRow">\n <p class="mobile-transcript-text" id="mobileTranscriptText">').concat(this.t("transcriptWillAppear"),'</p>\n <div class="mobile-transcript-footer">\n <span class="mobile-expand-hint">tap to expand & type</span>\n <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="opacity: 0.6;">\n <path d="M7 17L17 7M17 7H7M17 7V17"/>\n </svg>\n </div>\n </button>\n\n \x3c!-- Fly-to-cart target: always visible for animation (positioned where cart icon appears) --\x3e\n <div id="ttpFlyToCartTarget" class="ttp-fly-target" aria-hidden="true"></div>\n\n \x3c!-- Cart Row - shown when items are in cart --\x3e\n <div class="mobile-cart-row" id="mobileCartRow" style="display: none;">\n <div class="mobile-cart-row__content">\n <span class="mobile-cart-row__icon" data-ttp-fly-target>🛒</span>\n <span class="mobile-cart-row__text" id="mobileCartText">0 items · ₪0.00</span>\n </div>\n </div>\n </div>\n \n \x3c!-- Expanded Transcript Overlay --\x3e\n <div class="mobile-transcript-overlay" id="mobileTranscriptOverlay" style="display: none;">\n <div class="mobile-expanded-transcript" id="mobileExpandedTranscript">\n \x3c!-- Header --\x3e\n <div class="mobile-transcript-header">\n <div class="mobile-header-left">\n <div class="mobile-header-status">\n <div class="mobile-header-status-dot"></div>\n <span class="mobile-header-status-text" id="mobileHeaderStatusText">').concat(this.t("listening"),'</span>\n <span class="mobile-header-duration" id="mobileHeaderDuration">00:00</span>\n </div>\n <span class="mobile-transcript-label">CONVERSATION</span>\n </div>\n <button type="button" class="mobile-close-transcript-btn" id="mobileCloseTranscriptBtn">\n <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n \x3c!-- Messages Container --\x3e\n <div class="mobile-messages-container" id="mobileMessagesContainer">\n \x3c!-- Messages will be dynamically added here --\x3e\n </div>\n \n \x3c!-- Text Input Area --\x3e\n <div class="mobile-input-area">\n <div class="mobile-input-wrapper">\n <input\n type="text"\n placeholder="Type a message..."\n id="mobileTextInput"\n class="mobile-text-input"\n />\n <button type="button" class="mobile-send-btn" id="mobileSendBtn" disabled>\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"/>\n </svg>\n </button>\n </div>\n <p class="mobile-input-hint">🎙️ ').concat(this.t("voiceActive")||"Voice is still active"," • ").concat(this.t("typeOrSpeak")||"Type or speak","</p>\n </div>\n </div>\n </div>\n "),document.body.appendChild(n);var A=n.querySelector("#mobileMuteBtn"),o=n.querySelector("#mobileSpeakerBtn"),i=n.querySelector("#mobileEndCallBtn");if(A){A.style.cssText="\n width: 32px !important;\n height: 32px !important;\n min-width: 32px !important;\n min-height: 32px !important;\n max-width: 32px !important;\n max-height: 32px !important;\n aspect-ratio: 1 !important;\n border-radius: 50% !important;\n overflow: hidden !important;\n padding: 0 !important;\n margin: 0 !important;\n box-sizing: border-box !important;\n ";var r=A.querySelector(".mobile-mic-icon"),a=A.querySelector(".mobile-mic-off-icon");r&&(r.style.cssText="\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n width: 15px !important;\n height: 15px !important;\n margin: 0 !important;\n padding: 0 !important;\n position: absolute !important;\n top: 50% !important;\n left: 50% !important;\n transform: translate(-50%, -50%) !important;\n "),a&&(a.style.cssText="\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n position: absolute !important;\n top: 50% !important;\n left: 50% !important;\n transform: translate(-50%, -50%) !important;\n ")}if(o){o.style.cssText="\n width: 32px !important;\n height: 32px !important;\n min-width: 32px !important;\n min-height: 32px !important;\n max-width: 32px !important;\n max-height: 32px !important;\n aspect-ratio: 1 !important;\n border-radius: 50% !important;\n overflow: hidden !important;\n padding: 0 !important;\n margin: 0 !important;\n box-sizing: border-box !important;\n ";var s=o.querySelector(".mobile-speaker-icon"),c=o.querySelector(".mobile-speaker-off-icon");s&&(s.style.cssText="\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n width: 15px !important;\n height: 15px !important;\n margin: 0 !important;\n padding: 0 !important;\n position: absolute !important;\n top: 50% !important;\n left: 50% !important;\n transform: translate(-50%, -50%) !important;\n "),c&&(c.style.cssText="\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n position: absolute !important;\n top: 50% !important;\n left: 50% !important;\n transform: translate(-50%, -50%) !important;\n ")}if(i){i.style.cssText="\n width: 36px !important;\n height: 36px !important;\n min-width: 36px !important;\n min-height: 36px !important;\n max-width: 36px !important;\n max-height: 36px !important;\n aspect-ratio: 1 !important;\n border-radius: 50% !important;\n overflow: hidden !important;\n padding: 0 !important;\n margin: 0 !important;\n box-sizing: border-box !important;\n ";var l=i.querySelector("svg");l&&(l.style.cssText="\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n width: 15px !important;\n height: 15px !important;\n margin: 0 !important;\n padding: 0 !important;\n ")}this.voiceInterface.setupMobileEventHandlers()}hideMobileLoadingState(){var e=document.getElementById("mobile-voice-call-bar-container"),t=null==e?void 0:e.querySelector("#mobileWaveformSpinner"),n=null==e?void 0:e.querySelector("#mobileWaveformBars"),A=null==e?void 0:e.querySelector("#mobileDurationBadge");t&&(t.classList.add("mobile-waveform-spinner--hidden"),t.setAttribute("aria-hidden","true")),n&&n.classList.remove("mobile-waveform-bars--hidden"),A&&A.classList.remove("mobile-duration-badge--hidden")}startMobileTimer(){if(null==this._mobileCallStartTime&&!this._mobileTimerInterval){this._mobileCallStartTime=Date.now(),console.log("⏱️ [Mobile] Timer started at",new Date(this._mobileCallStartTime).toISOString());var e=()=>{var e=document.getElementById("mobile-voice-call-bar-container");if(e&&this._mobileCallStartTime){var t=Date.now()-this._mobileCallStartTime,n=Math.floor(t/6e4),A=Math.floor(t%6e4/1e3),o="".concat(n.toString().padStart(2,"0"),":").concat(A.toString().padStart(2,"0")),i=e.querySelector("#mobileDurationText"),r=e.querySelector("#mobileHeaderDuration");i&&(i.textContent=o),r&&(r.textContent=o)}};e(),this._mobileTimerInterval=setInterval(e,1e3)}}stopMobileTimer(){this._mobileTimerInterval&&(clearInterval(this._mobileTimerInterval),this._mobileTimerInterval=null,console.log("⏱️ [Mobile] Timer stopped")),this._mobileCallStartTime=null}removeMobileMinimizedBar(){this.stopMobileTimer();var e=document.getElementById("mobile-voice-call-bar-container");e&&e.remove()}expandMobileTranscript(){var e=document.getElementById("mobile-voice-call-bar-container"),t=null==e?void 0:e.querySelector("#mobileTranscriptOverlay");if(t){t.style.display="flex",this.isTranscriptExpanded=!0;var n=null==e?void 0:e.querySelector("#mobileTextInput"),A=null==e?void 0:e.querySelector("#mobileSendBtn");n&&setTimeout(()=>n.focus(),100),A&&n&&(A.disabled=!n.value.trim());var o=null==e?void 0:e.querySelector("#mobileMessagesContainer");o&&setTimeout(()=>{o.scrollTop=o.scrollHeight},100)}}collapseMobileTranscript(){var e=document.getElementById("mobile-voice-call-bar-container"),t=null==e?void 0:e.querySelector("#mobileTranscriptOverlay");t&&(t.style.display="none",this.isTranscriptExpanded=!1)}updateMobileStatus(e){var t=document.getElementById("mobile-voice-call-bar-container"),n=null==t?void 0:t.querySelector("#mobileStatusText"),A=null==t?void 0:t.querySelector("#mobileHeaderStatusText"),o=null==t?void 0:t.querySelector("#mobileStatusDot");if(n||A){var i=this.config.statusText,r="",a="#6b7280";i?(r=i,a=this.config.statusDotColor||"#10b981"):"connecting"===e?(r=this.t("connecting")||"Connecting...",a="#3b82f6"):"listening"===e||"recording"===e?(r=this.t("listening")||"Listening...",a="#22c55e"):"speaking"===e?(r=this.t("speaking")||"Speaking...",a="#a855f7"):(r=this.t("paused")||"Paused",a="#facc15"),n&&(n.textContent=r),A&&(A.textContent=r),o&&(o.style.backgroundColor=a,o.style.boxShadow="paused"===e?"none":"0 0 8px ".concat(a))}}addMobileMessage(e,t){this.voiceInterface.messages.push({type:e,text:t});var n=document.getElementById("mobile-voice-call-bar-container"),A=null==n?void 0:n.querySelector("#mobileMessagesContainer");if(A){var o=document.createElement("div");o.className="mobile-message-bubble ".concat(e),o.textContent=t,A.appendChild(o),A.scrollTop=A.scrollHeight}}startWaveformAnimation(){this.waveformInterval&&clearInterval(this.waveformInterval);var e=document.getElementById("mobile-voice-call-bar-container"),t=null==e?void 0:e.querySelector("#mobileWaveform");t&&(this.waveformInterval=setInterval(()=>{var e=null==t?void 0:t.querySelector("#mobileWaveformBars"),n=e?e.querySelectorAll(".mobile-waveform-bar"):null==t?void 0:t.querySelectorAll(".mobile-waveform-bar");null!=n&&n.length&&n.forEach((e,t)=>{var n=60*Math.random()+10;e.style.height="".concat(n,"px")})},100))}stopWaveformAnimation(){this.waveformInterval&&(clearInterval(this.waveformInterval),this.waveformInterval=null);var e=document.getElementById("mobile-voice-call-bar-container"),t=null==e?void 0:e.querySelector("#mobileWaveform");if(t){var n=t.querySelector("#mobileWaveformBars");(n?n.querySelectorAll(".mobile-waveform-bar"):t.querySelectorAll(".mobile-waveform-bar")).forEach(e=>{e.style.height="10px"})}}cleanup(){this.stopWaveformAnimation(),this.collapseMobileTranscript(),this.removeMobileMinimizedBar(),this.voiceInterface.messages=[]}}function ht(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function gt(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){ht(i,A,o,r,a,"next",e)}function a(e){ht(i,A,o,r,a,"throw",e)}r(void 0)})}}class mt{constructor(e){var t;this.config=e,this.audioStream=null,this.callStartTime=null,this.callTimerInterval=null,this.sdk=null,this.isActive=!1,this.isShowingDomainError=!1,this.shadowRoot=e.shadowRoot||document,this.textSDK=e.textSDK||null,this.deviceInfo=Ye(),this.isMobile=this.deviceInfo.isMobile,this.conversationExpanded=!1,this.isMicMuted=!1,this.isSpeakerMuted=!1;var n=e.visualAssistant||(null===(t=e.agentSettingsOverride)||void 0===t?void 0:t.visualAssistant);this.sdk=new Vn({agentId:e.agentId,appId:e.appId,websocketUrl:e.websocketUrl,agentSettingsOverride:e.agentSettingsOverride,visualAssistant:n,variables:e.variables||{},language:e.language||"en",outputContainer:e.outputContainer,outputEncoding:e.outputEncoding,outputSampleRate:e.outputSampleRate,outputChannels:e.outputChannels,outputBitDepth:e.outputBitDepth,onConversationStart:e.onConversationStart,onConversationEnd:e.onConversationEnd,onBargeIn:e.onBargeIn,onAudioStartPlaying:e.onAudioStartPlaying,onAudioStoppedPlaying:e.onAudioStoppedPlaying,onSubtitleDisplay:e.onSubtitleDisplay,flavor:e.flavor}),this.templates=new at(this),this.styles=new st(this),this.transcript=new ct(this),this.textHandlers=new lt(this),this.handlers=new dt(this),this.desktop=new pt(this),this.mobile=new ut(this),this.setupSDKEventHandlers(),this.checkAndHandleResume()}getVoiceSDK(){var e;return(null===(e=this.sdk)||void 0===e?void 0:e.voiceSDK)||null}checkAndHandleResume(){if(void 0!==this._resumeInfo)return console.log("🔄 [VOICE INTERFACE] Returning cached resume info:",this._resumeInfo),this._resumeInfo;var e=this.sdk.checkResumeBeforeConnect();return this._resumeInfo=e,e?(console.log("🔄 [WIDGET] Auto-resuming call:",e),console.log(" From:",e.fromPage,"→ To:",e.toPage),this.config.onResume&&this.config.onResume(e),e):null}setupSDKEventHandlers(){var e=this;this.sdk.onTranscript=e=>{console.log("📝 [VOICE INTERFACE] onTranscript called with text:",e),this.updateTranscript(e)},this._pendingUserTranscriptFrame=null,this.sdk.onUserTranscript=(e,t)=>{this._pendingUserTranscriptFrame&&cancelAnimationFrame(this._pendingUserTranscriptFrame),this._pendingUserTranscriptFrame=requestAnimationFrame(()=>{this._pendingUserTranscriptFrame=null;var t=document.getElementById("mobile-voice-call-bar-container");if(t){var n=t.querySelector("#mobileTranscriptText");n&&(n.textContent="You: "+e,n.style.color="#fde68a")}else{var A=this.shadowRoot.getElementById("liveTextCollapsed");if(A){A.textContent="",A.classList.remove("muted"),A.style.color="#1e293b";var o=document.createElement("span");o.style.fontWeight="600",o.style.opacity="0.7",o.textContent="You: ",A.appendChild(o),A.appendChild(document.createTextNode(e))}}}),t&&(this.isMobile?this.addMobileMessage("user",e):(this.transcript.finalizeLiveMessage(),this.addConversationMessage("user",e)))},this.sdk.onPlaybackStarted=()=>{var e,t,n,A;console.log("🔊 [VOICE INTERFACE] Playback started - updating status to listening"),this.isMobile?(null===(e=(t=this.mobile).hideMobileLoadingState)||void 0===e||e.call(t),null===(n=(A=this.mobile).startMobileTimer)||void 0===n||n.call(A),this.updateMobileStatus("listening")):this.updateDesktopStatus()},this.sdk.onAgentSpeaking=e=>{var t=this.shadowRoot.getElementById("voiceAvatarActive");t&&(e?(t.classList.add("speaking"),this.isMobile?(this.updateMobileStatus("speaking"),this.startWaveformAnimation()):(this.updateDesktopStatus(),this.startDesktopWaveformAnimation())):(t.classList.remove("speaking"),this.isMobile?(this.updateMobileStatus("listening"),this.startWaveformAnimation()):(this.updateDesktopStatus(),this.startDesktopWaveformAnimation())))},this.sdk.onDisconnected=function(){var t=gt(function*(t){console.log("🔌 WebSocket disconnected, hanging up call..."),t&&(1008===t.code&&t.reason&&(t.reason.includes("Domain not whitelisted")||t.reason.includes("domain")||t.reason.includes("whitelist"))||1008===t.code&&t.reason&&t.reason.includes("localhost"))?(console.error("❌ Domain not whitelisted - WebSocket closed:",t.code,t.reason),yield e.endCallOnServerRejection()):e.isActive&&(e.isActive=!1,e.endVoiceCall())});return function(e){return t.apply(this,arguments)}}(),this.sdk.onError=function(){var t=gt(function*(t){if(t&&("DOMAIN_NOT_WHITELISTED"===t.message||t.message&&t.message.includes("Domain not whitelisted")))return console.error("❌ Voice SDK Error: Domain not whitelisted:",t),void(yield e.endCallOnServerRejection());t.isServerRejection||"ServerRejected"===t.name||(console.error("❌ Voice SDK Error:",t),e.showError(t.message||t))});return function(e){return t.apply(this,arguments)}}(),this.sdk.onUnsupportedAction=e=>{console.warn('⚠️ Received "'.concat(e,'" but this is not an E-Commerce widget. Use TTPEcommerceWidget instead.'));var t="This widget does not support e-commerce features. Please use TTPEcommerceWidget to display products.";this.config.onErrorToast&&this.config.onErrorToast(t,"warning"),this.isMobile&&this.config.onMobileError&&this.config.onMobileError(t)}}setupTextInjectAckHandler(){return this.textHandlers.setupTextInjectAckHandler()}handleTextInjectAck(e){return this.textHandlers.handleTextInjectAck(e)}sendDesktopTextMessage(){return this.textHandlers.sendDesktopTextMessage()}sendMobileTextMessage(){return this.textHandlers.sendMobileTextMessage()}t(e){var t,n,A=this.config.language||"en";return((null===(t=this.config.translations)||void 0===t?void 0:t[A])||(null===(n=this.config.translations)||void 0===n?void 0:n.en)||{})[e]||e}getText(e,t){return void 0!==this.config[e]&&null!==this.config[e]?this.config[e]:this.t(t)}getTooltip(e){var t,n=null===(t=this.config.tooltips)||void 0===t?void 0:t[e];return null!=n?n:{mute:this.t("mute"),speaker:this.t("speaker"),endCall:this.t("endCall")}[e]||""}_updateTimerElements(e,t){var n=this.shadowRoot.getElementById("voiceTimer");n&&(n.textContent=e);var A=this.shadowRoot.getElementById("desktopTimerText"),o=this.shadowRoot.getElementById("compactTimerText");if(A&&(A.textContent=e),o&&(o.textContent=e),!o&&!A&&t<2e3){console.warn("⚠️ Timer elements not found - compactTimerText:",!!o,"desktopTimerText:",!!A,"elapsed:",t);var i=this.shadowRoot.querySelectorAll('[id*="Timer"], [id*="timer"]');console.log("Found timer-like elements:",Array.from(i).map(e=>e.id))}var r=document.getElementById("mobile-voice-call-bar-container");if(r){var a=r.querySelector("#mobileDurationText"),s=r.querySelector("#mobileHeaderDuration");a&&(a.textContent=e),s&&(s.textContent=e)}}generateHTML(){return this.templates.generateHTML()}generateMobileHTML(){return this.templates.generateMobileHTML()}generateCSS(){return this.styles.generateCSS()}setupEventHandlers(e){this.handlers.setupEventHandlers(e)}setupMobileEventHandlers(){return this.handlers.setupMobileEventHandlers()}adjustSizesForContainer(){return this.desktop.adjustSizesForContainer()}startDesktopWaveformAnimation(){return this.desktop.startDesktopWaveformAnimation()}stopDesktopWaveformAnimation(){return this.desktop.stopDesktopWaveformAnimation()}updateDesktopStatus(){return this.desktop.updateDesktopStatus()}updateLiveWaveform(e){return this.desktop.updateLiveWaveform(e)}showError(e){return this.desktop.showError(e)}showDomainError(){return this.desktop.showDomainError()}startVoiceCall(){var e=this;return gt(function*(){if(e.isActive)console.log("⚠️ Voice call already active");else{console.log("🎤 Starting voice call...");var t=yield Je();if(console.log("📋 Current permission state: ".concat(t)),"denied"===t)throw console.log("🚫 Permission is denied, showing blocked modal..."),e.resetConnectingState(),Ye(),it(()=>{console.log("Blocked modal closed")}),new Error("Microphone permission denied");if("prompt"===t||"unknown"===t){console.log("📋 Permission is in prompt state, showing pre-prompt modal with call view...");var n=e.shadowRoot.getElementById("voiceIdleState"),A=e.shadowRoot.getElementById("voiceActiveState");return n&&(n.style.display="none"),A&&(A.style.display="flex"),new Promise((t,o)=>{ot(gt(function*(){console.log("✅ Pre-prompt accepted, proceeding with voice call...");try{yield e.proceedWithVoiceCall(),t()}catch(e){o(e)}}),()=>{console.log("❌ Pre-prompt cancelled"),n&&(n.style.display="flex"),A&&(A.style.display="none"),e.resetConnectingState(),o(new Error("Call cancelled by user"))})})}yield e.proceedWithVoiceCall()}})()}proceedWithVoiceCall(){var e=this;return gt(function*(){try{if(null!==e._resumeInfo&&void 0!==e._resumeInfo)console.log("🔄 Resume call detected - preserving conversation history");else{console.log("🆕 New call detected - clearing conversation history"),e.transcript.clearConversationMessages(),e.conversationExpanded=!1;var t=e.shadowRoot.getElementById("desktopConversationPanel"),n=e.shadowRoot.getElementById("conversationHeader"),A=e.shadowRoot.getElementById("conversationToggleText"),o=e.shadowRoot.querySelector(".voice-interface"),i=e.shadowRoot.getElementById("desktopVoiceSection"),r=e.shadowRoot.getElementById("compactVoiceSection");t&&(t.classList.remove("expanded"),t.classList.add("collapsed")),n&&n.classList.remove("expanded"),A&&(A.textContent="Show history"),o&&o.classList.remove("expanded"),i&&(i.style.display=""),r&&(r.style.display="none")}if(e.isMobile){var a=e.shadowRoot.getElementById("voiceIdleState");a&&(a.style.display="none");var s=e.shadowRoot.getElementById("text-chat-panel");if(s)s.classList.remove("open"),s.style.display="none",console.log("✅ Widget panel hidden (waiting for permission)");else{var c=document.getElementById("text-chat-panel");c&&(c.classList.remove("open"),c.style.display="none",console.log("✅ Widget panel hidden (waiting for permission, fallback)"))}console.log("📱 Mobile device - requesting mic permission before connecting...");var l=null;try{l=yield navigator.mediaDevices.getUserMedia({audio:!0}),e._preliminaryInputStream=l,console.log("✅ Mobile: Microphone permission granted - keeping stream alive (ElevenLabs pattern)");var d=e.shadowRoot.getElementById("text-chat-button");if(d)d.style.display="none",console.log("✅ Floating button hidden (permission granted)");else{var p=document.getElementById("text-chat-button");p&&(p.style.display="none",console.log("✅ Floating button hidden (permission granted, fallback)"))}var u=e.shadowRoot.querySelector(".ttp-mobile-fab");u&&(u.style.display="none")}catch(T){console.error("❌ Mobile: Permission denied before connecting:",T),e.resetConnectingState(),document.getElementById("mobile-voice-call-bar-container")&&e.removeMobileMinimizedBar();var h=e.shadowRoot.getElementById("text-chat-button");if(h)h.style.display="";else{var g=document.getElementById("text-chat-button");g&&(g.style.display="")}var m=e.shadowRoot.querySelector(".ttp-mobile-fab");m&&(m.style.display="");var f=e.shadowRoot.getElementById("voiceIdleState");f&&(f.style.display="flex");var v=e.shadowRoot.getElementById("text-chat-panel");if(v)v.style.display="";else{var B=document.getElementById("text-chat-panel");B&&(B.style.display="")}return Ye(),void it(()=>{e.resetUIState()})}}else{e.resetConnectingState();var w=e.shadowRoot.getElementById("voiceIdleState"),b=e.shadowRoot.getElementById("voiceActiveState");w&&(w.style.display="none"),b&&(b.style.display="flex")}var y=e.shadowRoot.getElementById("voiceInterface");if(setTimeout(()=>e.adjustSizesForContainer(),50),y&&(y.scrollTop=0),!e.config.agentId)throw new Error("agentId is required for voice calls");if(e.sdk&&e.sdk.isConnected){console.log("🔄 SDK already connected, disconnecting for clean retry...");try{e.sdk.disconnect(),yield new Promise(e=>setTimeout(e,100))}catch(e){console.warn("Warning: Error disconnecting existing connection:",e)}}if(e.isMobile){var x,C=null!==(x=e.config.connectionDelay)&&void 0!==x?x:{default:0,android:3e3,ios:0};yield function(){return nt.apply(this,arguments)}(C)}var Q=yield e.sdk.connect();console.log("✅ Connected to WebSocket, connected:",Q),e.setupTextInjectAckHandler();var F=!1,U=e.sdk.onError,S=e.sdk.onDisconnected;e.sdk.onError=t=>{t&&("DOMAIN_NOT_WHITELISTED"===t.message||t.message&&t.message.includes("Domain not whitelisted"))&&(F=!0,console.log("🚫 Server rejected connection before starting audio capture")),U&&U.call(e.sdk,t)},e.sdk.onDisconnected=t=>{t&&1008===t.code&&t.reason&&(t.reason.includes("Domain not whitelisted")||t.reason.includes("domain")||t.reason.includes("whitelist"))&&(F=!0,console.log("🚫 Server disconnected due to domain error before starting audio capture")),S&&S.call(e.sdk,t)};for(var k=0;k<50;){if(F)throw console.log("🚫 Server rejected connection, aborting audio capture"),new Error("DOMAIN_NOT_WHITELISTED");if(e.sdk.isConnected&&e.sdk.voiceSDK&&e.sdk.voiceSDK.isConnected&&e.sdk.voiceSDK.websocket&&e.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN)break;yield new Promise(e=>setTimeout(e,100)),k++}if(F)throw e.sdk.onError=U,e.sdk.onDisconnected=S,console.log("🚫 Server rejected connection, aborting audio capture"),new Error("DOMAIN_NOT_WHITELISTED");if(!(e.sdk.isConnected&&e.sdk.voiceSDK&&e.sdk.voiceSDK.isConnected&&e.sdk.voiceSDK.websocket&&e.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN))throw e.sdk.onError=U,e.sdk.onDisconnected=S,console.warn("⚠️ Connection lost before starting audio capture"),new Error("Connection lost before starting audio capture");if(e.sdk.onError=U,e.sdk.onDisconnected=S,e.sdk.isConnected&&e.sdk.voiceSDK&&e.sdk.voiceSDK.websocket&&e.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN){console.log("✅ WebSocket ready, starting listening...");try{var E=e._preliminaryInputStream||null;if(E&&(e._preliminaryInputStream=null),yield e.sdk.startListening(E),!(e.sdk.isConnected&&e.sdk.voiceSDK&&e.sdk.voiceSDK.isConnected&&e.sdk.voiceSDK.websocket&&e.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN)){var I;if(null!==(I=e.sdk.voiceSDK)&&void 0!==I&&I.isRecording)try{yield e.sdk.voiceSDK.stopRecording()}catch(e){}var T=new Error("Connection lost - server may have rejected the call");throw T.name="ServerRejected",T.isServerRejection=!0,T}console.log("🎤 Started listening - permission granted"),e._stopPreliminaryInputStream(),e.isActive=!0,e.resetMuteState(),e.isMobile?(document.getElementById("mobile-voice-call-bar-container")?console.log("📱 Mobile device - bar already exists, updating status"):(console.log("📱 Mobile device - permission granted, creating minimized bar"),e.createMobileMinimizedBar()),0===e.messages.length&&e.messages.push({type:"assistant",text:e.t("transcriptWillAppear")}),e.startWaveformAnimation()):(e.startDesktopWaveformAnimation(),e.desktop.startLiveWaveformInterval())}catch(T){if(T.isServerRejection||"ServerRejected"===T.name)throw e.resetConnectingState(),T;if(console.error("❌ Failed to start listening - permission denied or error:",T),e.resetConnectingState(),e.isMobile){document.getElementById("mobile-voice-call-bar-container")&&e.removeMobileMinimizedBar();var H=e.shadowRoot.getElementById("voiceIdleState");H&&(H.style.display="flex");var _=e.shadowRoot.getElementById("text-chat-panel");if(_)_.style.display="";else{var D=document.getElementById("text-chat-panel");D&&(D.style.display="")}var M=e.shadowRoot.getElementById("text-chat-button");if(M)M.style.display="";else{var P=document.getElementById("text-chat-button");P&&(P.style.display="")}}throw T}if(!e.isMobile&&!e.callStartTime){e.callStartTime=Date.now(),console.log("⏱️ Starting call timer at",new Date(e.callStartTime).toISOString());var L=()=>{if(e.callStartTime){var t=Date.now()-e.callStartTime,n=Math.floor(t/6e4),A=Math.floor(t%6e4/1e3),o="".concat(n.toString().padStart(2,"0"),":").concat(A.toString().padStart(2,"0"));e._updateTimerElements(o,t)}};setTimeout(()=>{L(),e.callTimerInterval=setInterval(L,1e3)},100)}}else{if(F)throw console.log("🚫 Server rejected connection, aborting audio capture"),new Error("DOMAIN_NOT_WHITELISTED");if(!(e.sdk.isConnected&&e.sdk.voiceSDK&&e.sdk.voiceSDK.isConnected&&e.sdk.voiceSDK.websocket&&e.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN))throw console.warn("⚠️ Connection not valid, aborting audio capture"),new Error("Connection lost before starting audio capture");console.warn("⚠️ Connection not fully ready, but trying to start listening anyway...");try{var R=e._preliminaryInputStream||null;R&&(e._preliminaryInputStream=null),yield e.sdk.startListening(R),console.log("🎤 Started listening - permission granted"),e._stopPreliminaryInputStream(),e.isActive=!0,e.resetMuteState(),e.isMobile?(document.getElementById("mobile-voice-call-bar-container")?console.log("📱 Mobile device - bar already exists, updating status"):(console.log("📱 Mobile device - permission granted, creating minimized bar"),e.createMobileMinimizedBar()),0===e.messages.length&&e.messages.push({type:"assistant",text:e.t("transcriptWillAppear")}),e.startWaveformAnimation()):(e.startDesktopWaveformAnimation(),e.desktop.startLiveWaveformInterval())}catch(T){if(T.isServerRejection||"ServerRejected"===T.name)throw e.resetConnectingState(),T;if(console.error("❌ Failed to start listening - permission denied or error:",T),e.resetConnectingState(),e.isMobile){document.getElementById("mobile-voice-call-bar-container")&&e.removeMobileMinimizedBar();var K=e.shadowRoot.getElementById("voiceIdleState");K&&(K.style.display="flex");var O=e.shadowRoot.getElementById("text-chat-panel");if(O)O.style.display="";else{var V=document.getElementById("text-chat-panel");V&&(V.style.display="")}var N=e.shadowRoot.getElementById("text-chat-button");if(N)N.style.display="";else{var j=document.getElementById("text-chat-button");j&&(j.style.display="")}}throw T}if(!e.isMobile&&!e.callStartTime){e.callStartTime=Date.now(),console.log("⏱️ Starting call timer at",new Date(e.callStartTime).toISOString());var G=()=>{if(e.callStartTime){var t=Date.now()-e.callStartTime,n=Math.floor(t/6e4),A=Math.floor(t%6e4/1e3),o="".concat(n.toString().padStart(2,"0"),":").concat(A.toString().padStart(2,"0"));e._updateTimerElements(o,t)}};setTimeout(()=>{G(),e.callTimerInterval=setInterval(G,1e3)},100)}}console.log("✅ Voice call started successfully")}catch(T){if(T.isServerRejection||"ServerRejected"===T.name||console.error("❌ Error starting voice call:",T),e._stopPreliminaryInputStream(),e.resetConnectingState(),e.isActive=!1,e.callTimerInterval&&(clearInterval(e.callTimerInterval),e.callTimerInterval=null),e.callStartTime=null,e.sdk&&e.sdk.isConnected)try{e.sdk.disconnect()}catch(e){console.warn("Error disconnecting SDK on error:",e)}"NotAllowedError"===T.name||"PermissionDeniedError"===T.name?(Ye(),it(()=>{e.resetUIState()})):"NotFoundError"===T.name||"DevicesNotFoundError"===T.name?rt(()=>{e.resetUIState()}):T&&("DOMAIN_NOT_WHITELISTED"===T.message||T.message&&T.message.includes("Domain not whitelisted"))?yield e.endCallOnServerRejection():(e.showError(T.message||T),e.resetUIState())}})()}_stopPreliminaryInputStream(){if(this._preliminaryInputStream){try{this._preliminaryInputStream.getTracks().forEach(e=>e.stop())}catch(e){console.warn("⚠️ Error stopping preliminary stream:",e)}this._preliminaryInputStream=null}}resetUIState(){if(this.resetConnectingState(),this.isMobile){this.removeMobileMinimizedBar(),this.stopWaveformAnimation(),this.messages=[];var e=this.shadowRoot.getElementById("text-chat-panel");if(e)e.style.display="";else{var t=document.getElementById("text-chat-panel");t&&(t.style.display="")}}var n=this.shadowRoot.getElementById("voiceIdleState"),A=this.shadowRoot.getElementById("voiceActiveState");n&&(n.style.display="flex"),A&&(A.style.display="none")}endCallOnServerRejection(){var e=this;return gt(function*(){console.log("🚫 Server rejected call - ending call and stopping audio capture/VAD..."),console.log("🚫 Calling endCallOnServerRejection() - will show domain error message");var t=e.shadowRoot.getElementById("voiceInterface"),n=e.shadowRoot.getElementById("landingScreen");if(t&&(t.classList.add("active"),console.log("✅ Made voice interface visible")),n&&(n.classList.remove("active"),console.log("✅ Hid landing screen")),e.config.onShowVoice&&"function"==typeof e.config.onShowVoice&&(console.log("🚫 Calling onShowVoice callback to ensure voice interface is visible..."),e.config.onShowVoice()),e.sdk){try{var A,o,i=null===(A=e.sdk.voiceSDK)||void 0===A?void 0:A.audioRecorder;if(e.sdk.isListening||(null===(o=e.sdk.voiceSDK)||void 0===o?void 0:o.isRecording)||i&&i.isRecording||i&&null!==i.audioWorkletNode||i){if(console.log("🛑 Stopping audio capture/VAD..."),null!=i&&i.audioWorkletNode){console.log("🛑 Sending stop message to AudioWorklet to stop VAD...");try{i.audioWorkletNode.port.postMessage({type:"stop"}),yield new Promise(e=>setTimeout(e,150))}catch(e){console.warn("Error sending stop message to AudioWorklet:",e)}}if(e.sdk.voiceSDK&&"function"==typeof e.sdk.voiceSDK.stopRecording)try{yield e.sdk.voiceSDK.stopRecording(),console.log("✅ stopRecording() completed")}catch(e){console.warn("Error calling stopRecording:",e)}else if(e.sdk.stopListening)try{e.sdk.stopListening(),yield new Promise(e=>setTimeout(e,200))}catch(e){console.warn("Error calling stopListening:",e)}if(i&&"function"==typeof i.stop)try{yield i.stop(),console.log("✅ AudioRecorder.stop() completed")}catch(e){console.warn("Error calling AudioRecorder.stop():",e)}console.log("✅ Audio capture/VAD stopped")}null!=i&&i.mediaStream&&(console.log("🛑 Force stopping media stream tracks (backup cleanup)..."),i.mediaStream.getTracks().forEach(e=>{"ended"!==e.readyState&&(e.stop(),console.log("✅ Force stopped track:",e.kind))})),e.audioStream&&(console.log("🛑 Stopping stored audio stream..."),e.audioStream.getTracks().forEach(e=>{"ended"!==e.readyState&&e.stop()}),e.audioStream=null),e.sdk.hangup()}catch(t){console.warn("Error stopping listening on server rejection:",t);try{var r;null!==(r=e.sdk.voiceSDK)&&void 0!==r&&null!==(r=r.audioRecorder)&&void 0!==r&&r.mediaStream&&e.sdk.voiceSDK.audioRecorder.mediaStream.getTracks().forEach(e=>e.stop()),e.audioStream&&(e.audioStream.getTracks().forEach(e=>e.stop()),e.audioStream=null)}catch(e){console.warn("Error force-stopping media streams:",e)}}if(e.sdk.isConnected)try{e.sdk.disconnect()}catch(e){console.warn("Error disconnecting SDK on server rejection:",e)}}e.isActive=!1,e.config.onCallEnd&&e.config.onCallEnd,e.callTimerInterval&&(clearInterval(e.callTimerInterval),e.callTimerInterval=null);var a=e.shadowRoot.getElementById("voiceActiveState"),s=e.shadowRoot.getElementById("voiceIdleState");if(a&&(a.style.display="none"),s&&(s.style.display="flex",e.isShowingDomainError=!0,console.log("🚫 Setting isShowingDomainError flag to true"),console.log("🚫 Calling showDomainError() to display domain error in widget..."),e.showDomainError(),console.log("🚫 showDomainError() completed, isShowingDomainError:",e.isShowingDomainError)),e.isMobile){var c=e.shadowRoot.getElementById("text-chat-panel");if(c)c.style.display="";else{var l=document.getElementById("text-chat-panel");l&&(l.style.display="")}var d=e.shadowRoot.getElementById("text-chat-button");if(d)d.style.display="";else{var p=document.getElementById("text-chat-button");p&&(p.style.display="")}var u=e.shadowRoot.querySelector(".ttp-mobile-fab");u&&(u.style.display=""),e.removeMobileMinimizedBar(),e.stopWaveformAnimation();var h=e.t("domainNotValidated")||"Domain not whitelisted. Please contact support.";e.config.onMobileError?e.config.onMobileError(h):e.config.onErrorToast&&e.config.onErrorToast(h,"error")}})()}endVoiceCall(){var e;console.log("🔴 Ending voice call..."),this.isMicMuted=!1,this.isSpeakerMuted=!1,["desktopMuteBtn","desktopMuteBtnCompact"].forEach(e=>{var t=this.shadowRoot.getElementById(e);if(t){t.classList.remove("muted");var n=t.querySelector(".desktop-mic-icon"),A=t.querySelector(".desktop-mic-off-icon");n&&(n.style.display="block"),A&&(A.style.display="none")}}),["desktopSpeakerBtn","desktopSpeakerBtnCompact"].forEach(e=>{var t=this.shadowRoot.getElementById(e);if(t){t.classList.remove("muted");var n=t.querySelector(".desktop-speaker-icon"),A=t.querySelector(".desktop-speaker-off-icon");n&&(n.style.display="block"),A&&(A.style.display="none")}});var t=document.getElementById("mobile-voice-call-bar-container"),n=null==t?void 0:t.querySelector("#mobileMuteBtn");if(n){n.classList.remove("muted");var A=n.querySelector(".mobile-mic-icon"),o=n.querySelector(".mobile-mic-off-icon");A&&(A.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"),o&&(o.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;")}var i=null==t?void 0:t.querySelector("#mobileSpeakerBtn");if(i){i.classList.remove("muted");var r=i.querySelector(".mobile-speaker-icon"),a=i.querySelector(".mobile-speaker-off-icon");r&&(r.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"),a&&(a.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;")}if(this._resumeInfo=null,this.sdk&&this.isActive&&(this.sdk.stopListening(),this.sdk.hangup(),this.isActive=!1),this.audioStream&&(this.audioStream.getTracks().forEach(e=>e.stop()),this.audioStream=null),this.callTimerInterval&&(clearInterval(this.callTimerInterval),this.callTimerInterval=null),this._textInjectTimeout&&(clearTimeout(this._textInjectTimeout),this._textInjectTimeout=null),this._statusClearTimeout&&(clearTimeout(this._statusClearTimeout),this._statusClearTimeout=null),this._mobileTextInjectTimeout&&(clearTimeout(this._mobileTextInjectTimeout),this._mobileTextInjectTimeout=null),this._mobileStatusClearTimeout&&(clearTimeout(this._mobileStatusClearTimeout),this._mobileStatusClearTimeout=null),null!==(e=this.sdk)&&void 0!==e&&e.voiceSDK&&this.textHandlers._textInjectAckHandler&&(this.sdk.voiceSDK.off("textInjectAck",this.textHandlers._textInjectAckHandler),this.textHandlers._textInjectAckHandler=null),this._originalHintText=null,this._originalMobileHintText=null,this.isMobile||(this.stopDesktopWaveformAnimation(),this.desktop.stopLiveWaveformInterval(),this.transcript.clearConversationMessages(),this.conversationExpanded=!1),this.isMobile){this.stopWaveformAnimation(),this.collapseMobileTranscript(),this.removeMobileMinimizedBar(),this.messages=[];var s=this.shadowRoot.querySelector(".ttp-mobile-fab");s&&(s.style.display="");var c=this.shadowRoot.getElementById("text-chat-panel");if(c)c.style.display="";else{var l=document.getElementById("text-chat-panel");l&&(l.style.display="")}}var d=this.shadowRoot.getElementById("text-chat-button");if(d)d.style.display="",console.log("✅ Floating button restored (call ended)");else{var p=document.getElementById("text-chat-button");p&&(p.style.display="",console.log("✅ Floating button restored (call ended, fallback)"))}var u=this.shadowRoot.getElementById("voiceActiveState");if(u&&(u.style.display="none"),"function"==typeof this.config.onVoiceCallButtonClick)try{this.config.onVoiceCallButtonClick({timestamp:Date.now(),widgetState:"end"})}catch(e){console.error("Error in onVoiceCallButtonClick callback:",e)}if(this.config.onCallEnd)this.config.onCallEnd();else{var h=this.shadowRoot.getElementById("voiceIdleState");h&&(h.style.display="flex"),setTimeout(()=>this.adjustSizesForContainer(),50)}var g=this.shadowRoot.getElementById("transcriptText");g&&(g.textContent=this.t("transcriptWillAppear"),g.classList.add("empty"));var m=document.getElementById("mobile-voice-call-bar-container");if(m){var f=m.querySelector("#mobileTranscriptText");f&&(f.textContent=this.t("transcriptWillAppear"))}var v=this.shadowRoot.getElementById("voiceAvatarActive");v&&v.classList.remove("speaking"),console.log("✅ Voice call ended")}showConnectingState(){if(this.isMobile)console.log("📱 Mobile device - skipping showConnectingState() (minimized bar handles connecting state)");else{var e=this.shadowRoot.getElementById("voiceIdleState"),t=this.shadowRoot.getElementById("voiceActiveState");if(e){var n=e.querySelector(".voice-status-title"),A=e.querySelector(".voice-status-subtitle"),o=e.querySelector("#startCallBtn");if(n&&(n.textContent=this.t("connecting")),A&&(A.textContent=this.t("connectingSubtitle")),o){o.disabled=!0,o.style.opacity="0.6",o.style.cursor="not-allowed";var i=o.querySelector("span");if(i){var r=document.createElement("span");r.className="connecting-spinner",i.textContent="",i.appendChild(r),i.appendChild(document.createTextNode(" "+this.t("connecting")))}}e.style.display="flex"}t&&(t.style.display="none")}}resetConnectingState(){if(this.isShowingDomainError)console.log("🚫 resetConnectingState() called but domain error is displayed - skipping reset");else{var e=this.shadowRoot.getElementById("voiceIdleState");if(e){var t=e.querySelector("#domainErrorBackBtn");t&&t.parentNode&&t.parentNode.removeChild(t);var n=e.querySelector(".voice-status-title"),A=e.querySelector(".voice-status-subtitle"),o=e.querySelector("#startCallBtn");if(n&&(n.textContent=this.getText("startCallTitle","clickToStartCall"),n.style.color="",n.style.fontSize="",n.style.fontWeight="",n.style.marginLeft="",n.style.marginRight="",n.style.textAlign=""),A&&(A.textContent=this.getText("startCallSubtitle","realTimeVoice"),A.style.color="",A.style.fontSize="",A.style.marginLeft="",A.style.marginRight="",A.style.marginTop="",A.style.textAlign="",A.style.lineHeight=""),o){o.disabled=!1,o.style.opacity="",o.style.cursor="",o.style.display="";var i=o.querySelector("span");i&&(i.textContent=this.getText("startCallButtonText","startCall"))}}}}updateTranscript(e){return this.transcript.updateTranscript(e)}toggleConversationPanel(){return this.transcript.toggleConversationPanel()}addConversationMessage(e,t){return this.transcript.addConversationMessage(e,t)}renderConversationMessages(){return this.transcript.renderConversationMessages()}escapeHtml(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML}toggleMute(){if(this.sdk&&this.isActive){var e=null;if(this.sdk.voiceSDK&&this.sdk.voiceSDK.audioRecorder&&this.sdk.voiceSDK.audioRecorder.mediaStream&&(e=this.sdk.voiceSDK.audioRecorder.mediaStream.getAudioTracks()[0]),!e&&this.audioStream&&(e=this.audioStream.getAudioTracks()[0]),e){e.enabled=!e.enabled,this.isMicMuted=!e.enabled;var t=this.shadowRoot.getElementById("desktopMuteBtn"),n=this.shadowRoot.getElementById("desktopMuteBtnCompact");if(this.isMobile||this.updateDesktopStatus(),t){var A=t.querySelector(".desktop-mic-icon"),o=t.querySelector(".desktop-mic-off-icon");A&&o&&(e.enabled?(t.classList.remove("muted"),A.style.display="block",o.style.display="none"):(t.classList.add("muted"),A.style.display="none",o.style.display="block"))}if(n){var i=n.querySelector(".desktop-mic-icon"),r=n.querySelector(".desktop-mic-off-icon");i&&r&&(e.enabled?(n.classList.remove("muted"),i.style.display="block",r.style.display="none"):(n.classList.add("muted"),i.style.display="none",r.style.display="block"))}if(this.isMobile){var a=document.getElementById("mobile-voice-call-bar-container"),s=null==a?void 0:a.querySelector("#mobileMuteBtn"),c=null==s?void 0:s.querySelector(".mobile-mic-icon"),l=null==s?void 0:s.querySelector(".mobile-mic-off-icon");s&&c&&l&&(e.enabled?(s.classList.remove("muted"),c.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;",l.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;"):(s.classList.add("muted"),c.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;",l.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"))}console.log(e.enabled?"🔊 Unmuted":"🔇 Muted")}else console.warn("⚠️ No audio track available for mute toggle")}}toggleSpeaker(){if(this.sdk&&this.isActive){if(this.isSpeakerMuted=!this.isSpeakerMuted,this.sdk.voiceSDK&&this.sdk.voiceSDK.audioPlayer?(this.sdk.voiceSDK.audioPlayer.setMuted(this.isSpeakerMuted),console.log("🔊 Speaker toggle:",this.isSpeakerMuted?"muted":"unmuted")):console.warn("⚠️ Cannot toggle speaker - audioPlayer not available"),!this.isMobile){var e=this.shadowRoot.getElementById("desktopSpeakerBtn"),t=this.shadowRoot.getElementById("desktopSpeakerBtnCompact");if(e){var n=e.querySelector(".desktop-speaker-icon"),A=e.querySelector(".desktop-speaker-off-icon");n&&A&&(this.isSpeakerMuted?(e.classList.add("muted"),n.style.display="none",A.style.display="block"):(e.classList.remove("muted"),n.style.display="block",A.style.display="none"))}if(t){var o=t.querySelector(".desktop-speaker-icon"),i=t.querySelector(".desktop-speaker-off-icon");o&&i&&(this.isSpeakerMuted?(t.classList.add("muted"),o.style.display="none",i.style.display="block"):(t.classList.remove("muted"),o.style.display="block",i.style.display="none"))}}if(this.isMobile){var r=document.getElementById("mobile-voice-call-bar-container"),a=null==r?void 0:r.querySelector("#mobileSpeakerBtn"),s=null==a?void 0:a.querySelector(".mobile-speaker-icon"),c=null==a?void 0:a.querySelector(".mobile-speaker-off-icon");a&&s&&c&&(this.isSpeakerMuted?(a.classList.add("muted"),s.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;",c.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"):(a.classList.remove("muted"),s.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;",c.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;"))}}}updateMobileStatus(e){return this.mobile.updateMobileStatus(e)}createMobileMinimizedBar(){return this.mobile.createMobileMinimizedBar()}removeMobileMinimizedBar(){return this.mobile.removeMobileMinimizedBar()}expandMobileTranscript(){return this.mobile.expandMobileTranscript()}collapseMobileTranscript(){return this.mobile.collapseMobileTranscript()}addMobileMessage(e,t){return this.mobile.addMobileMessage(e,t)}startWaveformAnimation(){return this.mobile.startWaveformAnimation()}startMobileCallTimerEarly(){if(null==this.callStartTime&&!this.callTimerInterval){this.callStartTime=Date.now();var e=()=>{if(this.callStartTime){var e=Date.now()-this.callStartTime,t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3),A="".concat(t.toString().padStart(2,"0"),":").concat(n.toString().padStart(2,"0"));this._updateTimerElements(A,e)}};e(),this.callTimerInterval=setInterval(e,1e3)}}stopWaveformAnimation(){return this.mobile.stopWaveformAnimation()}resetMuteState(){var e,t;if(this.isMicMuted=!1,this.isSpeakerMuted=!1,console.log("%c🎤 MIC/SPEAKER RESET - New call starting unmuted","background: #10b981; color: white; font-size: 14px; font-weight: bold; padding: 4px 8px; border-radius: 4px;"),null!==(e=this.sdk)&&void 0!==e&&null!==(e=e.voiceSDK)&&void 0!==e&&null!==(e=e.audioRecorder)&&void 0!==e&&e.mediaStream){var n=this.sdk.voiceSDK.audioRecorder.mediaStream.getAudioTracks()[0];n&&(n.enabled=!0)}null!==(t=this.sdk)&&void 0!==t&&null!==(t=t.voiceSDK)&&void 0!==t&&t.audioPlayer&&this.sdk.voiceSDK.audioPlayer.setMuted(!1),["desktopMuteBtn","desktopMuteBtnCompact"].forEach(e=>{var t=this.shadowRoot.getElementById(e);if(t){t.classList.remove("muted");var n=t.querySelector(".desktop-mic-icon"),A=t.querySelector(".desktop-mic-off-icon");n&&(n.style.display="block"),A&&(A.style.display="none")}}),["desktopSpeakerBtn","desktopSpeakerBtnCompact"].forEach(e=>{var t=this.shadowRoot.getElementById(e);if(t){t.classList.remove("muted");var n=t.querySelector(".desktop-speaker-icon"),A=t.querySelector(".desktop-speaker-off-icon");n&&(n.style.display="block"),A&&(A.style.display="none")}});var A=document.getElementById("mobile-voice-call-bar-container"),o=null==A?void 0:A.querySelector("#mobileMuteBtn");if(o){o.classList.remove("muted");var i=o.querySelector(".mobile-mic-icon"),r=o.querySelector(".mobile-mic-off-icon");i&&(i.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"),r&&(r.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;")}var a=null==A?void 0:A.querySelector("#mobileSpeakerBtn");if(a){a.classList.remove("muted");var s=a.querySelector(".mobile-speaker-icon"),c=a.querySelector(".mobile-speaker-off-icon");s&&(s.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"),c&&(c.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;")}}destroy(){this.isActive&&this.endVoiceCall(),this.audioStream&&(this.audioStream.getTracks().forEach(e=>e.stop()),this.audioStream=null),this.callTimerInterval&&(clearInterval(this.callTimerInterval),this.callTimerInterval=null),this.sdk&&(this.sdk.disconnect(),this.sdk=null)}}function ft(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function vt(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){ft(i,A,o,r,a,"next",e)}function a(e){ft(i,A,o,r,a,"throw",e)}r(void 0)})}}class Bt{constructor(e,t){this.config=e,this.sdk=t,this.streamingEl=null,this.hasStartedStreaming=!1,this.isActive=!1,this.shadowRoot=e.shadowRoot||document,this.eventHandlers={autoResize:null,keydown:null},this.eventHandlersSetup=!1}t(e){var t,n,A=this.config.language||"en";return((null===(t=this.config.translations)||void 0===t?void 0:t[A])||(null===(n=this.config.translations)||void 0===n?void 0:n.en)||{})[e]||e}generateHTML(){var e,t,n,A,o,i,r,a,s,c=this.config.inputPlaceholder||(null===(e=this.config.panel)||void 0===e?void 0:e.inputPlaceholder)||this.t("typeMessage")||"Type your message...";return'<div class="text-interface" id="textInterface">\n <div class="messages-container" id="messagesContainer">\n <div class="empty-state">\n <div class="empty-state-icon">💬</div>\n <div class="empty-state-title">'.concat(this.t("hello"),'</div>\n <div class="empty-state-text">').concat(this.t("sendMessage"),'</div>\n </div>\n </div>\n <div class="input-container">\n <div class="input-wrapper" style="flex:1;">\n <textarea class="message-input" id="messageInput" placeholder="').concat(c,'" rows="1" dir="').concat(this.config.direction||"ltr",'"></textarea>\n </div>\n <button class="send-button" id="sendButton" aria-label="').concat(this.t("sendMessageAria"),'">').concat(this.config.sendButtonText||"➤","</button>\n ").concat(null!==(t=this.config.sendButtonHint)&&void 0!==t&&t.text||null!==(n=this.config.panel)&&void 0!==n&&null!==(n=n.sendButtonHint)&&void 0!==n&&n.text?'\n <div class="send-button-hint" style="color: '.concat((null===(A=this.config.sendButtonHint)||void 0===A?void 0:A.color)||(null===(o=this.config.panel)||void 0===o||null===(o=o.sendButtonHint)||void 0===o?void 0:o.color)||"#6B7280","; font-size: ").concat((null===(i=this.config.sendButtonHint)||void 0===i?void 0:i.fontSize)||(null===(r=this.config.panel)||void 0===r||null===(r=r.sendButtonHint)||void 0===r?void 0:r.fontSize)||"12px",'; text-align: center; margin-top: 4px;">\n ').concat((null===(a=this.config.sendButtonHint)||void 0===a?void 0:a.text)||(null===(s=this.config.panel)||void 0===s||null===(s=s.sendButtonHint)||void 0===s?void 0:s.text),"\n </div>\n "):"","\n </div>\n </div>")}generateCSS(){var e,t,n,A,o,i,r,a,s,c,l,d,p,u=this.config.messages,h=(this.config.panel,this.config.animation,this.config.sendButtonColor||(null===(e=this.config.panel)||void 0===e?void 0:e.sendButtonColor)||"#7C3AED"),g=this.config.sendButtonHoverColor||(null===(t=this.config.panel)||void 0===t?void 0:t.sendButtonHoverColor)||"#6D28D9",m=this.config.sendButtonTextColor||(null===(n=this.config.panel)||void 0===n?void 0:n.sendButtonTextColor)||"#FFFFFF",f=(this.config.inputPlaceholder||null===(A=this.config.panel)||void 0===A||A.inputPlaceholder,this.config.inputBorderColor||(null===(o=this.config.panel)||void 0===o?void 0:o.inputBorderColor)||"#E5E7EB"),v=this.config.inputFocusColor||(null===(i=this.config.panel)||void 0===i?void 0:i.inputFocusColor)||"#7C3AED",B=this.config.inputBackgroundColor||(null===(r=this.config.panel)||void 0===r?void 0:r.inputBackgroundColor)||"#FFFFFF",w=this.config.inputTextColor||(null===(a=this.config.panel)||void 0===a?void 0:a.inputTextColor)||"#1F2937",b=this.config.inputFontSize||(null===(s=this.config.panel)||void 0===s?void 0:s.inputFontSize)||"14px",y=this.config.inputBorderRadius||(null===(c=this.config.panel)||void 0===c?void 0:c.inputBorderRadius)||20,x=this.config.inputPadding||(null===(l=this.config.panel)||void 0===l?void 0:l.inputPadding)||"6px 14px",C=!1===this.config.useShadowDOM?" !important":"";return"\n /* Messages container using new classes */\n #messagesContainer { \n flex: 1; \n overflow-y: auto; \n overflow-x: hidden; \n padding: 20px; \n background: #f8fafc; \n display: flex; \n flex-direction: column; \n gap: 16px; \n min-height: 0; \n }\n .empty-state { \n flex: 1; \n display: flex; \n flex-direction: column; \n align-items: center; \n justify-content: center; \n gap: 12px; \n color: #64748b; \n text-align: center; \n padding: 20px; \n }\n .empty-state-icon { font-size: 48px; opacity: 0.3; }\n .empty-state-title { font-size: 20px; font-weight: 700; color: #334155; }\n .empty-state-text { font-size: 13px; max-width: 280px; }\n\n .text-interface { \n display: none".concat(C,"; \n flex: 1; \n flex-direction: column; \n min-height: 0; \n overflow: hidden; \n }\n .text-interface.active { display: flex").concat(C,"; }\n \n .message { \n display: flex; \n gap: 8px; \n padding: 4px 0; \n max-width: 100%; \n align-items: center; \n }\n .message.edge-left { flex-direction: row; }\n .message.edge-right { flex-direction: row-reverse; }\n .message-bubble { \n padding: 12px; \n border-radius: ").concat(u.borderRadius,"px").concat(C,"; \n max-width: 80%; \n font-size: ").concat(u.fontSize,"; \n word-wrap: break-word; \n text-align: ").concat("rtl"===this.config.direction?"right":"left","; \n direction: ").concat(this.config.direction||"ltr",";\n }\n .message.user .message-bubble { \n background: ").concat(u.userBackgroundColor).concat(C,"; \n color: ").concat(u.userTextColor||u.textColor).concat(C,"; \n }\n .message.agent .message-bubble { \n background: ").concat(u.agentBackgroundColor).concat(C,"; \n color: ").concat(u.agentTextColor||u.textColor).concat(C,"; \n }\n .message.user { \n align-self: ").concat("rtl"===this.config.direction?"flex-start":"flex-end","; \n }\n .message.agent { \n align-self: ").concat("rtl"===this.config.direction?"flex-end":"flex-start","; \n }\n .message .message-bubble { \n text-align: ").concat("rtl"===this.config.direction?"right":"left"," !important; \n }\n ").concat("rtl"===this.config.direction?"\n .message-bubble {\n text-align: right !important;\n }\n ":"","\n .message-avatar { \n width: 20px; \n height: 20px; \n display: flex; \n align-items: center; \n justify-content: center; \n flex-shrink: 0; \n color: inherit; \n font-size: 18px; \n line-height: 1; \n background: transparent; \n border: none; \n }\n .message-avatar.user { background: transparent; }\n .message-avatar.agent { background: transparent; }\n \n .message.system {\n background: ").concat(u.systemBackgroundColor,";\n align-self: flex-start;\n }\n .message.error {\n background: ").concat(u.errorBackgroundColor,";\n align-self: flex-start;\n }\n \n .input-container {\n display: flex;\n gap: 8px;\n padding: 12px 16px;\n background: #FFFFFF;\n border-top: 1px solid #E5E7EB;\n align-items: center;\n flex-shrink: 0;\n flex-direction: ").concat("rtl"===this.config.direction?"row-reverse":"row",";\n }\n \n .input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n \n .message-input {\n width: 100%;\n min-height: 32px;\n max-height: 120px;\n padding: ").concat(x,";\n border: 1px solid ").concat(f,";\n border-radius: ").concat(y,"px;\n font-size: ").concat(b,";\n font-family: inherit;\n line-height: 1.3;\n resize: none;\n overflow-y: auto;\n background: ").concat(B,";\n color: ").concat(w,";\n vertical-align: top;\n margin: 0;\n display: block;\n white-space: pre-wrap;\n word-wrap: break-word;\n text-align: ").concat("rtl"===this.config.direction?"right":"left",";\n direction: ").concat(this.config.direction||"ltr",";\n -webkit-appearance: none;\n appearance: none;\n box-sizing: border-box;\n }\n \n .message-input:focus {\n outline: none;\n border-color: ").concat(v,";\n background: ").concat("#FFFFFF"===B?"#FFFFFF":B,";\n box-shadow: 0 0 0 3px ").concat(v,"33;\n }\n \n .message-input::placeholder {\n color: #9CA3AF;\n text-align: ").concat("rtl"===this.config.direction?"right":"left",";\n }\n \n .send-button {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n border: none;\n background: ").concat(h,";\n color: ").concat(m,";\n font-size: ").concat(this.config.sendButtonFontSize||(null===(d=this.config.panel)||void 0===d?void 0:d.sendButtonFontSize)||"18px",";\n font-weight: ").concat(this.config.sendButtonFontWeight||(null===(p=this.config.panel)||void 0===p?void 0:p.sendButtonFontWeight)||"500",";\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n transition: all 0.2s ease;\n box-shadow: 0 4px 12px rgba(124, 60, 237, 0.3);\n }\n \n .send-button:hover:not(:disabled) {\n background: ").concat(g,";\n transform: scale(1.05);\n box-shadow: 0 6px 16px rgba(124, 60, 237, 0.4);\n }\n \n .send-button-hint {\n width: 100%;\n text-align: center;\n margin-top: 4px;\n }\n \n .send-button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n \n .typing-indicator {\n display: inline-flex;\n gap: 4px;\n align-items: center;\n }\n \n .typing-dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: #64748b;\n animation: typingDot 1.4s ease-in-out infinite;\n }\n \n .typing-dot:nth-child(2) { animation-delay: 0.2s; }\n .typing-dot:nth-child(3) { animation-delay: 0.4s; }\n \n @keyframes typingDot {\n 0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }\n 30% { transform: translateY(-8px); opacity: 1; }\n }\n \n .error-message {\n padding: 12px;\n background: ").concat(u.errorBackgroundColor,";\n border-radius: ").concat(u.borderRadius,"px;\n color: #991B1B;\n font-size: ").concat(u.fontSize,";\n margin: 8px 0;\n }\n \n @media (max-width: 768px) {\n #messagesContainer {\n padding: 12px;\n gap: 12px;\n }\n \n .message-bubble {\n max-width: 85%;\n font-size: 14px;\n padding: 10px;\n }\n \n .text-input-container {\n padding: 10px;\n gap: 8px;\n }\n \n #text-chat-input {\n font-size: 16px !important; /* Prevents iOS zoom on focus */\n padding: 10px 14px;\n min-height: 44px;\n }\n \n #text-chat-send {\n min-width: 56px;\n min-height: 44px;\n width: 56px;\n height: 44px;\n }\n \n .empty-state-icon {\n font-size: 40px;\n }\n \n .empty-state-title {\n font-size: 18px;\n }\n \n .empty-state-text {\n font-size: 12px;\n }\n }\n \n @media (max-width: 480px) {\n #messagesContainer {\n padding: 10px;\n gap: 10px;\n }\n \n .message-bubble {\n max-width: 90%;\n font-size: 13px;\n padding: 8px;\n }\n \n .text-input-container {\n padding: 8px;\n }\n \n #text-chat-input {\n font-size: 16px !important;\n padding: 8px 12px;\n }\n }\n ")}setupEventHandlers(){var e=this.shadowRoot.getElementById("sendButton"),t=this.shadowRoot.getElementById("messageInput"),n=this.shadowRoot.getElementById("newChatBtn");if(e&&(e.onclick=()=>this.sendMessage()),n&&(n.onclick=()=>this.startNewChat()),this.updateInputAttributes(),t){t.style.height="32px",t.style.overflow="hidden";var A=()=>{t.style.height="auto";var e=Math.min(t.scrollHeight,120);t.style.height=e+"px",t.style.overflowY=e>=120?"auto":"hidden",e>=120&&setTimeout(()=>{t.scrollTop=t.scrollHeight},0)};t.addEventListener("input",A),t.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey?"Enter"===e.key&&e.shiftKey&&setTimeout(A,0):(e.preventDefault(),this.sendMessage())})}}startNewChat(){try{localStorage.removeItem("ttp_text_chat_conversation_id")}catch(e){}this.sdk&&(this.sdk.config.conversationId=null);var e=this.shadowRoot.getElementById("messagesContainer");e&&(e.innerHTML='\n <div class="empty-state">\n <div class="empty-state-icon">💬</div>\n <div class="empty-state-title">'.concat(this.t("hello"),'</div>\n <div class="empty-state-text">').concat(this.t("sendMessage"),"</div>\n </div>"));var t=this.shadowRoot.getElementById("messageInput");t&&t.focus()}updateInputAttributes(){var e=this.shadowRoot.getElementById("messageInput");if(e){var t,n=this.config.inputPlaceholder||(null===(t=this.config.panel)||void 0===t?void 0:t.inputPlaceholder)||this.t("typeMessage")||"Type your message...";e.placeholder=n,e.dir=this.config.direction||"ltr",e.style.textAlign="rtl"===this.config.direction?"right":"left"}}show(){var e=this.shadowRoot.getElementById("textInterface");e&&e.classList.add("active"),setTimeout(()=>{var e=this.shadowRoot.getElementById("messageInput");e&&e.focus()},50)}hide(){var e=this.shadowRoot.getElementById("textInterface");e&&e.classList.remove("active")}startChat(){var e=this;return vt(function*(){e.isActive=!0,e.updateSendButtonState()})()}sendMessage(){var e=this;return vt(function*(){var t=e.shadowRoot.getElementById("messageInput"),n=t.value.trim();if(n){e.isActive||(yield e.startChat()),e.addMessage("user",n),t.value="",t.style.height="32px",t.style.overflow="hidden";try{e.beginStreaming(),yield e.sdk.sendMessage(n)}catch(t){console.error("❌ Failed to send message:",t),t&&("DOMAIN_NOT_WHITELISTED"===t.message||t.message&&t.message.includes("Domain not whitelisted"))||e.showError(t),e.stopStreamingState()}}})()}updateSendButtonState(){var e=this.shadowRoot.getElementById("sendButton");e&&(e.disabled=!this.isActive)}addMessage(e,t){var n,A,o=this.shadowRoot.getElementById("messagesContainer");if(o){var i=o.querySelector(".empty-state");i&&i.remove();var r=document.createElement("div"),a="rtl"===this.config.direction?"user"===e?"edge-left":"edge-right":"user"===e?"edge-right":"edge-left";r.className="message ".concat(e," ").concat(a);var s=document.createElement("div");s.className="message-avatar ".concat(e);var c="user"===e?(null===(n=this.config.messages)||void 0===n?void 0:n.userAvatarIcon)||"👤":(null===(A=this.config.messages)||void 0===A?void 0:A.agentAvatarIcon)||"🤖";s.textContent=c;var l=document.createElement("div");l.className="message-bubble",l.textContent=t,r.appendChild(s),r.appendChild(l),o.appendChild(r),o.scrollTop=o.scrollHeight}}beginStreaming(){var e,t=this.shadowRoot.getElementById("messagesContainer");if(t){this.stopStreamingState();var n=document.createElement("div"),A="rtl"===this.config.direction?"edge-right":"edge-left";n.className="message agent ".concat(A),n.id="agent-streaming";var o=document.createElement("div");o.className="message-avatar agent",o.textContent=(null===(e=this.config.messages)||void 0===e?void 0:e.agentAvatarIcon)||"🤖";var i=document.createElement("div");i.className="message-bubble",i.innerHTML='<span class="typing-indicator"><span class="typing-dot"></span><span class="typing-dot"></span><span class="typing-dot"></span></span>',n.appendChild(o),n.appendChild(i),t.appendChild(n),this.streamingEl=i,this.hasStartedStreaming=!1,t.scrollTop=t.scrollHeight}}appendStreamingChunk(e){if(this.streamingEl){this.hasStartedStreaming||(this.streamingEl.textContent="",this.hasStartedStreaming=!0),this.streamingEl.textContent+=e;var t=this.shadowRoot.getElementById("messagesContainer");t&&(t.scrollTop=t.scrollHeight)}}finalizeStreaming(e){if(this.streamingEl){this.streamingEl.textContent=e||this.streamingEl.textContent;var t=this.shadowRoot.getElementById("agent-streaming");t&&(t.id=""),this.streamingEl=null}this.updateSendButtonState()}stopStreamingState(){var e=this.shadowRoot.getElementById("agent-streaming");e&&e.remove(),this.streamingEl=null,this.hasStartedStreaming=!1}showError(e){var t=this.shadowRoot.getElementById("messagesContainer");if(t){if(e&&("DOMAIN_NOT_WHITELISTED"===e.message||"string"==typeof e&&e.includes("DOMAIN_NOT_WHITELISTED")||e.message&&e.message.includes("Domain not whitelisted")||"string"==typeof e&&e.includes("Domain not whitelisted"))){var n,A=document.createElement("div");A.className="error-message",A.style.cssText="padding: 16px; margin: 12px; border-radius: 8px; background: "+((null===(n=this.config.messages)||void 0===n?void 0:n.errorBackgroundColor)||"#FEE2E2")+";";var o=document.createElement("div");o.style.cssText="font-weight: 600; font-size: 16px; margin-bottom: 8px; color: #991B1B;",o.textContent=this.t("domainNotValidated");var i=document.createElement("div");i.style.cssText="font-size: 14px; color: #991B1B; line-height: 1.5;",i.textContent=this.t("domainErrorMessage"),A.appendChild(o),A.appendChild(i),t.appendChild(A)}else{var r=document.createElement("div");r.className="error-message",r.textContent="string"==typeof e?e:(null==e?void 0:e.message)||e,t.appendChild(r)}t.scrollTop=t.scrollHeight}}setActive(e){this.isActive=e,this.updateSendButtonState()}}class wt{constructor(e){this.config=e,this.translations=e.translations||{},this.shadowRoot=e.shadowRoot}t(e){var t=this.config.language||"en";return(this.translations[t]||this.translations.en||{})[e]||e}generateHTML(){var e,t=this.config.landing||{};return e="image"===t.logoType&&t.logoImageUrl?'<img src="'.concat(t.logoImageUrl,'" alt="Logo" style="max-width: 44px; max-height: 44px; object-fit: contain; border: none; outline: none;">'):'<span class="landing-avatar-emoji">'.concat(t.logoIcon||t.logo||"🤖","</span>"),'\n <div class="landing-screen" id="landingScreen">\n \x3c!-- Avatar --\x3e\n <div class="landing-avatar">\n '.concat(e,'\n </div>\n\n \x3c!-- Title --\x3e\n <h2 class="landing-title">').concat(t.title||this.t("landingTitle"),'</h2>\n <p class="landing-subtitle">').concat(t.subtitle||this.t("landingSubtitle")||"Choose your preferred method",'</p>\n\n \x3c!-- Mode Selection - Side by Side --\x3e\n <div class="mode-selection">\n \x3c!-- Voice Call Option --\x3e\n <button class="mode-card" id="mode-card-voice">\n <div class="mode-card-icon">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n <line x1="12" y1="19" x2="12" y2="23"/>\n <line x1="8" y1="23" x2="16" y2="23"/>\n </svg>\n </div>\n <span class="mode-card-title">').concat(t.voiceCardTitle||this.t("voiceCall"),'</span>\n </button>\n\n \x3c!-- Text Chat Option --\x3e\n <button class="mode-card" id="mode-card-text">\n <div class="mode-card-icon">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>\n </svg>\n </div>\n <span class="mode-card-title">').concat(t.textCardTitle||this.t("textChat"),"</span>\n </button>\n </div>\n </div>\n ")}generateCSS(){var e=this.config.landing||{},t=(this.config.animation,!1===this.config.useShadowDOM?" !important":"");return"\n /* ===== LANDING SCREEN - New Design ===== */\n .landing-screen { \n display: none".concat(t,"; \n flex: 1; \n padding: 32px 24px; \n background: ").concat(e.backgroundColor||"linear-gradient(180deg, #ffffff 0%, rgba(168, 85, 247, 0.03) 100%)","; \n align-items: center; \n justify-content: flex-start; \n flex-direction: column; \n gap: 0; \n overflow-y: auto; \n min-height: 0;\n text-align: center;\n }\n \n .landing-screen.active { \n display: flex").concat(t,"; \n }\n\n /* Avatar - Richer purple gradient */\n .landing-avatar {\n width: 88px;\n height: 88px;\n border-radius: 22px;\n margin-bottom: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n ").concat((()=>{if("image"===e.logoType){if(!1!==e.logoBackgroundEnabled){var t=e.logoBackgroundColor||e.avatarBackground||"linear-gradient(135deg, #667eea 0%, #764ba2 100%)";return"background: ".concat(t,"; box-shadow: 0 8px 28px rgba(102, 126, 234, 0.35); border: none;")}return"background: transparent; box-shadow: none; border: none; outline: none;"}var n=e.avatarBackground||"linear-gradient(135deg, #667eea 0%, #764ba2 100%)";return"background: ".concat(n,"; box-shadow: 0 8px 28px rgba(102, 126, 234, 0.35); border: none;")})(),"\n }\n \n .landing-avatar img {\n border: none !important;\n outline: none !important;\n }\n\n .landing-avatar-emoji {\n font-size: 44px;\n line-height: 1;\n }\n\n /* Title & Subtitle */\n .landing-title { \n font-size: 20px; \n color: ").concat(e.titleColor||"#1e1b4b","; \n font-weight: 600; \n margin-bottom: 6px; \n text-align: center;\n line-height: 1.3;\n }\n\n .landing-subtitle {\n font-size: 14px;\n color: ").concat(e.subtitleColor||"#64748b",";\n margin-bottom: 28px;\n text-align: center;\n }\n\n /* Mode Selection - Side by Side */\n .mode-selection { \n display: flex; \n gap: 12px; \n width: 100%; \n justify-content: center; \n }\n\n .mode-card { \n flex: 1; \n max-width: 160px; \n padding: 20px 16px;\n background: ").concat(e.modeCardBackgroundColor||"#ffffff","; \n border: 1px solid ").concat(e.modeCardBorderColor||"rgba(0, 0, 0, 0.06)","; \n border-radius: 18px; \n cursor: pointer; \n display: flex; \n flex-direction: column; \n align-items: center; \n gap: 12px; \n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); \n box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06); \n font-family: inherit;\n }\n\n .mode-card:hover { \n transform: translateY(-4px); \n box-shadow: 0 8px 24px rgba(124, 58, 237, 0.2); \n border-color: rgba(124, 58, 237, 0.3); \n }\n\n .mode-card:active {\n transform: translateY(-2px);\n }\n\n /* Mode Card Icon - Vibrant purple gradient */\n .mode-card-icon { \n width: 56px; \n height: 56px; \n display: flex; \n align-items: center; \n justify-content: center; \n border-radius: 16px; \n background: ").concat(e.modeCardIconBackgroundColor||"linear-gradient(135deg, #7c3aed, #a855f7)","; \n color: #fff; \n box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);\n }\n\n .mode-card-icon svg {\n width: 26px;\n height: 26px;\n stroke: white;\n fill: none;\n }\n\n .mode-card-title { \n color: ").concat(e.modeCardTitleColor||"#1e1b4b","; \n font-weight: 600; \n font-size: 14px;\n text-align: center;\n }\n\n /* Mobile Responsive */\n @media (max-width: 768px) {\n .landing-screen {\n padding: 24px 16px;\n }\n\n .landing-avatar {\n width: 72px;\n height: 72px;\n border-radius: 18px;\n margin-bottom: 16px;\n }\n\n .landing-avatar-emoji {\n font-size: 36px;\n }\n\n .landing-title {\n font-size: 18px;\n }\n\n .landing-subtitle {\n font-size: 13px;\n margin-bottom: 20px;\n }\n\n .mode-selection {\n gap: 10px;\n }\n\n .mode-card {\n padding: 16px 12px;\n max-width: 140px;\n }\n\n .mode-card-icon {\n width: 48px;\n height: 48px;\n border-radius: 14px;\n }\n\n .mode-card-icon svg {\n width: 22px;\n height: 22px;\n }\n\n .mode-card-title {\n font-size: 13px;\n }\n }\n\n @media (max-width: 380px) {\n .mode-selection {\n flex-direction: column;\n align-items: center;\n }\n\n .mode-card {\n max-width: 100%;\n width: 100%;\n flex-direction: row;\n padding: 14px 18px;\n gap: 14px;\n }\n\n .mode-card-icon {\n flex-shrink: 0;\n }\n\n .mode-card-title {\n text-align: left;\n }\n }\n ")}show(){var e,t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("landingScreen");t&&t.classList.add("active")}hide(){var e,t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("landingScreen");t&&t.classList.remove("active")}setupEventHandlers(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},A=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("mode-card-voice"),o=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("mode-card-text");A&&n.onSelectVoice&&(A.onclick=n.onSelectVoice),o&&n.onSelectText&&(o.onclick=n.onSelectText)}}const bt={en:{landingTitle:"How would you like to communicate?",landingSubtitle:"Choose your preferred method",voiceCall:"Voice Call",textChat:"Text Chat",clickToStartCall:"Click to Start Call",realTimeVoice:"Real-time voice conversation",startCall:"Start Call",connecting:"Connecting...",connectingSubtitle:"Please wait",listening:"Listening...",speakFreely:"Speak freely",liveTranscript:"Live Transcript",transcriptWillAppear:"Transcript will appear here during the call...",mute:"Mute",speaker:"Speaker",endCall:"End Call",hello:"Hello! How can I help?",sendMessage:"Send a message to get started",online:"Online",newChat:"New Chat",back:"Back",close:"Close",error:"Error",typeMessage:"Type your message...",sendMessageAria:"Send message",domainNotValidated:"Domain not validated",domainErrorMessage:"This domain is not whitelisted. Please contact the administrator to whitelist your website URL."},he:{landingTitle:"איך תרצה לתקשר?",landingSubtitle:"בחר את השיטה המועדפת עליך",voiceCall:"שיחה קולית",textChat:"צ'אט טקסט",clickToStartCall:"לחץ להתחלת שיחה",realTimeVoice:"שיחה קולית בזמן אמת",startCall:"התחל שיחה",connecting:"מתחבר...",connectingSubtitle:"אנא המתן",listening:"מקשיב...",speakFreely:"דבר בחופשיות",liveTranscript:"תמלול בזמן אמת",transcriptWillAppear:"התמלול יופיע כאן במהלך השיחה...",mute:"השתק",speaker:"רמקול",endCall:"סיים שיחה",hello:"שלום! איך אפשר לעזור?",sendMessage:"שלח הודעה או עבור למצב קולי לשיחה בזמן אמת",online:"מקוון",newChat:"צ'אט חדש",back:"חזור",close:"סגור",error:"שגיאה",typeMessage:"הקלד הודעה...",sendMessageAria:"שלח הודעה",domainNotValidated:"דומיין לא מאומת",domainErrorMessage:"דומיין זה לא ברשימת המורשים. אנא פנה למנהל המערכת כדי להוסיף את כתובת האתר שלך לרשימה."},ar:{landingTitle:"كيف تريد التواصل؟",landingSubtitle:"اختر الطريقة المفضلة لديك",voiceCall:"مكالمة صوتية",textChat:"دردشة نصية",clickToStartCall:"انقر لبدء المكالمة",realTimeVoice:"محادثة صوتية في الوقت الفعلي",startCall:"ابدأ المكالمة",connecting:"جارٍ الاتصال...",connectingSubtitle:"يرجى الانتظار",listening:"الاستماع...",speakFreely:"تكلم بحرية",liveTranscript:"نص مباشر",transcriptWillAppear:"سيظهر النص هنا أثناء المكالمة...",mute:"كتم الصوت",speaker:"مكبر الصوت",endCall:"إنهاء المكالمة",hello:"مرحبا! كيف يمكنني المساعدة؟",sendMessage:"أرسل رسالة للبدء",online:"متصل",newChat:"محادثة جديدة",back:"رجوع",close:"إغلاق",error:"خطأ",typeMessage:"اكتب رسالة...",sendMessageAria:"إرسال رسالة",domainNotValidated:"النطاق غير معتمد",domainErrorMessage:"هذا النطاق غير مسموح به. يرجى الاتصال بالمسؤول لإضافة عنوان موقع الويب الخاص بك إلى القائمة."},ru:{landingTitle:"Как вы хотите общаться?",landingSubtitle:"Выберите предпочтительный способ",voiceCall:"Голосовой звонок",textChat:"Текстовый чат",clickToStartCall:"Нажмите, чтобы начать звонок",realTimeVoice:"Голосовой разговор в реальном времени",startCall:"Начать звонок",connecting:"Подключение...",connectingSubtitle:"Пожалуйста, подождите",listening:"Слушаю...",speakFreely:"Говорите свободно",liveTranscript:"Живая транскрипция",transcriptWillAppear:"Транскрипция появится здесь во время звонка...",mute:"Отключить звук",speaker:"Динамик",endCall:"Завершить звонок",hello:"Привет! Как я могу помочь?",sendMessage:"Отправьте сообщение для начала",online:"В сети",newChat:"Новый чат",back:"Назад",close:"Закрыть",error:"Ошибка",typeMessage:"Введите сообщение...",sendMessageAria:"Отправить сообщение",domainNotValidated:"Домен не проверен",domainErrorMessage:"Этот домен не в белом списке. Пожалуйста, свяжитесь с администратором, чтобы добавить URL вашего веб-сайта в список."},es:{landingTitle:"¿Cómo te gustaría comunicarte?",landingSubtitle:"Elige tu método preferido",voiceCall:"Llamada de voz",textChat:"Chat de texto",clickToStartCall:"Haz clic para iniciar la llamada",realTimeVoice:"Conversación de voz en tiempo real",startCall:"Iniciar llamada",connecting:"Conectando...",connectingSubtitle:"Por favor espere",listening:"Escuchando...",speakFreely:"Habla libremente",liveTranscript:"Transcripción en vivo",transcriptWillAppear:"La transcripción aparecerá aquí durante la llamada...",mute:"Silenciar",speaker:"Altavoz",endCall:"Terminar llamada",hello:"¡Hola! ¿Cómo puedo ayudarte?",sendMessage:"Envía un mensaje para comenzar",online:"En línea",newChat:"Nuevo chat",back:"Atrás",close:"Cerrar",error:"Error",typeMessage:"Escribe un mensaje...",sendMessageAria:"Enviar mensaje",domainNotValidated:"Dominio no validado",domainErrorMessage:"Este dominio no está en la lista blanca. Por favor, contacte al administrador para agregar la URL de su sitio web a la lista."},fr:{landingTitle:"Comment souhaitez-vous communiquer?",landingSubtitle:"Choisissez votre méthode préférée",voiceCall:"Appel vocal",textChat:"Chat texte",clickToStartCall:"Cliquez pour démarrer l'appel",realTimeVoice:"Conversation vocale en temps réel",startCall:"Démarrer l'appel",connecting:"Connexion...",connectingSubtitle:"Veuillez patienter",listening:"Écoute...",speakFreely:"Parlez librement",liveTranscript:"Transcripción en direct",transcriptWillAppear:"La transcription apparaîtra ici pendant l'appel...",mute:"Muet",speaker:"Haut-parleur",endCall:"Terminer l'appel",hello:"Bonjour! Comment puis-je vous aider?",sendMessage:"Envoyez un message pour commencer",online:"En ligne",newChat:"Nouveau chat",back:"Retour",close:"Fermer",error:"Erreur",typeMessage:"Tapez votre message...",sendMessageAria:"Envoyer un message",domainNotValidated:"Domaine non validé",domainErrorMessage:"Ce domaine n'est pas sur la liste blanche. Veuillez contacter l'administrateur pour ajouter l'URL de votre site Web à la liste."},de:{landingTitle:"Wie möchten Sie kommunizieren?",landingSubtitle:"Wählen Sie Ihre bevorzugte Methode",voiceCall:"Sprachanruf",textChat:"Text-Chat",clickToStartCall:"Klicken Sie, um den Anruf zu starten",realTimeVoice:"Sprachanruf in Echtzeit",startCall:"Anruf starten",connecting:"Verbinden...",connectingSubtitle:"Bitte warten",listening:"Hören...",speakFreely:"Sprechen Sie frei",liveTranscript:"Live-Transkription",transcriptWillAppear:"Die Transkription erscheint hier während des Anrufs...",mute:"Stumm",speaker:"Lautsprecher",endCall:"Anruf beenden",hello:"Hallo! Wie kann ich helfen?",sendMessage:"Senden Sie eine Nachricht zum Starten",online:"Online",newChat:"Neuer Chat",back:"Zurück",close:"Schließen",error:"Fehler",typeMessage:"Geben Sie eine Nachricht ein...",sendMessageAria:"Nachricht senden",domainNotValidated:"Domain nicht validiert",domainErrorMessage:"Diese Domain steht nicht auf der Whitelist. Bitte kontaktieren Sie den Administrator, um die URL Ihrer Website zur Liste hinzuzufügen."}};class yt{showProducts(e,t,n){throw new Error("EcommercePresenter.showProducts() not implemented")}hideProducts(){throw new Error("EcommercePresenter.hideProducts() not implemented")}onProductAdded(e,t){throw new Error("EcommercePresenter.onProductAdded() not implemented")}updateCart(e){throw new Error("EcommercePresenter.updateCart() not implemented")}destroy(){throw new Error("EcommercePresenter.destroy() not implemented")}}function xt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function Ct(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xt(Object(n),!0).forEach(function(t){Qt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Qt(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ft{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.product=e,this.compact=t.compact||!1,this.primaryColor=t.primaryColor||"#7c3aed",this.onAdd=t.onAdd||(()=>{}),this.onAddDisabled=t.onAddDisabled||(()=>!1),this.onPickerOpen=t.onPickerOpen||(()=>{}),this.onPickerClose=t.onPickerClose||(()=>{}),this.hasVariants=t.hasVariants||(()=>!1),this.onVariantPick=t.onVariantPick||null,this.element=null;var n=e.sellBy||e.sell_by||"quantity";this.sellBy=n,this.step="weight"===n?.5:1,this.min="weight"===n?.5:1,this.unit="weight"===n?"kg":"";var A=e.cartQuantity||e.cart_quantity||0;this.inCart=A>0,this.amount=this.inCart?A:this.min}_generateStepperHTML(){var e="weight"===this.sellBy?"".concat(this.amount.toFixed(1)," ").concat(this.unit):"".concat(this.amount);return'\n <div class="ttp-stepper" data-sell-by="'.concat(this.sellBy,'">\n <button class="ttp-stepper-btn ttp-stepper-minus" type="button">−</button>\n <span class="ttp-stepper-value">').concat(e,'</span>\n <button class="ttp-stepper-btn ttp-stepper-plus" type="button">+</button>\n </div>\n ')}_updateStepperDisplay(e,t){"weight"===this.sellBy?e.textContent="".concat(this.amount.toFixed(1)," ").concat(this.unit):e.textContent="".concat(this.amount),t.disabled=this.amount<=this.min,t.classList.toggle("ttp-stepper-disabled",this.amount<=this.min)}render(){var e=document.createElement("div");e.className=this.compact?"ttp-product-compact":"ttp-product-card";var t=this.product,n="ILS"===t.currency?"₪":"$",A=this.hasVariants(t),o=A?"Choose":this.inCart?"Update":"Add",i=A?"ttp-add-btn ttp-choose-btn":this.inCart?"ttp-add-btn ttp-update-btn":"ttp-add-btn";this.compact?e.innerHTML='\n <div class="ttp-product-image-sm">\n <img src="'.concat(t.imageUrl,'" alt="').concat(t.name,'" onerror="this.style.display=\'none\'" />\n </div>\n <div class="ttp-product-info">\n <div class="ttp-product-name">\n ').concat(t.name,"\n ").concat(t.productPageUrl?'<a class="ttp-product-page-link" href="'.concat(t.productPageUrl,'" onclick="event.stopPropagation()">↗</a>'):"",'\n </div>\n <div class="ttp-product-meta">').concat(t.unit," · ").concat(t.brand,'</div>\n </div>\n <div class="ttp-product-action">\n <div class="ttp-product-price">').concat(n).concat(t.price.toFixed(2),"</div>\n ").concat(t.inStock?'<button class="'.concat(i,'">').concat(o,"</button>"):'<span class="ttp-out-of-stock">Out of stock</span>',"\n ").concat(this._generateStepperHTML(),"\n </div>\n "):e.innerHTML='\n <div class="ttp-product-image">\n <img src="'.concat(t.imageUrl,'" alt="').concat(t.name,'" onerror="this.style.display=\'none\'" />\n ').concat(t.inStock?"":'<div class="ttp-stock-badge">Out of stock</div>','\n </div>\n <div class="ttp-product-details">\n <div class="ttp-product-name">\n ').concat(t.name,"\n ").concat(t.productPageUrl?'<a class="ttp-product-page-link" href="'.concat(t.productPageUrl,'" onclick="event.stopPropagation()">↗</a>'):"",'\n </div>\n <div class="ttp-product-meta">').concat(t.unit,'</div>\n <div class="ttp-product-footer">\n <span class="ttp-product-price">').concat(n).concat(t.price.toFixed(2),"</span>\n ").concat(t.inStock?'<button class="'.concat(i,'">').concat(o,"</button>"):'<span class="ttp-out-of-stock">Out of stock</span>',"\n ").concat(this._generateStepperHTML(),"\n </div>\n </div>\n ");var r=e.querySelector(".ttp-add-btn");r&&r.addEventListener("click",t=>{if(t.stopPropagation(),!this.onAddDisabled())if(A&&this.onVariantPick)this.onVariantPick(e,this.product);else{r.textContent="✓",r.classList.add("ttp-added"),r.disabled=!0;var n=Ct(Ct({},this.product),{},{selectedAmount:this.amount,sellBy:this.sellBy});this.onAdd(e,n),this.inCart=!0,setTimeout(()=>{r.textContent="Update",r.classList.remove("ttp-added"),r.classList.add("ttp-update-btn"),r.disabled=!1},1500)}});var a=e.querySelector(".ttp-stepper-minus"),s=e.querySelector(".ttp-stepper-plus"),c=e.querySelector(".ttp-stepper-value");return a&&s&&c&&(a.addEventListener("click",e=>{e.stopPropagation(),this.amount>this.min&&(this.amount=Math.round(10*(this.amount-this.step))/10,this._updateStepperDisplay(c,a))}),s.addEventListener("click",e=>{e.stopPropagation(),this.amount=Math.round(10*(this.amount+this.step))/10,this._updateStepperDisplay(c,a)}),this._updateStepperDisplay(c,a)),this.element=e,e}}function Ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ut(Object(n),!0).forEach(function(t){kt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ut(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function kt(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Et(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function It(e){return!0===e.hasVariants&&(!!(Array.isArray(e.variants)&&e.variants.length>0)||Array.isArray(e.options)&&e.options.length>0)}function Tt(e){return Ht.apply(this,arguments)}function Ht(){var e;return e=function*(e){if(!e.productPageUrl)return null;try{var t=e.productPageUrl.split("/products/")[1];if(!t)return null;var n=yield fetch("/products/".concat(t,".js"));if(!n.ok)return null;var A=((yield n.json()).variants||[]).map(e=>{var t;return{id:"gid://shopify/ProductVariant/".concat(e.id),price:parseFloat(e.price)/100,available:e.available,imageUrl:(null===(t=e.featured_image)||void 0===t?void 0:t.src)||null,option1:e.option1||null,option2:e.option2||null,option3:e.option3||null}});return St(St({},e),{},{variants:A})}catch(e){return console.error("[TTP] Failed to fetch product variants:",e),null}},Ht=function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){Et(i,A,o,r,a,"next",e)}function a(e){Et(i,A,o,r,a,"throw",e)}r(void 0)})},Ht.apply(this,arguments)}function _t(e,t){return e.find(e=>t.every((t,n)=>e["option".concat(n+1)]===t))||null}function Dt(e,t,n){return[...new Set(e.map(e=>e["option".concat(t+1)]).filter(Boolean))].filter(A=>{var o=[...n];return o[t]=A,e.some(e=>o.every((t,n)=>!t||e["option".concat(n+1)]===t)&&e.available)})}function Mt(e){return{USD:"$",ILS:"₪",EUR:"€",GBP:"£"}[e]||e}function Pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function Lt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pt(Object(n),!0).forEach(function(t){Rt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Rt(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Kt{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onProductAdd=e.onProductAdd||(()=>{}),this.onBack=e.onBack||(()=>{}),this.primaryColor=e.primaryColor||"#7c3aed",this.element=null,this.product=null,this.selectedValues=[]}render(e){return this.product=e,this.element=document.createElement("div"),this.element.className="ttp-var-picker",this.element.style.setProperty("--ttp-var-primary",this.primaryColor),e.variants?(this.selectedValues=new Array(e.options.length).fill(null),e.options.forEach((t,n)=>{var A=Dt(e.variants,n,this.selectedValues);A.length>0&&(this.selectedValues[n]=A[0])}),this.element.innerHTML=this._buildHTML(),this._attachHandlers(),this._updateAddButton(),this.element):(this.element.innerHTML='\n <div class="ttp-var-header">\n <button class="ttp-var-back-btn" id="ttpVarBack">←</button>\n <span class="ttp-var-title">'.concat(e.name,'</span>\n </div>\n <div class="ttp-var-body" style="align-items:center;justify-content:center;display:flex;flex-direction:column;gap:10px;">\n <div class="ttp-var-spinner"></div>\n <div style="font-size:12px;color:#64748b;">Loading options...</div>\n </div>\n '),this.element.querySelector("#ttpVarBack").addEventListener("click",()=>{this.destroy(),this.onBack()}),Tt(e).then(e=>{if(!e||!e.variants)return this.destroy(),void this.onBack();this.product=e,this.selectedValues=new Array(e.options.length).fill(null),e.options.forEach((t,n)=>{var A=Dt(e.variants,n,this.selectedValues);A.length>0&&(this.selectedValues[n]=A[0])}),this.element.innerHTML=this._buildHTML(),this._attachHandlers(),this._updateAddButton()}),this.element)}destroy(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.product=null}_buildHTML(){var e=this.product,t=Mt(e.currency),n=_t(e.variants,this.selectedValues),A=n?n.price:e.price,o=(null==n?void 0:n.imageUrl)||e.imageUrl||"",i=e.productPageUrl&&""!==e.productPageUrl.trim();return'\n <div class="ttp-var-header">\n <button class="ttp-var-back-btn" id="ttpVarBack">←</button>\n <span class="ttp-var-title">'.concat(e.name,"</span>\n ").concat(i?'<a class="ttp-var-page-link" href="'.concat(e.productPageUrl,'">View page ↗</a>'):"",'\n </div>\n\n <div class="ttp-var-body">\n <div class="ttp-var-preview">\n <div class="ttp-var-preview-img" id="ttpVarPreviewImg">\n ').concat(o?'<img src="'.concat(o,'" alt="').concat(e.name,'" onerror="this.style.display=\'none\'"/>'):"",'\n </div>\n <div class="ttp-var-preview-info">\n ').concat(e.brand?'<div class="ttp-var-preview-brand">'.concat(e.brand,"</div>"):"",'\n <div class="ttp-var-preview-name">').concat(e.name,'</div>\n <div class="ttp-var-preview-price" id="ttpVarPreviewPrice">').concat(t).concat(A.toFixed(2),'</div>\n <div class="ttp-var-preview-selected" id="ttpVarPreviewSel">Select options</div>\n </div>\n </div>\n\n <div class="ttp-var-options" id="ttpVarOptions">\n ').concat(this._renderOptions(),'\n </div>\n </div>\n\n <div class="ttp-var-footer">\n <button class="ttp-var-add-btn" id="ttpVarAddBtn" disabled>\n Add to Cart — ').concat(t).concat(A.toFixed(2),"\n </button>\n </div>\n ")}_renderOptions(){return this.product.options.map((e,t)=>{var n=Dt(this.product.variants,t,this.selectedValues);return"color"===e.name.toLowerCase()||"colour"===e.name.toLowerCase()?'\n <div class="ttp-var-section">\n <div class="ttp-var-section-label">'.concat(e.name,'</div>\n <div class="ttp-var-swatches">\n ').concat(e.values.map(e=>{var A=!n.includes(e),o=this.selectedValues[t]===e;return'<div\n class="ttp-var-swatch'.concat(o?" selected":"").concat(A?" oos":"",'"\n data-value="').concat(e,'"\n data-opt-idx="').concat(t,'"\n style="background:').concat(this._colorNameToHex(e),';"\n title="').concat(e).concat(A?" (unavailable)":"",'"\n ></div>')}).join(""),"\n </div>\n </div>"):'\n <div class="ttp-var-section">\n <div class="ttp-var-section-label">'.concat(e.name,'</div>\n <div class="ttp-var-pills">\n ').concat(e.values.map(e=>{var A=!n.includes(e),o=this.selectedValues[t]===e;return'<button\n class="ttp-var-pill'.concat(o?" selected":"").concat(A?" oos":"",'"\n data-value="').concat(e,'"\n data-opt-idx="').concat(t,'"\n ').concat(A?"disabled":"","\n >").concat(e,"</button>")}).join(""),"\n </div>\n </div>")}).join("")}_attachHandlers(){this.element.querySelector("#ttpVarBack").addEventListener("click",()=>{this.destroy(),this.onBack()}),this.element.querySelector("#ttpVarAddBtn").addEventListener("click",()=>{this._handleAdd()}),this._attachOptionHandlers()}_attachOptionHandlers(){this.element.querySelectorAll(".ttp-var-swatch:not(.oos)").forEach(e=>{e.addEventListener("click",()=>this._selectOption(parseInt(e.dataset.optIdx),e.dataset.value))}),this.element.querySelectorAll(".ttp-var-pill:not(.oos)").forEach(e=>{e.addEventListener("click",()=>this._selectOption(parseInt(e.dataset.optIdx),e.dataset.value))})}_selectOption(e,t){this.selectedValues[e]=t,this.element.querySelector("#ttpVarOptions").innerHTML=this._renderOptions(),this._attachOptionHandlers(),this._updateAddButton(),this._updatePreview()}_updateAddButton(){var e,t=Mt(this.product.currency),n=_t(this.product.variants,this.selectedValues),A=this.element.querySelector("#ttpVarAddBtn");if(!this.selectedValues.every(e=>null!==e))return A.textContent="Select all options",void(A.disabled=!0);if(!n||!n.available)return A.textContent="Unavailable",void(A.disabled=!0);var o=null!==(e=n.price)&&void 0!==e?e:this.product.price;A.textContent="Add to Cart — ".concat(t).concat(o.toFixed(2)),A.disabled=!1}_updatePreview(){var e=Mt(this.product.currency),t=_t(this.product.variants,this.selectedValues),n=(null==t?void 0:t.imageUrl)||this.product.imageUrl||"",A=this.element.querySelector("#ttpVarPreviewImg");A&&n&&(A.innerHTML='<img src="'.concat(n,'" alt="').concat(this.product.name,'"\n onerror="this.style.display=\'none\'"/>'));var o=this.element.querySelector("#ttpVarPreviewPrice");o&&t&&(o.textContent="".concat(e).concat(t.price.toFixed(2)));var i=this.element.querySelector("#ttpVarPreviewSel");if(i){var r=this.selectedValues.filter(e=>null!==e);i.textContent=r.length>0?r.join(" · "):"Select options"}}_handleAdd(){var e=_t(this.product.variants,this.selectedValues);if(e&&e.available){var t=this.element.querySelector("#ttpVarAddBtn");t.textContent="✓ Added!",t.disabled=!0;var n=Lt(Lt({},this.product),{},{id:e.id,price:e.price,selectedOptions:this.selectedValues,selectedAmount:1,sellBy:"quantity"});this.onProductAdd(this.element,n),setTimeout(()=>{this.destroy(),this.onBack()},800)}}_colorNameToHex(e){return{black:"#1e293b",white:"#f8fafc",red:"#ef4444",blue:"#3b82f6",green:"#22c55e",yellow:"#eab308",orange:"#f97316",purple:"#a855f7",pink:"#ec4899",grey:"#94a3b8",gray:"#94a3b8",navy:"#1e3a5f",brown:"#92400e",beige:"#d4b483",cream:"#fef9c3"}[e.toLowerCase()]||"#94a3b8"}}class Ot{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.primaryColor=e.primaryColor||"#7c3aed",this.onProductAdd=e.onProductAdd||(()=>{}),this.onAddDisabled=e.onAddDisabled||(()=>!1),this.onClose=e.onClose||(()=>{}),this.element=null}show(e,t,n){this.hide();var A=document.createElement("div");A.className="picker-relative";var o=document.createElement("div");o.className="ttp-product-picker",o.setAttribute("data-layout",n);var i=document.createElement("div");i.className="ttp-picker-header",i.innerHTML='\n <span class="ttp-picker-title">'.concat(t,'</span>\n <button class="ttp-picker-close">✕</button>\n '),i.querySelector(".ttp-picker-close").addEventListener("click",()=>{this.hide(),this.onClose()}),o.appendChild(i);var r=document.createElement("div");r.className="cards"===n?"ttp-products-horizontal":"ttp-products-vertical";var a=this.primaryColor,s=this.onProductAdd,c=this.onAddDisabled;return e.forEach(e=>{var t=new Ft(e,{compact:"list"===n,primaryColor:a,onAdd:(e,t)=>s(e,t),onAddDisabled:()=>c(),hasVariants:It,onVariantPick:(e,t)=>{var n=e.closest(".picker-relative");if(n){var A=n.querySelector(".ttp-product-picker");A&&A.style.setProperty("display","none","important");var o=n.querySelector(".ttp-var-picker");o&&o.remove();var i=new Kt({primaryColor:a||"#7c3aed",onProductAdd:(e,t)=>{s(e,t)},onBack:()=>{n.classList.remove("ttp-var-picker-active"),A&&A.style.removeProperty("display")}});n.classList.add("ttp-var-picker-active"),n.appendChild(i.render(t))}}});r.appendChild(t.render())}),o.appendChild(r),A.appendChild(o),this.element=A,A}hide(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null}}class Vt{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onUndo=e.onUndo||(()=>{}),this.onHide=e.onHide||(()=>{}),this.element=null,this.dismissTimer=null}show(e){this.hide(!0);var t=document.createElement("div");return t.className="ttp-cart-toast",t.innerHTML='\n <div class="ttp-toast-icon">✓</div>\n <div class="ttp-toast-content">\n <div class="ttp-toast-title">Added to cart!</div>\n <div class="ttp-toast-product">'.concat(e.name,'</div>\n </div>\n <button class="ttp-toast-undo">Undo</button>\n '),t.querySelector(".ttp-toast-undo").addEventListener("click",()=>{this.onUndo(e),this.hide()}),this.element=t,this.dismissTimer=setTimeout(()=>this.hide(),3e3),t}hide(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.dismissTimer&&(clearTimeout(this.dismissTimer),this.dismissTimer=null),this.element&&this.element.parentNode){this.element.classList.add("ttp-toast-hiding");var t=this.element;this.element=null;var n=!e;setTimeout(()=>{t&&t.parentNode&&t.parentNode.removeChild(t),n&&this.onHide()},300)}}}class Nt{constructor(){this.element=null,this.itemCount=0,this.total=0,this.currency="$",this.cartUrl="/cart"}render(){var e=document.createElement("div");return e.className="ttp-cart-summary ttp-cart-empty",e.style.display="none",e.innerHTML='\n <div class="ttp-cart-info">\n <span class="ttp-cart-icon" data-ttp-fly-target>🛒</span>\n <span class="ttp-cart-count">0 items</span>\n <span class="ttp-cart-separator">·</span>\n <span class="ttp-cart-total">'.concat(this.currency,'0.00</span>\n </div>\n <a class="ttp-cart-view" href="').concat(this.cartUrl,'" target="_top">View Cart ›</a>\n '),this.element=e,e}update(e,t,n){this.itemCount=e,this.total=t,n&&(this.currency=n),this.element&&(this.element.style.setProperty("display",e>0?"flex":"none","important"),this.element.classList.toggle("ttp-cart-empty",0===e),this.element.querySelector(".ttp-cart-count").textContent="".concat(e," item").concat(1!==e?"s":""),this.element.querySelector(".ttp-cart-total").textContent="".concat(this.currency).concat(t.toFixed(2)))}}var jt,Gt,zt;class Wt{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.getCartTarget=e.getCartTarget||(()=>null),this.onCartBump=e.onCartBump||(()=>{}),this.onRipple=e.onRipple||(()=>{}),this.animatingId=null,this.trailParticles=[],this.canvas=null,this.rafId=null,this._canvasInitialized=!1}get isAnimating(){return null!==this.animatingId}_ensureCanvas(){if(!this._canvasInitialized){this._canvasInitialized=!0,this.canvas=document.createElement("canvas"),this.canvas.id="ttp-fly-to-cart-canvas",this.canvas.style.cssText="\n position: fixed; top: 0; left: 0;\n width: 100%; height: 100%;\n pointer-events: none; z-index: 2147483646;\n ",document.body.appendChild(this.canvas);var e=this.canvas.getContext("2d"),t=()=>{this.canvas.width=window.innerWidth,this.canvas.height=window.innerHeight};t(),window.addEventListener("resize",t);var n=()=>{if(this.canvas&&e){for(var t of(e.clearRect(0,0,this.canvas.width,this.canvas.height),this.trailParticles=this.trailParticles.filter(e=>e.life>0),this.trailParticles))t.life-=.025,t.x+=t.vx,t.y+=t.vy,t.vx*=.96,t.vy*=.96,t.r*=.97,e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI),e.fillStyle="rgba(".concat(t.color,", ").concat(.6*t.life,")"),e.fill();this.rafId=requestAnimationFrame(n)}};this.rafId=requestAnimationFrame(n)}}_emitTrailAt(e,t,n){for(var A=0;A<3;A++){var o=Math.random()*Math.PI*2,i=.5+2*Math.random(),r=3*(1-n);this.trailParticles.push({x:e+20*(Math.random()-.5)*r,y:t+10*(Math.random()-.5),vx:Math.cos(o)*i*r,vy:Math.sin(o)*i*.5,r:2+4*Math.random()*(1-n),life:.6+.4*Math.random(),color:Math.random()>.5?"139, 92, 246":"236, 72, 153"})}}_emitImpactBurst(e,t){for(var n=0;n<16;n++){var A=n/16*Math.PI*2,o=2+4*Math.random();this.trailParticles.push({x:e,y:t,vx:Math.cos(A)*o,vy:Math.sin(A)*o,r:2+3*Math.random(),life:.8+.2*Math.random(),color:n%3==0?"250, 204, 21":n%3==1?"74, 222, 128":"139, 92, 246"})}}triggerFly(e,t,n){var A,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(null===this.animatingId){var i=this.getCartTarget();if(e&&i){var r=e.getBoundingClientRect(),a=i.getBoundingClientRect(),s=a.left+a.width/2,c=a.top+a.height/2;if("undefined"!=typeof window&&window.Shopify){var l=r.top+r.height/2;(c<l||0===a.width&&0===a.height)&&(s=window.innerWidth-60,c=window.innerHeight-60)}this.animatingId=null!==(A=null==t?void 0:t.id)&&void 0!==A?A:"fly";var d=t=>{var A=document.createElement("div");A.style.cssText="\n position: fixed;\n z-index: 2147483647;\n left: ".concat(r.left,"px;\n top: ").concat(r.top,"px;\n width: ").concat(r.width,"px;\n height: ").concat(r.height,"px;\n pointer-events: none;\n perspective: 600px;\n "),t.style.cssText="\n width: 100%;\n height: 100%;\n border-radius: 12px;\n overflow: hidden;\n background: #fff;\n box-shadow: 0 8px 32px rgba(0,0,0,0.4);\n transform-origin: center top;\n transform: rotateX(0deg) scaleX(1) scaleY(1);\n object-fit: cover;\n transition: none;\n ",A.appendChild(t),document.body.appendChild(A),e.style.opacity="0",e.style.transition="opacity 0.08s ease";var o=r.left,i=r.top,a=r.width,l=r.height,d=o+a/2,p=i+l/2,u=performance.now(),h=e=>{var o=e-u,i=Math.min(o/1e3,1),r=i*i,g=d+(s-d)*r,m=p+i*i*i*(c-p),f=Math.max(1-.92*r,.08),v=a*f,B=l*f;A.style.left="".concat(g-v/2,"px"),A.style.top="".concat(m-B/2,"px"),A.style.width="".concat(v,"px"),A.style.height="".concat(B,"px");var w=55*r,b=1-.5*r,y=12*r,x=8*Math.sin(i*Math.PI*3)*r;t.style.transform="\n rotateX(".concat(w,"deg)\n rotateY(").concat(y,"deg)\n rotateZ(").concat(x,"deg)\n scaleX(").concat(b,")\n "),t.style.opacity="".concat(i<.7?1:1-(i-.7)/.3);var C=.4*(1-r);A.style.boxShadow="\n 0 ".concat(12*(1-r),"px ").concat(32*(1-r),"px rgba(0,0,0,").concat(C,"),\n 0 0 ").concat(20*r,"px rgba(139,92,246,").concat(.4*r,")\n "),i<.9&&this._emitTrailAt(g,m+.3*B,i),i<1?requestAnimationFrame(h):(A.remove(),this.animatingId=null,this.onCartBump(),this.onRipple(),this._emitImpactBurst(s,c),n&&n())};this._ensureCanvas(),requestAnimationFrame(h)};if(!0===o.preferClone){var p=e.cloneNode(!0);p.querySelectorAll("button").forEach(e=>{e.style.pointerEvents="none",e.style.cursor="default"}),d(p)}else q()(e,{useCORS:!0,allowTaint:!1,backgroundColor:"#ffffff",scale:1,logging:!1}).then(e=>{var t=document.createElement("img");t.src=e.toDataURL("image/png"),t.alt="",d(t)}).catch(()=>{var t=e.cloneNode(!0);t.querySelectorAll("button").forEach(e=>{e.style.pointerEvents="none",e.style.cursor="default"}),d(t)})}else n&&n()}}destroy(){this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this._canvasInitialized=!1,this.trailParticles=[],this.animatingId=null}}class qt extends yt{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.shadowRoot=e.shadowRoot,this.onProductAdd=e.onProductAdd||(()=>{}),this.onProductUndo=e.onProductUndo||(()=>{}),this.flyToCart=new Wt({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>this._triggerCartBump(),onRipple:()=>this._triggerRipple()}),this.productPicker=new Ot({primaryColor:e.primaryColor||"#7c3aed",onProductAdd:(e,t)=>this._handleProductAddWithFly(e,t),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>this._handlePickerClose()}),this.cartToast=new Vt({onUndo:e=>this.onProductUndo(e),onHide:()=>this._restoreWaveform()}),this.cartSummary=new Nt,this.container=document.createElement("div"),this.container.id="ttpEcommerceArea",this.container.className="ttp-ecommerce-area";var t=document.createElement("div");t.id="ttpDesktopFlyTarget",t.className="ttp-desktop-fly-target",t.setAttribute("aria-hidden","true"),this.container.appendChild(t),this.voiceActiveState=null,this.isAttached=!1,this._cartBump=!1,this._ripple=!1,this._toastActive=!1}_getCartTarget(){var e,t=this.voiceActiveState||(null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("voiceActiveState"));if(t){var n=t.querySelector(".ttp-cart-icon");if(n){var A=n.getBoundingClientRect();if(A.width>0&&A.height>0)return n}}var o=document.getElementById("ttpEcommerceArea")||this.container;return(null==o?void 0:o.querySelector("#ttpDesktopFlyTarget"))||null}_handleProductAddWithFly(e,t){var n;this.flyToCart.isAnimating||(null===(n=this.productPicker.element)||void 0===n||n.classList.add("ttp-products-animating"),this.flyToCart.triggerFly(e,t,()=>{var e;null===(e=this.productPicker.element)||void 0===e||e.classList.remove("ttp-products-animating"),this.onProductAdd(t)},{preferClone:!1}))}_triggerCartBump(){this._cartBump=!0,this._updateCartBumpStyles(),setTimeout(()=>{this._cartBump=!1,this._updateCartBumpStyles()},450)}_triggerRipple(){this._ripple=!0,this._updateRippleStyles(),setTimeout(()=>{this._ripple=!1,this._updateRippleStyles()},600)}_updateCartBumpStyles(){if(this.cartSummary.element){var e=this.cartSummary.element.querySelector(".ttp-cart-info");e&&(e.style.transform="none",e.style.transition="")}}_updateRippleStyles(){if(this.cartSummary.element&&this._ripple){var e=this.cartSummary.element.querySelector(".ttp-fly-ripple");e&&e.remove();var t=document.createElement("div");t.className="ttp-fly-ripple",this.cartSummary.element.style.position="relative",this.cartSummary.element.appendChild(t),setTimeout(()=>t.remove(),600)}}showProducts(e,t,n){this._ensureReady(),this._switchToCompactMode(),this._setContainerMode("products"),this.productPicker.hide();var A=n||(e.length<=4?"cards":"list"),o=this.productPicker.show(e,t,A);this.container.insertBefore(o,this.container.firstChild),this._expandPanelToFit(e.length,A)}hideProducts(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.productPicker.hide(),e.shrinkToToastHeight||this._toastActive?this._setPanelHeightForToast():this._shrinkPanel(),this._restoreFullVoiceMode(),this._setContainerMode("summary")}onProductAdded(e,t){var n,A;this._ensureReady(),this.cartSummary.update(t.itemCount,t.total,t.currency),this._toastActive=!0,this.hideProducts({shrinkToToastHeight:!0});var o=this.cartToast.show(e,"added"),i=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById("desktopMainWaveform");i&&i.style.setProperty("display","none","important");var r=null===(A=this.shadowRoot)||void 0===A?void 0:A.querySelector(".desktop-controls");r?r.parentNode.insertBefore(o,r.nextSibling):this.voiceActiveState&&this.voiceActiveState.appendChild(o)}_setPanelHeightForToast(){var e=()=>{var e,t=(null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("text-chat-panel"))||document.getElementById("text-chat-panel");if(t){var n=Math.min(qt.TOAST_HEIGHT_PX,Math.floor(.92*window.innerHeight));t.classList.add("ttp-panel-expanded"),t.style.setProperty("height","".concat(n,"px"),"important")}};e(),requestAnimationFrame(()=>requestAnimationFrame(e))}_shrinkPanelForToast(){var e;this._toastActive=!1;var t=(null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("text-chat-panel"))||document.getElementById("text-chat-panel");t&&(t.classList.remove("ttp-panel-expanded"),t.style.removeProperty("height"))}_restoreWaveform(){var e,t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("desktopMainWaveform");t&&t.style.removeProperty("display"),this._shrinkPanelForToast()}updateCart(e){this._ensureReady(),this.cartSummary.update(e.itemCount,e.total,e.currency)}destroy(){var e;this.flyToCart&&this.flyToCart.destroy(),this.productPicker.hide(),this.cartToast.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-products-visible"),null!==(e=this.cartSummary.element)&&void 0!==e&&e.parentNode&&this.cartSummary.element.parentNode.removeChild(this.cartSummary.element),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.isAttached=!1}_ensureReady(){this.isAttached||(this._injectStyles(),this._attachToDOM())}_injectStyles(){if(this.shadowRoot){var e='\n\n/* ═══════════════════════════════════════\n ECOMMERCE AREA\n ═══════════════════════════════════════ */\n\n\n/*\n * When products are visible, expand the panel dynamically.\n * Actual height is set via inline style by EcommerceManager._expandPanelToFit().\n * When the class is removed, the panel returns to its CSS-defined default.\n */\n#text-chat-panel.ttp-panel-expanded {\n transition: height 0.25s ease;\n}\n\n/*\n * Layout overrides when ecommerce layer is active.\n * voiceActiveState is a flex column: [voice-controls] [ecommerce] [conversation].\n * Ecommerce area fills the middle and scrolls; conversation panel stays at bottom.\n */\n#voiceActiveState {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow: hidden !important;\n}\n\n.desktop-voice-section {\n flex-shrink: 1 !important;\n}\n\n/* Conversation + input always stick to bottom; ecommerce area above grows to fill. */\n.desktop-conversation-panel {\n flex: 0 0 auto !important;\n margin-top: auto !important;\n display: flex !important;\n flex-direction: column !important;\n}\n\n.desktop-conversation-panel .live-transcript-collapsed {\n flex: 0 0 auto !important;\n min-height: 40px !important;\n overflow: hidden !important;\n}\n\n.desktop-conversation-panel .voice-text-input-area {\n margin-top: auto !important;\n padding: 3px 16px !important;\n}\n\n.desktop-conversation-panel .voice-input-hint {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-voice-section {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .compact-voice-section {\n display: flex !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-conversation-panel {\n flex: 0 0 auto !important;\n}\n\n#voiceActiveState.ttp-products-visible .conversation-history {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .live-transcript-collapsed {\n flex: 0 0 auto !important;\n}\n\n.voice-text-input-area {\n flex-shrink: 0 !important;\n}\n\n.conversation-history {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow-y: auto !important;\n}\n\n.ttp-ecommerce-area {\n display: flex !important;\n flex-direction: column !important;\n width: 100%;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n position: relative !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT PICKER\n ═══════════════════════════════════════ */\n\n.ttp-product-picker {\n background: #fff;\n border-radius: 14px;\n border: 1px solid #e5e7eb;\n box-shadow: 0 6px 24px rgba(0,0,0,0.08);\n margin: 8px 10px;\n overflow-x: hidden !important;\n overflow-y: auto !important;\n animation: ttpSlideUp 0.25s ease;\n display: flex !important;\n flex-direction: column;\n flex: 1;\n min-height: 0 !important;\n}\n\n@keyframes ttpSlideUp {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n.ttp-picker-header {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 10px 14px;\n border-bottom: 1px solid #f1f5f9;\n flex-shrink: 0;\n}\n\n.ttp-picker-title {\n font-size: 12px;\n font-weight: 600;\n color: #64748b;\n}\n\n.ttp-picker-close {\n background: none;\n border: none;\n cursor: pointer;\n color: #94a3b8;\n font-size: 14px;\n padding: 2px 6px;\n border-radius: 4px;\n}\n.ttp-picker-close:hover {\n background: #f1f5f9;\n color: #475569;\n}\n\n/* Horizontal card layout */\n.ttp-products-horizontal {\n display: flex !important;\n align-items: flex-start;\n flex-shrink: 0;\n gap: 10px;\n padding: 12px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: thin;\n}\n.ttp-products-horizontal::-webkit-scrollbar { height: 4px; }\n.ttp-products-horizontal::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }\n\n/* Vertical list layout */\n.ttp-products-vertical {\n padding: 8px 12px;\n overflow-y: auto !important;\n display: flex !important;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n min-height: 0 !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT CARD (horizontal)\n ═══════════════════════════════════════ */\n\n.ttp-product-card {\n width: 140px !important;\n flex-shrink: 0 !important;\n background: #fff;\n border-radius: 12px;\n border: 1px solid #e5e7eb;\n overflow: hidden;\n transition: border-color 0.15s;\n}\n.ttp-product-card:hover { border-color: #3b82f6; }\n\n.ttp-product-image {\n height: 85px !important;\n background: #f8fafc;\n display: flex !important;\n align-items: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n}\n.ttp-product-image img {\n max-width: 90%;\n max-height: 75px;\n object-fit: contain;\n}\n\n.ttp-stock-badge {\n position: absolute;\n top: 4px; right: 4px;\n background: #fef2f2;\n color: #ef4444;\n font-size: 9px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n}\n\n.ttp-product-details {\n padding: 8px 10px 14px;\n}\n\n.ttp-product-name {\n font-size: 12px;\n font-weight: 600;\n color: #1e293b;\n line-height: 1.3;\n min-height: 30px;\n}\n\n.ttp-product-page-link {\n display: inline-flex;\n align-items: center;\n margin-left: 5px;\n font-size: 10px;\n color: #3b82f6;\n text-decoration: none;\n opacity: 0.7;\n vertical-align: middle;\n}\n.ttp-product-page-link:hover { opacity: 1; text-decoration: underline; }\n\n.ttp-product-meta {\n font-size: 10px;\n color: #94a3b8;\n margin-top: 2px;\n}\n\n.ttp-product-footer {\n display: flex !important;\n align-items: center;\n justify-content: space-between;\n margin-top: 6px;\n}\n\n.ttp-product-price {\n font-size: 14px;\n font-weight: 700;\n color: #1e293b;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT COMPACT (list view)\n ═══════════════════════════════════════ */\n\n.ttp-product-compact {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n background: #fff;\n border-radius: 10px;\n border: 1px solid #e5e7eb;\n transition: border-color 0.15s;\n}\n.ttp-product-compact:hover { border-color: #3b82f6; }\n\n.ttp-product-image-sm {\n width: 40px !important; height: 40px !important;\n border-radius: 8px;\n background: #f8fafc;\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n}\n.ttp-product-image-sm img {\n max-width: 36px;\n max-height: 36px;\n object-fit: contain;\n}\n\n.ttp-product-compact .ttp-product-info {\n flex: 1;\n min-width: 0;\n}\n.ttp-product-compact .ttp-product-name {\n min-height: auto;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ttp-product-compact .ttp-product-action {\n text-align: right;\n flex-shrink: 0 !important;\n}\n.ttp-product-compact .ttp-product-price {\n font-size: 13px;\n}\n\n.ttp-out-of-stock {\n font-size: 10px;\n color: #ef4444;\n font-weight: 500;\n}\n\n/* ═══════════════════════════════════════\n ADD BUTTON\n ═══════════════════════════════════════ */\n\n.ttp-add-btn {\n padding: 4px 14px;\n border-radius: 8px;\n border: none;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n background: #3b82f6;\n color: #fff;\n transition: all 0.15s;\n}\n.ttp-add-btn:hover { background: #2563eb; }\n.ttp-add-btn:active { transform: scale(0.95); }\n.ttp-add-btn.ttp-added { background: #10b981 !important; }\n.ttp-add-btn:disabled { cursor: default; }\n.ttp-add-btn.ttp-update-btn { background: #f59e0b; }\n.ttp-add-btn.ttp-update-btn:hover { background: #d97706; }\n\n.ttp-products-animating .ttp-add-btn {\n opacity: 0.4;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n/* ═══════════════════════════════════════\n CART TOAST\n ═══════════════════════════════════════ */\n\n/* Toast replaces waveform in desktop voice section */\n.ttp-cart-toast {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n margin: 8px 12px;\n background: #f0fdf4;\n border-radius: 12px;\n border: 1px solid #bbf7d0;\n animation: ttpToastIn 0.25s ease;\n flex-shrink: 0;\n box-shadow: 0 2px 8px rgba(0,0,0,0.08);\n}\n\n@keyframes ttpToastIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n.ttp-cart-toast.ttp-toast-hiding {\n animation: ttpSlideDown 0.3s ease forwards;\n}\n\n@keyframes ttpSlideDown {\n to { opacity: 0; transform: translateY(-8px); height: 0; padding: 0; margin: 0; overflow: hidden; }\n}\n\n.ttp-toast-icon {\n width: 24px !important; height: 24px !important;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex !important;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: 700;\n flex-shrink: 0;\n}\n\n.ttp-toast-content { flex: 1; min-width: 0; }\n.ttp-toast-title { font-size: 12px; font-weight: 600; color: #166534; }\n.ttp-toast-product {\n font-size: 11px;\n color: #15803d;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-toast-undo {\n background: none;\n border: 1px solid #86efac;\n border-radius: 6px;\n padding: 3px 8px;\n font-size: 10px;\n color: #15803d;\n cursor: pointer;\n font-weight: 600;\n flex-shrink: 0;\n}\n.ttp-toast-undo:hover { background: #dcfce7; }\n\n/* Fly-to-cart desktop target (when cart summary is hidden) */\n.ttp-desktop-fly-target {\n position: absolute;\n bottom: 12px;\n right: 80px;\n width: 24px;\n height: 24px;\n pointer-events: none;\n}\n\n/* Fly-to-cart ripple effect */\n.ttp-fly-ripple {\n position: absolute;\n left: 10px;\n top: 50%;\n width: 30px;\n height: 30px;\n margin-top: -15px;\n border-radius: 50%;\n border: 2px solid rgba(74,222,128,0.7);\n animation: ttp-ripple-expand 0.6s ease-out forwards;\n pointer-events: none;\n}\n\n@keyframes ttp-ripple-expand {\n 0% { transform: scale(0.5); opacity: 0.8; }\n 100% { transform: scale(3); opacity: 0; }\n}\n\n/* ═══════════════════════════════════════\n CART SUMMARY BAR\n ═══════════════════════════════════════ */\n\n.ttp-cart-summary {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 8px 14px;\n margin: 4px 12px 0;\n margin-right: 20px;\n margin-top: auto !important;\n flex-shrink: 0 !important;\n background: #f8fafc;\n border-radius: 12px;\n border: 1px solid #e2e8f0;\n}\n\n/* Hide cart when empty — overrides display:flex !important */\n.ttp-cart-summary.ttp-cart-empty {\n display: none !important;\n}\n\n/* Desktop: cart below input (fallback when input area not found) */\n.ttp-cart-summary-bottom {\n margin-top: 0 !important;\n margin: 8px 12px 12px !important;\n flex-shrink: 0 !important;\n}\n\n/* Desktop: cart inside input area — unified section (like mobile) */\n.ttp-cart-summary-inline {\n margin: 0 !important;\n margin-top: 10px !important;\n padding: 0 !important;\n padding-top: 10px !important;\n flex-shrink: 0 !important;\n background: transparent !important;\n border: none !important;\n border-top: 1px solid rgba(0, 0, 0, 0.06) !important;\n border-radius: 0 !important;\n}\n\n.ttp-cart-info {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.ttp-cart-icon { font-size: 14px; }\n.ttp-cart-count { font-size: 12px; font-weight: 600; color: #475569; }\n.ttp-cart-separator { font-size: 12px; color: #94a3b8; }\n.ttp-cart-total { font-size: 13px; font-weight: 700; color: #1e293b; }\n.ttp-cart-view {\n font-size: 12px;\n font-weight: 600;\n color: #6366f1;\n text-decoration: none;\n cursor: pointer;\n white-space: nowrap;\n}\n.ttp-cart-view:hover {\n color: #4f46e5;\n text-decoration: underline;\n}\n\n/* ═══════════════════════════════════════\n QUANTITY/WEIGHT STEPPER\n ═══════════════════════════════════════ */\n\n.ttp-stepper {\n display: flex !important;\n align-items: center;\n gap: 2px;\n margin: 4px 0;\n}\n\n.ttp-stepper-btn {\n width: 24px !important;\n height: 24px !important;\n border-radius: 6px;\n border: 1px solid #e2e8f0;\n background: #f8fafc;\n color: #475569;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n display: flex !important;\n align-items: center;\n justify-content: center;\n padding: 0;\n line-height: 1;\n transition: all 0.15s;\n flex-shrink: 0;\n}\n\n.ttp-stepper-btn:hover:not(:disabled) {\n background: #e2e8f0;\n border-color: #cbd5e1;\n}\n\n.ttp-stepper-btn:active:not(:disabled) {\n transform: scale(0.9);\n}\n\n.ttp-stepper-btn:disabled,\n.ttp-stepper-disabled {\n opacity: 0.35;\n cursor: default;\n}\n\n.ttp-stepper-value {\n font-size: 12px;\n font-weight: 600;\n color: #1e293b;\n min-width: 36px;\n text-align: center;\n user-select: none;\n}\n\n.ttp-product-compact .ttp-stepper {\n justify-content: flex-end;\n}\n\n.ttp-product-compact .ttp-product-action {\n display: flex !important;\n flex-direction: column;\n align-items: flex-end;\n gap: 2px;\n}\n\n.ttp-product-card .ttp-stepper {\n justify-content: center;\n margin: 4px 0;\n}\n\n.ttp-product-card .ttp-product-footer {\n display: flex !important;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n/* ═══════════════════════════════════════\n VARIATION DESKTOP PICKER\n ═══════════════════════════════════════ */\n\n.picker-relative {\n position: relative !important;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n display: flex !important;\n flex-direction: column !important;\n overflow: hidden;\n}\n\n/* When variant picker is shown, center it horizontally and vertically */\n.picker-relative.ttp-var-picker-active {\n justify-content: center !important;\n align-items: center !important;\n}\n\n.ttp-var-picker {\n background: #fff;\n border-radius: 14px;\n display: flex !important;\n flex-direction: column;\n animation: ttpVarFadeIn 0.2s ease;\n overflow: hidden;\n width: 100%;\n flex-shrink: 0 !important;\n}\n\n@keyframes ttpVarFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.ttp-var-header {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n border-bottom: 1px solid #f1f5f9;\n flex-shrink: 0;\n}\n\n.ttp-var-back-btn {\n background: none;\n border: none;\n cursor: pointer;\n color: #64748b;\n font-size: 16px;\n padding: 0;\n display: flex;\n align-items: center;\n line-height: 1;\n font-family: inherit;\n}\n.ttp-var-back-btn:hover { color: #1e293b; }\n\n.ttp-var-title {\n font-size: 13px;\n font-weight: 700;\n color: #1e293b;\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-var-page-link {\n font-size: 11px;\n color: #3b82f6;\n text-decoration: none;\n font-weight: 500;\n white-space: nowrap;\n flex-shrink: 0;\n}\n.ttp-var-page-link:hover { text-decoration: underline; }\n\n.ttp-var-body {\n flex: 1;\n overflow-y: auto;\n padding: 12px 14px;\n display: flex !important;\n flex-direction: column;\n gap: 14px;\n}\n\n.ttp-var-preview {\n display: flex !important;\n gap: 12px;\n align-items: flex-start;\n}\n\n.ttp-var-preview-img {\n width: 72px !important;\n height: 72px !important;\n border-radius: 12px;\n background: #f8fafc;\n border: 1px solid #e5e7eb;\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n transition: all 0.2s ease;\n}\n\n.ttp-var-preview-img img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n padding: 6px;\n}\n\n.ttp-var-preview-info { flex: 1; min-width: 0; }\n\n.ttp-var-preview-brand {\n font-size: 10px;\n color: #94a3b8;\n font-weight: 500;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n\n.ttp-var-preview-name {\n font-size: 14px;\n font-weight: 700;\n color: #1e293b;\n margin: 2px 0 4px;\n line-height: 1.2;\n}\n\n.ttp-var-preview-price {\n font-size: 18px;\n font-weight: 700;\n color: #7c3aed;\n}\n\n.ttp-var-preview-selected {\n font-size: 11px;\n color: #64748b;\n margin-top: 3px;\n}\n\n.ttp-var-section { display: flex !important; flex-direction: column; gap: 8px; }\n\n.ttp-var-section-label {\n font-size: 11px;\n font-weight: 700;\n color: #1e293b;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n}\n\n.ttp-var-swatches { display: flex !important; flex-wrap: wrap; gap: 8px; }\n\n.ttp-var-swatch {\n display: block !important;\n width: 28px !important;\n height: 28px !important;\n border-radius: 50%;\n cursor: pointer;\n border: 3px solid transparent;\n transition: all 0.15s;\n position: relative;\n flex-shrink: 0;\n}\n.ttp-var-swatch:hover { transform: scale(1.1); }\n.ttp-var-swatch.selected {\n border-color: #7c3aed;\n box-shadow: 0 0 0 2px #fff, 0 0 0 4px #7c3aed;\n}\n.ttp-var-swatch.oos {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.ttp-var-pills { display: flex !important; flex-wrap: wrap; gap: 6px; }\n\n.ttp-var-pill {\n padding: 5px 12px;\n border-radius: 8px;\n border: 1.5px solid #e2e8f0;\n background: #fff;\n font-size: 12px;\n font-weight: 600;\n color: #475569;\n cursor: pointer;\n transition: all 0.15s;\n font-family: inherit;\n}\n.ttp-var-pill:hover:not(:disabled) { border-color: #7c3aed; color: #7c3aed; }\n.ttp-var-pill.selected { border-color: #7c3aed; background: #7c3aed; color: #fff; }\n.ttp-var-pill.oos { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }\n\n.ttp-var-footer {\n padding: 10px 14px 12px;\n border-top: 1px solid #f1f5f9;\n flex-shrink: 0;\n}\n\n.ttp-var-add-btn {\n width: 100%;\n padding: 10px;\n background: linear-gradient(135deg, #7c3aed, #6d28d9);\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n box-shadow: 0 3px 10px rgba(124,58,237,0.3);\n transition: all 0.15s;\n}\n.ttp-var-add-btn:hover:not(:disabled) { transform: scale(0.99); }\n.ttp-var-add-btn:disabled {\n background: #cbd5e1;\n box-shadow: none;\n cursor: not-allowed;\n}\n\n.ttp-var-spinner {\n width: 24px;\n height: 24px;\n border: 3px solid #e2e8f0;\n border-top-color: #7c3aed;\n border-radius: 50%;\n animation: ttpVarSpin 0.7s linear infinite;\n}\n@keyframes ttpVarSpin {\n to { transform: rotate(360deg); }\n}\n\n/* Amber "Choose" button for variant products */\n.ttp-add-btn.ttp-choose-btn {\n background: linear-gradient(135deg, #f59e0b, #d97706);\n box-shadow: 0 2px 8px rgba(245,158,11,0.3);\n color: #fff;\n}\n\n ',t=this.shadowRoot.querySelector("style");if(t)t.textContent+="\n"+e;else{var n=document.createElement("style");n.textContent=e,this.shadowRoot.appendChild(n)}}}_attachToDOM(){if(!this.isAttached&&this.shadowRoot)if(this.voiceActiveState=this.shadowRoot.getElementById("voiceActiveState"),this.voiceActiveState)if(this.shadowRoot.getElementById("ttpEcommerceArea"))this.isAttached=!0;else{var e=this.voiceActiveState.querySelector(".desktop-voice-section"),t=this.voiceActiveState.querySelector(".compact-voice-section")||e;t&&t.nextSibling?this.voiceActiveState.insertBefore(this.container,t.nextSibling):this.voiceActiveState.appendChild(this.container);var n=this.voiceActiveState.querySelector(".voice-text-input-area");if(n){var A=this.cartSummary.render();A.classList.add("ttp-cart-summary-inline"),n.appendChild(A)}else{var o=this.cartSummary.render();o.classList.add("ttp-cart-summary-bottom"),this.voiceActiveState.appendChild(o)}this.isAttached=!0}else console.warn("[DesktopPresenter] #voiceActiveState not found — will retry on next message")}_setContainerMode(e){if("products"===e?(this.container.style.flex="1 1 0",this.container.style.minHeight="0",this.container.style.overflowY="auto",this.voiceActiveState&&this.voiceActiveState.classList.add("ttp-products-visible")):(this.container.style.flex="1 1 0",this.container.style.minHeight="0",this.container.style.overflowY="",this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-products-visible")),this.cartSummary.element){var t="products"===e||"summary"===e&&this.cartSummary.itemCount>0;this.cartSummary.element.classList.toggle("ttp-cart-empty",!t)}}_expandPanelToFit(e,t){if(this.shadowRoot){var n=this.shadowRoot.getElementById("text-chat-panel");if(n){var A;if(A="cards"===t?520:Math.min(64*e+20,600),e>2){var o=Math.ceil(224)+20;A=Math.max(A,o)}var i=272+A,r=e>2?750:580,a=Math.min(1e3,Math.floor(.92*window.innerHeight)),s=Math.min(Math.max(i,r),a);n.classList.add("ttp-panel-expanded"),n.style.height="".concat(s,"px")}}}_shrinkPanel(){if(this.shadowRoot){var e=this.shadowRoot.getElementById("text-chat-panel");e&&(e.classList.remove("ttp-panel-expanded"),e.style.height="")}}_switchToCompactMode(){if(this.shadowRoot){var e=this.shadowRoot.getElementById("desktopVoiceSection"),t=this.shadowRoot.getElementById("compactVoiceSection");e&&(e.style.display="none"),t&&(t.style.display="flex")}}_restoreFullVoiceMode(){if(this.shadowRoot){var e=this.shadowRoot.getElementById("desktopVoiceSection"),t=this.shadowRoot.getElementById("compactVoiceSection");e&&t&&(e.style.display="",t.style.display="none")}}_handlePickerClose(){this.hideProducts()}}function Xt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function Yt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xt(Object(n),!0).forEach(function(t){Jt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jt(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}jt=qt,zt=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(Gt="TOAST_HEIGHT_PX"),(Gt="symbol"==typeof zt?zt:zt+"")in jt?Object.defineProperty(jt,Gt,{value:510,enumerable:!0,configurable:!0,writable:!0}):jt[Gt]=510;class Zt{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onProductAdd=e.onProductAdd||(()=>{}),this.onClose=e.onClose||(()=>{}),this.primaryColor=e.primaryColor||"#3b82f6",this.container=null,this.product=null,this.selectedValues=[]}show(e){if(this.hide(),this.product=e,!e.variants)return this._injectStyles(),this._buildLoadingDOM(),this._positionAboveMobileBar(),document.body.appendChild(this.container),void Tt(e).then(e=>{e&&e.variants?(this.hide(!0),this.show(e)):this.hide()});this.selectedValues=new Array(e.options.length).fill(null),e.options.forEach((t,n)=>{var A=Dt(e.variants,n,this.selectedValues);A.length>0&&(this.selectedValues[n]=A[0])}),this._injectStyles(),this._buildDOM(),this._positionAboveMobileBar(),document.body.appendChild(this.container)}hide(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.container&&this.container.parentNode){this.container.classList.add("ttp-varpicker--hiding");var t=this.container,n=this.onClose;setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),e||n()},280)}this.container=null,this.product=null}destroy(){this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null;var e=document.getElementById("ttp-varpicker-styles");e&&e.remove()}_buildLoadingDOM(){this.container=document.createElement("div"),this.container.className="ttp-varpicker",this.container.style.setProperty("--ttp-vp-primary",this.primaryColor),this.container.innerHTML='\n <div class="ttp-vp-backdrop"></div>\n <div class="ttp-vp-card" style="align-items:center;justify-content:center;min-height:120px;">\n <div style="display:flex;flex-direction:column;align-items:center;gap:10px;padding:24px;">\n <div class="ttp-vp-spinner"></div>\n <div style="font-size:12px;color:#64748b;font-weight:500;">Loading options...</div>\n </div>\n </div>\n ',this.container.querySelector(".ttp-vp-backdrop").addEventListener("click",()=>{this.hide()})}_buildDOM(){var e=this.product,t=Mt(e.currency),n=_t(e.variants,this.selectedValues),A=n?n.price:e.price;this.container=document.createElement("div"),this.container.className="ttp-varpicker",this.container.style.setProperty("--ttp-vp-primary",this.primaryColor),this.container.innerHTML='\n <div class="ttp-vp-backdrop"></div>\n <div class="ttp-vp-card" id="ttpVpCard">\n\n \x3c!-- Collapsed: product summary (left panel) --\x3e\n <div class="ttp-vp-left" id="ttpVpLeft">\n <div class="ttp-vp-img" id="ttpVpImg">'.concat(e.imageUrl?'<img src="'.concat(e.imageUrl,'" alt="').concat(e.name,'" onerror="this.style.display=\'none\'"/>'):"",'</div>\n <div class="ttp-vp-product-name">').concat(e.name,'</div>\n <div class="ttp-vp-product-price" id="ttpVpPrice">').concat(t).concat(A.toFixed(2),'</div>\n </div>\n\n \x3c!-- Options panel (right panel) --\x3e\n <div class="ttp-vp-right" id="ttpVpRight">\n <div class="ttp-vp-right-header">\n <span class="ttp-vp-right-title">Choose Options</span>\n <button class="ttp-vp-close-btn" id="ttpVpClose">✕</button>\n </div>\n <div class="ttp-vp-options" id="ttpVpOptions">\n ').concat(this._renderOptions(),'\n </div>\n <button class="ttp-vp-add-btn" id="ttpVpAddBtn">\n Add to Cart — ').concat(t).concat(A.toFixed(2),"\n </button>\n </div>\n </div>\n "),this.container.querySelector("#ttpVpClose").addEventListener("click",()=>{this.hide()}),this.container.querySelector("#ttpVpAddBtn").addEventListener("click",()=>{this._handleAdd()}),this._attachOptionHandlers(),this._updateAddButton()}_renderOptions(){return this.product.options.map((e,t)=>{var n=Dt(this.product.variants,t,this.selectedValues);return"color"===e.name.toLowerCase()||"colour"===e.name.toLowerCase()?'\n <div class="ttp-vp-section">\n <div class="ttp-vp-label">'.concat(e.name,'</div>\n <div class="ttp-vp-swatches" data-opt-idx="').concat(t,'">\n ').concat(e.values.map(e=>{var A=!n.includes(e),o=this.selectedValues[t]===e;return'<div\n class="ttp-vp-swatch'.concat(o?" selected":"").concat(A?" oos":"",'"\n data-value="').concat(e,'"\n data-opt-idx="').concat(t,'"\n style="background:').concat(this._colorNameToHex(e),';"\n title="').concat(e).concat(A?" (unavailable)":"",'"\n ></div>')}).join(""),"\n </div>\n </div>"):'\n <div class="ttp-vp-section">\n <div class="ttp-vp-label">'.concat(e.name,'</div>\n <div class="ttp-vp-pills" data-opt-idx="').concat(t,'">\n ').concat(e.values.map(e=>{var A=!n.includes(e),o=this.selectedValues[t]===e;return'<button\n class="ttp-vp-pill'.concat(o?" selected":"").concat(A?" oos":"",'"\n data-value="').concat(e,'"\n data-opt-idx="').concat(t,'"\n ').concat(A?"disabled":"","\n >").concat(e,"</button>")}).join(""),"\n </div>\n </div>")}).join("")}_attachOptionHandlers(){this.container.querySelectorAll(".ttp-vp-swatch:not(.oos)").forEach(e=>{e.addEventListener("click",()=>this._selectOption(parseInt(e.dataset.optIdx),e.dataset.value))}),this.container.querySelectorAll(".ttp-vp-pill:not(.oos)").forEach(e=>{e.addEventListener("click",()=>this._selectOption(parseInt(e.dataset.optIdx),e.dataset.value))})}_selectOption(e,t){this.selectedValues[e]=t,this.container.querySelector("#ttpVpOptions").innerHTML=this._renderOptions(),this._attachOptionHandlers(),this._updateAddButton(),this._updateImage()}_updateAddButton(){var e,t=Mt(this.product.currency),n=_t(this.product.variants,this.selectedValues),A=this.container.querySelector("#ttpVpAddBtn");if(!this.selectedValues.every(e=>null!==e))return A.textContent="Select all options",void(A.disabled=!0);if(!n||!n.available)return A.textContent="Unavailable",void(A.disabled=!0);var o=null!==(e=n.price)&&void 0!==e?e:this.product.price;A.textContent="Add to Cart — ".concat(t).concat(o.toFixed(2)),A.disabled=!1;var i=this.container.querySelector("#ttpVpPrice");i&&(i.textContent="".concat(t).concat(o.toFixed(2)))}_updateImage(){var e=_t(this.product.variants,this.selectedValues),t=(null==e?void 0:e.imageUrl)||this.product.imageUrl,n=this.container.querySelector("#ttpVpImg");n&&t&&(n.innerHTML='<img src="'.concat(t,'" alt="').concat(this.product.name,'"\n onerror="this.style.display=\'none\'"/>'))}_handleAdd(){var e=_t(this.product.variants,this.selectedValues);if(e&&e.available){var t=this.container.querySelector("#ttpVpAddBtn");t.textContent="✓ Added!",t.disabled=!0;var n=Yt(Yt({},this.product),{},{id:e.id,price:e.price,selectedOptions:this.selectedValues,selectedAmount:1,sellBy:"quantity"});this.onProductAdd(this.container,n),setTimeout(()=>this.hide(),800)}}_positionAboveMobileBar(){}_colorNameToHex(e){return{black:"#1e293b",white:"#f8fafc",red:"#ef4444",blue:"#3b82f6",green:"#22c55e",yellow:"#eab308",orange:"#f97316",purple:"#a855f7",pink:"#ec4899",grey:"#94a3b8",gray:"#94a3b8",navy:"#1e3a5f",brown:"#92400e",beige:"#d4b483",cream:"#fef9c3"}[e.toLowerCase()]||"#94a3b8"}_injectStyles(){if(!document.getElementById("ttp-varpicker-styles")){var e=document.createElement("style");e.id="ttp-varpicker-styles",e.textContent="\n\n.ttp-varpicker {\n position: fixed !important;\n inset: 0;\n z-index: 2147483647 !important;\n display: flex !important;\n align-items: center;\n justify-content: center;\n font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n animation: ttpVpIn 0.3s cubic-bezier(0.23,1,0.32,1);\n padding: 16px;\n}\n\n.ttp-varpicker--hiding {\n animation: ttpVpOut 0.28s ease forwards;\n pointer-events: none;\n}\n\n@keyframes ttpVpIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@keyframes ttpVpOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n.ttp-vp-backdrop {\n position: absolute;\n inset: 0;\n background: #0a0a0a;\n backdrop-filter: blur(20px);\n -webkit-backdrop-filter: blur(20px);\n}\n\n.ttp-vp-card {\n position: relative !important;\n z-index: 1 !important;\n width: 310px;\n background: #fff;\n border-radius: 20px;\n overflow: hidden;\n box-shadow: 0 16px 56px rgba(0,0,0,0.22);\n display: flex !important;\n flex-direction: row;\n animation: ttpVpCardIn 0.35s cubic-bezier(0.23,1,0.32,1);\n}\n\n@keyframes ttpVpCardIn {\n from { transform: translateY(20px) scale(0.96); opacity: 0; }\n to { transform: translateY(0) scale(1); opacity: 1; }\n}\n\n/* Left panel — product image + name + price */\n.ttp-vp-left {\n width: 110px;\n flex-shrink: 0;\n background: linear-gradient(160deg, #f0f4ff, #dde6f8);\n display: flex !important;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding: 14px 8px;\n border-right: 1px solid #f1f5f9;\n}\n\n.ttp-vp-img {\n width: 72px !important; height: 72px !important;\n border-radius: 14px;\n background: #fff;\n border: 1px solid #e5e7eb;\n display: flex !important; align-items: center; justify-content: center;\n overflow: hidden;\n transition: all 0.2s ease;\n}\n\n.ttp-vp-img img {\n width: 100%; height: 100%;\n object-fit: contain;\n padding: 6px;\n}\n\n.ttp-vp-product-name {\n font-size: 11px;\n font-weight: 700;\n color: #1e293b;\n text-align: center;\n line-height: 1.25;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n\n.ttp-vp-product-price {\n font-size: 14px;\n font-weight: 700;\n color: var(--ttp-vp-primary, #3b82f6);\n}\n\n/* Right panel — options */\n.ttp-vp-right {\n flex: 1;\n display: flex !important;\n flex-direction: column;\n padding: 12px 12px 10px;\n gap: 8px;\n min-width: 0;\n}\n\n.ttp-vp-right-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 2px;\n}\n\n.ttp-vp-right-title {\n font-size: 11px;\n font-weight: 700;\n color: #1e293b;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n}\n\n.ttp-vp-close-btn {\n background: none;\n border: none;\n cursor: pointer;\n color: #94a3b8;\n font-size: 13px;\n padding: 2px 4px;\n border-radius: 4px;\n line-height: 1;\n}\n.ttp-vp-close-btn:hover { background: #f1f5f9; color: #475569; }\n\n.ttp-vp-options {\n flex: 1;\n display: flex !important;\n flex-direction: column;\n gap: 10px;\n overflow-y: auto;\n}\n\n.ttp-vp-section { display: flex !important; flex-direction: column; gap: 5px; }\n\n.ttp-vp-label {\n font-size: 9px;\n font-weight: 700;\n color: #94a3b8;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n/* Color swatches */\n.ttp-vp-swatches { display: flex !important; flex-wrap: wrap; gap: 6px; }\n\n.ttp-vp-swatch {\n display: block !important;\n width: 22px !important; height: 22px !important;\n border-radius: 50%;\n cursor: pointer;\n border: 2.5px solid transparent;\n transition: all 0.15s;\n flex-shrink: 0;\n position: relative;\n}\n.ttp-vp-swatch:hover { transform: scale(1.12); }\n.ttp-vp-swatch.selected {\n border-color: var(--ttp-vp-primary, #3b82f6);\n box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ttp-vp-primary, #3b82f6);\n}\n.ttp-vp-swatch.oos { opacity: 0.3; cursor: not-allowed; }\n\n/* Size pills */\n.ttp-vp-pills { display: flex !important; flex-wrap: wrap; gap: 4px; }\n\n.ttp-vp-pill {\n padding: 3px 9px;\n border-radius: 6px;\n border: 1.5px solid #e2e8f0;\n background: #fff;\n font-size: 10px;\n font-weight: 600;\n color: #475569;\n cursor: pointer;\n transition: all 0.15s;\n font-family: inherit;\n line-height: 1.4;\n}\n.ttp-vp-pill:hover:not(:disabled) { border-color: var(--ttp-vp-primary, #3b82f6); color: var(--ttp-vp-primary, #3b82f6); }\n.ttp-vp-pill.selected { border-color: var(--ttp-vp-primary, #3b82f6); background: var(--ttp-vp-primary, #3b82f6); color: #fff; }\n.ttp-vp-pill.oos { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }\n\n/* Add button */\n.ttp-vp-add-btn {\n width: 100%;\n padding: 9px;\n background: linear-gradient(135deg, var(--ttp-vp-primary, #3b82f6), #2563eb);\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 11px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n box-shadow: 0 3px 10px rgba(59,130,246,0.3);\n transition: all 0.15s;\n flex-shrink: 0;\n}\n.ttp-vp-add-btn:hover:not(:disabled) { transform: scale(0.98); }\n.ttp-vp-add-btn:disabled { background: #cbd5e1; box-shadow: none; cursor: not-allowed; }\n\n.ttp-vp-spinner {\n width: 24px; height: 24px;\n border: 3px solid #e2e8f0;\n border-top-color: var(--ttp-vp-primary, #3b82f6);\n border-radius: 50%;\n animation: ttpVpSpin 0.7s linear infinite;\n}\n@keyframes ttpVpSpin {\n to { transform: rotate(360deg); }\n}\n\n ",document.head.appendChild(e)}}}function $t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function en(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$t(Object(n),!0).forEach(function(t){tn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function tn(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class nn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onProductAdd=e.onProductAdd||(()=>{}),this.onAddDisabled=e.onAddDisabled||(()=>!1),this.onClose=e.onClose||(()=>{}),this.primaryColor=e.primaryColor||"#3b82f6",this.products=[],this.current=0,this.amounts=[],this.sellByModes=[],this.container=null,this.wheel=null,this.dotsEl=null,this.currentPicker=null,this.anglePerCard=42,this.radius=240,this.dragging=!1,this.startX=0,this.swiped=!1,this.dragThreshold=40,this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._boundMouseMove=this._onMouseMove.bind(this),this._boundMouseUp=this._onMouseUp.bind(this)}show(e,t){this.hide(),e&&0!==e.length&&(this._normalizeProducts(e),this.current=0,this._injectStyles(),this._buildDOM(t),this._buildCards(),this._buildDots(),this._setupDragEvents(),this._updateWheel(),document.body.appendChild(this.container),this._positionAboveMobileBar())}hide(){if(this.currentPicker&&(this.currentPicker.hide(),this.currentPicker=null),this._removeEventListeners(),this.container&&this.container.parentNode){this.container.classList.add("ttp-carousel--hiding");var e=this.container;setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},280)}this.container=null,this.wheel=null,this.dotsEl=null}destroy(){this.currentPicker&&(this.currentPicker.destroy(),this.currentPicker=null),this._removeEventListeners(),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null;var e=document.getElementById("ttpCarouselToast");e&&e.remove();var t=document.getElementById("ttp-mobile-carousel-styles");t&&t.remove()}showToast(e,t){var n=document.getElementById("ttpCarouselToast");n&&n.remove();var A=document.createElement("div");A.id="ttpCarouselToast",A.className="ttp-carousel-toast";var o=t?'<div class="ttp-carousel-toast__cart">'.concat(t.itemCount," item").concat(1!==t.itemCount?"s":""," · ").concat(t.currency).concat(t.total.toFixed(2),"</div>"):"";A.innerHTML='\n <div class="ttp-carousel-toast__icon">✓</div>\n <div class="ttp-carousel-toast__text">\n <strong>'.concat(e,"</strong> added to cart\n ").concat(o,"\n </div>\n "),A.style.setProperty("--ttp-carousel-primary",this.primaryColor),document.body.appendChild(A);var i=document.getElementById("mobile-voice-call-bar-container"),r=document.getElementById("ttpMobileCartSummary");A.style.bottom=r?"".concat(parseInt(r.style.bottom)+r.offsetHeight+8,"px"):i?"".concat(i.offsetHeight+12,"px"):"100px",setTimeout(()=>{A.classList.add("ttp-carousel-toast--hiding"),setTimeout(()=>A.remove(),300)},3e3)}_normalizeProducts(e){this.products=e.map(e=>en(en({},e),{},{imageUrl:e.imageUrl||e.image_url||"",inStock:void 0!==e.inStock?e.inStock:void 0===e.in_stock||e.in_stock,sellBy:e.sellBy||e.sell_by||"quantity",cartQuantity:e.cartQuantity||e.cart_quantity||0,brand:e.brand||"",unit:e.unit||"",currency:e.currency||"USD"})),this.amounts=this.products.map(e=>{var t="weight"===e.sellBy?.5:1;return e.cartQuantity>0?e.cartQuantity:t}),this.sellByModes=this.products.map(e=>e.sellBy)}_buildDOM(e){this.container=document.createElement("div"),this.container.className="ttp-mobile-carousel",this.container.id="ttpMobileCarousel",this.container.style.setProperty("--ttp-carousel-primary",this.primaryColor),this.container.style.setProperty("--ttp-carousel-primary-light",this._hexToRgba(this.primaryColor,.12)),this.container.style.setProperty("--ttp-carousel-primary-dark",this._darkenHex(this.primaryColor,30)),this.container.style.setProperty("--ttp-carousel-primary-shadow",this._hexToRgba(this.primaryColor,.3));var t=document.createElement("div");t.className="ttp-carousel-header",t.innerHTML='\n <span class="ttp-carousel-title">'.concat(e||"Products",'</span>\n <button class="ttp-carousel-close" aria-label="Close">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">\n <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>\n </svg>\n </button>\n '),t.querySelector(".ttp-carousel-close").addEventListener("click",()=>{this.hide(),this.onClose()});var n=document.createElement("div");n.className="ttp-carousel-area",this.wheel=document.createElement("div"),this.wheel.className="ttp-carousel-wheel",n.appendChild(this.wheel),this.dotsEl=document.createElement("div"),this.dotsEl.className="ttp-carousel-dots",this.container.appendChild(t),this.container.appendChild(n),this.container.appendChild(this.dotsEl)}_buildCards(){this.products.forEach((e,t)=>{var n=document.createElement("div");n.className="ttp-carousel-card"+(e.inStock?"":" ttp-carousel-card--oos"),n.dataset.index=t;var A="ILS"===e.currency?"₪":"$",o="weight"===this.sellByModes[t]?"".concat(this.amounts[t].toFixed(1)," kg"):"".concat(this.amounts[t]),i=e.cartQuantity>0,r=It(e);n.innerHTML='\n <div class="ttp-carousel-card__image">\n <img src="'.concat(e.imageUrl,'" alt="').concat(e.name,'" onerror="this.style.display=\'none\'" />\n ').concat(e.inStock?"":'<div class="ttp-carousel-card__badge">Out of Stock</div>','\n </div>\n <div class="ttp-carousel-card__info">\n ').concat(e.brand?'<div class="ttp-carousel-card__brand">'.concat(e.brand,"</div>"):"",'\n <div class="ttp-carousel-card__name">').concat(e.name,"</div>\n ").concat(e.unit?'<div class="ttp-carousel-card__unit">'.concat(e.unit,"</div>"):"",'\n <div class="ttp-carousel-card__price">').concat(A).concat(e.price.toFixed(2),'</div>\n </div>\n <div class="ttp-carousel-card__actions">\n <div class="ttp-carousel-card__stepper">\n <button class="ttp-carousel-card__qty-btn ttp-carousel-minus" data-idx="').concat(t,'" ').concat(e.inStock?"":"disabled",'>−</button>\n <span class="ttp-carousel-card__qty-val" id="ttpCQty').concat(t,'">').concat(o,'</span>\n <button class="ttp-carousel-card__qty-btn ttp-carousel-plus" data-idx="').concat(t,'" ').concat(e.inStock?"":"disabled",'>+</button>\n </div>\n <button class="ttp-carousel-card__add-btn').concat(r?" ttp-carousel-card__add-btn--choose":"").concat(i?" ttp-carousel-card__add-btn--update":"",'" data-idx="').concat(t,'" ').concat(e.inStock?"":"disabled",">\n ").concat(e.inStock?r?"Choose Options":i?"Update":"Add to Cart":"Unavailable","\n </button>\n </div>\n "),n.style.transform="rotateY(".concat(t*this.anglePerCard,"deg) translateZ(").concat(this.radius,"px)"),this.wheel.appendChild(n)}),this._setupCardHandlers()}_setupCardHandlers(){var e=this.container.querySelector(".ttp-carousel-area");if(e){var t=null;e.addEventListener("touchstart",e=>{t={x:e.touches[0].clientX,y:e.touches[0].clientY}},{passive:!0}),e.addEventListener("touchend",e=>{if(t&&!this.swiped){var n=e.changedTouches[0],A=Math.abs(n.clientX-t.x),o=Math.abs(n.clientY-t.y);t=null,A>15||o>15||(e.preventDefault(),this._handleTapAt(n.clientX,n.clientY))}else t=null}),e.addEventListener("click",e=>{var t=e.target,n=t.closest(".ttp-carousel-card");if(n&&parseInt(n.dataset.index)===this.current){var A=t.closest(".ttp-carousel-minus"),o=t.closest(".ttp-carousel-plus"),i=t.closest(".ttp-carousel-card__add-btn");A&&!A.disabled?(e.stopPropagation(),this._handleMinus()):o&&!o.disabled?(e.stopPropagation(),this._handlePlus()):i&&!i.disabled&&(e.stopPropagation(),this._handleAdd())}})}}_handleTapAt(e,t){var n=this.wheel.querySelectorAll(".ttp-carousel-card")[this.current];if(n){var A=n.querySelector(".ttp-carousel-minus"),o=n.querySelector(".ttp-carousel-plus"),i=n.querySelector(".ttp-carousel-card__add-btn");!this._hitTest(e,t,A)||null!=A&&A.disabled?!this._hitTest(e,t,o)||null!=o&&o.disabled?!this._hitTest(e,t,i)||null!=i&&i.disabled||this._handleAdd():this._handlePlus():this._handleMinus()}}_hitTest(e,t,n){if(!n)return!1;var A=n.getBoundingClientRect();return e>=A.left&&e<=A.right&&t>=A.top&&t<=A.bottom}_handleMinus(){var e=this.current,t=this.sellByModes[e],n="weight"===t?.5:1,A="weight"===t?.5:1;this.amounts[e]>n&&(this.amounts[e]=Math.round(10*(this.amounts[e]-A))/10,this._refreshStepper(e))}_handlePlus(){var e=this.current,t="weight"===this.sellByModes[e]?.5:1;this.amounts[e]=Math.round(10*(this.amounts[e]+t))/10,this._refreshStepper(e)}_handleAdd(){var e=this.current,t=this.products[e];if(t.inStock&&!this.onAddDisabled()){if(It(t)){var n=new Zt({primaryColor:this.primaryColor,onProductAdd:(e,t)=>{this.onProductAdd(e,t),setTimeout(()=>this.hide(),800)},onClose:()=>{this.currentPicker=null,this.container&&this.container.classList.remove("ttp-carousel--picker-open")}});return this.currentPicker=n,this.container&&this.container.classList.add("ttp-carousel--picker-open"),void n.show(t)}var A=this.wheel.querySelectorAll(".ttp-carousel-card")[e],o=null==A?void 0:A.querySelector(".ttp-carousel-card__add-btn");o&&(o.textContent="✓ Added!",o.classList.add("ttp-carousel-card__add-btn--added"),o.disabled=!0);var i=en(en({},t),{},{selectedAmount:this.amounts[e],sellBy:this.sellByModes[e]});this.onProductAdd(A,i),setTimeout(()=>this.hide(),800)}}_refreshStepper(e){var t=this.sellByModes[e],n="weight"===t?.5:1,A=this.container.querySelector("#ttpCQty".concat(e)),o=this.container.querySelector('.ttp-carousel-minus[data-idx="'.concat(e,'"]'));A&&(A.textContent="weight"===t?"".concat(this.amounts[e].toFixed(1)," kg"):"".concat(this.amounts[e])),o&&(o.disabled=this.amounts[e]<=n)}_buildDots(){this.products.length<=1||this.products.forEach((e,t)=>{var n=document.createElement("div");n.className="ttp-carousel-dot",n.addEventListener("click",()=>this.goTo(t)),this.dotsEl.appendChild(n)})}_updateWheel(){var e=-this.current*this.anglePerCard;this.wheel.style.transform="translateZ(-".concat(this.radius,"px) rotateY(").concat(e,"deg)"),this.wheel.querySelectorAll(".ttp-carousel-card").forEach((t,n)=>{for(var A=n*this.anglePerCard+e;A>180;)A-=360;for(;A<-180;)A+=360;Math.abs(A)>90?(t.style.visibility="hidden",t.style.opacity="0"):(t.style.visibility="visible",t.style.opacity=this.products[n].inStock?"1":"0.7")}),this.dotsEl.querySelectorAll(".ttp-carousel-dot").forEach((e,t)=>e.classList.toggle("ttp-carousel-dot--active",t===this.current))}goTo(e){this.current=Math.max(0,Math.min(this.products.length-1,e)),this._updateWheel()}_setupDragEvents(){var e=this.container.querySelector(".ttp-carousel-area");e&&(e.addEventListener("touchstart",e=>{this.dragging=!0,this.startX=e.touches[0].clientX,this.swiped=!1},{passive:!0}),e.addEventListener("mousedown",e=>{this.dragging=!0,this.startX=e.clientX,this.swiped=!1}),document.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),document.addEventListener("touchend",this._boundTouchEnd),document.addEventListener("mousemove",this._boundMouseMove),document.addEventListener("mouseup",this._boundMouseUp))}_onTouchMove(e){if(this.dragging){var t=e.touches[0].clientX-this.startX;Math.abs(t)>this.dragThreshold&&(this.goTo(this.current+(t>0?-1:1)),this.startX=e.touches[0].clientX,this.swiped=!0)}}_onTouchEnd(){this.dragging=!1,this.swiped&&setTimeout(()=>{this.swiped=!1},400)}_onMouseMove(e){if(this.dragging){var t=e.clientX-this.startX;Math.abs(t)>this.dragThreshold&&(this.goTo(this.current+(t>0?-1:1)),this.startX=e.clientX,this.swiped=!0)}}_onMouseUp(){this.dragging=!1,this.swiped&&setTimeout(()=>{this.swiped=!1},400)}_removeEventListeners(){document.removeEventListener("touchmove",this._boundTouchMove),document.removeEventListener("touchend",this._boundTouchEnd),document.removeEventListener("mousemove",this._boundMouseMove),document.removeEventListener("mouseup",this._boundMouseUp)}_positionAboveMobileBar(){requestAnimationFrame(()=>{if(this.container){var e=document.getElementById("mobile-voice-call-bar-container");if(e){var t=e.getBoundingClientRect();this.container.style.bottom="".concat(window.innerHeight-t.top+8+50,"px")}}})}_hexToRgba(e,t){var n=parseInt(e.slice(1,3),16),A=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return"rgba(".concat(n,", ").concat(A,", ").concat(o,", ").concat(t,")")}_darkenHex(e,t){var n=Math.max(0,parseInt(e.slice(1,3),16)-t),A=Math.max(0,parseInt(e.slice(3,5),16)-t),o=Math.max(0,parseInt(e.slice(5,7),16)-t);return"#".concat(n.toString(16).padStart(2,"0")).concat(A.toString(16).padStart(2,"0")).concat(o.toString(16).padStart(2,"0"))}_injectStyles(){if(!document.getElementById("ttp-mobile-carousel-styles")){var e=document.createElement("style");e.id="ttp-mobile-carousel-styles",e.textContent=this._generateCSS(),document.head.appendChild(e)}}_generateCSS(){return"\n/* ═══════════════════════════════════════\n MOBILE PRODUCT CAROUSEL\n ═══════════════════════════════════════ */\n\n.ttp-mobile-carousel {\n position: fixed !important;\n bottom: 180px;\n left: 0 !important;\n right: 0 !important;\n top: 0 !important;\n z-index: 2147483646 !important;\n font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;\n animation: ttpCarouselIn 0.35s cubic-bezier(0.23, 1, 0.32, 1);\n -webkit-tap-highlight-color: transparent;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n padding-bottom: 16px;\n}\n\n.ttp-mobile-carousel > .ttp-carousel-header,\n.ttp-mobile-carousel > .ttp-carousel-area,\n.ttp-mobile-carousel > .ttp-carousel-dots {\n position: relative;\n z-index: 1;\n}\n\n.ttp-mobile-carousel::after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 420px;\n background: rgba(0, 0, 0, 0.2);\n backdrop-filter: blur(4px);\n -webkit-backdrop-filter: blur(4px);\n border-radius: 24px 24px 0 0;\n pointer-events: none;\n z-index: 0;\n}\n\n.ttp-mobile-carousel.ttp-carousel--hiding {\n animation: ttpCarouselOut 0.28s ease forwards;\n pointer-events: none;\n}\n\n/* Hide carousel when variation picker is open so products are not visible behind it */\n.ttp-mobile-carousel.ttp-carousel--picker-open {\n visibility: hidden !important;\n opacity: 0 !important;\n pointer-events: none !important;\n}\n\n@keyframes ttpCarouselIn {\n from { opacity: 0; transform: translateY(30px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes ttpCarouselOut {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(30px); }\n}\n\n/* ── Header ── */\n\n.ttp-carousel-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 24px 8px;\n flex-shrink: 0;\n}\n\n.ttp-carousel-title {\n font-size: 13px;\n font-weight: 600;\n color: #fff;\n text-shadow: 0 1px 4px rgba(0,0,0,0.4);\n}\n\n.ttp-carousel-close {\n width: 32px;\n height: 32px;\n border: none;\n border-radius: 0;\n background: none;\n color: #fff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: auto;\n padding: 0;\n opacity: 0.85;\n}\n.ttp-carousel-close:active {\n opacity: 1;\n}\n\n/* ── 3D Carousel Area ── */\n\n.ttp-carousel-area {\n position: relative;\n height: 300px;\n flex-shrink: 0;\n perspective: 800px;\n perspective-origin: 50% 55%;\n cursor: grab;\n user-select: none;\n -webkit-user-select: none;\n}\n.ttp-carousel-area:active {\n cursor: grabbing;\n}\n\n.ttp-carousel-wheel {\n position: absolute;\n width: 100%;\n height: 100%;\n transform-style: preserve-3d;\n transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);\n}\n\n/* ── Card ── */\n\n.ttp-carousel-card {\n position: absolute;\n width: 150px;\n height: 285px;\n left: 50%;\n top: 50%;\n margin-left: -75px;\n margin-top: -142px;\n background: #fff;\n border-radius: 18px;\n overflow: hidden;\n box-shadow: 0 8px 32px rgba(0,0,0,0.14);\n transform-style: preserve-3d;\n transition: visibility 0.3s, opacity 0.3s;\n display: flex;\n flex-direction: column;\n}\n\n.ttp-carousel-card--oos {\n opacity: 0.7;\n}\n\n/* Card Image */\n.ttp-carousel-card__image {\n width: 100%;\n height: 100px;\n background: linear-gradient(145deg, #f0f4ff, #e8ecf8);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n position: relative;\n overflow: hidden;\n}\n\n.ttp-carousel-card__image img {\n max-width: 80%;\n max-height: 80%;\n object-fit: contain;\n}\n\n.ttp-carousel-card__badge {\n position: absolute;\n top: 6px;\n right: 6px;\n background: #ef4444;\n color: #fff;\n font-size: 8px;\n font-weight: 700;\n padding: 2px 6px;\n border-radius: 4px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n\n/* Card Info */\n.ttp-carousel-card__info {\n padding: 8px 10px 4px;\n flex-shrink: 0;\n}\n\n.ttp-carousel-card__brand {\n font-size: 9px;\n font-weight: 500;\n color: #94a3b8;\n margin-bottom: 1px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n\n.ttp-carousel-card__name {\n font-size: 12px;\n font-weight: 600;\n color: #1e1b4b;\n line-height: 1.25;\n margin-bottom: 1px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n\n.ttp-carousel-card__unit {\n font-size: 9px;\n color: #64748b;\n margin-bottom: 3px;\n}\n\n.ttp-carousel-card__price {\n font-size: 16px;\n font-weight: 700;\n color: var(--ttp-carousel-primary, #3b82f6);\n}\n\n/* Card Actions */\n.ttp-carousel-card__actions {\n padding: 6px 10px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-top: auto;\n}\n\n/* Stepper */\n.ttp-carousel-card__stepper {\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--ttp-carousel-primary-light, rgba(59,130,246,0.12));\n border-radius: 10px;\n padding: 3px;\n}\n\n.ttp-carousel-card__qty-btn {\n width: 30px;\n height: 30px;\n border: none;\n background: transparent;\n color: var(--ttp-carousel-primary, #3b82f6);\n font-size: 17px;\n font-weight: 600;\n cursor: pointer;\n border-radius: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.15s;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 10;\n touch-action: manipulation;\n}\n.ttp-carousel-card__qty-btn:active:not(:disabled) {\n background: var(--ttp-carousel-primary-light, rgba(59,130,246,0.12));\n}\n.ttp-carousel-card__qty-btn:disabled {\n opacity: 0.3;\n cursor: default;\n}\n\n.ttp-carousel-card__qty-val {\n min-width: 40px;\n text-align: center;\n font-size: 14px;\n font-weight: 600;\n color: #1e1b4b;\n user-select: none;\n}\n\n/* Add Button */\n.ttp-carousel-card__add-btn {\n width: 100%;\n padding: 9px 12px;\n background: linear-gradient(135deg, var(--ttp-carousel-primary, #3b82f6), var(--ttp-carousel-primary-dark, #2563eb));\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n box-shadow: 0 4px 12px var(--ttp-carousel-primary-shadow, rgba(59,130,246,0.3));\n transition: transform 0.15s, box-shadow 0.15s;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 10;\n touch-action: manipulation;\n}\n.ttp-carousel-card__add-btn:active:not(:disabled) {\n transform: scale(0.97);\n}\n.ttp-carousel-card__add-btn:disabled {\n background: #94a3b8;\n cursor: default;\n box-shadow: none;\n}\n\n.ttp-carousel-card__add-btn--added {\n background: linear-gradient(135deg, #10b981, #059669) !important;\n box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;\n}\n\n.ttp-carousel-card__add-btn--update {\n background: linear-gradient(135deg, #f59e0b, #d97706);\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);\n}\n\n.ttp-carousel-card__add-btn--choose {\n background: linear-gradient(135deg, #f59e0b, #d97706);\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);\n}\n\n.ttp-products-animating .ttp-carousel-card__add-btn {\n opacity: 0.4;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n/* ── Dots ── */\n\n.ttp-carousel-dots {\n display: flex;\n justify-content: center;\n gap: 8px;\n padding: 8px 0 0;\n flex-shrink: 0;\n}\n\n.ttp-carousel-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: rgba(255,255,255,0.35);\n cursor: pointer;\n transition: all 0.3s;\n -webkit-tap-highlight-color: transparent;\n}\n\n.ttp-carousel-dot--active {\n width: 24px;\n border-radius: 4px;\n background: #fff;\n}\n\n/* ── Toast ── */\n\n.ttp-carousel-toast {\n position: fixed;\n left: 16px;\n right: 16px;\n bottom: 100px;\n z-index: 100001;\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n background: #fff;\n border-radius: 14px;\n box-shadow: 0 8px 32px rgba(0,0,0,0.15);\n animation: ttpCarouselToastIn 0.3s ease;\n pointer-events: auto;\n}\n\n.ttp-carousel-toast--hiding {\n animation: ttpCarouselOut 0.3s ease forwards;\n}\n\n@keyframes ttpCarouselToastIn {\n from { opacity: 0; transform: translateY(12px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n.ttp-carousel-toast__icon {\n width: 28px;\n height: 28px;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n font-weight: 700;\n flex-shrink: 0;\n}\n\n.ttp-carousel-toast__text {\n font-size: 13px;\n color: #1e293b;\n line-height: 1.3;\n}\n.ttp-carousel-toast__text strong {\n font-weight: 600;\n}\n.ttp-carousel-toast__cart {\n font-size: 11px;\n color: #64748b;\n margin-top: 2px;\n font-weight: 500;\n}\n"}}class An extends yt{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.primaryColor=e.primaryColor||"#3b82f6",this.onProductAdd=e.onProductAdd||(()=>{}),this.carousel=null,this.flyToCart=new Wt({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>this._triggerCartBump(),onRipple:()=>{}})}_getCartTarget(){var e=document.getElementById("mobile-voice-call-bar-container");if(!e)return null;var t=e.querySelector("[data-ttp-fly-target]");if(t){var n=t.getBoundingClientRect();if(n.width>0&&n.height>0)return t}var A=e.querySelector("#ttpFlyToCartTarget");if(A){var o=A.getBoundingClientRect();if(o.width>0&&o.height>0)return A}return null}_triggerCartBump(){}showProducts(e,t,n){this.carousel||(this.carousel=new nn({primaryColor:this.primaryColor,onProductAdd:(e,t)=>this._handleProductAddWithFly(e,t),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>{}})),this.carousel.show(e,t)}_handleProductAddWithFly(e,t){var n;this.flyToCart.isAnimating||(null===(n=this.carousel)||void 0===n||null===(n=n.container)||void 0===n||n.classList.add("ttp-products-animating"),this.flyToCart.triggerFly(e,t,()=>{var e;null===(e=this.carousel)||void 0===e||null===(e=e.container)||void 0===e||e.classList.remove("ttp-products-animating"),this.onProductAdd(t)},{preferClone:!1}))}hideProducts(){this.carousel&&this.carousel.hide()}onProductAdded(e,t){this.carousel&&this.carousel.container&&this.carousel.showToast(e.name,t),this._updateMobileCartRow(t)}updateCart(e){this._updateMobileCartRow(e)}destroy(){this.flyToCart&&this.flyToCart.destroy(),this.carousel&&(this.carousel.destroy(),this.carousel=null)}_updateMobileCartRow(e){var{itemCount:t,total:n,currency:A}=e,o=document.getElementById("mobileCartRow"),i=document.getElementById("mobileCartText");if(o&&i)if(t<=0)o.style.display="none";else{var r="".concat(t," item").concat(1!==t?"s":"");i.textContent="".concat(r," · ").concat(A).concat(n.toFixed(2)),o.style.display="flex"}}}class on{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.shadowRoot=e.shadowRoot,this.primaryColor=e.primaryColor||"#3b82f6",this.onProductSelected=e.onProductSelected||(()=>{}),this.onProductDeselected=e.onProductDeselected||(()=>{}),this.cartItemCount=0,this.cartTotal=0,this.currencySymbol="$",this._presenter=null}get presenter(){return this._presenter||(this._presenter=this._createPresenter()),this._presenter}_createPresenter(){return this._isMobileCall()?new An({primaryColor:this.primaryColor,onProductAdd:e=>this._handleProductAdd(e)}):new qt({shadowRoot:this.shadowRoot,primaryColor:this.primaryColor,onProductAdd:e=>this._handleProductAdd(e),onProductUndo:e=>this.onProductDeselected(e)})}_isMobileCall(){return!!document.getElementById("mobile-voice-call-bar-container")}_resolveCurrency(e){return"ILS"===e?"₪":"$"}_buildCartInfo(){return{itemCount:this.cartItemCount,total:this.cartTotal,currency:this.currencySymbol}}handleShowProducts(e){var{products:t,title:n,layout:A}=e;t&&0!==t.length?(this.currencySymbol=this._resolveCurrency(t[0].currency),this.presenter.showProducts(t,n,A)):console.warn("[EcommerceManager] show_products with no products")}handleCartUpdated(e){var{product:t,action:n,cartTotal:A,cartItemCount:o}=e;if(void 0!==A&&void 0!==o){var i=this._resolveCurrency(e.currency||("₪"===this.currencySymbol?"ILS":"USD"));this.cartItemCount=o,this.cartTotal=A,this.currencySymbol=i,this.presenter.updateCart(this._buildCartInfo())}"added"===n&&t&&this.presenter.onProductAdded(t,this._buildCartInfo())}handleMessage(e){var t=e.t||e.type;"show_products"===t?this.handleShowProducts(e):"cart_updated"===t&&this.handleCartUpdated(e)}_handleProductAdd(e){var t=e.price||0,n=e.selectedAmount||1,A=this._resolveCurrency(e.currency);this.cartItemCount+=1,this.cartTotal+=t*n,this.currencySymbol=A,this.presenter.onProductAdded(e,this._buildCartInfo()),this.onProductSelected(e)}hideProducts(){this.presenter.hideProducts()}destroy(){this._presenter&&(this._presenter.destroy(),this._presenter=null)}}var rn="ttp-gallery-handler-styles";function an(e){var t=null,n=null,A=[],o=0,i=null,r=!1,a=[],s=[],c=[],l=null,d=null,p=null,u=null,h=null,g=!1;function m(){try{var t,n=null===(t=e.shadowRoot)||void 0===t?void 0:t.host;n&&(n.style.zIndex=h||"",h=null),g&&!e.isOpen&&"function"==typeof e.togglePanel&&e.togglePanel(),g=!1}catch(e){}}function f(e){var t;0!==A.length&&(o=(e%A.length+A.length)%A.length,a.forEach((e,t)=>e.classList.toggle("ttp-gh-img-active",t===o)),s.forEach((e,t)=>e.classList.toggle("ttp-gh-thumb-active",t===o)),c.forEach((e,t)=>e.classList.toggle("ttp-gh-dot-active",t===o)),l&&(l.textContent=(null===(t=A[o])||void 0===t?void 0:t.caption)||""),d&&(d.textContent="".concat(o+1," / ").concat(A.length)))}function v(){A.length<2||(B(),i=setInterval(()=>f(o+1),4e3))}function B(){i&&(clearInterval(i),i=null)}function w(){B(),v()}function b(){if(!r&&t){r=!0,B(),t.classList.remove("ttp-gh-visible");var e=t;setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e),e._escHandler&&document.removeEventListener("keydown",e._escHandler)},320),t=null,n=null,a=[],s=[],c=[],m()}}return{handleShowMedia:function(i){t&&(B(),t&&(t._escHandler&&document.removeEventListener("keydown",t._escHandler),t.parentNode&&t.parentNode.removeChild(t),t=null,n=null,a=[],s=[],c=[]),m()),r=!1,function(){if(!document.getElementById(rn)){var e=document.createElement("style");e.id=rn,e.textContent="\n/* ── Backdrop ── */\n.ttp-gh-backdrop {\n position: fixed;\n inset: 0;\n z-index: 2147483640;\n background: rgba(0, 0, 0, 0);\n backdrop-filter: blur(0px);\n -webkit-backdrop-filter: blur(0px);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n box-sizing: border-box;\n transition: background 0.3s ease, backdrop-filter 0.3s ease;\n pointer-events: none;\n}\n.ttp-gh-backdrop.ttp-gh-visible {\n background: rgba(0, 0, 0, 0.45);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n pointer-events: all;\n}\n\n/* ── Card ── */\n.ttp-gh-card {\n position: relative;\n width: 80vw;\n max-width: 680px;\n background: #fff;\n border-radius: 20px;\n overflow: hidden;\n box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.10);\n display: flex;\n flex-direction: column;\n opacity: 0;\n transform: scale(0.94) translateY(10px);\n transition: opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1),\n transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);\n max-height: calc(100vh - 32px);\n}\n.ttp-gh-backdrop.ttp-gh-visible .ttp-gh-card {\n opacity: 1;\n transform: scale(1) translateY(0);\n}\n\n/* ── Image area ── */\n.ttp-gh-img-wrap {\n position: relative;\n width: 100%;\n padding-top: 56.25%; /* 16:9 */\n background: #f0f0ee;\n overflow: hidden;\n flex-shrink: 0;\n}\n.ttp-gh-img {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n opacity: 0;\n transition: opacity 0.5s ease, transform 0.5s ease;\n transform: scale(1.03);\n z-index: 1;\n}\n.ttp-gh-img.ttp-gh-img-active {\n opacity: 1;\n transform: scale(1);\n}\n.ttp-gh-img-placeholder {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #f0f0ee;\n z-index: 0;\n}\n\n/* Gradient + caption */\n.ttp-gh-img-grad {\n position: absolute;\n bottom: 0; left: 0; right: 0;\n height: 50%;\n background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.42));\n pointer-events: none;\n z-index: 2;\n}\n.ttp-gh-caption {\n position: absolute;\n bottom: 12px; left: 16px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 13px;\n font-weight: 500;\n color: rgba(255,255,255,0.92);\n pointer-events: none;\n letter-spacing: 0.01em;\n z-index: 3;\n}\n\n/* Counter */\n.ttp-gh-counter {\n position: absolute;\n top: 12px; right: 12px;\n background: rgba(0,0,0,0.32);\n color: #fff;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 11px;\n font-weight: 500;\n padding: 3px 10px;\n border-radius: 20px;\n letter-spacing: 0.05em;\n pointer-events: none;\n z-index: 3;\n}\n\n/* Close button */\n.ttp-gh-close {\n position: absolute;\n top: 12px; left: 12px;\n width: 36px; height: 36px;\n padding: 0;\n background: rgba(0,0,0,0.55);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n border: none;\n border-radius: 50%;\n color: #fff;\n cursor: pointer;\n display: flex; align-items: center; justify-content: center;\n transition: background 0.15s;\n box-shadow: 0 2px 8px rgba(0,0,0,0.2);\n z-index: 4;\n}\n.ttp-gh-close:hover { background: rgba(0,0,0,0.7); }\n\n/* Prev / next arrows */\n.ttp-gh-nav {\n position: absolute;\n top: 50%; transform: translateY(-50%);\n left: 12px; right: 12px;\n display: flex; justify-content: space-between;\n pointer-events: none;\n z-index: 4;\n}\n.ttp-gh-arr {\n width: 42px; height: 42px;\n padding: 0;\n background: rgba(255,255,255,0.95);\n backdrop-filter: blur(6px);\n -webkit-backdrop-filter: blur(6px);\n border: none; border-radius: 50%;\n color: #222;\n cursor: pointer;\n display: flex; align-items: center; justify-content: center;\n pointer-events: all;\n transition: background 0.15s, transform 0.15s;\n box-shadow: 0 2px 10px rgba(0,0,0,0.18);\n}\n.ttp-gh-arr:hover { background: #fff; transform: scale(1.06); }\n.ttp-gh-arr:active { transform: scale(0.94); }\n\n/* ── Body ── */\n.ttp-gh-body {\n padding: 16px 20px 12px;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 12px;\n flex-shrink: 0;\n}\n.ttp-gh-room-name {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 17px;\n font-weight: 500;\n color: #1a1a1a;\n line-height: 1.2;\n}\n.ttp-gh-price-wrap { text-align: right; flex-shrink: 0; }\n.ttp-gh-price-lbl {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 10px;\n color: #aaa;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n}\n.ttp-gh-price {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 22px;\n font-weight: 500;\n color: #1a1a1a;\n line-height: 1.1;\n}\n\n/* ── Thumbnails ── */\n.ttp-gh-thumbs {\n display: flex;\n gap: 7px;\n padding: 0 20px 12px;\n overflow-x: auto;\n scrollbar-width: none;\n flex-shrink: 0;\n}\n.ttp-gh-thumbs::-webkit-scrollbar { display: none; }\n.ttp-gh-thumb {\n flex-shrink: 0;\n width: 58px; height: 40px;\n border-radius: 8px;\n overflow: hidden;\n cursor: pointer;\n border: 2px solid transparent;\n opacity: 0.42;\n transition: opacity 0.2s, border-color 0.2s, transform 0.15s;\n background: #e8e8e6;\n}\n.ttp-gh-thumb img {\n width: 100%; height: 100%; object-fit: cover; display: block;\n}\n.ttp-gh-thumb.ttp-gh-thumb-active {\n opacity: 1;\n border-color: #1a1a1a;\n}\n.ttp-gh-thumb:hover:not(.ttp-gh-thumb-active) {\n opacity: 0.72;\n transform: translateY(-1px);\n}\n\n/* ── Dots ── */\n.ttp-gh-dots {\n display: flex;\n gap: 5px;\n align-items: center;\n padding: 0 20px 4px;\n flex-shrink: 0;\n}\n.ttp-gh-dot {\n height: 2.5px;\n border-radius: 2px;\n background: #ddd;\n cursor: pointer;\n width: 16px;\n transition: all 0.25s ease;\n}\n.ttp-gh-dot.ttp-gh-dot-active {\n background: #1a1a1a;\n width: 28px;\n}\n\n/* ── Footer ── */\n.ttp-gh-footer {\n padding: 8px 20px 20px;\n display: flex;\n gap: 10px;\n flex-shrink: 0;\n}\n.ttp-gh-btn-book {\n flex: 1;\n padding: 13px 20px;\n background: #1a1a1a;\n color: #fff;\n border: none;\n border-radius: 12px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n letter-spacing: 0.02em;\n transition: background 0.15s, transform 0.1s;\n}\n.ttp-gh-btn-book:hover { background: #2d2d2d; }\n.ttp-gh-btn-book:active { transform: scale(0.98); }\n\n/* ── Mobile ── */\n@media (max-width: 600px) {\n .ttp-gh-backdrop { padding: 12px; align-items: center; }\n .ttp-gh-card {\n width: calc(100vw - 24px);\n max-width: none;\n max-height: calc(100vh - 24px);\n border-radius: 18px;\n }\n .ttp-gh-img-wrap { padding-top: 62%; }\n .ttp-gh-room-name { font-size: 15px; }\n .ttp-gh-price { font-size: 18px; }\n .ttp-gh-thumb { width: 48px; height: 34px; }\n .ttp-gh-btn-book { padding: 12px 16px; font-size: 13px; }\n}\n",document.head.appendChild(e)}}(),(t=document.createElement("div")).className="ttp-gh-backdrop",t.addEventListener("click",b),t.appendChild(function(e){var t;A=e.images||[],o=0,a=[],s=[],c=[],(n=document.createElement("div")).className="ttp-gh-card",n.addEventListener("click",e=>e.stopPropagation());var i=document.createElement("div");i.className="ttp-gh-img-wrap";var r=document.createElement("div");r.className="ttp-gh-img-placeholder",r.innerHTML='<span style="font-size:32px;color:#ccc;line-height:1;">🖼</span>',i.appendChild(r),A.forEach((e,t)=>{var n=document.createElement("img");n.className="ttp-gh-img"+(0===t?" ttp-gh-img-active":""),n.src=e.url,n.alt=e.caption||"",n.draggable=!1,n.onload=()=>{r.style.display="none"},i.appendChild(n),a.push(n)});var h=document.createElement("div");h.className="ttp-gh-img-grad",i.appendChild(h),(l=document.createElement("div")).className="ttp-gh-caption",l.textContent=(null===(t=A[0])||void 0===t?void 0:t.caption)||"",i.appendChild(l),(d=document.createElement("div")).className="ttp-gh-counter",d.textContent=A.length>1?"1 / ".concat(A.length):"",A.length<=1&&(d.style.display="none"),i.appendChild(d);var g=document.createElement("button");if(g.className="ttp-gh-close",g.setAttribute("aria-label","Close gallery"),g.innerHTML='<span style="display:block;position:relative;width:16px;height:16px;"><span style="position:absolute;top:50%;left:50%;width:16px;height:2px;background:#fff;border-radius:1px;transform:translate(-50%,-50%) rotate(45deg);"></span><span style="position:absolute;top:50%;left:50%;width:16px;height:2px;background:#fff;border-radius:1px;transform:translate(-50%,-50%) rotate(-45deg);"></span></span>',g.addEventListener("click",b),i.appendChild(g),A.length>1){var m=document.createElement("div");m.className="ttp-gh-nav";var v=document.createElement("button");v.className="ttp-gh-arr",v.setAttribute("aria-label","Previous"),v.innerHTML='<span style="display:block;width:12px;height:12px;border-left:3px solid #222;border-bottom:3px solid #222;transform:rotate(45deg);margin-left:4px;"></span>',v.addEventListener("click",()=>{f(o-1),w()});var B=document.createElement("button");B.className="ttp-gh-arr",B.setAttribute("aria-label","Next"),B.innerHTML='<span style="display:block;width:12px;height:12px;border-right:3px solid #222;border-top:3px solid #222;transform:rotate(45deg);margin-right:4px;"></span>',B.addEventListener("click",()=>{f(o+1),w()}),m.appendChild(v),m.appendChild(B),i.appendChild(m)}n.appendChild(i);var y=document.createElement("div");if(y.className="ttp-gh-body",(p=document.createElement("div")).className="ttp-gh-room-name",p.textContent=e.title||"",y.appendChild(p),e.price){var x=document.createElement("div");x.className="ttp-gh-price-wrap";var C=document.createElement("div");C.className="ttp-gh-price-lbl",C.textContent="per night",(u=document.createElement("div")).className="ttp-gh-price",u.textContent=e.price,x.appendChild(C),x.appendChild(u),y.appendChild(x)}if(n.appendChild(y),A.length>1){var Q=document.createElement("div");Q.className="ttp-gh-thumbs",A.forEach((e,t)=>{var n=document.createElement("div");n.className="ttp-gh-thumb"+(0===t?" ttp-gh-thumb-active":"");var A=document.createElement("img");A.src=e.url,A.alt=e.caption||"",n.appendChild(A),n.addEventListener("click",()=>{f(t),w()}),Q.appendChild(n),s.push(n)}),n.appendChild(Q);var F=document.createElement("div");F.className="ttp-gh-dots",A.forEach((e,t)=>{var n=document.createElement("div");n.className="ttp-gh-dot"+(0===t?" ttp-gh-dot-active":""),n.addEventListener("click",()=>{f(t),w()}),F.appendChild(n),c.push(n)}),n.appendChild(F)}var U=document.createElement("div");U.className="ttp-gh-footer";var S=document.createElement("button");return S.className="ttp-gh-btn-book",S.textContent="Book this room",S.addEventListener("click",b),U.appendChild(S),n.appendChild(U),function(e){if(!(A.length<=1)){var t=0;e.addEventListener("touchstart",e=>{t=e.touches[0].clientX},{passive:!0}),e.addEventListener("touchend",e=>{var n=e.changedTouches[0].clientX-t;Math.abs(n)>45&&(f(o+(n>0?-1:1)),w())});var n=!1;e.addEventListener("mousedown",e=>{n=!0,t=e.clientX}),e.addEventListener("mouseup",e=>{if(n){n=!1;var A=e.clientX-t;Math.abs(A)>45&&(f(o+(A>0?-1:1)),w())}})}}(n),n}(i)),document.body.appendChild(t),requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.classList.add("ttp-gh-visible"),v()})}),t._escHandler=e=>{"Escape"===e.key&&b()},document.addEventListener("keydown",t._escHandler),function(){try{var t;(g=!!e.isOpen)&&"function"==typeof e.togglePanel&&e.togglePanel();var n=null===(t=e.shadowRoot)||void 0===t?void 0:t.host;n&&(h=n.style.zIndex||null,n.style.zIndex=String(2147483639))}catch(e){}}()},dismissGallery:b}}function sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function cn(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ln(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function dn(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){ln(i,A,o,r,a,"next",e)}function a(e){ln(i,A,o,r,a,"throw",e)}r(void 0)})}}function pn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function un(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pn(Object(n),!0).forEach(function(t){hn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function hn(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class gn{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.room=e,this.compact=t.compact||!1,this.primaryColor=t.primaryColor||"#2563eb",this.onBook=t.onBook||(()=>{}),this.element=null,this.nights=e.nights||1}render(){var e=document.createElement("div");e.className=this.compact?"ttp-product-compact":"ttp-product-card";var t=this.room,n="ILS"===t.currency?"₪":"EUR"===t.currency?"€":"$";if(this.compact)e.innerHTML='\n <div class="ttp-product-image-sm">\n <img src="'.concat(t.imageUrl,'" alt="').concat(t.name,'" onerror="this.style.display=\'none\'" />\n </div>\n <div class="ttp-product-info">\n <div class="ttp-product-name">').concat(t.name,'</div>\n <div class="ttp-product-meta">').concat(t.subtitle||"",'</div>\n </div>\n <div class="ttp-product-action">\n <div class="ttp-product-price">').concat(n).concat(t.pricePerNight,'<span class="ttp-room-per-night">/night</span></div>\n ').concat(!1!==t.available?'<button class="ttp-add-btn">Book</button>':'<span class="ttp-out-of-stock">Unavailable</span>','\n <div class="ttp-stepper" data-sell-by="nights">\n <button class="ttp-stepper-btn ttp-stepper-minus" type="button">−</button>\n <span class="ttp-stepper-value">').concat(this.nights," night").concat(1!==this.nights?"s":"",'</span>\n <button class="ttp-stepper-btn ttp-stepper-plus" type="button">+</button>\n </div>\n </div>\n ');else{var A=(t.pricePerNight*this.nights).toFixed(0);e.innerHTML='\n <div class="ttp-product-image">\n <img src="'.concat(t.imageUrl,'" alt="').concat(t.name,'" onerror="this.style.display=\'none\'" />\n ').concat(!1===t.available?'<div class="ttp-stock-badge">Unavailable</div>':"",'\n </div>\n <div class="ttp-product-details">\n <div class="ttp-product-name">').concat(t.name,'</div>\n <div class="ttp-product-meta">').concat(n).concat(t.pricePerNight,'/night</div>\n <div class="ttp-product-footer">\n <div class="ttp-stepper" data-sell-by="nights">\n <button class="ttp-stepper-btn ttp-stepper-minus" type="button">−</button>\n <span class="ttp-stepper-value">').concat(this.nights,'n</span>\n <button class="ttp-stepper-btn ttp-stepper-plus" type="button">+</button>\n </div>\n ').concat(!1!==t.available?'<button class="ttp-add-btn">Book · '.concat(n).concat(A,"</button>"):'<span class="ttp-out-of-stock">Unavailable</span>',"\n </div>\n </div>\n ")}return this._bindEvents(e,n),this.element=e,e}_bindEvents(e,t){var n=e.querySelector(".ttp-stepper-minus"),A=e.querySelector(".ttp-stepper-plus"),o=e.querySelector(".ttp-stepper-value"),i=e.querySelector(".ttp-add-btn");n&&A&&o&&(n.addEventListener("click",e=>{e.stopPropagation(),this.nights>1&&(this.nights--,this._updateDisplay(o,n,i,t))}),A.addEventListener("click",e=>{e.stopPropagation(),this.nights<30&&(this.nights++,this._updateDisplay(o,n,i,t))}),n.disabled=this.nights<=1,n.classList.toggle("ttp-stepper-disabled",this.nights<=1)),i&&i.addEventListener("click",t=>{t.stopPropagation(),i.textContent="✓ Booked!",i.classList.add("ttp-added"),i.disabled=!0,this.onBook(e,un(un({},this.room),{},{selectedNights:this.nights}))})}_updateDisplay(e,t,n,A){if(e.textContent=this.compact?"".concat(this.nights," night").concat(1!==this.nights?"s":""):"".concat(this.nights,"n"),t.disabled=this.nights<=1,t.classList.toggle("ttp-stepper-disabled",this.nights<=1),n&&!n.disabled){var o=(this.room.pricePerNight*this.nights).toFixed(0);n.textContent="Book · ".concat(A).concat(o)}}}class mn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.primaryColor=e.primaryColor||"#2563eb",this.onRoomBook=e.onRoomBook||(()=>{}),this.onClose=e.onClose||(()=>{}),this.element=null,this._cards=[]}show(e,t){if(this.hide(),!e||0===e.length)return null;var n=document.createElement("div");n.className="picker-relative";var A=document.createElement("div");A.className="ttp-product-picker";var o=document.createElement("div");o.className="ttp-picker-header",o.innerHTML='\n <span class="ttp-picker-title">'.concat(t||"Available Rooms",'</span>\n <button class="ttp-picker-close" aria-label="Close">×</button>\n '),o.querySelector(".ttp-picker-close").addEventListener("click",()=>{this.hide(),this.onClose()}),A.appendChild(o);var i=document.createElement("div");return i.className="ttp-products-horizontal",this._cards=[],e.forEach(e=>{var t=new gn(e,{compact:!1,primaryColor:this.primaryColor,onBook:(e,t)=>this.onRoomBook(e,t)});i.appendChild(t.render()),this._cards.push(t)}),A.appendChild(i),n.appendChild(A),this.element=n,n}hide(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this._cards=[]}destroy(){this.hide()}}class fn{constructor(){this.element=null,this.booking=null}render(){var e=document.createElement("div");return e.className="ttp-booking-summary ttp-booking-empty",e.style.display="none",e.innerHTML='\n <div class="ttp-booking-info">\n <span class="ttp-booking-icon">🏨</span>\n <span class="ttp-booking-room">No booking</span>\n <span class="ttp-booking-sep">·</span>\n <span class="ttp-booking-stay"></span>\n <span class="ttp-booking-sep">·</span>\n <span class="ttp-booking-total"></span>\n </div>\n ',this.element=e,e}update(e){if(this.booking=e,this.element){if(!e||!e.roomName)return this.element.style.setProperty("display","none","important"),void this.element.classList.add("ttp-booking-empty");this.element.style.setProperty("display","flex","important"),this.element.classList.remove("ttp-booking-empty");var t="ILS"===e.currency?"₪":"EUR"===e.currency?"€":"$",n=e.nights||1,A=e.guests||1,o=e.totalPrice||e.pricePerNight*n;this.element.querySelector(".ttp-booking-room").textContent=e.roomName,this.element.querySelector(".ttp-booking-stay").textContent="".concat(n," night").concat(1!==n?"s":""," · ").concat(A," guest").concat(1!==A?"s":""),this.element.querySelector(".ttp-booking-total").textContent="".concat(t).concat(o.toFixed(0))}}hide(){this.element&&(this.element.style.setProperty("display","none","important"),this.element.classList.add("ttp-booking-empty")),this.booking=null}static generateCSS(){return"\n/* ═══════════════════════════════════════\n BOOKING SUMMARY\n ═══════════════════════════════════════ */\n\n.ttp-booking-summary {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n background: linear-gradient(135deg, #eff6ff, #dbeafe);\n border-radius: 10px;\n margin: 6px 8px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.ttp-booking-info {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: #1e40af;\n font-weight: 500;\n flex-wrap: wrap;\n}\n\n.ttp-booking-icon {\n font-size: 14px;\n flex-shrink: 0;\n}\n\n.ttp-booking-room {\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 120px;\n}\n\n.ttp-booking-sep {\n color: #93c5fd;\n}\n\n.ttp-booking-stay {\n white-space: nowrap;\n}\n\n.ttp-booking-total {\n font-weight: 700;\n color: #1d4ed8;\n}\n\n.ttp-booking-empty {\n display: none !important;\n}\n"}}class vn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.shadowRoot=e.shadowRoot,this.primaryColor=e.primaryColor||"#2563eb",this.onRoomBook=e.onRoomBook||(()=>{}),this.picker=new mn({primaryColor:this.primaryColor,onRoomBook:(e,t)=>this._handleRoomBook(e,t),onClose:()=>this._handlePickerClose()}),this.bookingSummary=new fn,this.container=document.createElement("div"),this.container.id="ttpHotelsArea",this.container.className="ttp-hotels-area",this.voiceActiveState=null,this.isAttached=!1}_handleRoomBook(e,t){this.onRoomBook(t),setTimeout(()=>this.hideRooms(),800)}showRooms(e,t){this._ensureReady(),this._switchToCompactMode(),this._setContainerMode("rooms"),this.picker.hide();var n=this.picker.show(e,t);n&&this.container.insertBefore(n,this.container.firstChild),this._expandPanelToFit(e.length)}hideRooms(){this.picker.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this._setContainerMode("summary")}updateBooking(e){this._ensureReady(),e&&this.bookingSummary.update(e)}destroy(){var e,t;this.picker.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-rooms-visible"),null!==(e=this.bookingSummary.element)&&void 0!==e&&e.parentNode&&this.bookingSummary.element.parentNode.removeChild(this.bookingSummary.element),null!==(t=this.container)&&void 0!==t&&t.parentNode&&this.container.parentNode.removeChild(this.container),this.isAttached=!1}_ensureReady(){this.isAttached||(this._injectStyles(),this._attachToDOM())}_injectStyles(){if(this.shadowRoot&&!this.shadowRoot.querySelector("[data-ttp-hotels]")){var e=document.createElement("style");e.setAttribute("data-ttp-hotels",""),e.textContent='\n\n/* ═══════════════════════════════════════\n ECOMMERCE AREA\n ═══════════════════════════════════════ */\n\n\n/*\n * When products are visible, expand the panel dynamically.\n * Actual height is set via inline style by EcommerceManager._expandPanelToFit().\n * When the class is removed, the panel returns to its CSS-defined default.\n */\n#text-chat-panel.ttp-panel-expanded {\n transition: height 0.25s ease;\n}\n\n/*\n * Layout overrides when ecommerce layer is active.\n * voiceActiveState is a flex column: [voice-controls] [ecommerce] [conversation].\n * Ecommerce area fills the middle and scrolls; conversation panel stays at bottom.\n */\n#voiceActiveState {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow: hidden !important;\n}\n\n.desktop-voice-section {\n flex-shrink: 1 !important;\n}\n\n/* Conversation + input always stick to bottom; ecommerce area above grows to fill. */\n.desktop-conversation-panel {\n flex: 0 0 auto !important;\n margin-top: auto !important;\n display: flex !important;\n flex-direction: column !important;\n}\n\n.desktop-conversation-panel .live-transcript-collapsed {\n flex: 0 0 auto !important;\n min-height: 40px !important;\n overflow: hidden !important;\n}\n\n.desktop-conversation-panel .voice-text-input-area {\n margin-top: auto !important;\n padding: 3px 16px !important;\n}\n\n.desktop-conversation-panel .voice-input-hint {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-voice-section {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .compact-voice-section {\n display: flex !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-conversation-panel {\n flex: 0 0 auto !important;\n}\n\n#voiceActiveState.ttp-products-visible .conversation-history {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .live-transcript-collapsed {\n flex: 0 0 auto !important;\n}\n\n.voice-text-input-area {\n flex-shrink: 0 !important;\n}\n\n.conversation-history {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow-y: auto !important;\n}\n\n.ttp-ecommerce-area {\n display: flex !important;\n flex-direction: column !important;\n width: 100%;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n position: relative !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT PICKER\n ═══════════════════════════════════════ */\n\n.ttp-product-picker {\n background: #fff;\n border-radius: 14px;\n border: 1px solid #e5e7eb;\n box-shadow: 0 6px 24px rgba(0,0,0,0.08);\n margin: 8px 10px;\n overflow-x: hidden !important;\n overflow-y: auto !important;\n animation: ttpSlideUp 0.25s ease;\n display: flex !important;\n flex-direction: column;\n flex: 1;\n min-height: 0 !important;\n}\n\n@keyframes ttpSlideUp {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n.ttp-picker-header {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 10px 14px;\n border-bottom: 1px solid #f1f5f9;\n flex-shrink: 0;\n}\n\n.ttp-picker-title {\n font-size: 12px;\n font-weight: 600;\n color: #64748b;\n}\n\n.ttp-picker-close {\n background: none;\n border: none;\n cursor: pointer;\n color: #94a3b8;\n font-size: 14px;\n padding: 2px 6px;\n border-radius: 4px;\n}\n.ttp-picker-close:hover {\n background: #f1f5f9;\n color: #475569;\n}\n\n/* Horizontal card layout */\n.ttp-products-horizontal {\n display: flex !important;\n align-items: flex-start;\n flex-shrink: 0;\n gap: 10px;\n padding: 12px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: thin;\n}\n.ttp-products-horizontal::-webkit-scrollbar { height: 4px; }\n.ttp-products-horizontal::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }\n\n/* Vertical list layout */\n.ttp-products-vertical {\n padding: 8px 12px;\n overflow-y: auto !important;\n display: flex !important;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n min-height: 0 !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT CARD (horizontal)\n ═══════════════════════════════════════ */\n\n.ttp-product-card {\n width: 140px !important;\n flex-shrink: 0 !important;\n background: #fff;\n border-radius: 12px;\n border: 1px solid #e5e7eb;\n overflow: hidden;\n transition: border-color 0.15s;\n}\n.ttp-product-card:hover { border-color: #3b82f6; }\n\n.ttp-product-image {\n height: 85px !important;\n background: #f8fafc;\n display: flex !important;\n align-items: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n}\n.ttp-product-image img {\n max-width: 90%;\n max-height: 75px;\n object-fit: contain;\n}\n\n.ttp-stock-badge {\n position: absolute;\n top: 4px; right: 4px;\n background: #fef2f2;\n color: #ef4444;\n font-size: 9px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n}\n\n.ttp-product-details {\n padding: 8px 10px 14px;\n}\n\n.ttp-product-name {\n font-size: 12px;\n font-weight: 600;\n color: #1e293b;\n line-height: 1.3;\n min-height: 30px;\n}\n\n.ttp-product-page-link {\n display: inline-flex;\n align-items: center;\n margin-left: 5px;\n font-size: 10px;\n color: #3b82f6;\n text-decoration: none;\n opacity: 0.7;\n vertical-align: middle;\n}\n.ttp-product-page-link:hover { opacity: 1; text-decoration: underline; }\n\n.ttp-product-meta {\n font-size: 10px;\n color: #94a3b8;\n margin-top: 2px;\n}\n\n.ttp-product-footer {\n display: flex !important;\n align-items: center;\n justify-content: space-between;\n margin-top: 6px;\n}\n\n.ttp-product-price {\n font-size: 14px;\n font-weight: 700;\n color: #1e293b;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT COMPACT (list view)\n ═══════════════════════════════════════ */\n\n.ttp-product-compact {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n background: #fff;\n border-radius: 10px;\n border: 1px solid #e5e7eb;\n transition: border-color 0.15s;\n}\n.ttp-product-compact:hover { border-color: #3b82f6; }\n\n.ttp-product-image-sm {\n width: 40px !important; height: 40px !important;\n border-radius: 8px;\n background: #f8fafc;\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n}\n.ttp-product-image-sm img {\n max-width: 36px;\n max-height: 36px;\n object-fit: contain;\n}\n\n.ttp-product-compact .ttp-product-info {\n flex: 1;\n min-width: 0;\n}\n.ttp-product-compact .ttp-product-name {\n min-height: auto;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ttp-product-compact .ttp-product-action {\n text-align: right;\n flex-shrink: 0 !important;\n}\n.ttp-product-compact .ttp-product-price {\n font-size: 13px;\n}\n\n.ttp-out-of-stock {\n font-size: 10px;\n color: #ef4444;\n font-weight: 500;\n}\n\n/* ═══════════════════════════════════════\n ADD BUTTON\n ═══════════════════════════════════════ */\n\n.ttp-add-btn {\n padding: 4px 14px;\n border-radius: 8px;\n border: none;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n background: #3b82f6;\n color: #fff;\n transition: all 0.15s;\n}\n.ttp-add-btn:hover { background: #2563eb; }\n.ttp-add-btn:active { transform: scale(0.95); }\n.ttp-add-btn.ttp-added { background: #10b981 !important; }\n.ttp-add-btn:disabled { cursor: default; }\n.ttp-add-btn.ttp-update-btn { background: #f59e0b; }\n.ttp-add-btn.ttp-update-btn:hover { background: #d97706; }\n\n.ttp-products-animating .ttp-add-btn {\n opacity: 0.4;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n/* ═══════════════════════════════════════\n CART TOAST\n ═══════════════════════════════════════ */\n\n/* Toast replaces waveform in desktop voice section */\n.ttp-cart-toast {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n margin: 8px 12px;\n background: #f0fdf4;\n border-radius: 12px;\n border: 1px solid #bbf7d0;\n animation: ttpToastIn 0.25s ease;\n flex-shrink: 0;\n box-shadow: 0 2px 8px rgba(0,0,0,0.08);\n}\n\n@keyframes ttpToastIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n.ttp-cart-toast.ttp-toast-hiding {\n animation: ttpSlideDown 0.3s ease forwards;\n}\n\n@keyframes ttpSlideDown {\n to { opacity: 0; transform: translateY(-8px); height: 0; padding: 0; margin: 0; overflow: hidden; }\n}\n\n.ttp-toast-icon {\n width: 24px !important; height: 24px !important;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex !important;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: 700;\n flex-shrink: 0;\n}\n\n.ttp-toast-content { flex: 1; min-width: 0; }\n.ttp-toast-title { font-size: 12px; font-weight: 600; color: #166534; }\n.ttp-toast-product {\n font-size: 11px;\n color: #15803d;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-toast-undo {\n background: none;\n border: 1px solid #86efac;\n border-radius: 6px;\n padding: 3px 8px;\n font-size: 10px;\n color: #15803d;\n cursor: pointer;\n font-weight: 600;\n flex-shrink: 0;\n}\n.ttp-toast-undo:hover { background: #dcfce7; }\n\n/* Fly-to-cart desktop target (when cart summary is hidden) */\n.ttp-desktop-fly-target {\n position: absolute;\n bottom: 12px;\n right: 80px;\n width: 24px;\n height: 24px;\n pointer-events: none;\n}\n\n/* Fly-to-cart ripple effect */\n.ttp-fly-ripple {\n position: absolute;\n left: 10px;\n top: 50%;\n width: 30px;\n height: 30px;\n margin-top: -15px;\n border-radius: 50%;\n border: 2px solid rgba(74,222,128,0.7);\n animation: ttp-ripple-expand 0.6s ease-out forwards;\n pointer-events: none;\n}\n\n@keyframes ttp-ripple-expand {\n 0% { transform: scale(0.5); opacity: 0.8; }\n 100% { transform: scale(3); opacity: 0; }\n}\n\n/* ═══════════════════════════════════════\n CART SUMMARY BAR\n ═══════════════════════════════════════ */\n\n.ttp-cart-summary {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 8px 14px;\n margin: 4px 12px 0;\n margin-right: 20px;\n margin-top: auto !important;\n flex-shrink: 0 !important;\n background: #f8fafc;\n border-radius: 12px;\n border: 1px solid #e2e8f0;\n}\n\n/* Hide cart when empty — overrides display:flex !important */\n.ttp-cart-summary.ttp-cart-empty {\n display: none !important;\n}\n\n/* Desktop: cart below input (fallback when input area not found) */\n.ttp-cart-summary-bottom {\n margin-top: 0 !important;\n margin: 8px 12px 12px !important;\n flex-shrink: 0 !important;\n}\n\n/* Desktop: cart inside input area — unified section (like mobile) */\n.ttp-cart-summary-inline {\n margin: 0 !important;\n margin-top: 10px !important;\n padding: 0 !important;\n padding-top: 10px !important;\n flex-shrink: 0 !important;\n background: transparent !important;\n border: none !important;\n border-top: 1px solid rgba(0, 0, 0, 0.06) !important;\n border-radius: 0 !important;\n}\n\n.ttp-cart-info {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.ttp-cart-icon { font-size: 14px; }\n.ttp-cart-count { font-size: 12px; font-weight: 600; color: #475569; }\n.ttp-cart-separator { font-size: 12px; color: #94a3b8; }\n.ttp-cart-total { font-size: 13px; font-weight: 700; color: #1e293b; }\n.ttp-cart-view {\n font-size: 12px;\n font-weight: 600;\n color: #6366f1;\n text-decoration: none;\n cursor: pointer;\n white-space: nowrap;\n}\n.ttp-cart-view:hover {\n color: #4f46e5;\n text-decoration: underline;\n}\n\n/* ═══════════════════════════════════════\n QUANTITY/WEIGHT STEPPER\n ═══════════════════════════════════════ */\n\n.ttp-stepper {\n display: flex !important;\n align-items: center;\n gap: 2px;\n margin: 4px 0;\n}\n\n.ttp-stepper-btn {\n width: 24px !important;\n height: 24px !important;\n border-radius: 6px;\n border: 1px solid #e2e8f0;\n background: #f8fafc;\n color: #475569;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n display: flex !important;\n align-items: center;\n justify-content: center;\n padding: 0;\n line-height: 1;\n transition: all 0.15s;\n flex-shrink: 0;\n}\n\n.ttp-stepper-btn:hover:not(:disabled) {\n background: #e2e8f0;\n border-color: #cbd5e1;\n}\n\n.ttp-stepper-btn:active:not(:disabled) {\n transform: scale(0.9);\n}\n\n.ttp-stepper-btn:disabled,\n.ttp-stepper-disabled {\n opacity: 0.35;\n cursor: default;\n}\n\n.ttp-stepper-value {\n font-size: 12px;\n font-weight: 600;\n color: #1e293b;\n min-width: 36px;\n text-align: center;\n user-select: none;\n}\n\n.ttp-product-compact .ttp-stepper {\n justify-content: flex-end;\n}\n\n.ttp-product-compact .ttp-product-action {\n display: flex !important;\n flex-direction: column;\n align-items: flex-end;\n gap: 2px;\n}\n\n.ttp-product-card .ttp-stepper {\n justify-content: center;\n margin: 4px 0;\n}\n\n.ttp-product-card .ttp-product-footer {\n display: flex !important;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n/* ═══════════════════════════════════════\n VARIATION DESKTOP PICKER\n ═══════════════════════════════════════ */\n\n.picker-relative {\n position: relative !important;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n display: flex !important;\n flex-direction: column !important;\n overflow: hidden;\n}\n\n/* When variant picker is shown, center it horizontally and vertically */\n.picker-relative.ttp-var-picker-active {\n justify-content: center !important;\n align-items: center !important;\n}\n\n.ttp-var-picker {\n background: #fff;\n border-radius: 14px;\n display: flex !important;\n flex-direction: column;\n animation: ttpVarFadeIn 0.2s ease;\n overflow: hidden;\n width: 100%;\n flex-shrink: 0 !important;\n}\n\n@keyframes ttpVarFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.ttp-var-header {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n border-bottom: 1px solid #f1f5f9;\n flex-shrink: 0;\n}\n\n.ttp-var-back-btn {\n background: none;\n border: none;\n cursor: pointer;\n color: #64748b;\n font-size: 16px;\n padding: 0;\n display: flex;\n align-items: center;\n line-height: 1;\n font-family: inherit;\n}\n.ttp-var-back-btn:hover { color: #1e293b; }\n\n.ttp-var-title {\n font-size: 13px;\n font-weight: 700;\n color: #1e293b;\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-var-page-link {\n font-size: 11px;\n color: #3b82f6;\n text-decoration: none;\n font-weight: 500;\n white-space: nowrap;\n flex-shrink: 0;\n}\n.ttp-var-page-link:hover { text-decoration: underline; }\n\n.ttp-var-body {\n flex: 1;\n overflow-y: auto;\n padding: 12px 14px;\n display: flex !important;\n flex-direction: column;\n gap: 14px;\n}\n\n.ttp-var-preview {\n display: flex !important;\n gap: 12px;\n align-items: flex-start;\n}\n\n.ttp-var-preview-img {\n width: 72px !important;\n height: 72px !important;\n border-radius: 12px;\n background: #f8fafc;\n border: 1px solid #e5e7eb;\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n transition: all 0.2s ease;\n}\n\n.ttp-var-preview-img img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n padding: 6px;\n}\n\n.ttp-var-preview-info { flex: 1; min-width: 0; }\n\n.ttp-var-preview-brand {\n font-size: 10px;\n color: #94a3b8;\n font-weight: 500;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n\n.ttp-var-preview-name {\n font-size: 14px;\n font-weight: 700;\n color: #1e293b;\n margin: 2px 0 4px;\n line-height: 1.2;\n}\n\n.ttp-var-preview-price {\n font-size: 18px;\n font-weight: 700;\n color: #7c3aed;\n}\n\n.ttp-var-preview-selected {\n font-size: 11px;\n color: #64748b;\n margin-top: 3px;\n}\n\n.ttp-var-section { display: flex !important; flex-direction: column; gap: 8px; }\n\n.ttp-var-section-label {\n font-size: 11px;\n font-weight: 700;\n color: #1e293b;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n}\n\n.ttp-var-swatches { display: flex !important; flex-wrap: wrap; gap: 8px; }\n\n.ttp-var-swatch {\n display: block !important;\n width: 28px !important;\n height: 28px !important;\n border-radius: 50%;\n cursor: pointer;\n border: 3px solid transparent;\n transition: all 0.15s;\n position: relative;\n flex-shrink: 0;\n}\n.ttp-var-swatch:hover { transform: scale(1.1); }\n.ttp-var-swatch.selected {\n border-color: #7c3aed;\n box-shadow: 0 0 0 2px #fff, 0 0 0 4px #7c3aed;\n}\n.ttp-var-swatch.oos {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.ttp-var-pills { display: flex !important; flex-wrap: wrap; gap: 6px; }\n\n.ttp-var-pill {\n padding: 5px 12px;\n border-radius: 8px;\n border: 1.5px solid #e2e8f0;\n background: #fff;\n font-size: 12px;\n font-weight: 600;\n color: #475569;\n cursor: pointer;\n transition: all 0.15s;\n font-family: inherit;\n}\n.ttp-var-pill:hover:not(:disabled) { border-color: #7c3aed; color: #7c3aed; }\n.ttp-var-pill.selected { border-color: #7c3aed; background: #7c3aed; color: #fff; }\n.ttp-var-pill.oos { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }\n\n.ttp-var-footer {\n padding: 10px 14px 12px;\n border-top: 1px solid #f1f5f9;\n flex-shrink: 0;\n}\n\n.ttp-var-add-btn {\n width: 100%;\n padding: 10px;\n background: linear-gradient(135deg, #7c3aed, #6d28d9);\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n box-shadow: 0 3px 10px rgba(124,58,237,0.3);\n transition: all 0.15s;\n}\n.ttp-var-add-btn:hover:not(:disabled) { transform: scale(0.99); }\n.ttp-var-add-btn:disabled {\n background: #cbd5e1;\n box-shadow: none;\n cursor: not-allowed;\n}\n\n.ttp-var-spinner {\n width: 24px;\n height: 24px;\n border: 3px solid #e2e8f0;\n border-top-color: #7c3aed;\n border-radius: 50%;\n animation: ttpVarSpin 0.7s linear infinite;\n}\n@keyframes ttpVarSpin {\n to { transform: rotate(360deg); }\n}\n\n/* Amber "Choose" button for variant products */\n.ttp-add-btn.ttp-choose-btn {\n background: linear-gradient(135deg, #f59e0b, #d97706);\n box-shadow: 0 2px 8px rgba(245,158,11,0.3);\n color: #fff;\n}\n\n \n\n/* ═══════════════════════════════════════\n HOTELS-SPECIFIC OVERRIDES\n ═══════════════════════════════════════ */\n\n/* Hotels area mirrors ecommerce area */\n.ttp-hotels-area {\n display: flex !important;\n flex-direction: column !important;\n width: 100%;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n position: relative !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n/* Room-specific layout classes */\n#voiceActiveState.ttp-rooms-visible .desktop-voice-section {\n display: none !important;\n}\n#voiceActiveState.ttp-rooms-visible .compact-voice-section {\n display: flex !important;\n}\n#voiceActiveState.ttp-rooms-visible .desktop-conversation-panel {\n flex: 0 0 auto !important;\n}\n#voiceActiveState.ttp-rooms-visible .conversation-history {\n display: none !important;\n}\n#voiceActiveState.ttp-rooms-visible .live-transcript-collapsed {\n flex: 0 0 auto !important;\n}\n\n/* Per-night price styling */\n.ttp-room-per-night {\n font-size: 10px;\n color: #94a3b8;\n font-weight: 400;\n}\n\n/* Booking summary bar */\n.ttp-booking-summary-inline {\n margin: 0 !important;\n margin-top: 10px !important;\n padding: 0 !important;\n padding-top: 10px !important;\n flex-shrink: 0 !important;\n background: transparent !important;\n border: none !important;\n border-top: 1px solid rgba(0, 0, 0, 0.06) !important;\n border-radius: 0 !important;\n}\n\n.ttp-booking-summary {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 8px 14px;\n flex-shrink: 0 !important;\n}\n\n.ttp-booking-summary.ttp-booking-empty {\n display: none !important;\n}\n\n.ttp-booking-info {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: #475569;\n}\n\n.ttp-booking-total {\n font-size: 13px;\n font-weight: 700;\n color: #1e293b;\n}\n\n ',this.shadowRoot.appendChild(e)}}_attachToDOM(){if(!this.isAttached&&this.shadowRoot)if(this.voiceActiveState=this.shadowRoot.getElementById("voiceActiveState"),this.voiceActiveState)if(this.shadowRoot.getElementById("ttpHotelsArea"))this.isAttached=!0;else{var e=this.voiceActiveState.querySelector(".compact-voice-section"),t=this.voiceActiveState.querySelector(".desktop-voice-section"),n=e||t;null!=n&&n.nextSibling?this.voiceActiveState.insertBefore(this.container,n.nextSibling):this.voiceActiveState.appendChild(this.container);var A=this.voiceActiveState.querySelector(".voice-text-input-area");if(A){var o=this.bookingSummary.render();o.classList.add("ttp-booking-summary-inline"),A.appendChild(o)}this.isAttached=!0}else console.warn("[HotelsDesktopPresenter] #voiceActiveState not found")}_setContainerMode(e){"rooms"===e?(this.container.style.flex="1 1 0",this.container.style.minHeight="0",this.container.style.overflowY="auto",this.voiceActiveState&&this.voiceActiveState.classList.add("ttp-rooms-visible")):(this.container.style.flex="1 1 0",this.container.style.minHeight="0",this.container.style.overflowY="",this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-rooms-visible"))}_expandPanelToFit(e){if(this.shadowRoot){var t=this.shadowRoot.getElementById("text-chat-panel");if(t){var n=e>2?750:580,A=Math.min(1e3,Math.floor(.92*window.innerHeight)),o=Math.min(Math.max(792,n),A);t.classList.add("ttp-panel-expanded"),t.style.height="".concat(o,"px")}}}_shrinkPanel(){if(this.shadowRoot){var e=this.shadowRoot.getElementById("text-chat-panel");e&&(e.classList.remove("ttp-panel-expanded"),e.style.height="")}}_switchToCompactMode(){if(this.shadowRoot){var e=this.shadowRoot.getElementById("desktopVoiceSection"),t=this.shadowRoot.getElementById("compactVoiceSection");e&&(e.style.display="none"),t&&(t.style.display="flex")}}_restoreFullVoiceMode(){if(this.shadowRoot){var e=this.shadowRoot.getElementById("desktopVoiceSection"),t=this.shadowRoot.getElementById("compactVoiceSection");e&&t&&(e.style.display="",t.style.display="none")}}_handlePickerClose(){this.hideRooms()}}function Bn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function wn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bn(Object(n),!0).forEach(function(t){bn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bn(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class yn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onRoomBook=e.onRoomBook||(()=>{}),this.onClose=e.onClose||(()=>{}),this.primaryColor=e.primaryColor||"#2563eb",this.rooms=[],this.current=0,this.nights=[],this.container=null,this.wheel=null,this.dotsEl=null,this.anglePerCard=42,this.radius=240,this.dragging=!1,this.startX=0,this.swiped=!1,this.dragThreshold=40,this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._boundMouseMove=this._onMouseMove.bind(this),this._boundMouseUp=this._onMouseUp.bind(this)}show(e,t){this.hide(),e&&0!==e.length&&(this._normalizeRooms(e),this.current=0,this._injectStyles(),this._buildDOM(t),this._buildCards(),this._buildDots(),this._setupDragEvents(),this._updateWheel(),document.body.appendChild(this.container),this._positionAboveMobileBar())}hide(){var e;if(this._removeEventListeners(),null!==(e=this.container)&&void 0!==e&&e.parentNode){this.container.classList.add("ttp-carousel--hiding");var t=this.container;setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},280)}this.container=null,this.wheel=null,this.dotsEl=null}destroy(){var e;this._removeEventListeners(),null!==(e=this.container)&&void 0!==e&&e.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null;var t=document.getElementById("ttpHotelCarouselToast");t&&t.remove();var n=document.getElementById("ttp-hotel-carousel-styles");n&&n.remove()}showToast(e){var t=document.getElementById("ttpHotelCarouselToast");t&&t.remove();var n=document.createElement("div");n.id="ttpHotelCarouselToast",n.className="ttp-carousel-toast",n.innerHTML='\n <div class="ttp-carousel-toast__icon">✓</div>\n <div class="ttp-carousel-toast__text">\n <strong>'.concat(e,"</strong> booked!\n </div>\n "),document.body.appendChild(n);var A=document.getElementById("mobile-voice-call-bar-container");n.style.bottom=A?"".concat(A.offsetHeight+12,"px"):"100px",setTimeout(()=>{n.classList.add("ttp-carousel-toast--hiding"),setTimeout(()=>n.remove(),300)},3e3)}_normalizeRooms(e){this.rooms=e.map(e=>wn(wn({},e),{},{imageUrl:e.imageUrl||e.image_url||"",available:void 0===e.available||e.available,pricePerNight:e.pricePerNight||e.price_per_night||e.price||0,currency:e.currency||"USD",name:e.name||e.roomName||"Room"})),this.nights=this.rooms.map(e=>e.nights||1)}_buildDOM(e){this.container=document.createElement("div"),this.container.className="ttp-mobile-carousel",this.container.id="ttpHotelMobileCarousel",this.container.style.setProperty("--ttp-carousel-primary",this.primaryColor),this.container.style.setProperty("--ttp-carousel-primary-light",this._hexToRgba(this.primaryColor,.12)),this.container.style.setProperty("--ttp-carousel-primary-dark",this._darkenHex(this.primaryColor,30)),this.container.style.setProperty("--ttp-carousel-primary-shadow",this._hexToRgba(this.primaryColor,.3));var t=document.createElement("div");t.className="ttp-carousel-header",t.innerHTML='\n <span class="ttp-carousel-title">'.concat(e||"Available Rooms",'</span>\n <button class="ttp-carousel-close" aria-label="Close">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">\n <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>\n </svg>\n </button>\n '),t.querySelector(".ttp-carousel-close").addEventListener("click",()=>{this.hide(),this.onClose()});var n=document.createElement("div");n.className="ttp-carousel-area",this.wheel=document.createElement("div"),this.wheel.className="ttp-carousel-wheel",n.appendChild(this.wheel),this.dotsEl=document.createElement("div"),this.dotsEl.className="ttp-carousel-dots",this.container.appendChild(t),this.container.appendChild(n),this.container.appendChild(this.dotsEl)}_buildCards(){this.rooms.forEach((e,t)=>{var n=document.createElement("div");n.className="ttp-carousel-card"+(e.available?"":" ttp-carousel-card--oos"),n.dataset.index=t;var A="ILS"===e.currency?"₪":"EUR"===e.currency?"€":"$",o=(e.pricePerNight*this.nights[t]).toFixed(0);n.innerHTML='\n <div class="ttp-carousel-card__image">\n <img src="'.concat(e.imageUrl,'" alt="').concat(e.name,'" onerror="this.style.display=\'none\'" />\n ').concat(e.available?"":'<div class="ttp-carousel-card__badge">Unavailable</div>','\n </div>\n <div class="ttp-carousel-card__info">\n <div class="ttp-carousel-card__name">').concat(e.name,"</div>\n ").concat(e.subtitle?'<div class="ttp-carousel-card__unit">'.concat(e.subtitle,"</div>"):"",'\n <div class="ttp-carousel-card__price">').concat(A).concat(e.pricePerNight,'<span style="font-size:10px;color:#94a3b8;font-weight:400">/night</span></div>\n </div>\n <div class="ttp-carousel-card__actions">\n <div class="ttp-carousel-card__stepper">\n <button class="ttp-carousel-card__qty-btn ttp-carousel-minus" data-idx="').concat(t,'" ').concat(!e.available||this.nights[t]<=1?"disabled":"",'>−</button>\n <span class="ttp-carousel-card__qty-val" id="ttpHNights').concat(t,'">').concat(this.nights[t]," night").concat(1!==this.nights[t]?"s":"",'</span>\n <button class="ttp-carousel-card__qty-btn ttp-carousel-plus" data-idx="').concat(t,'" ').concat(e.available?"":"disabled",'>+</button>\n </div>\n <button class="ttp-carousel-card__add-btn" data-idx="').concat(t,'" ').concat(e.available?"":"disabled",">\n ").concat(e.available?"Book Now · ".concat(A).concat(o):"Unavailable","\n </button>\n </div>\n "),n.style.transform="rotateY(".concat(t*this.anglePerCard,"deg) translateZ(").concat(this.radius,"px)"),this.wheel.appendChild(n)}),this._setupCardHandlers()}_setupCardHandlers(){var e=this.container.querySelector(".ttp-carousel-area");if(e){var t=null;e.addEventListener("touchstart",e=>{t={x:e.touches[0].clientX,y:e.touches[0].clientY}},{passive:!0}),e.addEventListener("touchend",e=>{if(t&&!this.swiped){var n=e.changedTouches[0];Math.hypot(n.clientX-t.x,n.clientY-t.y)<15&&this._handleTapAt(n.clientX,n.clientY),t=null}else t=null}),e.addEventListener("click",e=>{var t=e.target.closest(".ttp-carousel-minus"),n=e.target.closest(".ttp-carousel-plus"),A=e.target.closest(".ttp-carousel-card__add-btn");t&&!t.disabled?(e.stopPropagation(),this._handleMinus()):n&&!n.disabled?(e.stopPropagation(),this._handlePlus()):A&&!A.disabled&&(e.stopPropagation(),this._handleBook())})}}_handleTapAt(e,t){var n=this.wheel.querySelectorAll(".ttp-carousel-card")[this.current];if(n){var A=n.querySelector(".ttp-carousel-minus"),o=n.querySelector(".ttp-carousel-plus"),i=n.querySelector(".ttp-carousel-card__add-btn");!this._hitTest(e,t,A)||null!=A&&A.disabled?!this._hitTest(e,t,o)||null!=o&&o.disabled?!this._hitTest(e,t,i)||null!=i&&i.disabled||this._handleBook():this._handlePlus():this._handleMinus()}}_hitTest(e,t,n){if(!n)return!1;var A=n.getBoundingClientRect();return e>=A.left&&e<=A.right&&t>=A.top&&t<=A.bottom}_handleMinus(){var e=this.current;this.nights[e]>1&&(this.nights[e]--,this._refreshStepper(e))}_handlePlus(){var e=this.current;this.nights[e]<30&&(this.nights[e]++,this._refreshStepper(e))}_handleBook(){var e=this.current,t=this.rooms[e];if(t.available){var n=this.wheel.querySelectorAll(".ttp-carousel-card")[e],A=null==n?void 0:n.querySelector(".ttp-carousel-card__add-btn");A&&(A.textContent="✓ Booked!",A.classList.add("ttp-carousel-card__add-btn--added"),A.disabled=!0);var o=wn(wn({},t),{},{selectedNights:this.nights[e]});this.onRoomBook(n,o),setTimeout(()=>this.hide(),800)}}_refreshStepper(e){var t=this.container.querySelector("#ttpHNights".concat(e)),n=this.container.querySelector('.ttp-carousel-minus[data-idx="'.concat(e,'"]')),A=this.container.querySelector('.ttp-carousel-card__add-btn[data-idx="'.concat(e,'"]'));if(t&&(t.textContent="".concat(this.nights[e]," night").concat(1!==this.nights[e]?"s":"")),n&&(n.disabled=this.nights[e]<=1),A&&!A.classList.contains("ttp-carousel-card__add-btn--added")){var o=this.rooms[e],i="ILS"===o.currency?"₪":"EUR"===o.currency?"€":"$",r=(o.pricePerNight*this.nights[e]).toFixed(0);A.textContent="Book Now · ".concat(i).concat(r)}}_buildDots(){this.rooms.length<=1||this.rooms.forEach((e,t)=>{var n=document.createElement("div");n.className="ttp-carousel-dot",n.addEventListener("click",()=>this.goTo(t)),this.dotsEl.appendChild(n)})}_updateWheel(){var e=-this.current*this.anglePerCard;this.wheel.style.transform="translateZ(-".concat(this.radius,"px) rotateY(").concat(e,"deg)"),this.wheel.querySelectorAll(".ttp-carousel-card").forEach((t,n)=>{for(var A=n*this.anglePerCard+e;A>180;)A-=360;for(;A<-180;)A+=360;Math.abs(A)>90?(t.style.visibility="hidden",t.style.opacity="0"):(t.style.visibility="visible",t.style.opacity=this.rooms[n].available?"1":"0.7")}),this.dotsEl.querySelectorAll(".ttp-carousel-dot").forEach((e,t)=>e.classList.toggle("ttp-carousel-dot--active",t===this.current))}goTo(e){this.current=Math.max(0,Math.min(this.rooms.length-1,e)),this._updateWheel()}_setupDragEvents(){var e=this.container.querySelector(".ttp-carousel-area");e&&(e.addEventListener("touchstart",e=>{this.dragging=!0,this.startX=e.touches[0].clientX,this.swiped=!1},{passive:!0}),e.addEventListener("mousedown",e=>{this.dragging=!0,this.startX=e.clientX,this.swiped=!1}),document.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),document.addEventListener("touchend",this._boundTouchEnd),document.addEventListener("mousemove",this._boundMouseMove),document.addEventListener("mouseup",this._boundMouseUp))}_onTouchMove(e){if(this.dragging){var t=e.touches[0].clientX-this.startX;Math.abs(t)>this.dragThreshold&&(this.goTo(this.current+(t>0?-1:1)),this.startX=e.touches[0].clientX,this.swiped=!0)}}_onTouchEnd(){this.dragging=!1,this.swiped&&setTimeout(()=>{this.swiped=!1},400)}_onMouseMove(e){if(this.dragging){var t=e.clientX-this.startX;Math.abs(t)>this.dragThreshold&&(this.goTo(this.current+(t>0?-1:1)),this.startX=e.clientX,this.swiped=!0)}}_onMouseUp(){this.dragging=!1,this.swiped&&setTimeout(()=>{this.swiped=!1},400)}_removeEventListeners(){document.removeEventListener("touchmove",this._boundTouchMove),document.removeEventListener("touchend",this._boundTouchEnd),document.removeEventListener("mousemove",this._boundMouseMove),document.removeEventListener("mouseup",this._boundMouseUp)}_positionAboveMobileBar(){requestAnimationFrame(()=>{if(this.container){var e=document.getElementById("mobile-voice-call-bar-container");if(e){var t=e.getBoundingClientRect();this.container.style.bottom="".concat(window.innerHeight-t.top+58,"px")}}})}_hexToRgba(e,t){var n=parseInt(e.slice(1,3),16),A=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return"rgba(".concat(n,", ").concat(A,", ").concat(o,", ").concat(t,")")}_darkenHex(e,t){var n=Math.max(0,parseInt(e.slice(1,3),16)-t),A=Math.max(0,parseInt(e.slice(3,5),16)-t),o=Math.max(0,parseInt(e.slice(5,7),16)-t);return"#".concat(n.toString(16).padStart(2,"0")).concat(A.toString(16).padStart(2,"0")).concat(o.toString(16).padStart(2,"0"))}_injectStyles(){if(!document.getElementById("ttp-hotel-carousel-styles")){var e=document.createElement("style");e.id="ttp-hotel-carousel-styles",e.textContent=this._generateCSS(),document.head.appendChild(e)}}_generateCSS(){return"\n/* ═══════════════════════════════════════\n HOTEL MOBILE CAROUSEL (reuses ecommerce carousel classes)\n ═══════════════════════════════════════ */\n\n.ttp-mobile-carousel {\n position: fixed !important;\n bottom: 180px;\n left: 0 !important;\n right: 0 !important;\n top: 0 !important;\n z-index: 2147483646 !important;\n font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;\n animation: ttpCarouselIn 0.35s cubic-bezier(0.23, 1, 0.32, 1);\n -webkit-tap-highlight-color: transparent;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n padding-bottom: 16px;\n}\n\n.ttp-mobile-carousel > .ttp-carousel-header,\n.ttp-mobile-carousel > .ttp-carousel-area,\n.ttp-mobile-carousel > .ttp-carousel-dots {\n position: relative;\n z-index: 1;\n}\n\n.ttp-mobile-carousel::after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 420px;\n background: rgba(0, 0, 0, 0.2);\n backdrop-filter: blur(4px);\n -webkit-backdrop-filter: blur(4px);\n border-radius: 24px 24px 0 0;\n pointer-events: none;\n z-index: 0;\n}\n\n.ttp-mobile-carousel.ttp-carousel--hiding {\n animation: ttpCarouselOut 0.28s ease forwards;\n pointer-events: none;\n}\n\n@keyframes ttpCarouselIn {\n from { opacity: 0; transform: translateY(30px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes ttpCarouselOut {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(30px); }\n}\n\n.ttp-carousel-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 24px 8px;\n flex-shrink: 0;\n}\n\n.ttp-carousel-title {\n font-size: 13px;\n font-weight: 600;\n color: #fff;\n text-shadow: 0 1px 4px rgba(0,0,0,0.4);\n}\n\n.ttp-carousel-close {\n width: 32px;\n height: 32px;\n border: none;\n border-radius: 0;\n background: none;\n color: #fff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n opacity: 0.85;\n}\n.ttp-carousel-close:active { opacity: 1; }\n\n.ttp-carousel-area {\n position: relative;\n height: 300px;\n flex-shrink: 0;\n perspective: 800px;\n perspective-origin: 50% 55%;\n cursor: grab;\n user-select: none;\n -webkit-user-select: none;\n}\n.ttp-carousel-area:active { cursor: grabbing; }\n\n.ttp-carousel-wheel {\n position: absolute;\n width: 100%;\n height: 100%;\n transform-style: preserve-3d;\n transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);\n}\n\n.ttp-carousel-card {\n position: absolute;\n width: 150px;\n height: 285px;\n left: 50%;\n top: 50%;\n margin-left: -75px;\n margin-top: -142px;\n background: #fff;\n border-radius: 18px;\n overflow: hidden;\n box-shadow: 0 8px 32px rgba(0,0,0,0.14);\n transform-style: preserve-3d;\n transition: visibility 0.3s, opacity 0.3s;\n display: flex;\n flex-direction: column;\n}\n\n.ttp-carousel-card--oos { opacity: 0.7; }\n\n.ttp-carousel-card__image {\n width: 100%;\n height: 100px;\n background: linear-gradient(145deg, #f0f4ff, #e8ecf8);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n position: relative;\n overflow: hidden;\n}\n.ttp-carousel-card__image img {\n max-width: 80%;\n max-height: 80%;\n object-fit: contain;\n}\n\n.ttp-carousel-card__badge {\n position: absolute;\n top: 6px; right: 6px;\n background: #ef4444;\n color: #fff;\n font-size: 8px;\n font-weight: 700;\n padding: 2px 6px;\n border-radius: 4px;\n text-transform: uppercase;\n}\n\n.ttp-carousel-card__info {\n padding: 8px 10px 4px;\n flex-shrink: 0;\n}\n\n.ttp-carousel-card__name {\n font-size: 12px;\n font-weight: 600;\n color: #1e1b4b;\n line-height: 1.25;\n margin-bottom: 1px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n\n.ttp-carousel-card__unit {\n font-size: 9px;\n color: #64748b;\n margin-bottom: 3px;\n}\n\n.ttp-carousel-card__price {\n font-size: 16px;\n font-weight: 700;\n color: var(--ttp-carousel-primary, #2563eb);\n}\n\n.ttp-carousel-card__actions {\n padding: 6px 10px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-top: auto;\n}\n\n.ttp-carousel-card__stepper {\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--ttp-carousel-primary-light, rgba(37,99,235,0.12));\n border-radius: 10px;\n padding: 3px;\n}\n\n.ttp-carousel-card__qty-btn {\n width: 30px;\n height: 30px;\n border: none;\n background: transparent;\n color: var(--ttp-carousel-primary, #2563eb);\n font-size: 17px;\n font-weight: 600;\n cursor: pointer;\n border-radius: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 10;\n touch-action: manipulation;\n}\n.ttp-carousel-card__qty-btn:active:not(:disabled) {\n background: var(--ttp-carousel-primary-light);\n}\n.ttp-carousel-card__qty-btn:disabled { opacity: 0.3; cursor: default; }\n\n.ttp-carousel-card__qty-val {\n min-width: 40px;\n text-align: center;\n font-size: 14px;\n font-weight: 600;\n color: #1e1b4b;\n user-select: none;\n}\n\n.ttp-carousel-card__add-btn {\n width: 100%;\n padding: 9px 12px;\n background: linear-gradient(135deg, var(--ttp-carousel-primary, #2563eb), var(--ttp-carousel-primary-dark, #1d4ed8));\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n box-shadow: 0 4px 12px var(--ttp-carousel-primary-shadow, rgba(37,99,235,0.3));\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 10;\n touch-action: manipulation;\n}\n.ttp-carousel-card__add-btn:active:not(:disabled) { transform: scale(0.97); }\n.ttp-carousel-card__add-btn:disabled { background: #94a3b8; cursor: default; box-shadow: none; }\n.ttp-carousel-card__add-btn--added {\n background: linear-gradient(135deg, #10b981, #059669) !important;\n box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;\n}\n\n.ttp-carousel-dots {\n display: flex;\n justify-content: center;\n gap: 8px;\n padding: 8px 0 0;\n flex-shrink: 0;\n}\n\n.ttp-carousel-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: rgba(255,255,255,0.35);\n cursor: pointer;\n transition: all 0.3s;\n}\n\n.ttp-carousel-dot--active {\n width: 24px;\n border-radius: 4px;\n background: #fff;\n}\n\n.ttp-carousel-toast {\n position: fixed;\n left: 16px;\n right: 16px;\n bottom: 100px;\n z-index: 100001;\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n background: #fff;\n border-radius: 14px;\n box-shadow: 0 8px 32px rgba(0,0,0,0.15);\n animation: ttpCarouselToastIn 0.3s ease;\n}\n\n.ttp-carousel-toast--hiding {\n animation: ttpCarouselOut 0.3s ease forwards;\n}\n\n@keyframes ttpCarouselToastIn {\n from { opacity: 0; transform: translateY(12px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n.ttp-carousel-toast__icon {\n width: 28px;\n height: 28px;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n font-weight: 700;\n flex-shrink: 0;\n}\n\n.ttp-carousel-toast__text {\n font-size: 13px;\n color: #1e293b;\n line-height: 1.3;\n}\n.ttp-carousel-toast__text strong { font-weight: 600; }\n"}}class xn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.primaryColor=e.primaryColor||"#2563eb",this.onRoomBook=e.onRoomBook||(()=>{}),this.carousel=null}showRooms(e,t){this.carousel||(this.carousel=new yn({primaryColor:this.primaryColor,onRoomBook:(e,t)=>{this.onRoomBook(t)},onClose:()=>{}})),this.carousel.show(e,t)}hideRooms(){this.carousel&&this.carousel.hide()}onRoomBooked(e){var t;null!==(t=this.carousel)&&void 0!==t&&t.container&&this.carousel.showToast(e.name||e.roomName||"Room")}updateBooking(e){}destroy(){this.carousel&&(this.carousel.destroy(),this.carousel=null)}}class Cn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.shadowRoot=e.shadowRoot,this.primaryColor=e.primaryColor||"#2563eb",this.onRoomSelected=e.onRoomSelected||(()=>{}),this.onExtraSelected=e.onExtraSelected||(()=>{}),this._presenter=null}get presenter(){return this._presenter||(this._presenter=this._createPresenter()),this._presenter}_createPresenter(){return this._isMobileCall()?new xn({primaryColor:this.primaryColor,onRoomBook:e=>this._handleRoomBook(e)}):new vn({shadowRoot:this.shadowRoot,primaryColor:this.primaryColor,onRoomBook:e=>this._handleRoomBook(e)})}_isMobileCall(){return!!document.getElementById("mobile-voice-call-bar-container")}handleShowItems(e){var t=e.items||e.products||[];if(t.length){var n=t.map(Qn);this.presenter.showRooms(n,e.title)}else console.warn("[HotelsManager] show_items with no items")}handleBookingUpdated(e){var t=e.booking||e;this.presenter.updateBooking(t)}handleShowExtras(e){var t=e.items||e.extras||[];if(t.length){var n=t.map(Fn);this.presenter.showRooms(n,e.title||"Extras")}}hideRooms(){this.presenter.hideRooms()}_handleRoomBook(e){this.onRoomSelected(e)}destroy(){this._presenter&&(this._presenter.destroy(),this._presenter=null)}}function Qn(e){return{id:e.roomId||e.id,name:e.roomName||e.name,imageUrl:e.imageUrl||e.image_url||"",subtitle:(t=e,A=[],t.beds&&A.push("".concat(t.beds," bed").concat(t.beds>1?"s":"")),null!==(n=t.amenities)&&void 0!==n&&n.length&&A.push(t.amenities.slice(0,3).join(", ")),A.join(" · ")),pricePerNight:e.pricePerNight||e.price_per_night||e.price||0,currency:e.currency||"USD",available:void 0===e.available||e.available,nights:1};var t,n,A}function Fn(e){return{id:e.extraId||e.id,name:e.name,imageUrl:e.imageUrl||e.image_url||"",subtitle:e.description||"",pricePerNight:e.price||e.pricePerNight||0,currency:e.currency||"USD",available:!0,nights:1}}var Un={ecommerce:function(e){var t,n,A,o=(null===(t=e._rawConfig)||void 0===t?void 0:t.cart)||{},i=new on({shadowRoot:e.shadowRoot,primaryColor:(null===(n=e.config)||void 0===n||null===(n=n.colors)||void 0===n?void 0:n.primary)||(null===(A=e._rawConfig)||void 0===A||null===(A=A.colors)||void 0===A?void 0:A.primary)||"#3b82f6",onProductSelected:t=>function(t){var n=t.selectedAmount||1;try{var A,o=null===(A=e.voiceInterface)||void 0===A||null===(A=A.sdk)||void 0===A?void 0:A.voiceSDK;null!=o&&o.stopAudioPlayback&&o.stopAudioPlayback()}catch(e){}r({t:"product_selected",productId:t.id,productName:t.name,price:t.price,quantity:n,sellBy:t.sellBy||"quantity"})}(t),onProductDeselected:e=>function(e){r({t:"product_deselected",productId:e.id,productName:e.name})}(e)});function r(t){try{var n,A=null===(n=e.voiceInterface)||void 0===n||null===(n=n.sdk)||void 0===n?void 0:n.voiceSDK;A&&A.sendMessage&&A.sendMessage(t)}catch(e){console.warn("[EcommerceFlavor] Could not send to VoiceSDK:",e)}}function a(e){i.handleCartUpdated(e)}function s(){return(s=dn(function*(){try{var e=yield fetch("/cart.js",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)return console.error("[EcommerceFlavor] Failed to fetch /cart.js:",e.status),void r({t:"cart_state_result",success:!1,error:"Failed to fetch cart: HTTP ".concat(e.status)});var t=yield e.json();r({t:"cart_state_result",success:!0,items:(t.items||[]).map(e=>({title:e.title,variant_title:e.variant_title,quantity:e.quantity,price:e.price,line_price:e.line_price,image:e.image,variant_id:e.variant_id,product_id:e.product_id})),item_count:t.item_count,total_price:t.total_price,currency:t.currency}),console.log("[EcommerceFlavor] Cart state sent: ".concat(t.item_count," items, ").concat(t.currency," ").concat((t.total_price/100).toFixed(2)))}catch(e){console.error("[EcommerceFlavor] Error fetching cart:",e),r({t:"cart_state_result",success:!1,error:e.message||"Failed to fetch cart"})}})).apply(this,arguments)}function c(){return c=dn(function*(e){var t,n,{variantId:A,quantity:o}=e,i="";try{var s=yield fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:parseInt(A),quantity:o||1}]})});if(!s.ok){var c=yield s.text();return console.error("[EcommerceFlavor] /cart/add.js failed:",s.status,c),void r({t:"cart_add_result",success:!1,error:"Cart add failed: HTTP ".concat(s.status),productName:i||String(A),quantity:o||1})}var l=yield s.json();l.items&&l.items.length>0&&(i=l.items[0].title||"");var d=yield fetch("/cart.js"),p=yield d.json(),u=!1;try{t=p.item_count,n=!1,[".cart-count",".cart-count-bubble","[data-cart-count]",".js-cart-count",".cart-item-count","#CartCount",".site-header__cart-count",".cart-count-tag"].forEach(e=>{document.querySelectorAll(e).forEach(e=>{e.textContent=t,n=!0})}),u=n}catch(e){console.warn("[EcommerceFlavor] Cart count refresh failed (non-critical):",e)}a({action:"added",product:{name:i,id:A},cartTotal:p.total_price/100,cartItemCount:p.item_count,currency:p.currency}),r({t:"cart_add_result",success:!0,cartRefreshed:u,productName:i,quantity:o||1,cartTotal:p.total_price,cartItemCount:p.item_count,currency:p.currency}),console.log("[EcommerceFlavor] Cart add result sent: ".concat(i,", refreshed=").concat(u,", ").concat(p.item_count," items"))}catch(e){console.error("[EcommerceFlavor] Error in handleAddToStoreCart:",e),r({t:"cart_add_result",success:!1,error:e.message||"Failed to add to cart",productName:i||String(A),quantity:o||1})}}),c.apply(this,arguments)}var l,d,p=[];o.addToCartFn&&p.push({name:"addToCart",handler:(l=dn(function*(e){try{var t=yield o.addToCartFn(e.productId,e.quantity||1);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sn(Object(n),!0).forEach(function(t){cn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({success:!0,productName:e.productName},t)}catch(e){return{success:!1,error:e.message}}}),function(e){return l.apply(this,arguments)})}),o.getCartFn&&p.push({name:"getCart",handler:(d=dn(function*(){try{return yield o.getCartFn()}catch(e){return{items:[],total:0,count:0,error:e.message}}}),function(){return d.apply(this,arguments)})});var u,h=an(e),g={show_products:e=>{h.dismissGallery(),i.handleShowProducts(e)},show_items:e=>{h.dismissGallery(),i.handleShowProducts(e)},show_media:e=>{i.hideProducts(),h.handleShowMedia(e)},dismiss_media:()=>{h.dismissGallery()},cart_updated:e=>a(e),add_to_store_cart:e=>function(e){return c.apply(this,arguments)}(e),get_store_cart:()=>function(){return s.apply(this,arguments)}()};return window.__TTP_ECOMMERCE__={handleMessage:e=>{i.handleMessage(e)},showProducts:(u=dn(function*(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"test",A=window.__TTP_MOCK_API__||"https://backend.talktopc.com";try{var o=yield fetch("".concat(A,"/api/partner/mock-store/products/search?q=").concat(encodeURIComponent(e),"&limit=").concat(t,"&sessionId=").concat(encodeURIComponent(n))),r=yield o.json();i.handleShowProducts({t:"show_products",products:r.products,title:"".concat(r.totalCount,' results for "').concat(e,'"'),layout:r.products.length<=4?"cards":"list"})}catch(e){console.error("[EcommerceFlavor] showProducts failed:",e)}}),function(e){return u.apply(this,arguments)}),getCart:()=>({total:i.cartTotal,count:i.cartItemCount}),clearCart:()=>{i.cartItemCount=0,i.cartTotal=0,i.presenter.updateCart({itemCount:0,total:0,currency:i.currencySymbol})}},{tools:p,messageHandlers:g,ecommerce:i,hookCallEnd(){var t=e.voiceInterface;if(t){var n=t.config.onCallEnd;t.config.onCallEnd=function(){i.hideProducts(),h.dismissGallery(),n&&n()}}},destroy(){delete window.__TTP_ECOMMERCE__,i.destroy()}}},hotels:function(e){var t,n,A=an(e),o=new Cn({shadowRoot:e.shadowRoot,primaryColor:(null===(t=e.config)||void 0===t||null===(t=t.colors)||void 0===t?void 0:t.primary)||(null===(n=e._rawConfig)||void 0===n||null===(n=n.colors)||void 0===n?void 0:n.primary)||"#2563eb",onRoomSelected:t=>function(t){try{var n,A=null===(n=e.voiceInterface)||void 0===n||null===(n=n.sdk)||void 0===n?void 0:n.voiceSDK;null!=A&&A.stopAudioPlayback&&A.stopAudioPlayback()}catch(e){}i({t:"room_selected",roomId:t.id,roomName:t.name,nights:t.selectedNights,pricePerNight:t.pricePerNight})}(t),onExtraSelected:e=>function(e){i({t:"extra_selected",extraId:e.id,extraName:e.name,quantity:e.selectedNights||1})}(e)});function i(t){try{var n,A=null===(n=e.voiceInterface)||void 0===n||null===(n=n.sdk)||void 0===n?void 0:n.voiceSDK;null!=A&&A.sendMessage&&A.sendMessage(t)}catch(e){console.warn("[HotelsFlavor] Could not send to VoiceSDK:",e)}}return{tools:[],messageHandlers:{show_items:e=>{A.dismissGallery(),o.handleShowItems(e)},booking_updated:e=>o.handleBookingUpdated(e),show_extras:e=>{A.dismissGallery(),o.handleShowExtras(e)},show_media:e=>{o.hideRooms(),A.handleShowMedia(e)},dismiss_media:()=>{A.dismissGallery()}},hotels:o,hookCallEnd(){var t=e.voiceInterface;if(t){var n=t.config.onCallEnd;t.config.onCallEnd=function(){o.hideRooms(),A.dismissGallery(),n&&n()}}},destroy(){o.destroy(),A.dismissGallery()}}}};function Sn(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function kn(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){Sn(i,A,o,r,a,"next",e)}function a(e){Sn(i,A,o,r,a,"throw",e)}r(void 0)})}}function En(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function In(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?En(Object(n),!0).forEach(function(t){Tn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):En(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Tn(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Hn{constructor(){var e,t,n,A,o,i,r,a,s,c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._rawConfig=c,this.config=this.mergeWithDefaults(c),c.signedUrl&&!c.websocketUrl&&console.warn("⚠️ TTPChatWidget: signedUrl is deprecated — use websocketUrl for custom backend URLs, or just provide agentId + appId"),this.sdk=new Ke(this.config),this.isOpen=!1,this.isActive=!1,this.translations=bt,this.currentView="landing",this.isStartingCall=!1,this.shadowRoot=null,this.container=null,this._pendingClientTools=null,this.config.useShadowDOM?(this.createShadowHost(),this.container=this.shadowRoot):(this.createRegularContainer(),this.container=this.regularContainer,this.shadowRoot=document);var l=In(In(In({},this.config),this.config.voice),{},{inputPlaceholder:(null===(e=this.config.text)||void 0===e?void 0:e.inputPlaceholder)||this.config.inputPlaceholder||"Type your message...",sendButtonColor:(null===(t=this.config.text)||void 0===t?void 0:t.sendButtonColor)||this.config.sendButtonColor||"#7C3AED",language:(null===(n=this.config.voice)||void 0===n?void 0:n.language)||this.config.language||"en",websocketUrl:this.config.websocketUrl,agentSettingsOverride:this.config.agentSettingsOverride,visualAssistant:this.config.visualAssistant,flavor:this.config.flavor||null,translations:this.translations,shadowRoot:this.shadowRoot,textSDK:this.sdk,outputContainer:(null===(A=this.config.voice)||void 0===A?void 0:A.outputContainer)||"raw",outputEncoding:(null===(o=this.config.voice)||void 0===o?void 0:o.outputEncoding)||"pcm",outputSampleRate:(null===(i=this.config.voice)||void 0===i?void 0:i.outputSampleRate)||44100,outputChannels:(null===(r=this.config.voice)||void 0===r?void 0:r.outputChannels)||1,outputBitDepth:(null===(a=this.config.voice)||void 0===a?void 0:a.outputBitDepth)||16,onConversationStart:this.config.onConversationStart,onConversationEnd:this.config.onConversationEnd,onBargeIn:this.config.onBargeIn,onAudioStartPlaying:this.config.onAudioStartPlaying,onAudioStoppedPlaying:this.config.onAudioStoppedPlaying,onSubtitleDisplay:this.config.onSubtitleDisplay,onVoiceCallButtonClick:this.config.onVoiceCallButtonClick,onCallEnd:()=>{var e,t,n=null===(e=this.voiceInterface)||void 0===e||null===(e=e.shadowRoot)||void 0===e?void 0:e.getElementById("voiceIdleState");if(n&&"none"!==n.style.display){var A=n.querySelector(".voice-status-title");if(A){var o,i=A.textContent.trim();if(i===(null===(o=this.voiceInterface)||void 0===o?void 0:o.t("domainNotValidated"))||i.includes("Domain not")||i.includes("not whitelisted"))return void console.log("🚫 Domain error is displayed - NOT returning to landing screen from onCallEnd")}}if("unified"===((null===(t=this.config.behavior)||void 0===t?void 0:t.mode)||"unified")){if(window.innerWidth<=768){var r,a,s=null===(r=this.shadowRoot)||void 0===r?void 0:r.getElementById("text-chat-panel");s&&(s.classList.remove("open"),this.isOpen=!1);var c=null===(a=this.shadowRoot)||void 0===a?void 0:a.querySelector(".ttp-mobile-fab");c&&(c.style.display="")}this.showLanding()}},onShowVoice:()=>{this.showVoice()},onShowLanding:()=>{this.showLanding()},onErrorToast:(e,t)=>{this.showErrorToast(e,t)},onMobileError:e=>{this.showMobileLandingError(e)}});this.voiceInterface=new mt(l);var d=In(In(In({},this.config),this.config.text),{},{translations:this.translations,shadowRoot:this.shadowRoot});if(this.textInterface=new Bt(d,this.sdk),"unified"===((null===(s=this.config.behavior)||void 0===s?void 0:s.mode)||"unified")){var p=In(In({},this.config),{},{translations:this.translations,shadowRoot:this.shadowRoot});this.landingScreen=new wt(p)}else this.landingScreen=null;if(this.createWidget(),this.setupEventHandlers(),this.config.behavior.startOpen||this.config.behavior.autoOpen)if(window.innerWidth<=768){var u,h,g=null===(u=this.shadowRoot)||void 0===u?void 0:u.querySelector(".ttp-mobile-fab"),m=null===(h=this.shadowRoot)||void 0===h?void 0:h.getElementById("ttpMobileLanding");g&&m&&(g.style.display="none",m.classList.add("active"),this.isMobileLandingOpen=!0)}else{var f,v=null===(f=this.shadowRoot)||void 0===f?void 0:f.getElementById("text-chat-panel");v&&(this.isOpen=!0,v.classList.add("open"))}this.checkAndHandleResume(),this._flavor=null,this._flavorObj=c.flavor&&"object"==typeof c.flavor?c.flavor:null,this._flavorObj&&this._flavorObj.type?this._initFlavor(this._flavorObj.type):this._flavorObj&&!this._flavorObj.type&&console.error('[TTPChatWidget] flavor object is set but missing required "type" field. Widget will run in vanilla mode.')}checkAndHandleResume(){var e=this.voiceInterface.checkAndHandleResume();if(e){if(console.log("🔄 [WIDGET] Auto-resuming call from page navigation"),console.log(" From:",e.fromPage,"→ To:",e.toPage),window.innerWidth<=768){var t,n,A=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("ttpMobileLanding"),o=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector(".ttp-mobile-fab");A&&(A.classList.remove("active"),this.isMobileLandingOpen=!1),o&&(o.style.display="none")}this.open(),this.showVoice(),this.currentView="voice",setTimeout(()=>{this.startVoiceCall().then(()=>{console.log("✅ [WIDGET] Auto-resumed call successfully")}).catch(e=>{var t;console.error("❌ [WIDGET] Failed to auto-resume call:",e),"unified"===((null===(t=this.config.behavior)||void 0===t?void 0:t.mode)||"unified")&&this.showLanding()})},100)}}_initFlavor(e){var t,n=Un[e]||null;if(n)if("ecommerce"!==e||null!==(t=this._flavorObj)&&void 0!==t&&t.partnerId){if(this._flavor=n(this,this._flavorObj||{}),this._flavor.tools&&this._flavor.tools.forEach(e=>{this.registerToolHandler(e.name,e.handler)}),this._flavor.messageHandlers){var A,o=null===(A=this.voiceInterface)||void 0===A?void 0:A.sdk;if(o){o.onUnsupportedAction=null;var i=this._flavor,r=o.connect.bind(o);o.connect=kn(function*(){yield r(),this.voiceSDK&&(this.voiceSDK.on("message",e=>{var t=e.t||e.type;i.messageHandlers[t]&&i.messageHandlers[t](e)}),console.log('[TTPChatWidget] Flavor "'.concat(e,'" message listeners attached')))})}}this._flavor.hookCallEnd&&this._flavor.hookCallEnd()}else console.error('[TTPChatWidget] flavor "ecommerce" requires partnerId (e.g. { type: "ecommerce", partnerId: "shopify", shopifyDomain: "..." }). Widget will run in vanilla mode.');else console.error('[TTPChatWidget] Unknown flavor: "'.concat(e,'". Available flavors: ecommerce. Widget will run in vanilla mode.'))}open(){var e;if(!this.isOpen){var t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("text-chat-panel");t&&(this.isOpen=!0,t.classList.add("open"))}}mergeWithDefaults(e){var t,n,A,o,i,r,a,s,c,l,d,p,u,h,g,m,f,v,B,w,b,y,x,C,Q,F,U,S,k,E,I,T,H,_,D,M,P,L,R,K,O,V,N,j,G,z,W,q,X,Y,J,Z,$,ee,te,ne,Ae,oe,ie,re,ae,se,ce,le,de,pe,ue,he,ge,me,fe,ve,Be,we,be,ye,xe,Ce,Qe,Fe,Ue,Se,ke,Ee,Ie,Te,He,_e,De,Me,Pe,Le,Re,Ke,Oe,Ve,Ne,je,Ge,ze,We,qe,Xe,Ye,Je,Ze,$e,et,tt,nt,At,ot,it,rt,at,st,ct,lt,dt,pt,ut,ht,gt,mt,ft,vt,Bt,wt,bt,yt,xt,Ct,Qt,Ft,Ut,St,kt,Et,It,Tt=e.position||"bottom-right";if("string"==typeof Tt){var Ht=Tt.split("-");Tt={vertical:Ht[0]||"bottom",horizontal:Ht[1]||"right",offset:e.positionOffset||{x:20,y:20}}}var _t=e.primaryColor||(null===(t=e.button)||void 0===t?void 0:t.primaryColor)||(null===(n=e.button)||void 0===n?void 0:n.backgroundColor)||"#FFFFFF",Dt={};e.landing&&Object.keys(e.landing).forEach(t=>{var n=e.landing[t];null!=n&&""!==n&&(Dt[t]=n)});var Mt={};return e.header&&Object.keys(e.header).forEach(t=>{var n=e.header[t];null!=n&&""!==n&&(Mt[t]=n)}),In({agentId:e.agentId,appId:e.appId,websocketUrl:e.websocketUrl||e.signedUrl,agentSettingsOverride:e.agentSettingsOverride,demo:!1!==e.demo,direction:e.direction||"ltr",language:e.language||"en",icon:In({type:(null===(A=e.icon)||void 0===A?void 0:A.type)||"custom",customImage:(null===(o=e.icon)||void 0===o?void 0:o.customImage)||"https://talktopc.com/logo192.png",emoji:(null===(i=e.icon)||void 0===i?void 0:i.emoji)||"🎤",text:(null===(r=e.icon)||void 0===r?void 0:r.text)||"AI",size:(null===(a=e.icon)||void 0===a?void 0:a.size)||"medium",backgroundColor:(null===(s=e.icon)||void 0===s?void 0:s.backgroundColor)||"#FFFFFF"},e.icon),position:In({vertical:Tt.vertical||"bottom",horizontal:Tt.horizontal||"right",offset:Tt.offset||{x:20,y:20}},"object"==typeof e.position?e.position:{}),button:In({size:(null===(c=e.button)||void 0===c?void 0:c.size)||"medium",shape:(null===(l=e.button)||void 0===l?void 0:l.shape)||"circle",backgroundColor:(null===(d=e.button)||void 0===d?void 0:d.backgroundColor)||(null===(p=e.icon)||void 0===p?void 0:p.backgroundColor)||"#FFFFFF",hoverColor:(null===(u=e.button)||void 0===u?void 0:u.hoverColor)||"#D3D3D3",shadow:!1!==(null===(h=e.button)||void 0===h?void 0:h.shadow),shadowColor:(null===(g=e.button)||void 0===g?void 0:g.shadowColor)||"rgba(0,0,0,0.15)",primaryColor:(null===(m=e.button)||void 0===m?void 0:m.backgroundColor)||(null===(f=e.icon)||void 0===f?void 0:f.backgroundColor)||"#FFFFFF"},e.button),panel:In({width:(null===(v=e.panel)||void 0===v?void 0:v.width)||360,height:(null===(B=e.panel)||void 0===B?void 0:B.height)||500,borderRadius:(null===(w=e.panel)||void 0===w?void 0:w.borderRadius)||24,backgroundColor:(null===(b=e.panel)||void 0===b?void 0:b.backgroundColor)||"#FFFFFF",backdropFilter:(null===(y=e.panel)||void 0===y?void 0:y.backdropFilter)||null,border:(null===(x=e.panel)||void 0===x?void 0:x.border)||"1px solid #E5E7EB"},e.panel),voice:In({micButtonColor:(null===(C=e.voice)||void 0===C?void 0:C.micButtonColor)||(null===(Q=e.panel)||void 0===Q?void 0:Q.micButtonColor)||_t,micButtonActiveColor:(null===(F=e.voice)||void 0===F?void 0:F.micButtonActiveColor)||(null===(U=e.panel)||void 0===U?void 0:U.micButtonActiveColor)||"#EF4444",micButtonHint:In(In({text:(null===(S=e.voice)||void 0===S||null===(S=S.micButtonHint)||void 0===S?void 0:S.text)||(null===(k=e.panel)||void 0===k||null===(k=k.micButtonHint)||void 0===k?void 0:k.text)||"Click the button to start voice conversation",color:(null===(E=e.voice)||void 0===E||null===(E=E.micButtonHint)||void 0===E?void 0:E.color)||(null===(I=e.panel)||void 0===I||null===(I=I.micButtonHint)||void 0===I?void 0:I.color)||"#6B7280",fontSize:(null===(T=e.voice)||void 0===T||null===(T=T.micButtonHint)||void 0===T?void 0:T.fontSize)||(null===(H=e.panel)||void 0===H||null===(H=H.micButtonHint)||void 0===H?void 0:H.fontSize)||"12px"},null===(_=e.voice)||void 0===_?void 0:_.micButtonHint),null===(D=e.panel)||void 0===D?void 0:D.micButtonHint),avatarBackgroundColor:(null===(M=e.voice)||void 0===M?void 0:M.avatarBackgroundColor)||"#667eea",avatarActiveBackgroundColor:(null===(P=e.voice)||void 0===P?void 0:P.avatarActiveBackgroundColor)||"#667eea",statusTitleColor:(null===(L=e.voice)||void 0===L?void 0:L.statusTitleColor)||"#1e293b",statusSubtitleColor:(null===(R=e.voice)||void 0===R?void 0:R.statusSubtitleColor)||"#64748b",statusDotColor:(null===(K=e.voice)||void 0===K?void 0:K.statusDotColor)||"#10b981",statusText:(null===(O=e.voice)||void 0===O?void 0:O.statusText)||null,startCallButtonColor:(null===(V=e.voice)||void 0===V?void 0:V.startCallButtonColor)||"#667eea",startCallButtonTextColor:(null===(N=e.voice)||void 0===N?void 0:N.startCallButtonTextColor)||"#FFFFFF",startCallTitle:(null===(j=e.voice)||void 0===j?void 0:j.startCallTitle)||null,startCallSubtitle:(null===(G=e.voice)||void 0===G?void 0:G.startCallSubtitle)||null,startCallButtonText:(null===(z=e.voice)||void 0===z?void 0:z.startCallButtonText)||null,transcriptBackgroundColor:(null===(W=e.voice)||void 0===W?void 0:W.transcriptBackgroundColor)||"#FFFFFF",transcriptTextColor:(null===(q=e.voice)||void 0===q?void 0:q.transcriptTextColor)||"#1e293b",transcriptLabelColor:(null===(X=e.voice)||void 0===X?void 0:X.transcriptLabelColor)||"#94a3b8",controlButtonColor:(null===(Y=e.voice)||void 0===Y?void 0:Y.controlButtonColor)||"#FFFFFF",controlButtonSecondaryColor:(null===(J=e.voice)||void 0===J?void 0:J.controlButtonSecondaryColor)||"#64748b",endCallButtonColor:(null===(Z=e.voice)||void 0===Z?void 0:Z.endCallButtonColor)||"#ef4444",language:(null===($=e.voice)||void 0===$?void 0:$.language)||e.language||"en"},e.voice),text:In({sendButtonColor:(null===(ee=e.text)||void 0===ee?void 0:ee.sendButtonColor)||(null===(te=e.panel)||void 0===te?void 0:te.sendButtonColor)||"#7C3AED",sendButtonHoverColor:(null===(ne=e.text)||void 0===ne?void 0:ne.sendButtonHoverColor)||(null===(Ae=e.panel)||void 0===Ae?void 0:Ae.sendButtonHoverColor)||"#6D28D9",sendButtonActiveColor:(null===(oe=e.text)||void 0===oe?void 0:oe.sendButtonActiveColor)||(null===(ie=e.panel)||void 0===ie?void 0:ie.sendButtonActiveColor)||"#6D28D9",sendButtonText:(null===(re=e.text)||void 0===re?void 0:re.sendButtonText)||(null===(ae=e.panel)||void 0===ae?void 0:ae.sendButtonText)||"➤",sendButtonTextColor:(null===(se=e.text)||void 0===se?void 0:se.sendButtonTextColor)||(null===(ce=e.panel)||void 0===ce?void 0:ce.sendButtonTextColor)||"#FFFFFF",sendButtonFontSize:(null===(le=e.text)||void 0===le?void 0:le.sendButtonFontSize)||(null===(de=e.panel)||void 0===de?void 0:de.sendButtonFontSize)||"18px",sendButtonFontWeight:(null===(pe=e.text)||void 0===pe?void 0:pe.sendButtonFontWeight)||(null===(ue=e.panel)||void 0===ue?void 0:ue.sendButtonFontWeight)||"500",sendButtonHint:In(In({text:(null===(he=e.text)||void 0===he||null===(he=he.sendButtonHint)||void 0===he?void 0:he.text)||(null===(ge=e.panel)||void 0===ge||null===(ge=ge.sendButtonHint)||void 0===ge?void 0:ge.text)||"",color:(null===(me=e.text)||void 0===me||null===(me=me.sendButtonHint)||void 0===me?void 0:me.color)||(null===(fe=e.panel)||void 0===fe||null===(fe=fe.sendButtonHint)||void 0===fe?void 0:fe.color)||"#6B7280",fontSize:(null===(ve=e.text)||void 0===ve||null===(ve=ve.sendButtonHint)||void 0===ve?void 0:ve.fontSize)||(null===(Be=e.panel)||void 0===Be||null===(Be=Be.sendButtonHint)||void 0===Be?void 0:Be.fontSize)||"12px"},null===(we=e.text)||void 0===we?void 0:we.sendButtonHint),null===(be=e.panel)||void 0===be?void 0:be.sendButtonHint),inputPlaceholder:(null===(ye=e.text)||void 0===ye?void 0:ye.inputPlaceholder)||(null===(xe=e.panel)||void 0===xe?void 0:xe.inputPlaceholder)||"Type your message...",inputBorderColor:(null===(Ce=e.text)||void 0===Ce?void 0:Ce.inputBorderColor)||(null===(Qe=e.panel)||void 0===Qe?void 0:Qe.inputBorderColor)||"#E5E7EB",inputFocusColor:(null===(Fe=e.text)||void 0===Fe?void 0:Fe.inputFocusColor)||(null===(Ue=e.panel)||void 0===Ue?void 0:Ue.inputFocusColor)||"#7C3AED",inputBackgroundColor:(null===(Se=e.text)||void 0===Se?void 0:Se.inputBackgroundColor)||(null===(ke=e.panel)||void 0===ke?void 0:ke.inputBackgroundColor)||"#FFFFFF",inputTextColor:(null===(Ee=e.text)||void 0===Ee?void 0:Ee.inputTextColor)||(null===(Ie=e.panel)||void 0===Ie?void 0:Ie.inputTextColor)||"#1F2937",inputFontSize:(null===(Te=e.text)||void 0===Te?void 0:Te.inputFontSize)||(null===(He=e.panel)||void 0===He?void 0:He.inputFontSize)||"14px",inputBorderRadius:(null===(_e=e.text)||void 0===_e?void 0:_e.inputBorderRadius)||(null===(De=e.panel)||void 0===De?void 0:De.inputBorderRadius)||20,inputPadding:(null===(Me=e.text)||void 0===Me?void 0:Me.inputPadding)||(null===(Pe=e.panel)||void 0===Pe?void 0:Pe.inputPadding)||"6px 14px"},e.text),landing:(()=>{var t={};return e.landing&&Object.keys(e.landing).forEach(n=>{var A=e.landing[n];(null!=A&&""!==A||!1===A)&&(t[n]=A)}),In({backgroundColor:t.backgroundColor||"linear-gradient(180deg, #f8fafc 0%, #e0e7ff 100%)",logo:t.logo||"🤖",title:t.title||null,titleColor:t.titleColor||"#1e293b",modeCardBackgroundColor:t.modeCardBackgroundColor||"#FFFFFF",modeCardBorderColor:t.modeCardBorderColor||"#E2E8F0",modeCardHoverBorderColor:t.modeCardHoverBorderColor||"#7C3AED",modeCardIconBackgroundColor:t.modeCardIconBackgroundColor||"#7C3AED",modeCardTitleColor:t.modeCardTitleColor||"#111827",voiceCardIcon:t.voiceCardIcon||"🎤",textCardIcon:t.textCardIcon||"💬",voiceCardTitle:t.voiceCardTitle||null,textCardTitle:t.textCardTitle||null,callButtonText:t.callButtonText||null,chatButtonText:t.chatButtonText||null,statusText:t.statusText||null},t)})(),header:(()=>{var t={};return e.header&&Object.keys(e.header).forEach(n=>{var A=e.header[n];n.startsWith("onlineIndicator")?null!=A&&(t[n]=A):null!=A&&""!==A&&(t[n]=A)}),In({title:t.title||"Chat Assistant",showTitle:!1!==t.showTitle,backgroundColor:t.backgroundColor||"#7C3AED",textColor:t.textColor||"#FFFFFF",showCloseButton:!1!==t.showCloseButton,mobileLabel:t.mobileLabel||"Chat"},t)})(),footer:In({show:!1!==(null===(Le=e.footer)||void 0===Le?void 0:Le.show),backgroundColor:(null===(Re=e.footer)||void 0===Re?void 0:Re.backgroundColor)||"#f9fafb",textColor:(null===(Ke=e.footer)||void 0===Ke?void 0:Ke.textColor)||"#9ca3af",hoverColor:(null===(Oe=e.footer)||void 0===Oe?void 0:Oe.hoverColor)||"#7C3AED"},e.footer),tooltips:In({newChat:(null===(Ve=e.tooltips)||void 0===Ve?void 0:Ve.newChat)||null,back:(null===(Ne=e.tooltips)||void 0===Ne?void 0:Ne.back)||null,close:(null===(je=e.tooltips)||void 0===je?void 0:je.close)||null,mute:(null===(Ge=e.tooltips)||void 0===Ge?void 0:Ge.mute)||null,speaker:(null===(ze=e.tooltips)||void 0===ze?void 0:ze.speaker)||null,endCall:(null===(We=e.tooltips)||void 0===We?void 0:We.endCall)||null},e.tooltips),messages:In({userBackgroundColor:(null===(qe=e.messages)||void 0===qe?void 0:qe.userBackgroundColor)||"#E5E7EB",agentBackgroundColor:(null===(Xe=e.messages)||void 0===Xe?void 0:Xe.agentBackgroundColor)||"#F3F4F6",systemBackgroundColor:(null===(Ye=e.messages)||void 0===Ye?void 0:Ye.systemBackgroundColor)||"#DCFCE7",errorBackgroundColor:(null===(Je=e.messages)||void 0===Je?void 0:Je.errorBackgroundColor)||"#FEE2E2",textColor:(null===(Ze=e.messages)||void 0===Ze?void 0:Ze.textColor)||"#1F2937",userTextColor:(null===($e=e.messages)||void 0===$e?void 0:$e.userTextColor)||(null===(et=e.messages)||void 0===et?void 0:et.textColor)||"#1F2937",agentTextColor:(null===(tt=e.messages)||void 0===tt?void 0:tt.agentTextColor)||(null===(nt=e.messages)||void 0===nt?void 0:nt.textColor)||"#1F2937",userAvatarIcon:(null===(At=e.messages)||void 0===At?void 0:At.userAvatarIcon)||"👤",agentAvatarIcon:(null===(ot=e.messages)||void 0===ot?void 0:ot.agentAvatarIcon)||"🤖",fontSize:(null===(it=e.messages)||void 0===it?void 0:it.fontSize)||"14px",borderRadius:(null===(rt=e.messages)||void 0===rt?void 0:rt.borderRadius)||16},e.messages),animation:In({enableHover:!1!==(null===(at=e.animation)||void 0===at?void 0:at.enableHover),enablePulse:!1!==(null===(st=e.animation)||void 0===st?void 0:st.enablePulse),enableSlide:!1!==(null===(ct=e.animation)||void 0===ct?void 0:ct.enableSlide),duration:(null===(lt=e.animation)||void 0===lt?void 0:lt.duration)||.3},e.animation),promptAnimation:In({enabled:!0===(null===(dt=e.promptAnimation)||void 0===dt?void 0:dt.enabled),text:(null===(pt=e.promptAnimation)||void 0===pt?void 0:pt.text)||"Try me!",backgroundColor:(null===(ut=e.promptAnimation)||void 0===ut?void 0:ut.backgroundColor)||"linear-gradient(135deg, #7c3aed, #4f46e5)",textColor:(null===(ht=e.promptAnimation)||void 0===ht?void 0:ht.textColor)||"#ffffff",animationType:(null===(gt=e.promptAnimation)||void 0===gt?void 0:gt.animationType)||"bounce",showShimmer:!1!==(null===(mt=e.promptAnimation)||void 0===mt?void 0:mt.showShimmer),showPulseRings:!1!==(null===(ft=e.promptAnimation)||void 0===ft?void 0:ft.showPulseRings),hideAfterClick:!1!==(null===(vt=e.promptAnimation)||void 0===vt?void 0:vt.hideAfterClick),hideAfterSeconds:void 0!==(null===(Bt=e.promptAnimation)||void 0===Bt?void 0:Bt.hideAfterSeconds)?e.promptAnimation.hideAfterSeconds:null,position:(null===(wt=e.promptAnimation)||void 0===wt?void 0:wt.position)||"top"},e.promptAnimation),behavior:In({autoOpen:(null===(bt=e.behavior)||void 0===bt?void 0:bt.autoOpen)||!1,startOpen:(null===(yt=e.behavior)||void 0===yt?void 0:yt.startOpen)||!1,hidden:(null===(xt=e.behavior)||void 0===xt?void 0:xt.hidden)||!1,autoConnect:(null===(Ct=e.behavior)||void 0===Ct?void 0:Ct.autoConnect)||!1,showWelcomeMessage:!1!==(null===(Qt=e.behavior)||void 0===Qt?void 0:Qt.showWelcomeMessage),welcomeMessage:(null===(Ft=e.behavior)||void 0===Ft?void 0:Ft.welcomeMessage)||"Hello! How can I help you today?",enableVoiceMode:void 0===(null===(Ut=e.behavior)||void 0===Ut?void 0:Ut.enableVoiceMode)||e.behavior.enableVoiceMode,mode:(null===(St=e.behavior)||void 0===St?void 0:St.mode)||"unified"},e.behavior),accessibility:In({ariaLabel:(null===(kt=e.accessibility)||void 0===kt?void 0:kt.ariaLabel)||"Chat Assistant",ariaDescription:(null===(Et=e.accessibility)||void 0===Et?void 0:Et.ariaDescription)||"Click to open chat assistant",keyboardNavigation:!1!==(null===(It=e.accessibility)||void 0===It?void 0:It.keyboardNavigation)},e.accessibility),customStyles:e.customStyles||"",useShadowDOM:!1!==e.useShadowDOM,variables:e.variables||{},forceConversationId:e.forceConversationId,visualAssistant:e.visualAssistant,flavor:e.flavor&&"object"==typeof e.flavor?e.flavor:null,onConversationStart:e.onConversationStart,onConversationEnd:e.onConversationEnd,onBargeIn:e.onBargeIn,onAudioStartPlaying:e.onAudioStartPlaying,onAudioStoppedPlaying:e.onAudioStoppedPlaying,onSubtitleDisplay:e.onSubtitleDisplay,onVoiceCallButtonClick:e.onVoiceCallButtonClick,primaryColor:_t},"string"==typeof e.position?{positionString:e.position}:{})}setupEventHandlers(){this.sdk.on("domainError",e=>{this.textInterface.showError(e),this.textInterface.stopStreamingState()}),this.sdk.on("error",e=>{e&&("DOMAIN_NOT_WHITELISTED"===e.message||e.message&&e.message.includes("Domain not whitelisted"))||(this.textInterface.showError(e.message||e),this.textInterface.stopStreamingState())}),this.sdk.on("chunk",e=>{this.textInterface.appendStreamingChunk(e)}),this.sdk.on("done",e=>{var{text:t}=e;this.textInterface.finalizeStreaming(t)})}createShadowHost(){var e=document.getElementById("ttp-widget-shadow-host");e&&e.remove();var t=document.createElement("div");t.id="ttp-widget-shadow-host",t.style.cssText="position: fixed; z-index: 10000; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; overflow: visible;",this.shadowRoot=t.attachShadow({mode:"open"}),document.body.appendChild(t)}createRegularContainer(){var e=document.getElementById("ttp-widget-container");e&&e.remove();var t=document.createElement("div");t.id="ttp-widget-container",t.style.cssText="position: fixed; z-index: 10000; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; overflow: visible;",document.body.appendChild(t),this.regularContainer=t}createWidget(){this.container||(this.config.useShadowDOM?(this.createShadowHost(),this.container=this.shadowRoot):(this.createRegularContainer(),this.container=this.regularContainer,this.shadowRoot=document));var e;e=this.config.useShadowDOM?"\n :host {\n all: initial;\n display: block;\n pointer-events: none;\n }\n img {\n max-width: none !important;\n }\n #text-chat-button img {\n width: 28px !important;\n height: 28px !important;\n }\n #text-chat-button {\n pointer-events: auto;\n }\n #text-chat-panel {\n pointer-events: auto;\n }\n .ttp-mobile-fab {\n pointer-events: auto;\n }\n #ttpMobileLanding {\n pointer-events: auto;\n }\n ":'\n /* Reset only problematic inherited styles, not all styles */\n #text-chat-button,\n #text-chat-panel,\n #text-chat-panel * {\n box-sizing: border-box;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n \n /* Prevent theme CSS from affecting images */\n #text-chat-button img,\n #text-chat-panel img {\n max-width: none !important;\n width: auto;\n height: auto;\n }\n \n #text-chat-button img {\n width: 28px !important;\n height: 28px !important;\n }\n \n /* Ensure button and panel can receive clicks */\n #text-chat-button,\n #text-chat-panel,\n .ttp-mobile-fab,\n #ttpMobileLanding {\n pointer-events: auto;\n }\n \n /* Reset any inherited text styles that might break layout */\n #text-chat-panel {\n text-align: left;\n line-height: normal;\n letter-spacing: normal;\n word-spacing: normal;\n text-transform: none;\n text-indent: 0;\n text-shadow: none;\n white-space: normal;\n }\n \n /* Ensure flexbox works properly */\n #text-chat-panel .widget-shell,\n #text-chat-panel .panel-inner,\n #text-chat-panel .widget-container,\n #text-chat-panel .landing-screen,\n #text-chat-panel .voice-interface,\n #text-chat-panel .text-interface,\n #text-chat-panel .widget-header,\n #text-chat-panel .mode-selection {\n display: flex;\n }\n \n #text-chat-panel .widget-shell,\n #text-chat-panel .panel-inner,\n #text-chat-panel .widget-container,\n #text-chat-panel .landing-screen,\n #text-chat-panel .voice-interface,\n #text-chat-panel .text-interface {\n flex-direction: column;\n }\n \n #text-chat-panel .mode-selection {\n flex-direction: row;\n }\n \n /* Ensure proper stacking */\n #text-chat-button {\n z-index: 10001 !important;\n }\n \n #text-chat-panel {\n z-index: 10000 !important;\n }\n ';var t=this.generateWidgetHTML();if(this.config.useShadowDOM){var n="\n <style>".concat(e,"</style>\n ").concat(t,"\n ");this.shadowRoot.innerHTML=n}else this.injectStylesIntoHead(e),this.container.innerHTML=t;this.setupWidgetEvents();var A=this.shadowRoot.getElementById("text-chat-panel");if(A)if(this.config.behavior.startOpen||this.config.behavior.autoOpen)if(window.innerWidth<=768){var o,i,r=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(".ttp-mobile-fab"),a=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("ttpMobileLanding");r&&a&&(r.style.display="none",a.classList.add("active"),this.isMobileLandingOpen=!0),this.hidePrompt()}else this.isOpen=!0,A.classList.add("open"),this.hidePrompt();else this.showPrompt();else setTimeout(()=>{this.showPrompt()},100);setTimeout(()=>{this.isOpen?this.hidePrompt():this.showPrompt()},200)}injectStylesIntoHead(e){var t,n,A=document.getElementById("ttp-widget-styles");A&&A.remove();var o={small:50,medium:60,large:70,xl:80}[null===(t=this.config.button)||void 0===t?void 0:t.size]||60,i={small:20,medium:28,large:36,xl:44}[null===(n=this.config.icon)||void 0===n?void 0:n.size]||28,r=this.generatePositionStyles(),a=this.generateCSS(r,o,i),s=document.createElement("style");s.id="ttp-widget-styles",s.textContent=e+"\n"+a,this.config.customStyles&&(s.textContent+="\n"+this.config.customStyles),document.head.appendChild(s)}generateWidgetHTML(){this.config.position;var e,t=this.config.button,n=this.config.icon,A=(this.config.panel,this.config.header),o=(this.config.animation,{small:50,medium:60,large:70,xl:80}[t.size]||60),i={small:20,medium:28,large:36,xl:44}[n.size]||28,r=this.generatePositionStyles(),a=this.generateIconHTML(i),s=(null===(e=this.config.behavior)||void 0===e?void 0:e.mode)||"unified",c="unified"===s,l="unified"===s||"voice-only"===s,d="unified"===s||"text-only"===s,p=e=>{var t=this.config.language||"en";return(this.translations[t]||this.translations.en)[e]||e},u=e=>{var t,n=null===(t=this.config.tooltips)||void 0===t?void 0:t[e];return null!=n?n:{newChat:p("newChat"),back:p("back"),close:p("close"),mute:p("mute"),speaker:p("speaker"),endCall:p("endCall")}[e]||""},h=this.config.useShadowDOM?"\n <style>\n ".concat(this.generateCSS(r,o,i),"\n ").concat(this.config.customStyles,"\n </style>\n "):"",g=this.config.promptAnimation||{},m=!0===g.enabled,f=m?this.generatePromptBubbleHTML(g,o):"";return console.log("📝 generateWidgetHTML - promptAnimation:",{hasConfig:!!this.config.promptAnimation,promptConfig:g,enabled:g.enabled,isPromptEnabled:m,willGenerateHTML:!!f}),"\n ".concat(h,"\n \n ").concat(this.config.behavior.hidden?"":'\n <div id="text-chat-button-container">\n '.concat(f,"\n ").concat(m&&!1!==g.showPulseRings?this.generatePulseRingsHTML(g):"",'\n <button id="text-chat-button" \n aria-label="').concat(this.config.accessibility.ariaLabel,'"\n aria-description="').concat(this.config.accessibility.ariaDescription,'">\n ').concat(a,'\n </button>\n <button class="ttp-mobile-fab" aria-label="').concat(this.config.accessibility.ariaLabel,'">\n <div class="ttp-mobile-fab__icon-wrap">\n <div class="ttp-mobile-fab__waveform">\n <span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span>\n </div>\n </div>\n <div class="ttp-mobile-fab__label-wrap">\n <span class="ttp-mobile-fab__label">').concat(A.mobileLabel||"Chat",'</span>\n <span class="ttp-mobile-fab__status">\n <span class="ttp-mobile-fab__dot"></span>\n ').concat(void 0!==A.onlineIndicatorText&&null!==A.onlineIndicatorText?A.onlineIndicatorText:p("online"),"\n </span>\n </div>\n </button>\n </div>\n "),"\n\n ").concat(this.config.behavior.hidden?"":'\n <div id="ttpMobileLanding" class="ttp-mobile-landing">\n <div class="ttp-mobile-landing__header">\n <div class="ttp-mobile-landing__avatar">\n <div class="ttp-mobile-landing__waveform">\n <span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span>\n </div>\n </div>\n <div class="ttp-mobile-landing__info">\n <div class="ttp-mobile-landing__name">'.concat(A.title||"Chat Assistant",'</div>\n <div class="ttp-mobile-landing__status">\n <span class="ttp-mobile-landing__dot"></span>\n ').concat(this.config.landing.statusText||p("online")+" • "+(this.config.landing.subtitle||"Ready to help"),'\n </div>\n </div>\n <button class="ttp-mobile-landing__close" aria-label="Close">\n <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>\n </svg>\n </button>\n </div>\n <div class="ttp-mobile-landing__error" id="ttpMobileLandingError" style="display:none;">\n <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">\n <circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>\n </svg>\n <span class="ttp-mobile-landing__error-text"></span>\n </div>\n <div class="ttp-mobile-landing__actions">\n ').concat(l?'\n <button class="ttp-mobile-landing__btn ttp-mobile-landing__btn--call" id="ttpMobileCallBtn">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z"/>\n </svg>\n '.concat(this.config.landing.callButtonText||this.config.landing.voiceCardTitle||p("voiceCall"),"\n </button>\n "):"","\n ").concat(d?'\n <button class="ttp-mobile-landing__btn ttp-mobile-landing__btn--text" id="ttpMobileChatBtn">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>\n </svg>\n '.concat(this.config.landing.chatButtonText||this.config.landing.textCardTitle||p("textChat"),"\n </button>\n "):"","\n </div>\n ").concat(!1!==this.config.footer.show?'\n <div class="ttp-mobile-landing__footer">\n <div class="ttp-mobile-landing__powered">\n <svg viewBox="0 0 24 24" fill="currentColor" width="10" height="10">\n <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>\n </svg>\n Powered by <a href="https://talktopc.com" target="_blank" rel="noopener">TalkToPC</a>\n </div>\n </div>\n ':"","\n </div>\n "),'\n \n <div id="text-chat-panel">\n <div class="widget-shell">\n <div class="panel-inner widget-container" style="direction: ').concat(this.config.direction,';">\n <div class="widget-header" style="background: ').concat(A.backgroundColor||"#7C3AED"," !important; color: ").concat(A.textColor||"#FFFFFF",' !important;">\n <div>\n ').concat(A.showTitle?'<div class="header-title">'.concat(A.title,"</div>"):"",'\n <div class="header-status" style="color: ').concat(A.onlineIndicatorColor||"rgba(255,255,255,0.7)",' !important;">\n <span class="status-dot" style="background: ').concat(A.onlineIndicatorDotColor||"#10b981",' !important;"></span>\n <span>').concat(void 0!==A.onlineIndicatorText&&null!==A.onlineIndicatorText?A.onlineIndicatorText:p("online"),'</span>\n </div>\n </div>\n \n <div style="display: flex; gap: 6px; align-items: center; position: relative; z-index: 1;">\n \x3c!-- New Chat Button (hide on landing screen, show otherwise) --\x3e\n <button class="header-icon new-chat-btn" id="newChatBtn" title="').concat(u("newChat"),'" style="').concat(c?"display: none;":"",'">\n <span style="font-size: 18px; font-weight: bold;">+</span>\n </button>\n \n \x3c!-- Back Button (only show in unified mode) --\x3e\n ').concat("unified"===s?'<button class="header-icon back-btn" id="backBtn" title="'.concat(u("back"),'" style="display: none;">\n <span style="font-size: 16px;">‹</span>\n </button>'):"","\n \n \x3c!-- Close Button --\x3e\n ").concat(A.showCloseButton?'<button class="header-icon close-btn" id="closeBtn" title="'+u("close")+'"><span style="font-size: 18px; font-weight: bold;">×</span></button>':"","\n </div>\n </div>\n\n ").concat(c&&this.landingScreen?this.landingScreen.generateHTML():"","\n\n ").concat(l?this.voiceInterface.generateHTML():"","\n ").concat(d?this.textInterface.generateHTML():"","\n ").concat(this.generateFooterHTML(),"\n </div>\n </div>\n </div>\n ")}generateFooterHTML(){if(!this.config.footer.show)return"";var e=encodeURIComponent(window.location.hostname||"widget"),t="https://talktopc.com?ref=widget&source=".concat(e);return'\n <div class="widget-footer" style="\n padding: 10px 16px;\n text-align: center;\n border-top: 1px solid rgba(0,0,0,0.06);\n font-size: 11px;\n color: #64748b;\n background: #fff;\n flex-shrink: 0;\n ">\n <div class="powered-by" style="\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 4px;\n ">\n <svg viewBox="0 0 24 24" fill="currentColor" style="width: 11px; height: 11px; color: #f59e0b;">\n <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>\n </svg>\n Powered by <a href="'.concat(t,'" target="_blank" rel="noopener noreferrer" style="color: #a855f7; text-decoration: none; font-weight: 500;" onmouseover="this.style.color=\'#9333ea\'" onmouseout="this.style.color=\'#a855f7\'">TalkToPC</a>\n </div>\n </div>\n ')}generatePositionStyles(){var e=this.config.position,t=e.offset||{x:20,y:20},n="";return"top"===e.vertical?n+="top: ".concat(t.y,"px;"):"bottom"===e.vertical?n+="bottom: ".concat(t.y,"px;"):"center"===e.vertical&&(n+="top: 50%; transform: translateY(-50%);"),"left"===e.horizontal?n+="left: ".concat(t.x,"px;"):"right"===e.horizontal?n+="right: ".concat(t.x,"px;"):"center"===e.horizontal&&(n+="left: 50%; transform: translateX(-50%);"),n}generateIconHTML(e){var t=this.config.icon;switch(t.type){case"custom":return'<img src="'.concat(t.customImage,'" alt="Chat Assistant" style="width: ').concat(e,"px; height: ").concat(e,'px; object-fit: contain;" />');case"emoji":return'<span style="font-size: '.concat(e,'px; line-height: 1;">').concat(t.emoji,"</span>");case"text":return'<span style="font-size: '.concat(Math.floor(.6*e),'px; font-weight: bold; color: white;">').concat(t.text,"</span>");case"microphone":default:return'<svg viewBox="0 0 24 24" style="width: '.concat(e,"px; height: ").concat(e,'px; fill: white;">\n <path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/>\n <path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/>\n </svg>');case"chat":return'<svg viewBox="0 0 24 24" style="width: '.concat(e,"px; height: ").concat(e,'px; fill: white;">\n <path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"/>\n </svg>')}}generatePromptBubbleHTML(e,t){var n="#7c3aed";if(e.backgroundColor&&e.backgroundColor.includes("gradient")){var A=e.backgroundColor.match(/#[0-9a-fA-F]{6}/);A&&(n=A[0])}else n=e.backgroundColor;var o="none"===e.animationType?"":"animation-".concat(e.animationType),i=e.showShimmer?'<div class="prompt-bubble-shimmer"></div>':"";return'\n <div class="prompt-bubble '.concat(e.position," ").concat(o,'" \n id="prompt-bubble"\n role="tooltip"\n style="--prompt-bubble-bg-color: ').concat(n,';">\n <div class="prompt-bubble-content" \n style="background: ').concat(e.backgroundColor,"; color: ").concat(e.textColor,';">\n ').concat(i,'\n <span style="position: relative; z-index: 1;">').concat(e.text,'</span>\n </div>\n <div class="prompt-bubble-arrow"></div>\n </div>\n ')}generatePulseRingsHTML(e){var t="#7c3aed";if(e.backgroundColor&&e.backgroundColor.includes("gradient")){var n=e.backgroundColor.match(/#[0-9a-fA-F]{6}/);n&&(t=n[0])}else t=e.backgroundColor;return'\n <div class="prompt-pulse-rings" id="prompt-pulse-rings">\n <div class="prompt-pulse-ring" style="background-color: '.concat(t,'33;"></div>\n <div class="prompt-pulse-ring" style="background-color: ').concat(t,'1a;"></div>\n </div>\n ')}generateCSS(e,t,n){var A,o,i,r,a,s=this.config.button,c=this.config.icon,l=this.config.panel,d=this.config.header,p=(this.config.messages,this.config.animation),u=(null===(A=this.config.behavior)||void 0===A?void 0:A.mode)||"unified",h="unified"===u,g="unified"===u||"voice-only"===u,m="unified"===u||"text-only"===u,f=!1===this.config.useShadowDOM?" !important":"";return'\n /* MOBILE FIRST - Default styles for all devices */\n #text-chat-widget {\n position: fixed !important;\n z-index: 10000;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n /* Mobile defaults */\n right: 10px;\n bottom: 10px;\n left: auto;\n top: auto;\n }\n \n /* Desktop positioning (only on larger screens) */\n @media (min-width: 769px) {\n #text-chat-widget {\n '.concat(e,"\n right: ").concat("right"===this.config.position.horizontal?"20px":"auto",";\n left: ").concat("left"===this.config.position.horizontal?"20px":"auto",";\n bottom: ").concat("bottom"===this.config.position.vertical?"20px":"auto",";\n top: ").concat("top"===this.config.position.vertical?"20px":"auto",";\n }\n }\n \n /* Mobile override (force mobile positioning) */\n @media (max-width: 768px) {\n #text-chat-widget {\n right: 10px !important;\n bottom: 10px !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n }\n }\n \n @media (max-width: 480px) {\n #text-chat-widget {\n right: 8px !important;\n bottom: 8px !important;\n left: auto !important;\n top: auto !important;\n }\n }\n \n #text-chat-button {\n position: relative;\n width: ").concat(t,"px;\n height: ").concat(t,"px;\n margin: 0;\n flex-shrink: 0;\n border-radius: ").concat("circle"===s.shape?"50%":"square"===s.shape?"0":"12px",";\n background: ").concat(s.backgroundColor||c.backgroundColor||"#7C3AED",";\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all ").concat(p.duration,"s ease;\n box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);\n touch-action: manipulation;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n user-select: none;\n min-width: 44px;\n min-height: 44px;\n z-index: 1;\n }\n \n @media (max-width: 768px) {\n #text-chat-widget {\n right: 10px !important;\n bottom: 10px !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n }\n \n #text-chat-button-container {\n width: 56px !important;\n height: 56px !important;\n }\n \n #text-chat-button {\n width: 56px !important;\n height: 56px !important;\n min-width: 56px !important;\n min-height: 56px !important;\n max-width: 56px !important;\n max-height: 56px !important;\n }\n \n #text-chat-panel {\n position: fixed !important;\n left: 10px !important;\n right: 10px !important;\n bottom: 92px !important; /* 56px button + 20px gap + 16px footer */\n top: 60px !important; /* Add top spacing */\n width: auto !important;\n max-width: none !important;\n height: auto !important; /* Change from max-height to auto */\n max-height: none !important; /* Remove max-height */\n transform: none !important;\n margin: 0 !important;\n }\n \n #text-chat-panel .widget-header {\n padding: 10px 14px;\n min-height: 56px;\n }\n \n #text-chat-panel .header-title {\n font-size: 15px;\n }\n \n #text-chat-panel .header-icon {\n width: 40px;\n height: 40px;\n min-width: 40px;\n min-height: 40px;\n }\n \n #text-chat-input {\n font-size: 16px !important; /* Prevents iOS zoom on focus */\n padding: 12px 16px !important;\n min-height: 48px !important;\n }\n \n #text-chat-send {\n min-width: 48px !important;\n min-height: 48px !important;\n width: 48px !important;\n height: 48px !important;\n }\n \n .landing-screen {\n padding: 16px;\n }\n \n .landing-logo {\n font-size: 40px;\n }\n \n .landing-title {\n font-size: 18px;\n margin-bottom: 16px;\n }\n \n .mode-selection {\n flex-direction: column;\n gap: 12px;\n align-items: center;\n }\n \n .mode-card {\n max-width: 100%;\n width: 100%;\n padding: 16px;\n }\n \n .mode-card-icon {\n width: 50px;\n height: 50px;\n font-size: 28px;\n }\n \n .mode-card-title {\n font-size: 14px;\n }\n }\n \n @media (max-width: 480px) {\n #text-chat-widget {\n right: 8px !important;\n bottom: 8px !important;\n left: auto !important;\n top: auto !important;\n }\n \n #text-chat-button-container {\n width: 54px !important;\n height: 54px !important;\n }\n \n #text-chat-button {\n width: 54px !important;\n height: 54px !important;\n min-width: 54px !important;\n min-height: 54px !important;\n }\n \n #text-chat-panel {\n left: 8px !important;\n right: 8px !important;\n bottom: 86px !important; /* 54px button + 20px gap + 12px footer */\n top: 50px !important; /* Add top spacing for very small screens */\n height: auto !important;\n max-height: none !important;\n }\n \n #text-chat-panel .widget-header {\n padding: 8px 12px;\n min-height: 52px;\n }\n \n #text-chat-panel .header-title {\n font-size: 14px;\n }\n \n .landing-logo {\n font-size: 36px;\n }\n \n .landing-title {\n font-size: 16px;\n }\n }\n \n ").concat(p.enableHover?"\n #text-chat-button:hover {\n ".concat(s.hoverColor?"background: ".concat(s.hoverColor,";"):"","\n transform: scale(1.05);\n box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);\n }\n "):"","\n \n /* Prompt Animation Keyframes */\n @keyframes widget-shimmer {\n 0% { transform: translateX(-100%); }\n 100% { transform: translateX(200%); }\n }\n \n @keyframes widget-ripple {\n 0% { transform: scale(1); opacity: 0.6; }\n 100% { transform: scale(2.5); opacity: 0; }\n }\n \n @keyframes widget-float {\n 0%, 100% { transform: translateX(-50%) translateY(0); }\n 50% { transform: translateX(-50%) translateY(-8px); }\n }\n \n @keyframes widget-bounce {\n 0%, 100% { transform: translateX(-50%) translateY(0); }\n 50% { transform: translateX(-50%) translateY(-10px); }\n }\n \n @keyframes widget-pulse-ring {\n 0% { transform: scale(1); opacity: 0.4; }\n 100% { transform: scale(1.8); opacity: 0; }\n }\n \n /* Prompt Bubble Container */\n #text-chat-button-container {\n position: fixed;\n ").concat("bottom"===this.config.position.vertical?"bottom: ".concat((null===(o=this.config.position.offset)||void 0===o?void 0:o.y)||20,"px;"):"top: ".concat((null===(i=this.config.position.offset)||void 0===i?void 0:i.y)||20,"px;"),"\n ").concat("right"===this.config.position.horizontal?"right: ".concat((null===(r=this.config.position.offset)||void 0===r?void 0:r.x)||20,"px;"):"left: ".concat((null===(a=this.config.position.offset)||void 0===a?void 0:a.x)||20,"px;"),"\n width: ").concat(t,"px;\n height: ").concat(t,"px;\n z-index: 10001;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n @media (max-width: 768px) {\n #text-chat-button-container {\n right: 10px !important;\n bottom: 10px !important;\n left: auto !important;\n top: auto !important;\n }\n }\n \n @media (max-width: 480px) {\n #text-chat-button-container {\n right: 8px !important;\n bottom: 8px !important;\n left: auto !important;\n top: auto !important;\n }\n }\n \n /* Prompt Bubble Styles */\n .prompt-bubble {\n position: absolute;\n z-index: 10002;\n pointer-events: none;\n white-space: nowrap;\n }\n \n .prompt-bubble.top {\n bottom: calc(100% + 18px);\n left: 50%;\n transform: translateX(-50%);\n }\n \n .prompt-bubble.left {\n right: calc(100% + 12px);\n top: 50%;\n transform: translateY(-50%);\n }\n \n .prompt-bubble.right {\n left: calc(100% + 12px);\n top: 50%;\n transform: translateY(-50%);\n }\n \n /* Ensure animations preserve horizontal centering for top position */\n .prompt-bubble.top.animation-bounce {\n animation: widget-bounce 1s ease-in-out infinite;\n transform: translateX(-50%); /* Keep centering */\n }\n \n .prompt-bubble.top.animation-float {\n animation: widget-float 2s ease-in-out infinite;\n transform: translateX(-50%); /* Keep centering */\n }\n \n .prompt-bubble.top.animation-pulse {\n animation: pulse 2s ease-in-out infinite;\n transform: translateX(-50%); /* Keep centering */\n }\n \n .prompt-bubble-content {\n position: relative;\n padding: 8px 16px;\n border-radius: 20px;\n font-weight: 500;\n font-size: 14px;\n box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);\n overflow: hidden;\n }\n \n .prompt-bubble-shimmer {\n position: absolute;\n inset: 0;\n background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);\n animation: widget-shimmer 2s infinite;\n }\n \n .prompt-bubble.animation-bounce {\n animation: widget-bounce 1s ease-in-out infinite;\n }\n \n .prompt-bubble.animation-pulse {\n animation: pulse 2s ease-in-out infinite;\n }\n \n .prompt-bubble.animation-float {\n animation: widget-float 2s ease-in-out infinite;\n }\n \n /* Ensure top-positioned bubbles maintain horizontal centering during animations */\n .prompt-bubble.top.animation-bounce,\n .prompt-bubble.top.animation-float,\n .prompt-bubble.top.animation-pulse {\n /* Animation keyframes already include translateX(-50%) for centering */\n }\n \n /* Prompt Bubble Arrow */\n .prompt-bubble-arrow {\n position: absolute;\n width: 0;\n height: 0;\n border: 8px solid transparent;\n }\n \n .prompt-bubble.top .prompt-bubble-arrow {\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n border-top-color: var(--prompt-bubble-bg-color, #7c3aed);\n border-bottom: none;\n margin-left: 0;\n }\n \n .prompt-bubble.left .prompt-bubble-arrow {\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n border-left-color: var(--prompt-bubble-bg-color, #7c3aed);\n border-right: none;\n }\n \n .prompt-bubble.right .prompt-bubble-arrow {\n right: 100%;\n top: 50%;\n transform: translateY(-50%);\n border-right-color: var(--prompt-bubble-bg-color, #7c3aed);\n border-left: none;\n }\n \n /* Pulse Rings */\n .prompt-pulse-rings {\n position: absolute;\n inset: 0;\n border-radius: 50%;\n pointer-events: none;\n }\n \n .prompt-pulse-ring {\n position: absolute;\n inset: 0;\n border-radius: 50%;\n animation: widget-pulse-ring 2s ease-out infinite;\n }\n \n .prompt-pulse-ring:nth-child(2) {\n animation-delay: 0.5s;\n }\n \n /* Mobile adjustments for prompt bubble */\n @media (max-width: 768px) {\n .prompt-bubble-content {\n font-size: 12px;\n padding: 6px 12px;\n }\n \n .prompt-bubble.top {\n bottom: calc(100% + 14px);\n }\n \n .prompt-bubble.left,\n .prompt-bubble.right {\n display: none; /* Hide side prompts on mobile */\n }\n }\n \n #text-chat-panel {\n display: none").concat(f,";\n position: fixed;\n bottom: calc(").concat(t,"px + 20px + 20px); /* Button + gap + reduced footer offset */\n ").concat("right"===this.config.position.horizontal?"right: 20px;":"left: 20px;","\n width: ").concat(l.width,"px;\n max-width: calc(100vw - 40px);\n height: ").concat(l.height,"px;\n max-height: calc(100vh - ").concat(t,"px - 40px - 20px); /* Account for footer height */\n background: transparent;\n border-radius: ").concat(l.borderRadius,"px;\n border: none;\n flex-direction: column;\n overflow: hidden;\n ").concat(l.backdropFilter?"backdrop-filter: ".concat(l.backdropFilter,";"):"","\n ").concat(p.enableSlide?"transition: all ".concat(p.duration,"s ease;"):"","\n box-sizing: border-box;\n }\n \n #text-chat-panel.open {\n display: flex").concat(f,";\n ").concat(p.enableSlide?"transform: translateY(0); opacity: 1;":"","\n }\n\n /* Shell for gradient border/background */\n .widget-shell { width: 100%; height: 100%; padding: 0; border-radius: ").concat(l.borderRadius,"px; background: transparent; box-shadow: 0 20px 60px rgba(0,0,0,0.15); overflow: hidden; display: flex; flex-direction: column; box-sizing: border-box; }\n .panel-inner { width: 100%; height: 100%; background: #ffffff; border-radius: ").concat(l.borderRadius,"px; border: ").concat(l.border,"; overflow: hidden; display:flex; flex-direction: column; padding: 0; box-sizing: border-box; max-width: 100%; }\n\n /* New structure styles matching provided design */\n #text-chat-panel .widget-container {\n width: 100%; height: 100%; background: #FFFFFF; overflow: visible; display: flex; flex-direction: column; border-radius: ").concat(l.borderRadius,"px;\n container-type: size;\n }\n \n /* Ensure content areas can scroll when height is constrained */\n #text-chat-panel .widget-container > .landing-screen,\n #text-chat-panel .widget-container > .voice-interface,\n #text-chat-panel .widget-container > .text-interface {\n flex: 1;\n overflow-y: auto;\n overflow-x: visible; /* Change from hidden to visible */\n }\n \n /* Header should not scroll */\n #text-chat-panel .widget-header {\n padding: 14px 16px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-top-left-radius: ").concat(l.borderRadius,"px;\n border-top-right-radius: ").concat(l.borderRadius,"px;\n flex-shrink: 0;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n background: ").concat(d.backgroundColor||"#7C3AED").concat(f,";\n color: ").concat(d.textColor||"#FFFFFF").concat(f,";\n }\n \n #text-chat-panel .widget-header::before {\n content: '';\n position: absolute;\n top: -50%;\n right: -20%;\n width: 180px;\n height: 180px;\n background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);\n pointer-events: none;\n }\n \n #text-chat-panel .widget-header > div:first-child {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n position: relative;\n z-index: 1;\n }\n \n #text-chat-panel .header-title { font-size: 15px; font-weight: 600; margin: 0; }\n #text-chat-panel .header-status { display: flex; align-items: center; gap: 5px; font-size: 12px; margin: 0; }\n #text-chat-panel .status-dot { width: 6px; height: 6px; border-radius: 50%; animation: pulse 2s ease-in-out infinite; }\n /* Online indicator customization - inline styles take precedence */\n @keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.15); opacity: 0.8; } }\n /* Header icon buttons */\n .header-icon {\n background: rgba(255, 255, 255, 0.1);\n border: none;\n color: white;\n width: 34px;\n height: 34px;\n min-width: 34px;\n min-height: 34px;\n border-radius: 10px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.2s;\n flex-shrink: 0;\n font-size: 16px;\n padding: 0;\n box-sizing: border-box;\n position: relative;\n z-index: 1;\n }\n \n .header-icon:hover {\n background: rgba(255, 255, 255, 0.2);\n }\n \n .header-icon svg {\n pointer-events: none;\n stroke: white;\n fill: none;\n }\n \n .back-btn.visible {\n display: flex !important;\n }\n\n ").concat(h&&this.landingScreen?this.landingScreen.generateCSS():"","\n\n ").concat(g?this.voiceInterface.generateCSS():"","\n ").concat(m?this.textInterface.generateCSS():"","\n \n /* Footer Branding */\n .widget-footer {\n box-sizing: border-box;\n }\n \n .footer-brand-link {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n }\n \n .footer-brand-link:hover {\n opacity: 0.9;\n }\n \n @media (max-width: 768px) {\n .widget-footer {\n height: 32px;\n }\n .widget-footer span {\n font-size: 10px;\n }\n .widget-footer span:last-child {\n font-size: 8px;\n }\n }\n \n #text-chat-send-hint {\n text-align: center;\n line-height: 1.4;\n }\n \n .agent-thinking {\n font-style: italic;\n color: #6B7280;\n }\n\n /* ========================================\n MOBILE PILL BUTTON & LANDING OVERLAY\n Hidden on desktop, shown on mobile only\n ======================================== */\n .ttp-mobile-fab {\n display: none;\n }\n\n .ttp-mobile-landing {\n display: none;\n }\n\n @keyframes ttpWaveAnimation {\n 0%, 100% { transform: scaleY(0.4); }\n 50% { transform: scaleY(1); }\n }\n\n @keyframes ttpPulseAnimation {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n\n @media (max-width: 768px) {\n /* Hide desktop circle button on mobile */\n #text-chat-button {\n display: none !important;\n }\n\n /* Re-flow the container for pill shape */\n #text-chat-button-container {\n width: auto !important;\n height: auto !important;\n min-width: 0 !important;\n min-height: 0 !important;\n max-width: none !important;\n max-height: none !important;\n }\n\n /* Show mobile pill button */\n .ttp-mobile-fab {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 16px 10px 12px;\n background: linear-gradient(135deg, #581c87, ").concat(d.backgroundColor||"#7C3AED",");\n border: none;\n border-radius: 24px;\n cursor: pointer;\n box-shadow: 0 8px 24px rgba(88, 28, 135, 0.4);\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n z-index: 1;\n font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;\n touch-action: manipulation;\n -webkit-tap-highlight-color: transparent;\n }\n\n .ttp-mobile-fab:hover {\n transform: translateY(-3px);\n box-shadow: 0 12px 32px rgba(88, 28, 135, 0.5);\n }\n\n .ttp-mobile-fab__icon-wrap {\n width: 36px;\n height: 36px;\n border-radius: 50%;\n background: rgba(255, 255, 255, 0.15);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n\n .ttp-mobile-fab__waveform {\n display: flex;\n align-items: center;\n gap: 2px;\n height: 16px;\n }\n\n .ttp-mobile-fab__waveform .bar {\n width: 2px;\n background: #fff;\n border-radius: 1px;\n animation: ttpWaveAnimation 0.8s ease-in-out infinite;\n }\n\n .ttp-mobile-fab__waveform .bar:nth-child(1) { height: 5px; animation-delay: 0s; }\n .ttp-mobile-fab__waveform .bar:nth-child(2) { height: 10px; animation-delay: 0.1s; }\n .ttp-mobile-fab__waveform .bar:nth-child(3) { height: 16px; animation-delay: 0.2s; }\n .ttp-mobile-fab__waveform .bar:nth-child(4) { height: 8px; animation-delay: 0.3s; }\n .ttp-mobile-fab__waveform .bar:nth-child(5) { height: 12px; animation-delay: 0.4s; }\n\n .ttp-mobile-fab__label-wrap {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 1px;\n }\n\n .ttp-mobile-fab__label {\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n line-height: 1.2;\n }\n\n .ttp-mobile-fab__status {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 11px;\n color: rgba(255, 255, 255, 0.7);\n line-height: 1.2;\n }\n\n .ttp-mobile-fab__dot {\n width: 6px;\n height: 6px;\n background: ").concat(d.onlineIndicatorDotColor||"#10b981",";\n border-radius: 50%;\n box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);\n }\n\n /* ---- Mobile Landing Overlay ---- */\n .ttp-mobile-landing.active {\n display: block;\n position: fixed;\n bottom: 16px;\n left: 12px;\n right: 12px;\n background: linear-gradient(135deg, #581c87 0%, ").concat(d.backgroundColor||"#7C3AED"," 100%);\n border-radius: 20px;\n overflow: hidden;\n box-shadow:\n 0 10px 40px rgba(88, 28, 135, 0.4),\n 0 0 0 1px rgba(255, 255, 255, 0.1) inset;\n z-index: 10002;\n font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;\n }\n\n .ttp-mobile-landing::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 1px;\n background: linear-gradient(90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.3) 50%,\n transparent 100%);\n }\n\n .ttp-mobile-landing__header {\n padding: 14px 16px;\n display: flex;\n align-items: center;\n gap: 12px;\n }\n\n .ttp-mobile-landing__avatar {\n width: 44px;\n height: 44px;\n border-radius: 12px;\n background: rgba(255, 255, 255, 0.15);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n\n .ttp-mobile-landing__waveform {\n display: flex;\n align-items: center;\n gap: 3px;\n height: 20px;\n }\n\n .ttp-mobile-landing__waveform .bar {\n width: 3px;\n background: rgba(255, 255, 255, 0.9);\n border-radius: 2px;\n animation: ttpWaveAnimation 0.8s ease-in-out infinite;\n }\n\n .ttp-mobile-landing__waveform .bar:nth-child(1) { height: 6px; animation-delay: 0s; }\n .ttp-mobile-landing__waveform .bar:nth-child(2) { height: 12px; animation-delay: 0.1s; }\n .ttp-mobile-landing__waveform .bar:nth-child(3) { height: 20px; animation-delay: 0.2s; }\n .ttp-mobile-landing__waveform .bar:nth-child(4) { height: 10px; animation-delay: 0.3s; }\n .ttp-mobile-landing__waveform .bar:nth-child(5) { height: 16px; animation-delay: 0.4s; }\n\n .ttp-mobile-landing__info {\n flex: 1;\n min-width: 0;\n }\n\n .ttp-mobile-landing__name {\n color: #fff;\n font-size: 15px;\n font-weight: 600;\n margin-bottom: 2px;\n }\n\n .ttp-mobile-landing__status {\n color: rgba(255, 255, 255, 0.7);\n font-size: 12px;\n display: flex;\n align-items: center;\n gap: 5px;\n }\n\n .ttp-mobile-landing__dot {\n width: 6px;\n height: 6px;\n background: ").concat(d.onlineIndicatorDotColor||"#10b981",";\n border-radius: 50%;\n animation: ttpPulseAnimation 2s ease-in-out infinite;\n }\n\n .ttp-mobile-landing__close {\n width: 32px;\n height: 32px;\n border-radius: 10px;\n background: rgba(255, 255, 255, 0.1);\n border: none;\n color: rgba(255, 255, 255, 0.7);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: all 0.2s;\n flex-shrink: 0;\n }\n\n .ttp-mobile-landing__close:hover {\n background: rgba(255, 255, 255, 0.2);\n color: #fff;\n }\n\n .ttp-mobile-landing__error {\n margin: 0 14px 10px;\n padding: 10px 12px;\n background: #fef2f2;\n border: 1px solid #fecaca;\n border-radius: 10px;\n display: flex;\n align-items: flex-start;\n gap: 8px;\n color: #b91c1c;\n font-size: 13px;\n line-height: 1.4;\n }\n .ttp-mobile-landing__error svg {\n flex-shrink: 0;\n margin-top: 1px;\n stroke: #dc2626;\n }\n\n .ttp-mobile-landing__actions {\n padding: 0 14px 14px;\n display: flex;\n gap: 10px;\n }\n\n .ttp-mobile-landing__btn {\n flex: 1;\n padding: 14px;\n border-radius: 12px;\n border: none;\n cursor: pointer;\n font-family: inherit;\n font-size: 14px;\n font-weight: 600;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n touch-action: manipulation;\n -webkit-tap-highlight-color: transparent;\n }\n\n .ttp-mobile-landing__btn svg {\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n }\n\n .ttp-mobile-landing__btn--call {\n background: #fff;\n color: ").concat(d.backgroundColor||"#7C3AED",";\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n\n .ttp-mobile-landing__btn--call:hover {\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);\n }\n\n .ttp-mobile-landing__btn--text {\n background: rgba(255, 255, 255, 0.15);\n color: #fff;\n border: 1px solid rgba(255, 255, 255, 0.1);\n }\n\n .ttp-mobile-landing__btn--text:hover {\n background: rgba(255, 255, 255, 0.2);\n border-color: rgba(255, 255, 255, 0.2);\n }\n\n .ttp-mobile-landing__footer {\n padding: 10px 16px;\n display: flex;\n justify-content: center;\n border-top: 1px solid rgba(255, 255, 255, 0.08);\n }\n\n .ttp-mobile-landing__powered {\n color: rgba(255, 255, 255, 0.4);\n font-size: 11px;\n display: flex;\n align-items: center;\n gap: 4px;\n }\n\n .ttp-mobile-landing__powered svg {\n width: 10px;\n height: 10px;\n color: #f59e0b;\n }\n\n .ttp-mobile-landing__powered a {\n color: rgba(255, 255, 255, 0.6);\n text-decoration: none;\n }\n\n .ttp-mobile-landing__powered a:hover {\n color: #fff;\n }\n }\n ")}setupWidgetEvents(){var e,t=this;if(this.shadowRoot){this.setupPromptAnimation();var n=this.shadowRoot.getElementById("text-chat-button");n&&(n.onclick=()=>{this.config.promptAnimation.hideAfterClick&&this.hidePrompt(),this.togglePanel()});var A=this.shadowRoot.getElementById("closeBtn");A&&(A.onclick=()=>{this._doTogglePanel()});var o,i=(null===(e=this.config.behavior)||void 0===e?void 0:e.mode)||"unified",r="unified"===i,a="unified"===i||"voice-only"===i,s="unified"===i||"text-only"===i,c=this.shadowRoot.getElementById("backBtn"),l=this.shadowRoot.getElementById("landingScreen"),d=this.shadowRoot.getElementById("textInterface"),p=this.shadowRoot.getElementById("voiceInterface");c&&(c.onclick=()=>{var e,t,n;if(null!==(e=this.voiceInterface)&&void 0!==e&&e.isShowingDomainError)return console.log("🔙 Back button clicked - clearing domain error and returning to landing"),this.voiceInterface.isShowingDomainError=!1,null!==(n=this.voiceInterface)&&void 0!==n&&n.resetConnectingState&&this.voiceInterface.resetConnectingState(),void this.showLanding();if(null!==(t=this.voiceInterface)&&void 0!==t&&t.isActive)this.showBackButtonWarning();else if(window.innerWidth<=768){var A=this.shadowRoot.getElementById("text-chat-panel");A&&(A.classList.remove("open"),this.isOpen=!1);var o=this.shadowRoot.querySelector(".ttp-mobile-fab");o&&(o.style.display=""),this.showLanding()}else this.showLanding()}),r&&this.landingScreen?(this.landingScreen.setupEventHandlers({onSelectVoice:(o=kn(function*(){if(t.isStartingCall)console.log("⚠️ Call already starting, ignoring duplicate click");else{if("function"==typeof t.config.onVoiceCallButtonClick)try{t.config.onVoiceCallButtonClick({timestamp:Date.now(),widgetState:"start"})}catch(e){console.error("Error in onVoiceCallButtonClick callback:",e)}t.isStartingCall=!0;try{var e,n;if(t.showVoice(),null!==(e=t.voiceInterface)&&void 0!==e&&e.isMobile){var A,o,i,r,a,s=(null===(A=t.shadowRoot)||void 0===A?void 0:A.getElementById("text-chat-panel"))||document.getElementById("text-chat-panel");s&&(s.classList.remove("open"),s.style.display="none");var c=null===(o=t.voiceInterface)||void 0===o||null===(o=o.shadowRoot)||void 0===o?void 0:o.getElementById("voiceIdleState");c&&(c.style.display="none");var l=(null===(i=t.shadowRoot)||void 0===i?void 0:i.getElementById("text-chat-button"))||document.getElementById("text-chat-button");l&&(l.style.display="none");var d,p,u=null===(r=t.shadowRoot)||void 0===r?void 0:r.querySelector(".ttp-mobile-fab");u&&(u.style.display="none"),null!==(a=t.voiceInterface)&&void 0!==a&&a.createMobileMinimizedBar&&(t.voiceInterface.createMobileMinimizedBar(),t.voiceInterface.updateMobileStatus("connecting"),null===(d=(p=t.voiceInterface).startWaveformAnimation)||void 0===d||d.call(p),yield new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))))}else{var h;null!==(h=t.voiceInterface)&&void 0!==h&&h.showConnectingState&&t.voiceInterface.showConnectingState()}if(yield t.startVoiceCall(),null!==(n=t.voiceInterface)&&void 0!==n&&n.isActive)console.log("✅ Voice call started successfully");else{var g,m,f;console.warn("⚠️ startVoiceCall() returned but call is not active");var v=null===(g=t.voiceInterface)||void 0===g||null===(g=g.shadowRoot)||void 0===g?void 0:g.getElementById("voiceIdleState"),B=!1;if(v&&"none"!==v.style.display){var w=v.querySelector(".voice-status-title");if(w){var b,y=w.textContent.trim(),x=null===(b=t.voiceInterface)||void 0===b?void 0:b.t("domainNotValidated");console.log("🔍 Checking for domain error - titleText:",y,"domainErrorTitle:",x),(y===x||y.includes("Domain not")||y.includes("not whitelisted"))&&(B=!0,console.log("🚫 Domain error detected - staying on voice interface, NOT returning to landing"))}}if(B)return t.currentView="voice",t.showVoice(),void console.log("✅ Staying on voice interface with domain error displayed");console.log("⚠️ Not a domain error - returning to landing screen"),null!==(m=t.voiceInterface)&&void 0!==m&&m.resetConnectingState&&t.voiceInterface.resetConnectingState(),"unified"===((null===(f=t.config.behavior)||void 0===f?void 0:f.mode)||"unified")&&t.showLanding()}}catch(e){var C,Q,F,U;if(e.isServerRejection||"ServerRejected"===e.name)return void(null!==(U=t.voiceInterface)&&void 0!==U&&U.resetConnectingState&&t.voiceInterface.resetConnectingState());if(console.error("❌ Failed to start voice call:",e),null!==(C=t.voiceInterface)&&void 0!==C&&C.resetConnectingState&&t.voiceInterface.resetConnectingState(),null!==(Q=t.voiceInterface)&&void 0!==Q&&Q.isMobile){var S,k,E;document.getElementById("mobile-voice-call-bar-container")&&null!==(S=t.voiceInterface)&&void 0!==S&&S.removeMobileMinimizedBar&&t.voiceInterface.removeMobileMinimizedBar();var I=(null===(k=t.shadowRoot)||void 0===k?void 0:k.getElementById("text-chat-button"))||document.getElementById("text-chat-button");I&&(I.style.display="");var T=null===(E=t.shadowRoot)||void 0===E?void 0:E.querySelector(".ttp-mobile-fab");T&&(T.style.display="")}"Call cancelled by user"!==e.message&&t.showErrorToast(e.message||"Failed to start voice call. Please try again.","error"),"unified"===((null===(F=t.config.behavior)||void 0===F?void 0:F.mode)||"unified")&&t.showLanding()}finally{t.isStartingCall=!1}}}),function(){return o.apply(this,arguments)}),onSelectText:()=>this.showText()}),"text"===this.currentView?(l&&l.classList.remove("active"),d&&d.classList.add("active"),p&&p.classList.remove("active"),c&&"unified"===i&&c.classList.add("visible"),u&&(u.style.display="")):"voice"===this.currentView?(l&&l.classList.remove("active"),d&&d.classList.remove("active"),p&&p.classList.add("active"),c&&"unified"===i&&c.classList.add("visible"),u&&(u.style.display="none")):(this.currentView="landing",l&&l.classList.add("active"),d&&d.classList.remove("active"),p&&p.classList.remove("active"),c&&"unified"===i&&c.classList.remove("visible"))):"voice-only"===i?(p&&p.classList.add("active"),d&&d.classList.remove("active"),l&&l.classList.remove("active")):"text-only"===i&&(d&&d.classList.add("active"),p&&p.classList.remove("active"),l&&l.classList.remove("active")),a&&(console.log("⚙️ Setting up voice interface event handlers"),this.voiceInterface.setupEventHandlers()),s&&(console.log("⚙️ Setting up text interface event handlers"),this.textInterface.setupEventHandlers());var u=this.shadowRoot.getElementById("newChatBtn");u&&(u.onclick=()=>this.textInterface.startNewChat(),r&&(u.style.display="none")),this.setupMobileWidgetEvents(),this.config.accessibility.keyboardNavigation&&this.setupKeyboardNavigation()}}startNewChat(){this.textInterface.startNewChat()}showLanding(){var e;if(this.shadowRoot){var t=null===(e=this.voiceInterface)||void 0===e||null===(e=e.shadowRoot)||void 0===e?void 0:e.getElementById("voiceIdleState");if(t&&"none"!==t.style.display){var n=t.querySelector(".voice-status-title");if(n){var A,o=n.textContent.trim();if(o===(null===(A=this.voiceInterface)||void 0===A?void 0:A.t("domainNotValidated"))||o.includes("Domain not")||o.includes("not whitelisted"))return void console.log("🚫 showLanding() called but domain error is displayed - preventing return to landing")}}if("unified"===(this.config.behavior.mode||"unified")){this.currentView="landing";var i=this.shadowRoot.getElementById("landingScreen"),r=this.shadowRoot.getElementById("textInterface"),a=this.shadowRoot.getElementById("voiceInterface"),s=this.shadowRoot.getElementById("backBtn"),c=this.shadowRoot.getElementById("newChatBtn");i&&i.classList.add("active"),r&&r.classList.remove("active"),a&&a.classList.remove("active"),s&&s.classList.remove("visible"),c&&(c.style.display="none")}}}showText(){if(this.shadowRoot){this.currentView="text";var e=this.shadowRoot.getElementById("landingScreen"),t=this.shadowRoot.getElementById("voiceInterface"),n=this.shadowRoot.getElementById("backBtn"),A=this.shadowRoot.getElementById("newChatBtn");e&&e.classList.remove("active"),t&&t.classList.remove("active"),this.textInterface.show();var o=this.config.behavior.mode||"unified";n&&"unified"===o&&n.classList.add("visible"),A&&(A.style.display="")}}showVoice(){if(this.shadowRoot){this.currentView="voice";var e=this.shadowRoot.getElementById("landingScreen"),t=this.shadowRoot.getElementById("textInterface"),n=this.shadowRoot.getElementById("voiceInterface"),A=this.shadowRoot.getElementById("backBtn"),o=this.shadowRoot.getElementById("newChatBtn");e&&e.classList.remove("active"),t&&t.classList.remove("active"),n&&n.classList.add("active");var i=this.config.behavior.mode||"unified";A&&"unified"===i&&A.classList.add("visible"),o&&(o.style.display="none")}}setupMobileWidgetEvents(){if(this.shadowRoot){var e=this.shadowRoot.querySelector(".ttp-mobile-fab"),t=this.shadowRoot.getElementById("ttpMobileLanding");if(e&&t){var n=()=>{t.classList.remove("active"),e.style.display="",this.isMobileLandingOpen=!1};e.onclick=()=>{this.config.promptAnimation.hideAfterClick&&this.hidePrompt();var n=this.shadowRoot.getElementById("ttpMobileLandingError");n&&(n.style.display="none"),e.style.display="none",t.classList.add("active"),this.isMobileLandingOpen=!0};var A=t.querySelector(".ttp-mobile-landing__close");A&&(A.onclick=n);var o=this.shadowRoot.getElementById("ttpMobileCallBtn");o&&(o.onclick=()=>{n();var e=this.shadowRoot.getElementById("mode-card-voice");e?e.click():this.showVoice()});var i=this.shadowRoot.getElementById("ttpMobileChatBtn");i&&(i.onclick=()=>{n();var t=this.shadowRoot.getElementById("text-chat-panel");t&&(t.classList.add("open"),this.isOpen=!0),e.style.display="none",this.showText()}),document.addEventListener("click",A=>{if(this.isMobileLandingOpen){var o=A.composedPath();o.includes(t)||o.includes(e)||n()}}),document.addEventListener("keydown",e=>{"Escape"===e.key&&this.isMobileLandingOpen&&n()})}}}setupKeyboardNavigation(){document.addEventListener("keydown",e=>{"Escape"===e.key&&this.isOpen&&this.togglePanel()})}setupPromptAnimation(){var e=this;if(this.shadowRoot){var t=this.config.promptAnimation||{},n=!0===t.enabled;if(console.log("🎨 setupPromptAnimation called:",{hasPromptConfig:!!this.config.promptAnimation,promptConfig:t,enabled:t.enabled,isPromptEnabled:n,isOpen:this.isOpen}),!n)return console.log("❌ Prompt disabled, hiding"),void this.hidePrompt();if(this.isOpen?this.hidePrompt():this.showPrompt(),!this.isOpen&&null!==t.hideAfterSeconds&&t.hideAfterSeconds>0&&(this.promptAutoHideTimer=setTimeout(()=>{this.hidePrompt()},1e3*t.hideAfterSeconds)),this.voiceInterface&&this.voiceInterface.sdk){var A=this.config.onConversationStart;this.config.onConversationStart=function(){var t=e.shadowRoot.getElementById("prompt-pulse-rings");t&&(t.style.display="none"),A&&A(...arguments)},this.voiceInterface.sdk.voiceSDK&&this.voiceInterface.sdk.voiceSDK.on("recordingStarted",()=>{var e=this.shadowRoot.getElementById("prompt-pulse-rings");e&&(e.style.display="none")})}}}hidePrompt(){if(this.shadowRoot){this.promptAutoHideTimer&&(clearTimeout(this.promptAutoHideTimer),this.promptAutoHideTimer=null);var e=this.shadowRoot.getElementById("prompt-bubble");e||this.shadowRoot===document||(e=document.getElementById("prompt-bubble")),e&&(e.style.display="none",e.style.visibility="hidden");var t=this.shadowRoot.getElementById("prompt-pulse-rings");t||this.shadowRoot===document||(t=document.getElementById("prompt-pulse-rings")),t&&(t.style.display="none",t.style.visibility="hidden")}}showPrompt(){if(this.shadowRoot){var e=this.config.promptAnimation||{},t=!1!==e.enabled;if(console.log("👁️ showPrompt called:",{hasPromptConfig:!!this.config.promptAnimation,promptConfig:e,enabled:e.enabled,isPromptEnabled:t,shadowRoot:!!this.shadowRoot}),t){var n=()=>{var t=this.shadowRoot.getElementById("prompt-bubble");if(t||this.shadowRoot===document||(t=document.getElementById("prompt-bubble")),t?(t.style.display="block",t.style.visibility="visible",t.style.opacity="1",console.log("✅ Prompt bubble shown:",t)):console.warn("⚠️ Prompt bubble not found in shadowRoot or document"),!1!==e.showPulseRings){var n=this.shadowRoot.getElementById("prompt-pulse-rings");n||this.shadowRoot===document||(n=document.getElementById("prompt-pulse-rings")),n&&(n.style.display="block",n.style.visibility="visible",n.style.opacity="1")}};n();var A=this.shadowRoot.getElementById("prompt-bubble"),o=!1!==e.showPulseRings?this.shadowRoot.getElementById("prompt-pulse-rings"):null;A&&(!1===e.showPulseRings||o)||(setTimeout(()=>{n()},100),setTimeout(()=>{n()},500)),null!==e.hideAfterSeconds&&e.hideAfterSeconds>0&&(this.promptAutoHideTimer&&clearTimeout(this.promptAutoHideTimer),this.promptAutoHideTimer=setTimeout(()=>{this.hidePrompt()},1e3*e.hideAfterSeconds))}else console.log("❌ Prompt not enabled, skipping show")}}togglePanel(){this.shadowRoot&&this._doTogglePanel()}_doTogglePanel(){if(this.shadowRoot){this.isOpen=!this.isOpen;var e=this.shadowRoot.getElementById("text-chat-panel");if(e&&e.classList.toggle("open"),this.isOpen)this.hidePrompt(),setTimeout(()=>{var e=this.shadowRoot.getElementById("messageInput");e&&e.focus()},100);else{if(window.innerWidth<=768){var t=this.shadowRoot.querySelector(".ttp-mobile-fab");t&&(t.style.display="")}this.showPrompt(),setTimeout(()=>{var e,t=this.shadowRoot.getElementById("prompt-bubble");t&&"none"===t.style.display&&(t.style.display="block");var n=this.shadowRoot.getElementById("prompt-pulse-rings");n&&!1!==(null===(e=this.config.promptAnimation)||void 0===e?void 0:e.showPulseRings)&&"none"===n.style.display&&(n.style.display="block")},100)}this.isOpen&&!this.isActive&&this.config.behavior.autoConnect&&this.startChat()}}showErrorToast(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"error",n=document.createElement("div");n.className="widget-toast widget-toast-".concat(t),n.textContent=e;var A="error"===t?"#ef4444":"warning"===t?"#f59e0b":"#3b82f6";if(Object.assign(n.style,{position:"fixed",bottom:"20px",left:"50%",transform:"translateX(-50%)",backgroundColor:A,color:"white",padding:"12px 24px",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:"10003",fontSize:"14px",fontWeight:"500",maxWidth:"90%",textAlign:"center",animation:"slideUp 0.3s ease-out",fontFamily:"inherit",pointerEvents:"auto"}),!document.getElementById("widget-toast-styles")){var o=document.createElement("style");o.id="widget-toast-styles",o.textContent="\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateX(-50%) translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateX(-50%) translateY(0);\n }\n }\n @keyframes slideDown {\n from {\n opacity: 1;\n transform: translateX(-50%) translateY(0);\n }\n to {\n opacity: 0;\n transform: translateX(-50%) translateY(20px);\n }\n }\n ",document.head.appendChild(o)}(this.shadowRoot||document.body).appendChild(n),setTimeout(()=>{n.style.animation="slideDown 0.3s ease-out",setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n)},300)},4e3)}showMobileLandingError(e){if(this.shadowRoot){var t=this.shadowRoot.getElementById("ttpMobileLanding"),n=this.shadowRoot.querySelector(".ttp-mobile-fab"),A=this.shadowRoot.getElementById("ttpMobileLandingError");if(t&&A){var o=A.querySelector(".ttp-mobile-landing__error-text");o&&(o.textContent=e),A.style.display="flex",t.classList.add("active"),n&&(n.style.display="none"),this.isMobileLandingOpen=!0}}}showConfirmModal(e){var{title:t="Confirm",message:n="Are you sure?",confirmText:A="Confirm",cancelText:o="Cancel",confirmButtonClass:i="primary",onConfirm:r,onCancel:a}=e,s=document.createElement("div");s.className="widget-modal-overlay",s.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n ";var c=document.createElement("div");c.className="widget-confirm-modal",c.style.cssText="\n background: white;\n border-radius: 12px;\n padding: 24px;\n max-width: 400px;\n width: 90%;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);\n ";var l="danger"===i?"widget-modal-btn--danger":"widget-modal-btn--primary";c.innerHTML='\n <h3 style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: #1e293b;">'.concat(t,'</h3>\n <p style="margin: 0 0 24px 0; color: #64748b; font-size: 14px; line-height: 1.5;">').concat(n,'</p>\n <div style="display: flex; gap: 12px; justify-content: flex-end;">\n <button class="widget-modal-btn widget-modal-btn--cancel" data-action="cancel" style="\n padding: 10px 20px;\n border: 1px solid #e2e8f0;\n background: white;\n color: #64748b;\n border-radius: 8px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n ">\n ').concat(o,'\n </button>\n <button class="widget-modal-btn ').concat(l,'" data-action="confirm" style="\n padding: 10px 20px;\n border: none;\n background: ').concat("danger"===i?"#ef4444":"#7c3aed",';\n color: white;\n border-radius: 8px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n ">\n ').concat(A,"\n </button>\n </div>\n "),s.appendChild(c),(this.shadowRoot||document.body).appendChild(s),c.querySelector('[data-action="confirm"]').onclick=()=>{s.remove(),null==r||r()},c.querySelector('[data-action="cancel"]').onclick=()=>{s.remove(),null==a||a()},s.onclick=e=>{e.target===s&&(s.remove(),null==a||a())}}startChat(){var e=this;return kn(function*(){e.isActive=!0,e.textInterface.setActive(!0)})()}sendMessage(){var e=this;return kn(function*(){yield e.textInterface.sendMessage()})()}updateSendButtonState(){this.textInterface.updateSendButtonState()}showBackButtonWarning(){var e,t;null!==(e=this.voiceInterface)&&void 0!==e&&e.isActive&&null!==(t=this.voiceInterface.desktop)&&void 0!==t&&t.showBackButtonWarning&&this.voiceInterface.desktop.showBackButtonWarning()}buildWebSocketUrl(){if(!this.config.agentId)throw new Error("agentId is required");var e=this.config.websocketUrl||"wss://backend.talktopc.com/ws/conv",t=new URL(e,"wss://placeholder.com"),n=t.searchParams;n.delete("signed_token"),n.has("agentId")||n.append("agentId",this.config.agentId),this.config.appId&&!n.has("appId")&&n.append("appId",this.config.appId),!1!==this.config.demo&&n.append("demo","true");var A="".concat(t.origin).concat(t.pathname,"?").concat(n.toString());return"undefined"!=typeof __DEV__&&__DEV__&&console.log("[TTPAgentSDK] WebSocket URL:",A),A}addMessage(e,t){this.textInterface.addMessage(e,t)}beginStreaming(){this.textInterface.beginStreaming()}appendStreamingChunk(e){this.textInterface.appendStreamingChunk(e)}finalizeStreaming(e){this.textInterface.finalizeStreaming(e)}stopStreamingState(){this.textInterface.stopStreamingState()}showError(e){this.textInterface.showError(e)}updateStatus(e){}updateConfig(e){var t,n,A,o,i,r,a,s,c,l,d=In({},this.config);e.panel&&(d.panel=In(In({},this.config.panel),e.panel)),e.voice&&(d.voice=In(In({},this.config.voice),e.voice),e.voice.micButtonHint&&(d.voice.micButtonHint=In(In({},null===(c=this.config.voice)||void 0===c?void 0:c.micButtonHint),e.voice.micButtonHint))),e.text&&(d.text=In(In({},this.config.text),e.text),e.text.sendButtonHint&&(d.text.sendButtonHint=In(In({},null===(l=this.config.text)||void 0===l?void 0:l.sendButtonHint),e.text.sendButtonHint))),void 0!==e.language&&(d.language=e.language),void 0!==e.language&&(["he","ar"].includes(e.language)?d.direction="rtl":void 0===e.direction&&(d.direction="ltr")),e.translations&&(d.translations=e.translations,this.translations=e.translations),e.button&&(d.button=In(In({},this.config.button),e.button)),e.header&&(d.header=In(In({},this.config.header),e.header)),e.icon&&(d.icon=In(In({},this.config.icon),e.icon)),e.messages&&(d.messages=In(In({},this.config.messages),e.messages)),e.animation&&(d.animation=In(In({},this.config.animation),e.animation)),e.behavior&&(d.behavior=In(In({},this.config.behavior),e.behavior)),e.accessibility&&(d.accessibility=In(In({},this.config.accessibility),e.accessibility)),e.tooltips&&(d.tooltips=In(In({},this.config.tooltips),e.tooltips)),e.landing&&(d.landing=In(In({},this.config.landing),e.landing)),e.footer&&(d.footer=In(In({},this.config.footer),e.footer)),void 0!==e.direction&&void 0===d.direction&&(d.direction=e.direction),void 0!==e.primaryColor&&(d.primaryColor=e.primaryColor),d.onConversationStart=void 0!==e.onConversationStart?e.onConversationStart:this.config.onConversationStart,d.onConversationEnd=void 0!==e.onConversationEnd?e.onConversationEnd:this.config.onConversationEnd,d.onBargeIn=void 0!==e.onBargeIn?e.onBargeIn:this.config.onBargeIn,d.onAudioStartPlaying=void 0!==e.onAudioStartPlaying?e.onAudioStartPlaying:this.config.onAudioStartPlaying,d.onAudioStoppedPlaying=void 0!==e.onAudioStoppedPlaying?e.onAudioStoppedPlaying:this.config.onAudioStoppedPlaying,d.onSubtitleDisplay=void 0!==e.onSubtitleDisplay?e.onSubtitleDisplay:this.config.onSubtitleDisplay,d.onVoiceCallButtonClick=void 0!==e.onVoiceCallButtonClick?e.onVoiceCallButtonClick:this.config.onVoiceCallButtonClick,void 0!==e.useShadowDOM&&(d.useShadowDOM=e.useShadowDOM),Object.keys(e).forEach(t=>{["panel","button","header","footer","icon","messages","direction","voice","text","animation","behavior","accessibility","language","tooltips","landing","primaryColor","useShadowDOM","onConversationStart","onConversationEnd","onBargeIn","onAudioStartPlaying","onAudioStoppedPlaying","onSubtitleDisplay","onVoiceCallButtonClick"].includes(t)||(d[t]=e[t])}),null===(t=this.config)||void 0===t||t.language;var p=!1!==(null===(n=this.config)||void 0===n?void 0:n.useShadowDOM);if(this.config=this.mergeWithDefaults(d),!1!==this.config.useShadowDOM===p&&this.container){var u=document.getElementById("ttp-widget-shadow-host");u&&!this.config.useShadowDOM&&u.remove();var h=document.getElementById("ttp-widget-container");if(h&&this.config.useShadowDOM&&h.remove(),this.config.useShadowDOM)if(this.shadowRoot)this.container=this.shadowRoot;else{var g=document.getElementById("ttp-widget-shadow-host");g?(this.shadowRoot=g.shadowRoot,this.container=this.shadowRoot):(this.createShadowHost(),this.container=this.shadowRoot)}else{if(this.regularContainer)this.container=this.regularContainer;else{var m=document.getElementById("ttp-widget-container");m?(this.regularContainer=m,this.container=m):(this.createRegularContainer(),this.container=this.regularContainer)}this.shadowRoot=document}}else{var f=document.getElementById("ttp-widget-shadow-host");f&&f.remove();var v=document.getElementById("ttp-widget-container");if(v&&v.remove(),!1===p){var B=document.getElementById("ttp-widget-styles");B&&B.remove()}this.config.useShadowDOM?(this.createShadowHost(),this.container=this.shadowRoot):(this.createRegularContainer(),this.container=this.regularContainer,this.shadowRoot=document)}var w=this.config.language||"en",b=In(In(In({},this.config),this.config.voice),{},{language:w,translations:this.translations,shadowRoot:this.shadowRoot,websocketUrl:this.config.websocketUrl,agentSettingsOverride:this.config.agentSettingsOverride,visualAssistant:this.config.visualAssistant,outputContainer:(null===(A=this.config.voice)||void 0===A?void 0:A.outputContainer)||"raw",outputEncoding:(null===(o=this.config.voice)||void 0===o?void 0:o.outputEncoding)||"pcm",outputSampleRate:(null===(i=this.config.voice)||void 0===i?void 0:i.outputSampleRate)||44100,outputChannels:(null===(r=this.config.voice)||void 0===r?void 0:r.outputChannels)||1,outputBitDepth:(null===(a=this.config.voice)||void 0===a?void 0:a.outputBitDepth)||16,onConversationStart:this.config.onConversationStart,onConversationEnd:this.config.onConversationEnd,onBargeIn:this.config.onBargeIn,onAudioStartPlaying:this.config.onAudioStartPlaying,onAudioStoppedPlaying:this.config.onAudioStoppedPlaying,onSubtitleDisplay:this.config.onSubtitleDisplay});this.voiceInterface=new mt(b);var y=In(In(In({},this.config),this.config.text),{},{language:w,translations:this.translations,shadowRoot:this.shadowRoot});if(this.textInterface=new Bt(y,this.sdk),"unified"===((null===(s=this.config.behavior)||void 0===s?void 0:s.mode)||"unified")){var x=In(In({},this.config),{},{translations:this.translations,shadowRoot:this.shadowRoot});this.landingScreen=new wt(x)}else this.landingScreen=null;this.createWidget(),this.textInterface&&this.textInterface.updateInputAttributes&&this.textInterface.updateInputAttributes()}destroy(){this.promptAutoHideTimer&&(clearTimeout(this.promptAutoHideTimer),this.promptAutoHideTimer=null);var e=document.getElementById("ttp-widget-shadow-host");e&&e.remove();var t=document.getElementById("ttp-widget-container");t&&t.remove();var n=document.getElementById("ttp-widget-styles");n&&n.remove(),this.sdk&&this.sdk.destroy(),this.voiceInterface&&this.voiceInterface.destroy(),this._flavor&&this._flavor.destroy&&(this._flavor.destroy(),this._flavor=null)}startVoiceCall(){var e=this;return kn(function*(){yield e.voiceInterface.startVoiceCall(),e._flushPendingClientTools()})()}endVoiceCall(){this.voiceInterface.endVoiceCall()}toggleMute(){this.voiceInterface.toggleMute()}toggleSpeaker(){this.voiceInterface.toggleSpeaker()}injectData(e){var t=arguments,n=this;return kn(function*(){var A,o=t.length>1&&void 0!==t[1]?t[1]:{};if(!e||!e.trim())throw console.warn("TTPChatWidget: Cannot inject empty data"),new Error("Cannot inject empty data");if(!n.voiceInterface||!n.voiceInterface.isActive)throw console.warn("TTPChatWidget: Cannot inject data - voice call is not active"),new Error("Voice call is not active");var i=null===(A=n.voiceInterface)||void 0===A?void 0:A.getVoiceSDK();if(!i)throw console.warn("TTPChatWidget: VoiceSDK not available"),new Error("VoiceSDK not available");try{return yield i.injectData(e,In(In({},o),{},{source:o.source||"widget_programmatic"}))}catch(e){throw e}})()}registerToolHandler(e,t){var n;return null!==(n=this.voiceInterface)&&void 0!==n&&n.sdk?this.voiceInterface.sdk.registerToolHandler(e,t):(this._pendingClientTools=this._pendingClientTools||[],this._pendingClientTools.push({name:e,handler:t}),console.warn("TTPChatWidget: Tool handler queued - voice interface SDK not ready yet"),this._flushPendingClientTools(),this)}unregisterToolHandler(e){var t;return null!==(t=this.voiceInterface)&&void 0!==t&&t.sdk?this.voiceInterface.sdk.unregisterToolHandler(e):(this._pendingClientTools&&(this._pendingClientTools=this._pendingClientTools.filter(t=>t.name!==e)),this)}hasToolHandler(e){var t;return!(null===(t=this.voiceInterface)||void 0===t||!t.sdk)&&this.voiceInterface.sdk.hasToolHandler(e)}getRegisteredTools(){var e;return null!==(e=this.voiceInterface)&&void 0!==e&&e.sdk?this.voiceInterface.sdk.getRegisteredTools():this._pendingClientTools?this._pendingClientTools.map(e=>e.name):[]}_flushPendingClientTools(){var e;this._pendingClientTools&&null!==(e=this.voiceInterface)&&void 0!==e&&e.sdk&&(this._pendingClientTools.forEach(e=>{var{name:t,handler:n}=e;this.voiceInterface.sdk.registerToolHandler(t,n)}),this._pendingClientTools=null,console.log("TTPChatWidget: Flushed pending client tools"))}registerClientTool(e,t){return this.registerToolHandler(e,t)}unregisterClientTool(e){return this.unregisterToolHandler(e)}hasClientTool(e){return this.hasToolHandler(e)}getRegisteredClientTools(){return this.getRegisteredTools()}}function _n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(e);t&&(A=A.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,A)}return n}function Dn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_n(Object(n),!0).forEach(function(t){Mn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_n(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mn(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Pn extends Hn{constructor(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(Dn(Dn({},n),{},{flavor:n.flavor||{type:"ecommerce",partnerId:null===(e=n.partner)||void 0===e?void 0:e.name,shopifyDomain:null===(t=n.partner)||void 0===t?void 0:t.shopifyDomain}}))}}class Ln{constructor(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.images=t.images||[],this.title=t.title||"",this.autoRotate=!1!==t.autoRotate,this.timeout=null!==(e=t.timeout)&&void 0!==e?e:10,this.onDismiss=t.onDismiss||(()=>{}),this.current=0,this.container=null,this.imageEl=null,this.captionEl=null,this.dotsEl=null,this._rotateInterval=null,this._dismissTimeout=null,this._interactionTimeout=null,this._dragging=!1,this._startX=0,this._swiped=!1,this._dragThreshold=40,this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._boundMouseMove=this._onMouseMove.bind(this),this._boundMouseUp=this._onMouseUp.bind(this),this._dismissed=!1}mount(e){e&&0!==this.images.length&&(this._buildDOM(),e.appendChild(this.container),this._setupDragEvents(),this._startAutoRotate(),this._startAutoDismiss())}dismiss(){if(!this._dismissed){if(this._dismissed=!0,this._stopAutoRotate(),this._stopAutoDismiss(),this._removeEventListeners(),this.container){this.container.classList.add("ttp-gallery--hiding");var e=this.container;setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},280)}this.container=null,this.onDismiss()}}replace(e){var t,n,A=null===(t=this.container)||void 0===t?void 0:t.parentNode;A&&(this._stopAutoRotate(),this._stopAutoDismiss(),this._removeEventListeners(),this.container&&this.container.remove(),this.images=e.images||[],this.title=e.title||"",this.autoRotate=!1!==e.autoRotate,this.timeout=null!==(n=e.timeout)&&void 0!==n?n:10,this.current=0,this._dismissed=!1,this._buildDOM(),A.appendChild(this.container),this._setupDragEvents(),this._startAutoRotate(),this._startAutoDismiss())}_buildDOM(){this.container=document.createElement("div"),this.container.className="ttp-gallery";var e=document.createElement("div");e.className="ttp-gallery-header";var t=document.createElement("span");t.className="ttp-gallery-title",t.textContent=this.title,e.appendChild(t);var n=document.createElement("button");n.className="ttp-gallery-close",n.setAttribute("aria-label","Close gallery"),n.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',n.addEventListener("click",()=>this.dismiss()),e.appendChild(n),this.container.appendChild(e);var A=document.createElement("div");if(A.className="ttp-gallery-slide-area",this.images.length>1){var o=document.createElement("button");o.className="ttp-gallery-arrow ttp-gallery-arrow--left",o.setAttribute("aria-label","Previous image"),o.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"/></svg>',o.addEventListener("click",()=>{this._goTo(this.current-1),this._pauseAutoRotate()}),A.appendChild(o)}var i=document.createElement("div");if(i.className="ttp-gallery-image-container",this.imageEl=document.createElement("img"),this.imageEl.className="ttp-gallery-image",this.imageEl.alt="",this.imageEl.draggable=!1,i.appendChild(this.imageEl),A.appendChild(i),this.images.length>1){var r=document.createElement("button");r.className="ttp-gallery-arrow ttp-gallery-arrow--right",r.setAttribute("aria-label","Next image"),r.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>',r.addEventListener("click",()=>{this._goTo(this.current+1),this._pauseAutoRotate()}),A.appendChild(r)}this.container.appendChild(A),this.captionEl=document.createElement("div"),this.captionEl.className="ttp-gallery-caption",this.container.appendChild(this.captionEl),this.images.length>1&&(this.dotsEl=document.createElement("div"),this.dotsEl.className="ttp-gallery-dots",this.images.forEach((e,t)=>{var n=document.createElement("div");n.className="ttp-gallery-dot",n.addEventListener("click",()=>{this._goTo(t),this._pauseAutoRotate()}),this.dotsEl.appendChild(n)}),this.container.appendChild(this.dotsEl)),this._updateSlide()}_updateSlide(){var e=this.images[this.current];e&&this.imageEl&&(this.imageEl.src=e.url,this.imageEl.alt=e.caption||"",this.captionEl&&(this.captionEl.textContent=e.caption||"",this.captionEl.style.display=e.caption?"":"none"),this.dotsEl&&this.dotsEl.querySelectorAll(".ttp-gallery-dot").forEach((e,t)=>e.classList.toggle("ttp-gallery-dot--active",t===this.current)))}_goTo(e){0!==this.images.length&&(this.current=(e%this.images.length+this.images.length)%this.images.length,this._updateSlide())}_startAutoRotate(){!this.autoRotate||this.images.length<3||(this._rotateInterval=setInterval(()=>this._goTo(this.current+1),3e3))}_stopAutoRotate(){this._rotateInterval&&(clearInterval(this._rotateInterval),this._rotateInterval=null),this._interactionTimeout&&(clearTimeout(this._interactionTimeout),this._interactionTimeout=null)}_pauseAutoRotate(){this._stopAutoRotate(),!this.autoRotate||this.images.length<3||(this._interactionTimeout=setTimeout(()=>{this._startAutoRotate()},5e3))}_startAutoDismiss(){this.timeout<=0||(this._dismissTimeout=setTimeout(()=>this.dismiss(),1e3*this.timeout))}_stopAutoDismiss(){this._dismissTimeout&&(clearTimeout(this._dismissTimeout),this._dismissTimeout=null)}_setupDragEvents(){if(!(this.images.length<=1)){var e=this.container.querySelector(".ttp-gallery-slide-area");e&&(e.addEventListener("touchstart",e=>{this._dragging=!0,this._startX=e.touches[0].clientX,this._swiped=!1},{passive:!0}),e.addEventListener("mousedown",e=>{this._dragging=!0,this._startX=e.clientX,this._swiped=!1}),document.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),document.addEventListener("touchend",this._boundTouchEnd),document.addEventListener("mousemove",this._boundMouseMove),document.addEventListener("mouseup",this._boundMouseUp))}}_onTouchMove(e){if(this._dragging){var t=e.touches[0].clientX-this._startX;Math.abs(t)>this._dragThreshold&&(this._goTo(this.current+(t>0?-1:1)),this._startX=e.touches[0].clientX,this._swiped=!0,this._pauseAutoRotate())}}_onTouchEnd(){this._dragging=!1,this._swiped&&setTimeout(()=>{this._swiped=!1},400)}_onMouseMove(e){if(this._dragging){var t=e.clientX-this._startX;Math.abs(t)>this._dragThreshold&&(this._goTo(this.current+(t>0?-1:1)),this._startX=e.clientX,this._swiped=!0,this._pauseAutoRotate())}}_onMouseUp(){this._dragging=!1,this._swiped&&setTimeout(()=>{this._swiped=!1},400)}_removeEventListeners(){document.removeEventListener("touchmove",this._boundTouchMove),document.removeEventListener("touchend",this._boundTouchEnd),document.removeEventListener("mousemove",this._boundMouseMove),document.removeEventListener("mouseup",this._boundMouseUp)}static injectStyles(e){if(!Ln._stylesInjected.has(e)){Ln._stylesInjected.add(e);var t=Ln.generateCSS(),n=e.querySelector("style");if(n)n.textContent+="\n"+t;else{var A=document.createElement("style");A.textContent=t,e.appendChild(A)}}}static generateCSS(){return"\n/* ═══════════════════════════════════════\n GALLERY VIEWER\n ═══════════════════════════════════════ */\n\n.ttp-gallery {\n width: 100%;\n background: #fff;\n border-radius: 14px;\n overflow: hidden;\n box-shadow: 0 4px 20px rgba(0,0,0,0.1);\n animation: ttpGalleryIn 0.3s cubic-bezier(0.23, 1, 0.32, 1);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.ttp-gallery.ttp-gallery--hiding {\n animation: ttpGalleryOut 0.28s ease forwards;\n pointer-events: none;\n}\n\n@keyframes ttpGalleryIn {\n from { opacity: 0; transform: translateY(-10px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes ttpGalleryOut {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(-10px); }\n}\n\n/* ── Header ── */\n\n.ttp-gallery-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 12px 6px;\n}\n\n.ttp-gallery-title {\n font-size: 13px;\n font-weight: 600;\n color: #1e293b;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-gallery-close {\n width: 28px;\n height: 28px;\n border: none;\n border-radius: 50%;\n background: rgba(0,0,0,0.06);\n color: #64748b;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n flex-shrink: 0;\n transition: background 0.15s;\n}\n.ttp-gallery-close:hover {\n background: rgba(0,0,0,0.1);\n}\n\n/* ── Slide Area ── */\n\n.ttp-gallery-slide-area {\n position: relative;\n width: 100%;\n aspect-ratio: 16 / 10;\n background: #f1f5f9;\n user-select: none;\n -webkit-user-select: none;\n cursor: grab;\n overflow: hidden;\n}\n.ttp-gallery-slide-area:active {\n cursor: grabbing;\n}\n\n.ttp-gallery-image-container {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ttp-gallery-image {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n transition: opacity 0.2s ease;\n pointer-events: none;\n}\n\n/* ── Arrows ── */\n\n.ttp-gallery-arrow {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n z-index: 2;\n width: 32px;\n height: 32px;\n border: none;\n border-radius: 50%;\n background: rgba(255,255,255,0.85);\n color: #334155;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n box-shadow: 0 2px 8px rgba(0,0,0,0.12);\n transition: background 0.15s, transform 0.15s;\n -webkit-tap-highlight-color: transparent;\n touch-action: manipulation;\n}\n.ttp-gallery-arrow:hover {\n background: #fff;\n transform: translateY(-50%) scale(1.05);\n}\n.ttp-gallery-arrow:active {\n transform: translateY(-50%) scale(0.95);\n}\n.ttp-gallery-arrow--left {\n left: 8px;\n}\n.ttp-gallery-arrow--right {\n right: 8px;\n}\n\n/* ── Caption ── */\n\n.ttp-gallery-caption {\n padding: 6px 12px;\n font-size: 12px;\n color: #64748b;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* ── Dots ── */\n\n.ttp-gallery-dots {\n display: flex;\n justify-content: center;\n gap: 6px;\n padding: 4px 0 10px;\n}\n\n.ttp-gallery-dot {\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background: #cbd5e1;\n cursor: pointer;\n transition: all 0.25s;\n -webkit-tap-highlight-color: transparent;\n}\n\n.ttp-gallery-dot--active {\n width: 18px;\n border-radius: 4px;\n background: #3b82f6;\n}\n\n/* ── Mobile gallery (mounted to body) ── */\n\n.ttp-gallery--mobile {\n position: fixed !important;\n left: 8px !important;\n right: 8px !important;\n z-index: 2147483645 !important;\n border-radius: 16px;\n box-shadow: 0 8px 32px rgba(0,0,0,0.18);\n}\n"}static injectMobileStyles(){if(!document.getElementById("ttp-gallery-mobile-styles")){var e=document.createElement("style");e.id="ttp-gallery-mobile-styles",e.textContent=Ln.generateCSS(),document.head.appendChild(e)}}static injectFullscreenStyles(){if(!document.getElementById("ttp-gallery-fullscreen-viewer-styles")){var e=document.createElement("style");e.id="ttp-gallery-fullscreen-viewer-styles",e.textContent=Ln.generateCSS()+"\n"+Ln.generateFullscreenCSS(),document.head.appendChild(e)}}static generateFullscreenCSS(){return"\n/* ═══════════════════════════════════════\n GALLERY — FULLSCREEN IMMERSIVE\n ═══════════════════════════════════════ */\n\n.ttp-gallery--fullscreen {\n width: 100vw;\n height: 100vh;\n background: transparent;\n border-radius: 0;\n box-shadow: none;\n position: relative;\n animation: ttpGalleryFsIn 0.4s ease;\n overflow: hidden;\n}\n\n.ttp-gallery--fullscreen.ttp-gallery--hiding {\n animation: ttpGalleryFsOut 0.3s ease forwards;\n}\n\n@keyframes ttpGalleryFsIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@keyframes ttpGalleryFsOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* ── Header: floating top bar ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-header {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n z-index: 10;\n padding: 16px 20px;\n background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);\n}\n\n.ttp-gallery--fullscreen .ttp-gallery-title {\n font-size: 18px;\n color: #fff;\n text-shadow: 0 1px 4px rgba(0,0,0,0.5);\n}\n\n.ttp-gallery--fullscreen .ttp-gallery-close {\n width: 40px;\n height: 40px;\n background: rgba(255,255,255,0.15);\n color: #fff;\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n}\n.ttp-gallery--fullscreen .ttp-gallery-close:hover {\n background: rgba(255,255,255,0.25);\n}\n.ttp-gallery--fullscreen .ttp-gallery-close svg {\n width: 22px;\n height: 22px;\n}\n\n/* ── Slide area: fills entire viewport ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-slide-area {\n width: 100vw;\n height: 100vh;\n aspect-ratio: auto;\n background: transparent;\n}\n\n.ttp-gallery--fullscreen .ttp-gallery-image {\n width: 100%;\n height: 100%;\n object-fit: contain;\n}\n\n/* ── Arrows: large, floating on edges ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-arrow {\n width: 52px;\n height: 52px;\n background: rgba(255,255,255,0.12);\n color: #fff;\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: none;\n}\n.ttp-gallery--fullscreen .ttp-gallery-arrow:hover {\n background: rgba(255,255,255,0.25);\n transform: translateY(-50%) scale(1.05);\n}\n.ttp-gallery--fullscreen .ttp-gallery-arrow svg {\n width: 28px;\n height: 28px;\n}\n.ttp-gallery--fullscreen .ttp-gallery-arrow--left { left: 16px; }\n.ttp-gallery--fullscreen .ttp-gallery-arrow--right { right: 16px; }\n\n/* ── Caption: floating bottom center ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-caption {\n position: absolute;\n bottom: 56px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 10;\n font-size: 15px;\n color: #fff;\n text-shadow: 0 1px 6px rgba(0,0,0,0.6);\n background: rgba(0,0,0,0.35);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n padding: 8px 20px;\n border-radius: 20px;\n max-width: 80vw;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* ── Dots: floating bottom ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-dots {\n position: absolute;\n bottom: 20px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 10;\n gap: 10px;\n padding: 6px 14px;\n background: rgba(0,0,0,0.3);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n border-radius: 20px;\n}\n.ttp-gallery--fullscreen .ttp-gallery-dot {\n width: 10px;\n height: 10px;\n background: rgba(255,255,255,0.4);\n}\n.ttp-gallery--fullscreen .ttp-gallery-dot--active {\n width: 28px;\n border-radius: 5px;\n background: #fff;\n}\n\n/* ── Mobile tweaks ── */\n\n@media (max-width: 768px) {\n .ttp-gallery--fullscreen .ttp-gallery-arrow {\n width: 40px;\n height: 40px;\n }\n .ttp-gallery--fullscreen .ttp-gallery-arrow--left { left: 8px; }\n .ttp-gallery--fullscreen .ttp-gallery-arrow--right { right: 8px; }\n .ttp-gallery--fullscreen .ttp-gallery-caption {\n font-size: 13px;\n bottom: 50px;\n }\n}\n"}}function Rn(o){var[i,r]=A(!1),a=n(null);return t(()=>(a.current=new Wt({getCartTarget:()=>{var e;return null!==(e=null==o?void 0:o.current)&&void 0!==e?e:null},onCartBump:()=>{},onRipple:()=>{}}),()=>{a.current&&(a.current.destroy(),a.current=null)}),[o]),{triggerFly:e((e,t,n)=>{var A=a.current;A?A.isAnimating||(r(!0),A.triggerFly(e,t,()=>{r(A.isAnimating),n&&n()})):n&&n()},[]),isAnimating:i}}function Kn(e,t,n,A,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(A,o)}function On(e){return function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(e){Kn(i,A,o,r,a,"next",e)}function a(e){Kn(i,A,o,r,a,"throw",e)}r(void 0)})}}!function(e,t,n){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Ln,"_stylesInjected",new WeakSet);class Vn{constructor(e){console.log("🚀 AgentSDK v2.1.8 initialized with config:",e),this.config=e,this.voiceSDK=null,this.isConnected=!1,this.isListening=!1,this.wasListening=!1,this._resumeInfo=null,this.onConnected=()=>{},this.onDisconnected=()=>{},this.onError=e=>console.error("SDK Error:",e),this.onTranscript=e=>{},this.onAgentSpeaking=e=>{},this.onConversationStart=e.onConversationStart||(()=>{}),this.onConversationEnd=e.onConversationEnd||(()=>{}),this.onBargeIn=e.onBargeIn||(()=>{}),this.onAudioStartPlaying=e.onAudioStartPlaying||(()=>{}),this.onAudioStoppedPlaying=e.onAudioStoppedPlaying||(()=>{}),this.onSubtitleDisplay=e.onSubtitleDisplay||(()=>{}),this.onUserTranscript=null,this.onUnsupportedAction=null}checkResumeBeforeConnect(){if(void 0!==this._resumeChecked)return this._resumeInfo;try{var e,t=this.config.visualAssistant||(null===(e=this.config.agentSettingsOverride)||void 0===e?void 0:e.visualAssistant),n=new De({autoReconnect:!1,agentId:this.config.agentId,appId:this.config.appId,language:this.config.language||"en",visualAssistant:t,protocolVersion:2}).checkAndResume();return this._resumeChecked=!0,n?(console.log("🔄 [AGENT SDK] Found resume state before connect:",n),this._resumeInfo=n,n):(this._resumeInfo=null,null)}catch(e){return console.warn("⚠️ [AGENT SDK] Error checking resume:",e),this._resumeChecked=!0,this._resumeInfo=null,null}}connect(){var e=this;return On(function*(){try{var t;e.voiceSDK&&(console.log("🔌 AgentSDK: Cleaning up existing connection"),e.voiceSDK.destroy(),e.voiceSDK=null);var n=e.config.visualAssistant||(null===(t=e.config.agentSettingsOverride)||void 0===t?void 0:t.visualAssistant);if(e.voiceSDK=new De({websocketUrl:e.config.websocketUrl,autoReconnect:!1,agentId:e.config.agentId,appId:e.config.appId,language:e.config.language||"en",agentSettingsOverride:e.config.agentSettingsOverride,visualAssistant:n,protocolVersion:2,outputContainer:e.config.outputContainer||"raw",outputEncoding:e.config.outputEncoding||"pcm",outputSampleRate:e.config.outputSampleRate||44100,outputChannels:e.config.outputChannels||1,outputBitDepth:e.config.outputBitDepth||16,flavor:e.config.flavor||null}),e._resumeInfo&&(console.log("🔄 [AGENT SDK] Using stored resume info:",e._resumeInfo),console.log(" From:",e._resumeInfo.fromPage,"→ To:",e._resumeInfo.toPage)),e.voiceSDK.on("connected",()=>{e.isConnected=!0,e.onConnected()}),setTimeout(()=>{e.voiceSDK&&e.voiceSDK.isConnected&&!e.isConnected&&(e.isConnected=!0,e.onConnected())},10),e.voiceSDK.on("disconnected",t=>{if(e.isConnected=!1,t&&1008===t.code&&t.reason&&(t.reason.includes("Domain not whitelisted")||t.reason.includes("domain")||t.reason.includes("whitelist"))){var n=new Error("DOMAIN_NOT_WHITELISTED");n.reason=t.reason,n.code=t.code,e.onError(n)}if((e.isListening||e.wasListening)&&(console.log("🎤 [AGENT SDK] disconnected event - calling onConversationEnd hook (isListening:",e.isListening,", wasListening:",e.wasListening,")"),e.onConversationEnd&&"function"==typeof e.onConversationEnd))try{e.onConversationEnd(),console.log("🎤 [AGENT SDK] ✅ onConversationEnd hook called from disconnected event"),e.wasListening=!1}catch(e){console.error("🎤 [AGENT SDK] ❌ Error calling onConversationEnd from disconnected:",e)}e.onDisconnected()}),e.voiceSDK.on("domainError",t=>{e.onError(t)}),e.voiceSDK.on("error",t=>{e.onError(t)}),e.voiceSDK.on("message",t=>{e.handleWebSocketMessage(t)}),e.voiceSDK.on("recordingStarted",()=>{if(e.isListening=!0,e.wasListening=!0,e.onConversationStart&&"function"==typeof e.onConversationStart)try{e.onConversationStart()}catch(e){console.error("🎤 [AGENT SDK] ❌ Error calling onConversationStart:",e)}}),e.voiceSDK.on("recordingStopped",()=>{console.log("🎤 [AGENT SDK] recordingStopped event received");var t=e.isListening;if(e.isListening=!1,t&&e.onConversationEnd&&"function"==typeof e.onConversationEnd)try{console.log("🎤 [AGENT SDK] ✅ Calling onConversationEnd hook from recordingStopped"),e.onConversationEnd(),console.log("🎤 [AGENT SDK] ✅ onConversationEnd hook called successfully"),e.wasListening=!1}catch(e){console.error("🎤 [AGENT SDK] ❌ Error calling onConversationEnd:",e)}}),e.voiceSDK.on("playbackStarted",()=>{e.onAgentSpeaking(!0),e.onAudioStartPlaying(),e.onPlaybackStarted&&"function"==typeof e.onPlaybackStarted&&e.onPlaybackStarted()}),e.voiceSDK.on("playbackStopped",()=>{e.onAgentSpeaking(!1),e.onAudioStoppedPlaying()}),e.voiceSDK.on("bargeIn",t=>{e.onBargeIn(t)}),e.voiceSDK.on("transcriptDisplay",t=>{console.log("📝 [AGENT SDK] transcriptDisplay event received:",t),t&&t.text&&(console.log("📝 [AGENT SDK] Calling onTranscript with text:",t.text),e.onTranscript&&"function"==typeof e.onTranscript?e.onTranscript(t.text):console.warn("📝 [AGENT SDK] ⚠️ onTranscript is not a function!",typeof e.onTranscript)),e.onSubtitleDisplay(t)}),e.voiceSDK.on("user_transcript",t=>{console.log("📝 [AGENT SDK] user_transcript event received:",t),e.onUserTranscript&&"function"==typeof e.onUserTranscript&&e.onUserTranscript(t.text,t.final)}),e._pendingToolHandlers&&e._pendingToolHandlers.size>0)for(var[A,o]of(console.log("🔧 AgentSDK: Registering ".concat(e._pendingToolHandlers.size," pending tool handlers")),e._pendingToolHandlers))e.voiceSDK.registerToolHandler(A,o);yield e.voiceSDK.connect()}catch(t){throw e.onError(t),t}})()}handleWebSocketMessage(e){var t=e.t||e.type;switch(t){case"connected":case"hello_ack":console.log("Session started successfully");break;case"user_transcript":case"agent_response":case"barge_in":case"stop_playing":default:break;case"error":this.onError(new Error(e.message||e.error||"Unknown error"));break;case"show_products":case"cart_updated":case"add_to_store_cart":"function"==typeof this.onUnsupportedAction&&this.onUnsupportedAction(t,e)}}startListening(){var e=arguments,t=this;return On(function*(){var n=e.length>0&&void 0!==e[0]?e[0]:null;if(console.log("🎤 AgentSDK: startListening() called",n?"(with existing stream)":""),!t.voiceSDK)throw console.error("❌ AgentSDK: No voiceSDK instance available"),new Error("No voiceSDK instance available");try{console.log("🎤 AgentSDK: Starting recording..."),(yield t.voiceSDK.startRecording(n))&&console.log("✅ AgentSDK: Recording started successfully")}catch(e){if(e.isServerRejection||"ServerRejected"===e.name)throw e;throw console.error("❌ AgentSDK: Failed to start recording:",e),e}})()}stopListening(){this.voiceSDK&&this.voiceSDK.stopRecording()}hangup(){this.voiceSDK&&this.voiceSDK.hangup()}updateVariables(e){this.voiceSDK&&this.isConnected&&this.voiceSDK.sendMessage({t:"update_variables",variables:e})}disconnect(){this.voiceSDK&&(this.voiceSDK.destroy(),this.voiceSDK=null),this.isConnected=!1,this.isListening=!1}registerToolHandler(e,t){if(this.voiceSDK)return this.voiceSDK.registerToolHandler(e,t);this._pendingToolHandlers||(this._pendingToolHandlers=new Map),this._pendingToolHandlers.set(e,t),console.log("🔧 AgentSDK: Queued tool handler '".concat(e,"' for registration after connect"))}unregisterToolHandler(e){if(this.voiceSDK)return this.voiceSDK.unregisterToolHandler(e);this._pendingToolHandlers&&this._pendingToolHandlers.delete(e)}hasToolHandler(e){var t;return this.voiceSDK?this.voiceSDK.hasToolHandler(e):(null===(t=this._pendingToolHandlers)||void 0===t?void 0:t.has(e))||!1}getRegisteredTools(){return this.voiceSDK?this.voiceSDK.getRegisteredTools():this._pendingToolHandlers?Array.from(this._pendingToolHandlers.keys()):[]}}var Nn="2.38.4",jn="2026-03-14T20:52:52.108Z";console.log("%c TTP Agent SDK v".concat(Nn," (").concat(jn,") "),"background: #4f46e5; color: white; font-size: 12px; font-weight: bold; padding: 2px 6px; border-radius: 4px;");const Gn={VoiceSDK_v2:De,TextChatSDK:Ke,WebSocketManager:Ge,AudioRecorder:E,AudioPlayer:qe,EventEmitter:v,AgentSDK:Vn,TTPChatWidget:Hn,TTPEcommerceWidget:Pn,ItemCard:Ft,GalleryViewer:Ln,FlyToCart:Wt,useFlyToCart:Rn,VERSION:Nn};export{Vn as AgentSDK,qe as AudioPlayer,E as AudioRecorder,jn as BUILD_TIME,v as EventEmitter,Wt as FlyToCart,Ln as GalleryViewer,Ft as ItemCard,s as MicPermissionModals,a as MicPermissionUtils,Hn as TTPChatWidget,Pn as TTPEcommerceWidget,Ke as TextChatSDK,Nn as VERSION,De as VoiceSDK_v2,Ge as WebSocketManager,Gn as default,Rn as useFlyToCart};
|
|
2
|
+
import{useCallback as t,useEffect as e,useRef as n,useState as A}from"react";var o={354:function(t){t.exports=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function A(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(A.prototype=n.prototype,new A)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,A=arguments.length;n<A;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)};function A(t,e,n,A){return new(n||(n=Promise))(function(o,i){function r(t){try{s(A.next(t))}catch(t){i(t)}}function a(t){try{s(A.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,a)}s((A=A.apply(t,e||[])).next())})}function o(t,e){var n,A,o,i,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,A&&(o=2&i[0]?A.return:i[0]?A.throw||((o=A.return)&&o.call(A),0):A.next)&&!(o=o.call(A,i[1])).done)return o;switch(A=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,A=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){r.label=i[1];break}if(6===i[0]&&r.label<o[1]){r.label=o[1],o=i;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(i);break}o[2]&&r.ops.pop(),r.trys.pop();continue}i=e.call(t,r)}catch(t){i=[6,t],A=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function i(t,e,n){if(n||2===arguments.length)for(var A,o=0,i=e.length;o<i;o++)!A&&o in e||(A||(A=Array.prototype.slice.call(e,0,o)),A[o]=e[o]);return t.concat(A||e)}for(var r=function(){function t(t,e,n,A){this.left=t,this.top=e,this.width=n,this.height=A}return t.prototype.add=function(e,n,A,o){return new t(this.left+e,this.top+n,this.width+A,this.height+o)},t.fromClientRect=function(e,n){return new t(n.left+e.windowBounds.left,n.top+e.windowBounds.top,n.width,n.height)},t.fromDOMRectList=function(e,n){var A=Array.from(n).find(function(t){return 0!==t.width});return A?new t(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height):t.EMPTY},t.EMPTY=new t(0,0,0,0),t}(),a=function(t,e){return r.fromClientRect(t,e.getBoundingClientRect())},s=function(t){for(var e=[],n=0,A=t.length;n<A;){var o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<A){var i=t.charCodeAt(n++);56320==(64512&i)?e.push(((1023&o)<<10)+(1023&i)+65536):(e.push(o),n--)}else e.push(o)}return e},c=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var n=t.length;if(!n)return"";for(var A=[],o=-1,i="";++o<n;){var r=t[o];r<=65535?A.push(r):(r-=65536,A.push(55296+(r>>10),r%1024+56320)),(o+1===n||A.length>16384)&&(i+=String.fromCharCode.apply(String,A),A.length=0)}return i},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="undefined"==typeof Uint8Array?[]:new Uint8Array(256),p=0;p<64;p++)d[l.charCodeAt(p)]=p;for(var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h="undefined"==typeof Uint8Array?[]:new Uint8Array(256),g=0;g<64;g++)h[u.charCodeAt(g)]=g;for(var m=function(t,e,n){return t.slice?t.slice(e,n):new Uint16Array(Array.prototype.slice.call(t,e,n))},v=function(){function t(t,e,n,A,o,i){this.initialValue=t,this.errorValue=e,this.highStart=n,this.highValueIndex=A,this.index=o,this.data=i}return t.prototype.get=function(t){var e;if(t>=0){if(t<55296||t>56319&&t<=65535)return e=((e=this.index[t>>5])<<2)+(31&t),this.data[e];if(t<=65535)return e=((e=this.index[2048+(t-55296>>5)])<<2)+(31&t),this.data[e];if(t<this.highStart)return e=2080+(t>>11),e=this.index[e],e+=t>>5&63,e=((e=this.index[e])<<2)+(31&t),this.data[e];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w="undefined"==typeof Uint8Array?[]:new Uint8Array(256),B=0;B<64;B++)w[f.charCodeAt(B)]=B;var b=10,y=13,x=15,C=17,Q=18,S=19,F=20,U=21,E=22,k=24,I=25,T=26,H=27,_=28,D=30,M=32,P=33,L=34,R=35,K=37,O=38,V=39,N=40,j=42,G=[9001,65288],z="×",W="÷",q=function(t){var e,n,A,o=function(t){var e,n,A,o,i,r=.75*t.length,a=t.length,s=0;"="===t[t.length-1]&&(r--,"="===t[t.length-2]&&r--);var c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(r):new Array(r),l=Array.isArray(c)?c:new Uint8Array(c);for(e=0;e<a;e+=4)n=h[t.charCodeAt(e)],A=h[t.charCodeAt(e+1)],o=h[t.charCodeAt(e+2)],i=h[t.charCodeAt(e+3)],l[s++]=n<<2|A>>4,l[s++]=(15&A)<<4|o>>2,l[s++]=(3&o)<<6|63&i;return c}(t),i=Array.isArray(o)?function(t){for(var e=t.length,n=[],A=0;A<e;A+=4)n.push(t[A+3]<<24|t[A+2]<<16|t[A+1]<<8|t[A]);return n}(o):new Uint32Array(o),r=Array.isArray(o)?function(t){for(var e=t.length,n=[],A=0;A<e;A+=2)n.push(t[A+1]<<8|t[A]);return n}(o):new Uint16Array(o),a=m(r,12,i[4]/2),s=2===i[5]?m(r,(24+i[4])/2):(e=i,n=Math.ceil((24+i[4])/4),e.slice?e.slice(n,A):new Uint32Array(Array.prototype.slice.call(e,n,A)));return new v(i[0],i[1],i[2],i[3],a,s)}("KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA=="),X=[D,36],Y=[1,2,3,5],J=[b,8],Z=[H,T],$=Y.concat(J),tt=[O,V,N,L,R],et=[x,y],nt=function(t,e,n,A){var o=A[n];if(Array.isArray(t)?-1!==t.indexOf(o):t===o)for(var i=n;i<=A.length;){if((s=A[++i])===e)return!0;if(s!==b)break}if(o===b)for(i=n;i>0;){var r=A[--i];if(Array.isArray(t)?-1!==t.indexOf(r):t===r)for(var a=n;a<=A.length;){var s;if((s=A[++a])===e)return!0;if(s!==b)break}if(r!==b)break}return!1},At=function(t,e){for(var n=t;n>=0;){var A=e[n];if(A!==b)return A;n--}return 0},ot=function(t,e,n,A,o){if(0===n[A])return z;var i=A-1;if(Array.isArray(o)&&!0===o[i])return z;var r=i-1,a=i+1,s=e[i],c=r>=0?e[r]:0,l=e[a];if(2===s&&3===l)return z;if(-1!==Y.indexOf(s))return"!";if(-1!==Y.indexOf(l))return z;if(-1!==J.indexOf(l))return z;if(8===At(i,e))return W;if(11===q.get(t[i]))return z;if((s===M||s===P)&&11===q.get(t[a]))return z;if(7===s||7===l)return z;if(9===s)return z;if(-1===[b,y,x].indexOf(s)&&9===l)return z;if(-1!==[C,Q,S,k,_].indexOf(l))return z;if(At(i,e)===E)return z;if(nt(23,E,i,e))return z;if(nt([C,Q],U,i,e))return z;if(nt(12,12,i,e))return z;if(s===b)return W;if(23===s||23===l)return z;if(16===l||16===s)return W;if(-1!==[y,x,U].indexOf(l)||14===s)return z;if(36===c&&-1!==et.indexOf(s))return z;if(s===_&&36===l)return z;if(l===F)return z;if(-1!==X.indexOf(l)&&s===I||-1!==X.indexOf(s)&&l===I)return z;if(s===H&&-1!==[K,M,P].indexOf(l)||-1!==[K,M,P].indexOf(s)&&l===T)return z;if(-1!==X.indexOf(s)&&-1!==Z.indexOf(l)||-1!==Z.indexOf(s)&&-1!==X.indexOf(l))return z;if(-1!==[H,T].indexOf(s)&&(l===I||-1!==[E,x].indexOf(l)&&e[a+1]===I)||-1!==[E,x].indexOf(s)&&l===I||s===I&&-1!==[I,_,k].indexOf(l))return z;if(-1!==[I,_,k,C,Q].indexOf(l))for(var d=i;d>=0;){if((p=e[d])===I)return z;if(-1===[_,k].indexOf(p))break;d--}if(-1!==[H,T].indexOf(l))for(d=-1!==[C,Q].indexOf(s)?r:i;d>=0;){var p;if((p=e[d])===I)return z;if(-1===[_,k].indexOf(p))break;d--}if(O===s&&-1!==[O,V,L,R].indexOf(l)||-1!==[V,L].indexOf(s)&&-1!==[V,N].indexOf(l)||-1!==[N,R].indexOf(s)&&l===N)return z;if(-1!==tt.indexOf(s)&&-1!==[F,T].indexOf(l)||-1!==tt.indexOf(l)&&s===H)return z;if(-1!==X.indexOf(s)&&-1!==X.indexOf(l))return z;if(s===k&&-1!==X.indexOf(l))return z;if(-1!==X.concat(I).indexOf(s)&&l===E&&-1===G.indexOf(t[a])||-1!==X.concat(I).indexOf(l)&&s===Q)return z;if(41===s&&41===l){for(var u=n[i],h=1;u>0&&41===e[--u];)h++;if(h%2!=0)return z}return s===M&&l===P?z:W},it=function(t,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var n=function(t,e){void 0===e&&(e="strict");var n=[],A=[],o=[];return t.forEach(function(t,i){var r=q.get(t);if(r>50?(o.push(!0),r-=50):o.push(!1),-1!==["normal","auto","loose"].indexOf(e)&&-1!==[8208,8211,12316,12448].indexOf(t))return A.push(i),n.push(16);if(4===r||11===r){if(0===i)return A.push(i),n.push(D);var a=n[i-1];return-1===$.indexOf(a)?(A.push(A[i-1]),n.push(a)):(A.push(i),n.push(D))}return A.push(i),31===r?n.push("strict"===e?U:K):r===j||29===r?n.push(D):43===r?t>=131072&&t<=196605||t>=196608&&t<=262141?n.push(K):n.push(D):void n.push(r)}),[A,n,o]}(t,e.lineBreak),A=n[0],o=n[1],i=n[2];"break-all"!==e.wordBreak&&"break-word"!==e.wordBreak||(o=o.map(function(t){return-1!==[I,D,j].indexOf(t)?K:t}));var r="keep-all"===e.wordBreak?i.map(function(e,n){return e&&t[n]>=19968&&t[n]<=40959}):void 0;return[A,o,r]},rt=function(){function t(t,e,n,A){this.codePoints=t,this.required="!"===e,this.start=n,this.end=A}return t.prototype.slice=function(){return c.apply(void 0,this.codePoints.slice(this.start,this.end))},t}(),at=45,st=43,ct=-1,lt=function(t){return t>=48&&t<=57},dt=function(t){return lt(t)||t>=65&&t<=70||t>=97&&t<=102},pt=function(t){return 10===t||9===t||32===t},ut=function(t){return function(t){return function(t){return t>=97&&t<=122}(t)||function(t){return t>=65&&t<=90}(t)}(t)||function(t){return t>=128}(t)||95===t},ht=function(t){return ut(t)||lt(t)||t===at},gt=function(t){return t>=0&&t<=8||11===t||t>=14&&t<=31||127===t},mt=function(t,e){return 92===t&&10!==e},vt=function(t,e,n){return t===at?ut(e)||mt(e,n):!!ut(t)||!(92!==t||!mt(t,e))},ft=function(t,e,n){return t===st||t===at?!!lt(e)||46===e&<(n):lt(46===t?e:t)},wt=function(t){var e=0,n=1;t[e]!==st&&t[e]!==at||(t[e]===at&&(n=-1),e++);for(var A=[];lt(t[e]);)A.push(t[e++]);var o=A.length?parseInt(c.apply(void 0,A),10):0;46===t[e]&&e++;for(var i=[];lt(t[e]);)i.push(t[e++]);var r=i.length,a=r?parseInt(c.apply(void 0,i),10):0;69!==t[e]&&101!==t[e]||e++;var s=1;t[e]!==st&&t[e]!==at||(t[e]===at&&(s=-1),e++);for(var l=[];lt(t[e]);)l.push(t[e++]);var d=l.length?parseInt(c.apply(void 0,l),10):0;return n*(o+a*Math.pow(10,-r))*Math.pow(10,s*d)},Bt={type:2},bt={type:3},yt={type:4},xt={type:13},Ct={type:8},Qt={type:21},St={type:9},Ft={type:10},Ut={type:11},Et={type:12},kt={type:14},It={type:23},Tt={type:1},Ht={type:25},_t={type:24},Dt={type:26},Mt={type:27},Pt={type:28},Lt={type:29},Rt={type:31},Kt={type:32},Ot=function(){function t(){this._value=[]}return t.prototype.write=function(t){this._value=this._value.concat(s(t))},t.prototype.read=function(){for(var t=[],e=this.consumeToken();e!==Kt;)t.push(e),e=this.consumeToken();return t},t.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case 34:return this.consumeStringToken(34);case 35:var e=this.peekCodePoint(0),n=this.peekCodePoint(1),A=this.peekCodePoint(2);if(ht(e)||mt(n,A)){var o=vt(e,n,A)?2:1;return{type:5,value:this.consumeName(),flags:o}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),xt;break;case 39:return this.consumeStringToken(39);case 40:return Bt;case 41:return bt;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),kt;break;case st:if(ft(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case 44:return yt;case at:var i=t,r=this.peekCodePoint(0),a=this.peekCodePoint(1);if(ft(i,r,a))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(vt(i,r,a))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(r===at&&62===a)return this.consumeCodePoint(),this.consumeCodePoint(),_t;break;case 46:if(ft(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var s=this.consumeCodePoint();if(42===s&&47===(s=this.consumeCodePoint()))return this.consumeToken();if(s===ct)return this.consumeToken()}break;case 58:return Dt;case 59:return Mt;case 60:if(33===this.peekCodePoint(0)&&this.peekCodePoint(1)===at&&this.peekCodePoint(2)===at)return this.consumeCodePoint(),this.consumeCodePoint(),Ht;break;case 64:var l=this.peekCodePoint(0),d=this.peekCodePoint(1),p=this.peekCodePoint(2);if(vt(l,d,p))return{type:7,value:this.consumeName()};break;case 91:return Pt;case 92:if(mt(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case 93:return Lt;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Ct;break;case 123:return Ut;case 125:return Et;case 117:case 85:var u=this.peekCodePoint(0),h=this.peekCodePoint(1);return u!==st||!dt(h)&&63!==h||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),St;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),Qt;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Ft;break;case ct:return Kt}return pt(t)?(this.consumeWhiteSpace(),Rt):lt(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):ut(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:c(t)}},t.prototype.consumeCodePoint=function(){var t=this._value.shift();return void 0===t?-1:t},t.prototype.reconsumeCodePoint=function(t){this._value.unshift(t)},t.prototype.peekCodePoint=function(t){return t>=this._value.length?-1:this._value[t]},t.prototype.consumeUnicodeRangeToken=function(){for(var t=[],e=this.consumeCodePoint();dt(e)&&t.length<6;)t.push(e),e=this.consumeCodePoint();for(var n=!1;63===e&&t.length<6;)t.push(e),e=this.consumeCodePoint(),n=!0;if(n)return{type:30,start:parseInt(c.apply(void 0,t.map(function(t){return 63===t?48:t})),16),end:parseInt(c.apply(void 0,t.map(function(t){return 63===t?70:t})),16)};var A=parseInt(c.apply(void 0,t),16);if(this.peekCodePoint(0)===at&&dt(this.peekCodePoint(1))){this.consumeCodePoint(),e=this.consumeCodePoint();for(var o=[];dt(e)&&o.length<6;)o.push(e),e=this.consumeCodePoint();return{type:30,start:A,end:parseInt(c.apply(void 0,o),16)}}return{type:30,start:A,end:A}},t.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return"url"===t.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},t.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===ct)return{type:22,value:""};var e=this.peekCodePoint(0);if(39===e||34===e){var n=this.consumeStringToken(this.consumeCodePoint());return 0===n.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===ct||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),It)}for(;;){var A=this.consumeCodePoint();if(A===ct||41===A)return{type:22,value:c.apply(void 0,t)};if(pt(A))return this.consumeWhiteSpace(),this.peekCodePoint(0)===ct||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:c.apply(void 0,t)}):(this.consumeBadUrlRemnants(),It);if(34===A||39===A||40===A||gt(A))return this.consumeBadUrlRemnants(),It;if(92===A){if(!mt(A,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),It;t.push(this.consumeEscapedCodePoint())}else t.push(A)}},t.prototype.consumeWhiteSpace=function(){for(;pt(this.peekCodePoint(0));)this.consumeCodePoint()},t.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(41===t||t===ct)return;mt(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},t.prototype.consumeStringSlice=function(t){for(var e="";t>0;){var n=Math.min(5e4,t);e+=c.apply(void 0,this._value.splice(0,n)),t-=n}return this._value.shift(),e},t.prototype.consumeStringToken=function(t){for(var e="",n=0;;){var A=this._value[n];if(A===ct||void 0===A||A===t)return{type:0,value:e+=this.consumeStringSlice(n)};if(10===A)return this._value.splice(0,n),Tt;if(92===A){var o=this._value[n+1];o!==ct&&void 0!==o&&(10===o?(e+=this.consumeStringSlice(n),n=-1,this._value.shift()):mt(A,o)&&(e+=this.consumeStringSlice(n),e+=c(this.consumeEscapedCodePoint()),n=-1))}n++}},t.prototype.consumeNumber=function(){var t=[],e=4,n=this.peekCodePoint(0);for(n!==st&&n!==at||t.push(this.consumeCodePoint());lt(this.peekCodePoint(0));)t.push(this.consumeCodePoint());n=this.peekCodePoint(0);var A=this.peekCodePoint(1);if(46===n&<(A))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),e=8;lt(this.peekCodePoint(0));)t.push(this.consumeCodePoint());n=this.peekCodePoint(0),A=this.peekCodePoint(1);var o=this.peekCodePoint(2);if((69===n||101===n)&&((A===st||A===at)&<(o)||lt(A)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),e=8;lt(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[wt(t),e]},t.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),e=t[0],n=t[1],A=this.peekCodePoint(0),o=this.peekCodePoint(1),i=this.peekCodePoint(2);return vt(A,o,i)?{type:15,number:e,flags:n,unit:this.consumeName()}:37===A?(this.consumeCodePoint(),{type:16,number:e,flags:n}):{type:17,number:e,flags:n}},t.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(dt(t)){for(var e=c(t);dt(this.peekCodePoint(0))&&e.length<6;)e+=c(this.consumeCodePoint());pt(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(e,16);return 0===n||function(t){return t>=55296&&t<=57343}(n)||n>1114111?65533:n}return t===ct?65533:t},t.prototype.consumeName=function(){for(var t="";;){var e=this.consumeCodePoint();if(ht(e))t+=c(e);else{if(!mt(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),t;t+=c(this.consumeEscapedCodePoint())}}},t}(),Vt=function(){function t(t){this._tokens=t}return t.create=function(e){var n=new Ot;return n.write(e),new t(n.read())},t.parseValue=function(e){return t.create(e).parseComponentValue()},t.parseValues=function(e){return t.create(e).parseComponentValues()},t.prototype.parseComponentValue=function(){for(var t=this.consumeToken();31===t.type;)t=this.consumeToken();if(32===t.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(t);var e=this.consumeComponentValue();do{t=this.consumeToken()}while(31===t.type);if(32===t.type)return e;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},t.prototype.parseComponentValues=function(){for(var t=[];;){var e=this.consumeComponentValue();if(32===e.type)return t;t.push(e),t.push()}},t.prototype.consumeComponentValue=function(){var t=this.consumeToken();switch(t.type){case 11:case 28:case 2:return this.consumeSimpleBlock(t.type);case 19:return this.consumeFunction(t)}return t},t.prototype.consumeSimpleBlock=function(t){for(var e={type:t,values:[]},n=this.consumeToken();;){if(32===n.type||Jt(n,t))return e;this.reconsumeToken(n),e.values.push(this.consumeComponentValue()),n=this.consumeToken()}},t.prototype.consumeFunction=function(t){for(var e={name:t.value,values:[],type:18};;){var n=this.consumeToken();if(32===n.type||3===n.type)return e;this.reconsumeToken(n),e.values.push(this.consumeComponentValue())}},t.prototype.consumeToken=function(){var t=this._tokens.shift();return void 0===t?Kt:t},t.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},t}(),Nt=function(t){return 15===t.type},jt=function(t){return 17===t.type},Gt=function(t){return 20===t.type},zt=function(t){return 0===t.type},Wt=function(t,e){return Gt(t)&&t.value===e},qt=function(t){return 31!==t.type},Xt=function(t){return 31!==t.type&&4!==t.type},Yt=function(t){var e=[],n=[];return t.forEach(function(t){if(4===t.type){if(0===n.length)throw new Error("Error parsing function args, zero tokens for arg");return e.push(n),void(n=[])}31!==t.type&&n.push(t)}),n.length&&e.push(n),e},Jt=function(t,e){return 11===e&&12===t.type||28===e&&29===t.type||2===e&&3===t.type},Zt=function(t){return 17===t.type||15===t.type},$t=function(t){return 16===t.type||Zt(t)},te=function(t){return t.length>1?[t[0],t[1]]:[t[0]]},ee={type:17,number:0,flags:4},ne={type:16,number:50,flags:4},Ae={type:16,number:100,flags:4},oe=function(t,e,n){var A=t[0],o=t[1];return[ie(A,e),ie(void 0!==o?o:A,n)]},ie=function(t,e){if(16===t.type)return t.number/100*e;if(Nt(t))switch(t.unit){case"rem":case"em":return 16*t.number;default:return t.number}return t.number},re="grad",ae="turn",se=function(t,e){if(15===e.type)switch(e.unit){case"deg":return Math.PI*e.number/180;case re:return Math.PI/200*e.number;case"rad":return e.number;case ae:return 2*Math.PI*e.number}throw new Error("Unsupported angle type")},ce=function(t){return 15===t.type&&("deg"===t.unit||t.unit===re||"rad"===t.unit||t.unit===ae)},le=function(t){switch(t.filter(Gt).map(function(t){return t.value}).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ee,ee];case"to top":case"bottom":return de(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ee,Ae];case"to right":case"left":return de(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Ae,Ae];case"to bottom":case"top":return de(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Ae,ee];case"to left":case"right":return de(270)}return 0},de=function(t){return Math.PI*t/180},pe=function(t,e){if(18===e.type){var n=Be[e.name];if(void 0===n)throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return n(t,e.values)}if(5===e.type){if(3===e.value.length){var A=e.value.substring(0,1),o=e.value.substring(1,2),i=e.value.substring(2,3);return ge(parseInt(A+A,16),parseInt(o+o,16),parseInt(i+i,16),1)}if(4===e.value.length){A=e.value.substring(0,1),o=e.value.substring(1,2),i=e.value.substring(2,3);var r=e.value.substring(3,4);return ge(parseInt(A+A,16),parseInt(o+o,16),parseInt(i+i,16),parseInt(r+r,16)/255)}if(6===e.value.length)return A=e.value.substring(0,2),o=e.value.substring(2,4),i=e.value.substring(4,6),ge(parseInt(A,16),parseInt(o,16),parseInt(i,16),1);if(8===e.value.length)return A=e.value.substring(0,2),o=e.value.substring(2,4),i=e.value.substring(4,6),r=e.value.substring(6,8),ge(parseInt(A,16),parseInt(o,16),parseInt(i,16),parseInt(r,16)/255)}if(20===e.type){var a=ye[e.value.toUpperCase()];if(void 0!==a)return a}return ye.TRANSPARENT},ue=function(t){return!(255&t)},he=function(t){var e=255&t,n=255&t>>8,A=255&t>>16,o=255&t>>24;return e<255?"rgba("+o+","+A+","+n+","+e/255+")":"rgb("+o+","+A+","+n+")"},ge=function(t,e,n,A){return(t<<24|e<<16|n<<8|Math.round(255*A))>>>0},me=function(t,e){if(17===t.type)return t.number;if(16===t.type){var n=3===e?1:255;return 3===e?t.number/100*n:Math.round(t.number/100*n)}return 0},ve=function(t,e){var n=e.filter(Xt);if(3===n.length){var A=n.map(me),o=A[0],i=A[1],r=A[2];return ge(o,i,r,1)}if(4===n.length){var a=n.map(me),s=(o=a[0],i=a[1],r=a[2],a[3]);return ge(o,i,r,s)}return 0};function fe(t,e,n){return n<0&&(n+=1),n>=1&&(n-=1),n<1/6?(e-t)*n*6+t:n<.5?e:n<2/3?6*(e-t)*(2/3-n)+t:t}var we=function(t,e){var n=e.filter(Xt),A=n[0],o=n[1],i=n[2],r=n[3],a=(17===A.type?de(A.number):se(t,A))/(2*Math.PI),s=$t(o)?o.number/100:0,c=$t(i)?i.number/100:0,l=void 0!==r&&$t(r)?ie(r,1):1;if(0===s)return ge(255*c,255*c,255*c,1);var d=c<=.5?c*(s+1):c+s-c*s,p=2*c-d,u=fe(p,d,a+1/3),h=fe(p,d,a),g=fe(p,d,a-1/3);return ge(255*u,255*h,255*g,l)},Be={hsl:we,hsla:we,rgb:ve,rgba:ve},be=function(t,e){return pe(t,Vt.create(e).parseComponentValue())},ye={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},xe={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(t){if(Gt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ce={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Qe=function(t,e){var n=pe(t,e[0]),A=e[1];return A&&$t(A)?{color:n,stop:A}:{color:n,stop:null}},Se=function(t,e){var n=t[0],A=t[t.length-1];null===n.stop&&(n.stop=ee),null===A.stop&&(A.stop=Ae);for(var o=[],i=0,r=0;r<t.length;r++){var a=t[r].stop;if(null!==a){var s=ie(a,e);s>i?o.push(s):o.push(i),i=s}else o.push(null)}var c=null;for(r=0;r<o.length;r++){var l=o[r];if(null===l)null===c&&(c=r);else if(null!==c){for(var d=r-c,p=(l-o[c-1])/(d+1),u=1;u<=d;u++)o[c+u-1]=p*u;c=null}}return t.map(function(t,n){return{color:t.color,stop:Math.max(Math.min(1,o[n]/e),0)}})},Fe=function(t,e,n){var A="number"==typeof t?t:function(t,e,n){var A=e/2,o=n/2,i=ie(t[0],e)-A,r=o-ie(t[1],n);return(Math.atan2(r,i)+2*Math.PI)%(2*Math.PI)}(t,e,n),o=Math.abs(e*Math.sin(A))+Math.abs(n*Math.cos(A)),i=e/2,r=n/2,a=o/2,s=Math.sin(A-Math.PI/2)*a,c=Math.cos(A-Math.PI/2)*a;return[o,i-c,i+c,r-s,r+s]},Ue=function(t,e){return Math.sqrt(t*t+e*e)},Ee=function(t,e,n,A,o){return[[0,0],[0,e],[t,0],[t,e]].reduce(function(t,e){var i=e[0],r=e[1],a=Ue(n-i,A-r);return(o?a<t.optimumDistance:a>t.optimumDistance)?{optimumCorner:e,optimumDistance:a}:t},{optimumDistance:o?1/0:-1/0,optimumCorner:null}).optimumCorner},ke=function(t,e){var n=de(180),A=[];return Yt(e).forEach(function(e,o){if(0===o){var i=e[0];if(20===i.type&&-1!==["top","left","right","bottom"].indexOf(i.value))return void(n=le(e));if(ce(i))return void(n=(se(t,i)+de(270))%de(360))}var r=Qe(t,e);A.push(r)}),{angle:n,stops:A,type:1}},Ie="closest-side",Te="farthest-side",He="closest-corner",_e="farthest-corner",De="circle",Me="ellipse",Pe="cover",Le="contain",Re=function(t,e){var n=0,A=3,o=[],i=[];return Yt(e).forEach(function(e,r){var a=!0;if(0===r?a=e.reduce(function(t,e){if(Gt(e))switch(e.value){case"center":return i.push(ne),!1;case"top":case"left":return i.push(ee),!1;case"right":case"bottom":return i.push(Ae),!1}else if($t(e)||Zt(e))return i.push(e),!1;return t},a):1===r&&(a=e.reduce(function(t,e){if(Gt(e))switch(e.value){case De:return n=0,!1;case Me:return n=1,!1;case Le:case Ie:return A=0,!1;case Te:return A=1,!1;case He:return A=2,!1;case Pe:case _e:return A=3,!1}else if(Zt(e)||$t(e))return Array.isArray(A)||(A=[]),A.push(e),!1;return t},a)),a){var s=Qe(t,e);o.push(s)}}),{size:A,shape:n,stops:o,position:i,type:2}},Ke=function(t,e){if(22===e.type){var n={url:e.value,type:0};return t.cache.addImage(e.value),n}if(18===e.type){var A=Ve[e.name];if(void 0===A)throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return A(t,e.values)}throw new Error("Unsupported image type "+e.type)};var Oe,Ve={"linear-gradient":function(t,e){var n=de(180),A=[];return Yt(e).forEach(function(e,o){if(0===o){var i=e[0];if(20===i.type&&"to"===i.value)return void(n=le(e));if(ce(i))return void(n=se(t,i))}var r=Qe(t,e);A.push(r)}),{angle:n,stops:A,type:1}},"-moz-linear-gradient":ke,"-ms-linear-gradient":ke,"-o-linear-gradient":ke,"-webkit-linear-gradient":ke,"radial-gradient":function(t,e){var n=0,A=3,o=[],i=[];return Yt(e).forEach(function(e,r){var a=!0;if(0===r){var s=!1;a=e.reduce(function(t,e){if(s)if(Gt(e))switch(e.value){case"center":return i.push(ne),t;case"top":case"left":return i.push(ee),t;case"right":case"bottom":return i.push(Ae),t}else($t(e)||Zt(e))&&i.push(e);else if(Gt(e))switch(e.value){case De:return n=0,!1;case Me:return n=1,!1;case"at":return s=!0,!1;case Ie:return A=0,!1;case Pe:case Te:return A=1,!1;case Le:case He:return A=2,!1;case _e:return A=3,!1}else if(Zt(e)||$t(e))return Array.isArray(A)||(A=[]),A.push(e),!1;return t},a)}if(a){var c=Qe(t,e);o.push(c)}}),{size:A,shape:n,stops:o,position:i,type:2}},"-moz-radial-gradient":Re,"-ms-radial-gradient":Re,"-o-radial-gradient":Re,"-webkit-radial-gradient":Re,"-webkit-gradient":function(t,e){var n=de(180),A=[],o=1;return Yt(e).forEach(function(e,n){var i=e[0];if(0===n){if(Gt(i)&&"linear"===i.value)return void(o=1);if(Gt(i)&&"radial"===i.value)return void(o=2)}if(18===i.type)if("from"===i.name){var r=pe(t,i.values[0]);A.push({stop:ee,color:r})}else if("to"===i.name)r=pe(t,i.values[0]),A.push({stop:Ae,color:r});else if("color-stop"===i.name){var a=i.values.filter(Xt);if(2===a.length){r=pe(t,a[1]);var s=a[0];jt(s)&&A.push({stop:{type:16,number:100*s.number,flags:s.flags},color:r})}}}),1===o?{angle:(n+de(180))%de(360),stops:A,type:o}:{size:3,shape:0,stops:A,position:[],type:o}}},Ne={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(0===e.length)return[];var n=e[0];return 20===n.type&&"none"===n.value?[]:e.filter(function(t){return Xt(t)&&function(t){return!(20===t.type&&"none"===t.value||18===t.type&&!Ve[t.name])}(t)}).map(function(e){return Ke(t,e)})}},je={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(t){if(Gt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ge={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(t,e){return Yt(e).map(function(t){return t.filter($t)}).map(te)}},ze={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(t,e){return Yt(e).map(function(t){return t.filter(Gt).map(function(t){return t.value}).join(" ")}).map(We)}},We=function(t){switch(t){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(t){t.AUTO="auto",t.CONTAIN="contain",t.COVER="cover"}(Oe||(Oe={}));var qe,Xe={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(t,e){return Yt(e).map(function(t){return t.filter(Ye)})}},Ye=function(t){return Gt(t)||$t(t)},Je=function(t){return{name:"border-"+t+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Ze=Je("top"),$e=Je("right"),tn=Je("bottom"),en=Je("left"),nn=function(t){return{name:"border-radius-"+t,initialValue:"0 0",prefix:!1,type:1,parse:function(t,e){return te(e.filter($t))}}},An=nn("top-left"),on=nn("top-right"),rn=nn("bottom-right"),an=nn("bottom-left"),sn=function(t){return{name:"border-"+t+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(t,e){switch(e){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},cn=sn("top"),ln=sn("right"),dn=sn("bottom"),pn=sn("left"),un=function(t){return{name:"border-"+t+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,e){return Nt(e)?e.number:0}}},hn=un("top"),gn=un("right"),mn=un("bottom"),vn=un("left"),fn={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},wn={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(t,e){return"rtl"===e?1:0}},Bn={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(t,e){return e.filter(Gt).reduce(function(t,e){return t|bn(e.value)},0)}},bn=function(t){switch(t){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},yn={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},xn={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(t,e){return 20===e.type&&"normal"===e.value?0:17===e.type||15===e.type?e.number:0}};!function(t){t.NORMAL="normal",t.STRICT="strict"}(qe||(qe={}));var Cn,Qn={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){return"strict"===e?qe.STRICT:qe.NORMAL}},Sn={name:"line-height",initialValue:"normal",prefix:!1,type:4},Fn=function(t,e){return Gt(t)&&"normal"===t.value?1.2*e:17===t.type?e*t.number:$t(t)?ie(t,e):e},Un={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(t,e){return 20===e.type&&"none"===e.value?null:Ke(t,e)}},En={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(t,e){return"inside"===e?0:1}},kn={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},In=function(t){return{name:"margin-"+t,initialValue:"0",prefix:!1,type:4}},Tn=In("top"),Hn=In("right"),_n=In("bottom"),Dn=In("left"),Mn={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(t,e){return e.filter(Gt).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},Pn={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){return"break-word"===e?"break-word":"normal"}},Ln=function(t){return{name:"padding-"+t,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Rn=Ln("top"),Kn=Ln("right"),On=Ln("bottom"),Vn=Ln("left"),Nn={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(t,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},jn={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(t,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Gn={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return 1===e.length&&Wt(e[0],"none")?[]:Yt(e).map(function(e){for(var n={color:ye.TRANSPARENT,offsetX:ee,offsetY:ee,blur:ee},A=0,o=0;o<e.length;o++){var i=e[o];Zt(i)?(0===A?n.offsetX=i:1===A?n.offsetY=i:n.blur=i,A++):n.color=pe(t,i)}return n})}},zn={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Wn={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(t,e){if(20===e.type&&"none"===e.value)return null;if(18===e.type){var n=qn[e.name];if(void 0===n)throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return n(e.values)}return null}},qn={matrix:function(t){var e=t.filter(function(t){return 17===t.type}).map(function(t){return t.number});return 6===e.length?e:null},matrix3d:function(t){var e=t.filter(function(t){return 17===t.type}).map(function(t){return t.number}),n=e[0],A=e[1];e[2],e[3];var o=e[4],i=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var r=e[12],a=e[13];return e[14],e[15],16===e.length?[n,A,o,i,r,a]:null}},Xn={type:16,number:50,flags:4},Yn=[Xn,Xn],Jn={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(t,e){var n=e.filter($t);return 2!==n.length?Yn:[n[0],n[1]]}},Zn={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}};!function(t){t.NORMAL="normal",t.BREAK_ALL="break-all",t.KEEP_ALL="keep-all"}(Cn||(Cn={}));for(var $n={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-all":return Cn.BREAK_ALL;case"keep-all":return Cn.KEEP_ALL;default:return Cn.NORMAL}}},tA={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(t,e){if(20===e.type)return{auto:!0,order:0};if(jt(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},eA={name:"time",parse:function(t,e){if(15===e.type)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},nA={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(t,e){return jt(e)?e.number:1}},AA={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},oA={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(t,e){return e.filter(Gt).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return 0!==t})}},iA={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(t,e){var n=[],A=[];return e.forEach(function(t){switch(t.type){case 20:case 0:n.push(t.value);break;case 17:n.push(t.number.toString());break;case 4:A.push(n.join(" ")),n.length=0}}),n.length&&A.push(n.join(" ")),A.map(function(t){return-1===t.indexOf(" ")?t:"'"+t+"'"})}},rA={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},aA={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(t,e){return jt(e)?e.number:Gt(e)&&"bold"===e.value?700:400}},sA={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.filter(Gt).map(function(t){return t.value})}},cA={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},lA=function(t,e){return 0!==(t&e)},dA={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(0===e.length)return[];var n=e[0];return 20===n.type&&"none"===n.value?[]:e}},pA={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(0===e.length)return null;var n=e[0];if(20===n.type&&"none"===n.value)return null;for(var A=[],o=e.filter(qt),i=0;i<o.length;i++){var r=o[i],a=o[i+1];if(20===r.type){var s=a&&jt(a)?a.number:1;A.push({counter:r.value,increment:s})}}return A}},uA={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(0===e.length)return[];for(var n=[],A=e.filter(qt),o=0;o<A.length;o++){var i=A[o],r=A[o+1];if(Gt(i)&&"none"!==i.value){var a=r&&jt(r)?r.number:0;n.push({counter:i.value,reset:a})}}return n}},hA={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(t,e){return e.filter(Nt).map(function(e){return eA.parse(t,e)})}},gA={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(0===e.length)return null;var n=e[0];if(20===n.type&&"none"===n.value)return null;var A=[],o=e.filter(zt);if(o.length%2!=0)return null;for(var i=0;i<o.length;i+=2){var r=o[i].value,a=o[i+1].value;A.push({open:r,close:a})}return A}},mA=function(t,e,n){if(!t)return"";var A=t[Math.min(e,t.length-1)];return A?n?A.open:A.close:""},vA={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return 1===e.length&&Wt(e[0],"none")?[]:Yt(e).map(function(e){for(var n={color:255,offsetX:ee,offsetY:ee,blur:ee,spread:ee,inset:!1},A=0,o=0;o<e.length;o++){var i=e[o];Wt(i,"inset")?n.inset=!0:Zt(i)?(0===A?n.offsetX=i:1===A?n.offsetY=i:2===A?n.blur=i:n.spread=i,A++):n.color=pe(t,i)}return n})}},fA={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(t,e){var n=[];return e.filter(Gt).forEach(function(t){switch(t.value){case"stroke":n.push(1);break;case"fill":n.push(0);break;case"markers":n.push(2)}}),[0,1,2].forEach(function(t){-1===n.indexOf(t)&&n.push(t)}),n}},wA={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},BA={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(t,e){return Nt(e)?e.number:0}},bA=function(){function t(t,e){var n,A;this.animationDuration=CA(t,hA,e.animationDuration),this.backgroundClip=CA(t,xe,e.backgroundClip),this.backgroundColor=CA(t,Ce,e.backgroundColor),this.backgroundImage=CA(t,Ne,e.backgroundImage),this.backgroundOrigin=CA(t,je,e.backgroundOrigin),this.backgroundPosition=CA(t,Ge,e.backgroundPosition),this.backgroundRepeat=CA(t,ze,e.backgroundRepeat),this.backgroundSize=CA(t,Xe,e.backgroundSize),this.borderTopColor=CA(t,Ze,e.borderTopColor),this.borderRightColor=CA(t,$e,e.borderRightColor),this.borderBottomColor=CA(t,tn,e.borderBottomColor),this.borderLeftColor=CA(t,en,e.borderLeftColor),this.borderTopLeftRadius=CA(t,An,e.borderTopLeftRadius),this.borderTopRightRadius=CA(t,on,e.borderTopRightRadius),this.borderBottomRightRadius=CA(t,rn,e.borderBottomRightRadius),this.borderBottomLeftRadius=CA(t,an,e.borderBottomLeftRadius),this.borderTopStyle=CA(t,cn,e.borderTopStyle),this.borderRightStyle=CA(t,ln,e.borderRightStyle),this.borderBottomStyle=CA(t,dn,e.borderBottomStyle),this.borderLeftStyle=CA(t,pn,e.borderLeftStyle),this.borderTopWidth=CA(t,hn,e.borderTopWidth),this.borderRightWidth=CA(t,gn,e.borderRightWidth),this.borderBottomWidth=CA(t,mn,e.borderBottomWidth),this.borderLeftWidth=CA(t,vn,e.borderLeftWidth),this.boxShadow=CA(t,vA,e.boxShadow),this.color=CA(t,fn,e.color),this.direction=CA(t,wn,e.direction),this.display=CA(t,Bn,e.display),this.float=CA(t,yn,e.cssFloat),this.fontFamily=CA(t,iA,e.fontFamily),this.fontSize=CA(t,rA,e.fontSize),this.fontStyle=CA(t,cA,e.fontStyle),this.fontVariant=CA(t,sA,e.fontVariant),this.fontWeight=CA(t,aA,e.fontWeight),this.letterSpacing=CA(t,xn,e.letterSpacing),this.lineBreak=CA(t,Qn,e.lineBreak),this.lineHeight=CA(t,Sn,e.lineHeight),this.listStyleImage=CA(t,Un,e.listStyleImage),this.listStylePosition=CA(t,En,e.listStylePosition),this.listStyleType=CA(t,kn,e.listStyleType),this.marginTop=CA(t,Tn,e.marginTop),this.marginRight=CA(t,Hn,e.marginRight),this.marginBottom=CA(t,_n,e.marginBottom),this.marginLeft=CA(t,Dn,e.marginLeft),this.opacity=CA(t,nA,e.opacity);var o=CA(t,Mn,e.overflow);this.overflowX=o[0],this.overflowY=o[o.length>1?1:0],this.overflowWrap=CA(t,Pn,e.overflowWrap),this.paddingTop=CA(t,Rn,e.paddingTop),this.paddingRight=CA(t,Kn,e.paddingRight),this.paddingBottom=CA(t,On,e.paddingBottom),this.paddingLeft=CA(t,Vn,e.paddingLeft),this.paintOrder=CA(t,fA,e.paintOrder),this.position=CA(t,jn,e.position),this.textAlign=CA(t,Nn,e.textAlign),this.textDecorationColor=CA(t,AA,null!==(n=e.textDecorationColor)&&void 0!==n?n:e.color),this.textDecorationLine=CA(t,oA,null!==(A=e.textDecorationLine)&&void 0!==A?A:e.textDecoration),this.textShadow=CA(t,Gn,e.textShadow),this.textTransform=CA(t,zn,e.textTransform),this.transform=CA(t,Wn,e.transform),this.transformOrigin=CA(t,Jn,e.transformOrigin),this.visibility=CA(t,Zn,e.visibility),this.webkitTextStrokeColor=CA(t,wA,e.webkitTextStrokeColor),this.webkitTextStrokeWidth=CA(t,BA,e.webkitTextStrokeWidth),this.wordBreak=CA(t,$n,e.wordBreak),this.zIndex=CA(t,tA,e.zIndex)}return t.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},t.prototype.isTransparent=function(){return ue(this.backgroundColor)},t.prototype.isTransformed=function(){return null!==this.transform},t.prototype.isPositioned=function(){return 0!==this.position},t.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},t.prototype.isFloating=function(){return 0!==this.float},t.prototype.isInlineLevel=function(){return lA(this.display,4)||lA(this.display,33554432)||lA(this.display,268435456)||lA(this.display,536870912)||lA(this.display,67108864)||lA(this.display,134217728)},t}(),yA=function(t,e){this.content=CA(t,dA,e.content),this.quotes=CA(t,gA,e.quotes)},xA=function(t,e){this.counterIncrement=CA(t,pA,e.counterIncrement),this.counterReset=CA(t,uA,e.counterReset)},CA=function(t,e,n){var A=new Ot,o=null!=n?n.toString():e.initialValue;A.write(o);var i=new Vt(A.read());switch(e.type){case 2:var r=i.parseComponentValue();return e.parse(t,Gt(r)?r.value:e.initialValue);case 0:return e.parse(t,i.parseComponentValue());case 1:return e.parse(t,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(e.format){case"angle":return se(t,i.parseComponentValue());case"color":return pe(t,i.parseComponentValue());case"image":return Ke(t,i.parseComponentValue());case"length":var a=i.parseComponentValue();return Zt(a)?a:ee;case"length-percentage":var s=i.parseComponentValue();return $t(s)?s:ee;case"time":return eA.parse(t,i.parseComponentValue())}}},QA=function(t,e){var n=function(t){switch(t.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}}(t);return 1===n||e===n},SA=function(t,e){this.context=t,this.textNodes=[],this.elements=[],this.flags=0,QA(e,3),this.styles=new bA(t,window.getComputedStyle(e,null)),Io(e)&&(this.styles.animationDuration.some(function(t){return t>0})&&(e.style.animationDuration="0s"),null!==this.styles.transform&&(e.style.transform="none")),this.bounds=a(this.context,e),QA(e,4)&&(this.flags|=16)},FA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",UA="undefined"==typeof Uint8Array?[]:new Uint8Array(256),EA=0;EA<64;EA++)UA[FA.charCodeAt(EA)]=EA;for(var kA=function(t,e,n){return t.slice?t.slice(e,n):new Uint16Array(Array.prototype.slice.call(t,e,n))},IA=function(){function t(t,e,n,A,o,i){this.initialValue=t,this.errorValue=e,this.highStart=n,this.highValueIndex=A,this.index=o,this.data=i}return t.prototype.get=function(t){var e;if(t>=0){if(t<55296||t>56319&&t<=65535)return e=((e=this.index[t>>5])<<2)+(31&t),this.data[e];if(t<=65535)return e=((e=this.index[2048+(t-55296>>5)])<<2)+(31&t),this.data[e];if(t<this.highStart)return e=2080+(t>>11),e=this.index[e],e+=t>>5&63,e=((e=this.index[e])<<2)+(31&t),this.data[e];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),TA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",HA="undefined"==typeof Uint8Array?[]:new Uint8Array(256),_A=0;_A<64;_A++)HA[TA.charCodeAt(_A)]=_A;var DA,MA=8,PA=9,LA=11,RA=12,KA=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var n=t.length;if(!n)return"";for(var A=[],o=-1,i="";++o<n;){var r=t[o];r<=65535?A.push(r):(r-=65536,A.push(55296+(r>>10),r%1024+56320)),(o+1===n||A.length>16384)&&(i+=String.fromCharCode.apply(String,A),A.length=0)}return i},OA=function(t){var e,n,A,o=function(t){var e,n,A,o,i,r=.75*t.length,a=t.length,s=0;"="===t[t.length-1]&&(r--,"="===t[t.length-2]&&r--);var c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(r):new Array(r),l=Array.isArray(c)?c:new Uint8Array(c);for(e=0;e<a;e+=4)n=UA[t.charCodeAt(e)],A=UA[t.charCodeAt(e+1)],o=UA[t.charCodeAt(e+2)],i=UA[t.charCodeAt(e+3)],l[s++]=n<<2|A>>4,l[s++]=(15&A)<<4|o>>2,l[s++]=(3&o)<<6|63&i;return c}(t),i=Array.isArray(o)?function(t){for(var e=t.length,n=[],A=0;A<e;A+=4)n.push(t[A+3]<<24|t[A+2]<<16|t[A+1]<<8|t[A]);return n}(o):new Uint32Array(o),r=Array.isArray(o)?function(t){for(var e=t.length,n=[],A=0;A<e;A+=2)n.push(t[A+1]<<8|t[A]);return n}(o):new Uint16Array(o),a=kA(r,12,i[4]/2),s=2===i[5]?kA(r,(24+i[4])/2):(e=i,n=Math.ceil((24+i[4])/4),e.slice?e.slice(n,A):new Uint32Array(Array.prototype.slice.call(e,n,A)));return new IA(i[0],i[1],i[2],i[3],a,s)}("AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA="),VA="×",NA=function(t){return OA.get(t)},jA=function(t,e,n){var A=n-2,o=e[A],i=e[n-1],r=e[n];if(2===i&&3===r)return VA;if(2===i||3===i||4===i)return"÷";if(2===r||3===r||4===r)return"÷";if(i===MA&&-1!==[MA,PA,LA,RA].indexOf(r))return VA;if(!(i!==LA&&i!==PA||r!==PA&&10!==r))return VA;if((i===RA||10===i)&&10===r)return VA;if(13===r||5===r)return VA;if(7===r)return VA;if(1===i)return VA;if(13===i&&14===r){for(;5===o;)o=e[--A];if(14===o)return VA}if(15===i&&15===r){for(var a=0;15===o;)a++,o=e[--A];if(a%2==0)return VA}return"÷"},GA=function(t){var e=function(t){for(var e=[],n=0,A=t.length;n<A;){var o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<A){var i=t.charCodeAt(n++);56320==(64512&i)?e.push(((1023&o)<<10)+(1023&i)+65536):(e.push(o),n--)}else e.push(o)}return e}(t),n=e.length,A=0,o=0,i=e.map(NA);return{next:function(){if(A>=n)return{done:!0,value:null};for(var t=VA;A<n&&(t=jA(0,i,++A))===VA;);if(t!==VA||A===n){var r=KA.apply(null,e.slice(o,A));return o=A,{value:r,done:!1}}return{done:!0,value:null}}}},zA=function(t){return 0===t[0]&&255===t[1]&&0===t[2]&&255===t[3]},WA=function(t,e,n,A,o){var i="http://www.w3.org/2000/svg",r=document.createElementNS(i,"svg"),a=document.createElementNS(i,"foreignObject");return r.setAttributeNS(null,"width",t.toString()),r.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",n.toString()),a.setAttributeNS(null,"y",A.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),r.appendChild(a),a.appendChild(o),r},qA=function(t){return new Promise(function(e,n){var A=new Image;A.onload=function(){return e(A)},A.onerror=n,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(t))})},XA={get SUPPORT_RANGE_BOUNDS(){var t=function(t){if(t.createRange){var e=t.createRange();if(e.getBoundingClientRect){var n=t.createElement("boundtest");n.style.height="123px",n.style.display="block",t.body.appendChild(n),e.selectNode(n);var A=e.getBoundingClientRect(),o=Math.round(A.height);if(t.body.removeChild(n),123===o)return!0}}return!1}(document);return Object.defineProperty(XA,"SUPPORT_RANGE_BOUNDS",{value:t}),t},get SUPPORT_WORD_BREAKING(){var t=XA.SUPPORT_RANGE_BOUNDS&&function(t){var e=t.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",t.body.appendChild(e);var n=t.createRange();e.innerHTML="function"==typeof"".repeat?"👨".repeat(10):"";var A=e.firstChild,o=s(A.data).map(function(t){return c(t)}),i=0,r={},a=o.every(function(t,e){n.setStart(A,i),n.setEnd(A,i+t.length);var o=n.getBoundingClientRect();i+=t.length;var a=o.x>r.x||o.y>r.y;return r=o,0===e||a});return t.body.removeChild(e),a}(document);return Object.defineProperty(XA,"SUPPORT_WORD_BREAKING",{value:t}),t},get SUPPORT_SVG_DRAWING(){var t=function(t){var e=new Image,n=t.createElement("canvas"),A=n.getContext("2d");if(!A)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{A.drawImage(e,0,0),n.toDataURL()}catch(t){return!1}return!0}(document);return Object.defineProperty(XA,"SUPPORT_SVG_DRAWING",{value:t}),t},get SUPPORT_FOREIGNOBJECT_DRAWING(){var t="function"==typeof Array.from&&"function"==typeof window.fetch?function(t){var e=t.createElement("canvas"),n=100;e.width=n,e.height=n;var A=e.getContext("2d");if(!A)return Promise.reject(!1);A.fillStyle="rgb(0, 255, 0)",A.fillRect(0,0,n,n);var o=new Image,i=e.toDataURL();o.src=i;var r=WA(n,n,0,0,o);return A.fillStyle="red",A.fillRect(0,0,n,n),qA(r).then(function(e){A.drawImage(e,0,0);var o=A.getImageData(0,0,n,n).data;A.fillStyle="red",A.fillRect(0,0,n,n);var r=t.createElement("div");return r.style.backgroundImage="url("+i+")",r.style.height=n+"px",zA(o)?qA(WA(n,n,0,0,r)):Promise.reject(!1)}).then(function(t){return A.drawImage(t,0,0),zA(A.getImageData(0,0,n,n).data)}).catch(function(){return!1})}(document):Promise.resolve(!1);return Object.defineProperty(XA,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:t}),t},get SUPPORT_CORS_IMAGES(){var t=void 0!==(new Image).crossOrigin;return Object.defineProperty(XA,"SUPPORT_CORS_IMAGES",{value:t}),t},get SUPPORT_RESPONSE_TYPE(){var t="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(XA,"SUPPORT_RESPONSE_TYPE",{value:t}),t},get SUPPORT_CORS_XHR(){var t="withCredentials"in new XMLHttpRequest;return Object.defineProperty(XA,"SUPPORT_CORS_XHR",{value:t}),t},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var t=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(XA,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:t}),t}},YA=function(t,e){this.text=t,this.bounds=e},JA=function(t,e){var n=e.ownerDocument;if(n){var A=n.createElement("html2canvaswrapper");A.appendChild(e.cloneNode(!0));var o=e.parentNode;if(o){o.replaceChild(A,e);var i=a(t,A);return A.firstChild&&o.replaceChild(A.firstChild,A),i}}return r.EMPTY},ZA=function(t,e,n){var A=t.ownerDocument;if(!A)throw new Error("Node has no owner document");var o=A.createRange();return o.setStart(t,e),o.setEnd(t,e+n),o},$A=function(t){if(XA.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(t)).map(function(t){return t.segment})}return function(t){for(var e,n=GA(t),A=[];!(e=n.next()).done;)e.value&&A.push(e.value.slice());return A}(t)},to=function(t,e){return 0!==e.letterSpacing?$A(t):function(t,e){if(XA.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(n.segment(t)).map(function(t){return t.segment})}return no(t,e)}(t,e)},eo=[32,160,4961,65792,65793,4153,4241],no=function(t,e){for(var n,A=function(t,e){var n=s(t),A=it(n,e),o=A[0],i=A[1],r=A[2],a=n.length,c=0,l=0;return{next:function(){if(l>=a)return{done:!0,value:null};for(var t=z;l<a&&(t=ot(n,i,o,++l,r))===z;);if(t!==z||l===a){var e=new rt(n,t,c,l);return c=l,{value:e,done:!1}}return{done:!0,value:null}}}}(t,{lineBreak:e.lineBreak,wordBreak:"break-word"===e.overflowWrap?"break-word":e.wordBreak}),o=[],i=function(){if(n.value){var t=n.value.slice(),e=s(t),A="";e.forEach(function(t){-1===eo.indexOf(t)?A+=c(t):(A.length&&o.push(A),o.push(c(t)),A="")}),A.length&&o.push(A)}};!(n=A.next()).done;)i();return o},Ao=function(t,e,n){this.text=oo(e.data,n.textTransform),this.textBounds=function(t,e,n,A){var o=to(e,n),i=[],a=0;return o.forEach(function(e){if(n.textDecorationLine.length||e.trim().length>0)if(XA.SUPPORT_RANGE_BOUNDS){var o=ZA(A,a,e.length).getClientRects();if(o.length>1){var s=$A(e),c=0;s.forEach(function(e){i.push(new YA(e,r.fromDOMRectList(t,ZA(A,c+a,e.length).getClientRects()))),c+=e.length})}else i.push(new YA(e,r.fromDOMRectList(t,o)))}else{var l=A.splitText(e.length);i.push(new YA(e,JA(t,A))),A=l}else XA.SUPPORT_RANGE_BOUNDS||(A=A.splitText(e.length));a+=e.length}),i}(t,this.text,n,e)},oo=function(t,e){switch(e){case 1:return t.toLowerCase();case 3:return t.replace(io,ro);case 2:return t.toUpperCase();default:return t}},io=/(^|\s|:|-|\(|\))([a-z])/g,ro=function(t,e,n){return t.length>0?e+n.toUpperCase():t},ao=function(t){function n(e,n){var A=t.call(this,e,n)||this;return A.src=n.currentSrc||n.src,A.intrinsicWidth=n.naturalWidth,A.intrinsicHeight=n.naturalHeight,A.context.cache.addImage(A.src),A}return e(n,t),n}(SA),so=function(t){function n(e,n){var A=t.call(this,e,n)||this;return A.canvas=n,A.intrinsicWidth=n.width,A.intrinsicHeight=n.height,A}return e(n,t),n}(SA),co=function(t){function n(e,n){var A=t.call(this,e,n)||this,o=new XMLSerializer,i=a(e,n);return n.setAttribute("width",i.width+"px"),n.setAttribute("height",i.height+"px"),A.svg="data:image/svg+xml,"+encodeURIComponent(o.serializeToString(n)),A.intrinsicWidth=n.width.baseVal.value,A.intrinsicHeight=n.height.baseVal.value,A.context.cache.addImage(A.svg),A}return e(n,t),n}(SA),lo=function(t){function n(e,n){var A=t.call(this,e,n)||this;return A.value=n.value,A}return e(n,t),n}(SA),po=function(t){function n(e,n){var A=t.call(this,e,n)||this;return A.start=n.start,A.reversed="boolean"==typeof n.reversed&&!0===n.reversed,A}return e(n,t),n}(SA),uo=[{type:15,flags:0,unit:"px",number:3}],ho=[{type:16,flags:0,number:50}],go="checkbox",mo="radio",vo="password",fo=707406591,wo=function(t){function n(e,n){var A,o,i,a=t.call(this,e,n)||this;switch(a.type=n.type.toLowerCase(),a.checked=n.checked,a.value=0===(i=(o=n).type===vo?new Array(o.value.length+1).join("•"):o.value).length?o.placeholder||"":i,a.type!==go&&a.type!==mo||(a.styles.backgroundColor=3739148031,a.styles.borderTopColor=a.styles.borderRightColor=a.styles.borderBottomColor=a.styles.borderLeftColor=2779096575,a.styles.borderTopWidth=a.styles.borderRightWidth=a.styles.borderBottomWidth=a.styles.borderLeftWidth=1,a.styles.borderTopStyle=a.styles.borderRightStyle=a.styles.borderBottomStyle=a.styles.borderLeftStyle=1,a.styles.backgroundClip=[0],a.styles.backgroundOrigin=[0],a.bounds=(A=a.bounds).width>A.height?new r(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width<A.height?new r(A.left,A.top+(A.height-A.width)/2,A.width,A.width):A),a.type){case go:a.styles.borderTopRightRadius=a.styles.borderTopLeftRadius=a.styles.borderBottomRightRadius=a.styles.borderBottomLeftRadius=uo;break;case mo:a.styles.borderTopRightRadius=a.styles.borderTopLeftRadius=a.styles.borderBottomRightRadius=a.styles.borderBottomLeftRadius=ho}return a}return e(n,t),n}(SA),Bo=function(t){function n(e,n){var A=t.call(this,e,n)||this,o=n.options[n.selectedIndex||0];return A.value=o&&o.text||"",A}return e(n,t),n}(SA),bo=function(t){function n(e,n){var A=t.call(this,e,n)||this;return A.value=n.value,A}return e(n,t),n}(SA),yo=function(t){function n(e,n){var A=t.call(this,e,n)||this;A.src=n.src,A.width=parseInt(n.width,10)||0,A.height=parseInt(n.height,10)||0,A.backgroundColor=A.styles.backgroundColor;try{if(n.contentWindow&&n.contentWindow.document&&n.contentWindow.document.documentElement){A.tree=So(e,n.contentWindow.document.documentElement);var o=n.contentWindow.document.documentElement?be(e,getComputedStyle(n.contentWindow.document.documentElement).backgroundColor):ye.TRANSPARENT,i=n.contentWindow.document.body?be(e,getComputedStyle(n.contentWindow.document.body).backgroundColor):ye.TRANSPARENT;A.backgroundColor=ue(o)?ue(i)?A.styles.backgroundColor:i:o}}catch(t){}return A}return e(n,t),n}(SA),xo=["OL","UL","MENU"],Co=function(t,e,n,A){for(var o=e.firstChild,i=void 0;o;o=i)if(i=o.nextSibling,Eo(o)&&o.data.trim().length>0)n.textNodes.push(new Ao(t,o,n.styles));else if(ko(o))if(Go(o)&&o.assignedNodes)o.assignedNodes().forEach(function(e){return Co(t,e,n,A)});else{var r=Qo(t,o);r.styles.isVisible()&&(Fo(o,r,A)?r.flags|=4:Uo(r.styles)&&(r.flags|=2),-1!==xo.indexOf(o.tagName)&&(r.flags|=8),n.elements.push(r),o.slot,o.shadowRoot?Co(t,o.shadowRoot,r,A):No(o)||Mo(o)||jo(o)||Co(t,o,r,A))}},Qo=function(t,e){return Ko(e)?new ao(t,e):Lo(e)?new so(t,e):Mo(e)?new co(t,e):Ho(e)?new lo(t,e):_o(e)?new po(t,e):Do(e)?new wo(t,e):jo(e)?new Bo(t,e):No(e)?new bo(t,e):Oo(e)?new yo(t,e):new SA(t,e)},So=function(t,e){var n=Qo(t,e);return n.flags|=4,Co(t,e,n,n),n},Fo=function(t,e,n){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Po(t)&&n.styles.isTransparent()},Uo=function(t){return t.isPositioned()||t.isFloating()},Eo=function(t){return t.nodeType===Node.TEXT_NODE},ko=function(t){return t.nodeType===Node.ELEMENT_NODE},Io=function(t){return ko(t)&&void 0!==t.style&&!To(t)},To=function(t){return"object"==typeof t.className},Ho=function(t){return"LI"===t.tagName},_o=function(t){return"OL"===t.tagName},Do=function(t){return"INPUT"===t.tagName},Mo=function(t){return"svg"===t.tagName},Po=function(t){return"BODY"===t.tagName},Lo=function(t){return"CANVAS"===t.tagName},Ro=function(t){return"VIDEO"===t.tagName},Ko=function(t){return"IMG"===t.tagName},Oo=function(t){return"IFRAME"===t.tagName},Vo=function(t){return"STYLE"===t.tagName},No=function(t){return"TEXTAREA"===t.tagName},jo=function(t){return"SELECT"===t.tagName},Go=function(t){return"SLOT"===t.tagName},zo=function(t){return t.tagName.indexOf("-")>0},Wo=function(){function t(){this.counters={}}return t.prototype.getCounterValue=function(t){var e=this.counters[t];return e&&e.length?e[e.length-1]:1},t.prototype.getCounterValues=function(t){return this.counters[t]||[]},t.prototype.pop=function(t){var e=this;t.forEach(function(t){return e.counters[t].pop()})},t.prototype.parse=function(t){var e=this,n=t.counterIncrement,A=t.counterReset,o=!0;null!==n&&n.forEach(function(t){var n=e.counters[t.counter];n&&0!==t.increment&&(o=!1,n.length||n.push(1),n[Math.max(0,n.length-1)]+=t.increment)});var i=[];return o&&A.forEach(function(t){var n=e.counters[t.counter];i.push(t.counter),n||(n=e.counters[t.counter]=[]),n.push(t.reset)}),i},t}(),qo={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Xo={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Yo={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Jo={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Zo=function(t,e,n,A,o,i){return t<e||t>n?ai(t,o,i.length>0):A.integers.reduce(function(e,n,o){for(;t>=n;)t-=n,e+=A.values[o];return e},"")+i},$o=function(t,e,n,A){var o="";do{n||t--,o=A(t)+o,t/=e}while(t*e>=e);return o},ti=function(t,e,n,A,o){var i=n-e+1;return(t<0?"-":"")+($o(Math.abs(t),i,A,function(t){return c(Math.floor(t%i)+e)})+o)},ei=function(t,e,n){void 0===n&&(n=". ");var A=e.length;return $o(Math.abs(t),A,!1,function(t){return e[Math.floor(t%A)]})+n},ni=function(t,e,n,A,o,i){if(t<-9999||t>9999)return ai(t,4,o.length>0);var r=Math.abs(t),a=o;if(0===r)return e[0]+a;for(var s=0;r>0&&s<=4;s++){var c=r%10;0===c&&lA(i,1)&&""!==a?a=e[c]+a:c>1||1===c&&0===s||1===c&&1===s&&lA(i,2)||1===c&&1===s&&lA(i,4)&&t>100||1===c&&s>1&&lA(i,8)?a=e[c]+(s>0?n[s-1]:"")+a:1===c&&s>0&&(a=n[s-1]+a),r=Math.floor(r/10)}return(t<0?A:"")+a},Ai="十百千萬",oi="拾佰仟萬",ii="マイナス",ri="마이너스",ai=function(t,e,n){var A=n?". ":"",o=n?"、":"",i=n?", ":"",r=n?" ":"";switch(e){case 0:return"•"+r;case 1:return"◦"+r;case 2:return"◾"+r;case 5:var a=ti(t,48,57,!0,A);return a.length<4?"0"+a:a;case 4:return ei(t,"〇一二三四五六七八九",o);case 6:return Zo(t,1,3999,qo,3,A).toLowerCase();case 7:return Zo(t,1,3999,qo,3,A);case 8:return ti(t,945,969,!1,A);case 9:return ti(t,97,122,!1,A);case 10:return ti(t,65,90,!1,A);case 11:return ti(t,1632,1641,!0,A);case 12:case 49:return Zo(t,1,9999,Xo,3,A);case 35:return Zo(t,1,9999,Xo,3,A).toLowerCase();case 13:return ti(t,2534,2543,!0,A);case 14:case 30:return ti(t,6112,6121,!0,A);case 15:return ei(t,"子丑寅卯辰巳午未申酉戌亥",o);case 16:return ei(t,"甲乙丙丁戊己庚辛壬癸",o);case 17:case 48:return ni(t,"零一二三四五六七八九",Ai,"負",o,14);case 47:return ni(t,"零壹貳參肆伍陸柒捌玖",oi,"負",o,15);case 42:return ni(t,"零一二三四五六七八九",Ai,"负",o,14);case 41:return ni(t,"零壹贰叁肆伍陆柒捌玖",oi,"负",o,15);case 26:return ni(t,"〇一二三四五六七八九","十百千万",ii,o,0);case 25:return ni(t,"零壱弐参四伍六七八九","拾百千万",ii,o,7);case 31:return ni(t,"영일이삼사오육칠팔구","십백천만",ri,i,7);case 33:return ni(t,"零一二三四五六七八九","十百千萬",ri,i,0);case 32:return ni(t,"零壹貳參四五六七八九","拾百千",ri,i,7);case 18:return ti(t,2406,2415,!0,A);case 20:return Zo(t,1,19999,Jo,3,A);case 21:return ti(t,2790,2799,!0,A);case 22:return ti(t,2662,2671,!0,A);case 22:return Zo(t,1,10999,Yo,3,A);case 23:return ei(t,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ei(t,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return ti(t,3302,3311,!0,A);case 28:return ei(t,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",o);case 29:return ei(t,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",o);case 34:return ti(t,3792,3801,!0,A);case 37:return ti(t,6160,6169,!0,A);case 38:return ti(t,4160,4169,!0,A);case 39:return ti(t,2918,2927,!0,A);case 40:return ti(t,1776,1785,!0,A);case 43:return ti(t,3046,3055,!0,A);case 44:return ti(t,3174,3183,!0,A);case 45:return ti(t,3664,3673,!0,A);case 46:return ti(t,3872,3881,!0,A);default:return ti(t,48,57,!0,A)}},si="data-html2canvas-ignore",ci=function(){function t(t,e,n){if(this.context=t,this.options=n,this.scrolledElements=[],this.referenceElement=e,this.counters=new Wo,this.quoteDepth=0,!e.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(e.ownerDocument.documentElement,!1)}return t.prototype.toIFrame=function(t,e){var n=this,i=di(t,e);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var r=t.defaultView.pageXOffset,a=t.defaultView.pageYOffset,s=i.contentWindow,c=s.document,l=hi(i).then(function(){return A(n,void 0,void 0,function(){var t,n;return o(this,function(A){switch(A.label){case 0:return this.scrolledElements.forEach(wi),s&&(s.scrollTo(e.left,e.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||s.scrollY===e.top&&s.scrollX===e.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(s.scrollX-e.left,s.scrollY-e.top,0,0))),t=this.options.onclone,void 0===(n=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:c.fonts&&c.fonts.ready?[4,c.fonts.ready]:[3,2];case 1:A.sent(),A.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,ui(c)]:[3,4];case 3:A.sent(),A.label=4;case 4:return"function"==typeof t?[2,Promise.resolve().then(function(){return t(c,n)}).then(function(){return i})]:[2,i]}})})});return c.open(),c.write(vi(document.doctype)+"<html></html>"),fi(this.referenceElement.ownerDocument,r,a),c.replaceChild(c.adoptNode(this.documentElement),c.documentElement),c.close(),l},t.prototype.createElementClone=function(t){if(QA(t,2),Lo(t))return this.createCanvasClone(t);if(Ro(t))return this.createVideoClone(t);if(Vo(t))return this.createStyleClone(t);var e=t.cloneNode(!1);return Ko(e)&&(Ko(t)&&t.currentSrc&&t.currentSrc!==t.src&&(e.src=t.currentSrc,e.srcset=""),"lazy"===e.loading&&(e.loading="eager")),zo(e)?this.createCustomElementClone(e):e},t.prototype.createCustomElementClone=function(t){var e=document.createElement("html2canvascustomelement");return mi(t.style,e),e},t.prototype.createStyleClone=function(t){try{var e=t.sheet;if(e&&e.cssRules){var n=[].slice.call(e.cssRules,0).reduce(function(t,e){return e&&"string"==typeof e.cssText?t+e.cssText:t},""),A=t.cloneNode(!1);return A.textContent=n,A}}catch(t){if(this.context.logger.error("Unable to access cssRules property",t),"SecurityError"!==t.name)throw t}return t.cloneNode(!1)},t.prototype.createCanvasClone=function(t){var e;if(this.options.inlineImages&&t.ownerDocument){var n=t.ownerDocument.createElement("img");try{return n.src=t.toDataURL(),n}catch(e){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",t)}}var A=t.cloneNode(!1);try{A.width=t.width,A.height=t.height;var o=t.getContext("2d"),i=A.getContext("2d");if(i)if(!this.options.allowTaint&&o)i.putImageData(o.getImageData(0,0,t.width,t.height),0,0);else{var r=null!==(e=t.getContext("webgl2"))&&void 0!==e?e:t.getContext("webgl");if(r){var a=r.getContextAttributes();!1===(null==a?void 0:a.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}i.drawImage(t,0,0)}return A}catch(e){this.context.logger.info("Unable to clone canvas as it is tainted",t)}return A},t.prototype.createVideoClone=function(t){var e=t.ownerDocument.createElement("canvas");e.width=t.offsetWidth,e.height=t.offsetHeight;var n=e.getContext("2d");try{return n&&(n.drawImage(t,0,0,e.width,e.height),this.options.allowTaint||n.getImageData(0,0,e.width,e.height)),e}catch(e){this.context.logger.info("Unable to clone video as it is tainted",t)}var A=t.ownerDocument.createElement("canvas");return A.width=t.offsetWidth,A.height=t.offsetHeight,A},t.prototype.appendChildNode=function(t,e,n){ko(e)&&("SCRIPT"===e.tagName||e.hasAttribute(si)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(e))||this.options.copyStyles&&ko(e)&&Vo(e)||t.appendChild(this.cloneNode(e,n))},t.prototype.cloneChildNodes=function(t,e,n){for(var A=this,o=t.shadowRoot?t.shadowRoot.firstChild:t.firstChild;o;o=o.nextSibling)if(ko(o)&&Go(o)&&"function"==typeof o.assignedNodes){var i=o.assignedNodes();i.length&&i.forEach(function(t){return A.appendChildNode(e,t,n)})}else this.appendChildNode(e,o,n)},t.prototype.cloneNode=function(t,e){if(Eo(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var n=t.ownerDocument.defaultView;if(n&&ko(t)&&(Io(t)||To(t))){var A=this.createElementClone(t);A.style.transitionProperty="none";var o=n.getComputedStyle(t),i=n.getComputedStyle(t,":before"),r=n.getComputedStyle(t,":after");this.referenceElement===t&&Io(A)&&(this.clonedReferenceElement=A),Po(A)&&xi(A);var a=this.counters.parse(new xA(this.context,o)),s=this.resolvePseudoContent(t,A,i,DA.BEFORE);zo(t)&&(e=!0),Ro(t)||this.cloneChildNodes(t,A,e),s&&A.insertBefore(s,A.firstChild);var c=this.resolvePseudoContent(t,A,r,DA.AFTER);return c&&A.appendChild(c),this.counters.pop(a),(o&&(this.options.copyStyles||To(t))&&!Oo(t)||e)&&mi(o,A),0===t.scrollTop&&0===t.scrollLeft||this.scrolledElements.push([A,t.scrollLeft,t.scrollTop]),(No(t)||jo(t))&&(No(A)||jo(A))&&(A.value=t.value),A}return t.cloneNode(!1)},t.prototype.resolvePseudoContent=function(t,e,n,A){var o=this;if(n){var i=n.content,r=e.ownerDocument;if(r&&i&&"none"!==i&&"-moz-alt-content"!==i&&"none"!==n.display){this.counters.parse(new xA(this.context,n));var a=new yA(this.context,n),s=r.createElement("html2canvaspseudoelement");mi(n,s),a.content.forEach(function(e){if(0===e.type)s.appendChild(r.createTextNode(e.value));else if(22===e.type){var n=r.createElement("img");n.src=e.value,n.style.opacity="1",s.appendChild(n)}else if(18===e.type){if("attr"===e.name){var A=e.values.filter(Gt);A.length&&s.appendChild(r.createTextNode(t.getAttribute(A[0].value)||""))}else if("counter"===e.name){var i=e.values.filter(Xt),c=i[0],l=i[1];if(c&&Gt(c)){var d=o.counters.getCounterValue(c.value),p=l&&Gt(l)?kn.parse(o.context,l.value):3;s.appendChild(r.createTextNode(ai(d,p,!1)))}}else if("counters"===e.name){var u=e.values.filter(Xt),h=(c=u[0],u[1]);if(l=u[2],c&&Gt(c)){var g=o.counters.getCounterValues(c.value),m=l&&Gt(l)?kn.parse(o.context,l.value):3,v=h&&0===h.type?h.value:"",f=g.map(function(t){return ai(t,m,!1)}).join(v);s.appendChild(r.createTextNode(f))}}}else if(20===e.type)switch(e.value){case"open-quote":s.appendChild(r.createTextNode(mA(a.quotes,o.quoteDepth++,!0)));break;case"close-quote":s.appendChild(r.createTextNode(mA(a.quotes,--o.quoteDepth,!1)));break;default:s.appendChild(r.createTextNode(e.value))}}),s.className=Bi+" "+bi;var c=A===DA.BEFORE?" "+Bi:" "+bi;return To(e)?e.className.baseValue+=c:e.className+=c,s}}},t.destroy=function(t){return!!t.parentNode&&(t.parentNode.removeChild(t),!0)},t}();!function(t){t[t.BEFORE=0]="BEFORE",t[t.AFTER=1]="AFTER"}(DA||(DA={}));var li,di=function(t,e){var n=t.createElement("iframe");return n.className="html2canvas-container",n.style.visibility="hidden",n.style.position="fixed",n.style.left="-10000px",n.style.top="0px",n.style.border="0",n.width=e.width.toString(),n.height=e.height.toString(),n.scrolling="no",n.setAttribute(si,"true"),t.body.appendChild(n),n},pi=function(t){return new Promise(function(e){t.complete?e():t.src?(t.onload=e,t.onerror=e):e()})},ui=function(t){return Promise.all([].slice.call(t.images,0).map(pi))},hi=function(t){return new Promise(function(e,n){var A=t.contentWindow;if(!A)return n("No window assigned for iframe");var o=A.document;A.onload=t.onload=function(){A.onload=t.onload=null;var n=setInterval(function(){o.body.childNodes.length>0&&"complete"===o.readyState&&(clearInterval(n),e(t))},50)}})},gi=["all","d","content"],mi=function(t,e){for(var n=t.length-1;n>=0;n--){var A=t.item(n);-1===gi.indexOf(A)&&e.style.setProperty(A,t.getPropertyValue(A))}return e},vi=function(t){var e="";return t&&(e+="<!DOCTYPE ",t.name&&(e+=t.name),t.internalSubset&&(e+=t.internalSubset),t.publicId&&(e+='"'+t.publicId+'"'),t.systemId&&(e+='"'+t.systemId+'"'),e+=">"),e},fi=function(t,e,n){t&&t.defaultView&&(e!==t.defaultView.pageXOffset||n!==t.defaultView.pageYOffset)&&t.defaultView.scrollTo(e,n)},wi=function(t){var e=t[0],n=t[1],A=t[2];e.scrollLeft=n,e.scrollTop=A},Bi="___html2canvas___pseudoelement_before",bi="___html2canvas___pseudoelement_after",yi='{\n content: "" !important;\n display: none !important;\n}',xi=function(t){Ci(t,"."+Bi+":before"+yi+"\n ."+bi+":after"+yi)},Ci=function(t,e){var n=t.ownerDocument;if(n){var A=n.createElement("style");A.textContent=e,t.appendChild(A)}},Qi=function(){function t(){}return t.getOrigin=function(e){var n=t._link;return n?(n.href=e,n.href=n.href,n.protocol+n.hostname+n.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),Si=function(){function t(t,e){this.context=t,this._options=e,this._cache={}}return t.prototype.addImage=function(t){var e=Promise.resolve();return this.has(t)?e:Hi(t)||ki(t)?((this._cache[t]=this.loadImage(t)).catch(function(){}),e):e},t.prototype.match=function(t){return this._cache[t]},t.prototype.loadImage=function(t){return A(this,void 0,void 0,function(){var e,n,A,i,r=this;return o(this,function(o){switch(o.label){case 0:return e=Qi.isSameOrigin(t),n=!Ii(t)&&!0===this._options.useCORS&&XA.SUPPORT_CORS_IMAGES&&!e,A=!Ii(t)&&!e&&!Hi(t)&&"string"==typeof this._options.proxy&&XA.SUPPORT_CORS_XHR&&!n,e||!1!==this._options.allowTaint||Ii(t)||Hi(t)||A||n?(i=t,A?[4,this.proxy(i)]:[3,2]):[2];case 1:i=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+t.substring(0,256)),[4,new Promise(function(t,e){var A=new Image;A.onload=function(){return t(A)},A.onerror=e,(Ti(i)||n)&&(A.crossOrigin="anonymous"),A.src=i,!0===A.complete&&setTimeout(function(){return t(A)},500),r._options.imageTimeout>0&&setTimeout(function(){return e("Timed out ("+r._options.imageTimeout+"ms) loading image")},r._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},t.prototype.has=function(t){return void 0!==this._cache[t]},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(t){var e=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var A=t.substring(0,256);return new Promise(function(o,i){var r=XA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(200===a.status)if("text"===r)o(a.response);else{var t=new FileReader;t.addEventListener("load",function(){return o(t.result)},!1),t.addEventListener("error",function(t){return i(t)},!1),t.readAsDataURL(a.response)}else i("Failed to proxy resource "+A+" with status code "+a.status)},a.onerror=i;var s=n.indexOf("?")>-1?"&":"?";if(a.open("GET",""+n+s+"url="+encodeURIComponent(t)+"&responseType="+r),"text"!==r&&a instanceof XMLHttpRequest&&(a.responseType=r),e._options.imageTimeout){var c=e._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return i("Timed out ("+c+"ms) proxying "+A)}}a.send()})},t}(),Fi=/^data:image\/svg\+xml/i,Ui=/^data:image\/.*;base64,/i,Ei=/^data:image\/.*/i,ki=function(t){return XA.SUPPORT_SVG_DRAWING||!_i(t)},Ii=function(t){return Ei.test(t)},Ti=function(t){return Ui.test(t)},Hi=function(t){return"blob"===t.substr(0,4)},_i=function(t){return"svg"===t.substr(-3).toLowerCase()||Fi.test(t)},Di=function(){function t(t,e){this.type=0,this.x=t,this.y=e}return t.prototype.add=function(e,n){return new t(this.x+e,this.y+n)},t}(),Mi=function(t,e,n){return new Di(t.x+(e.x-t.x)*n,t.y+(e.y-t.y)*n)},Pi=function(){function t(t,e,n,A){this.type=1,this.start=t,this.startControl=e,this.endControl=n,this.end=A}return t.prototype.subdivide=function(e,n){var A=Mi(this.start,this.startControl,e),o=Mi(this.startControl,this.endControl,e),i=Mi(this.endControl,this.end,e),r=Mi(A,o,e),a=Mi(o,i,e),s=Mi(r,a,e);return n?new t(this.start,A,r,s):new t(s,a,i,this.end)},t.prototype.add=function(e,n){return new t(this.start.add(e,n),this.startControl.add(e,n),this.endControl.add(e,n),this.end.add(e,n))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),Li=function(t){return 1===t.type},Ri=function(t){var e=t.styles,n=t.bounds,A=oe(e.borderTopLeftRadius,n.width,n.height),o=A[0],i=A[1],r=oe(e.borderTopRightRadius,n.width,n.height),a=r[0],s=r[1],c=oe(e.borderBottomRightRadius,n.width,n.height),l=c[0],d=c[1],p=oe(e.borderBottomLeftRadius,n.width,n.height),u=p[0],h=p[1],g=[];g.push((o+a)/n.width),g.push((u+l)/n.width),g.push((i+h)/n.height),g.push((s+d)/n.height);var m=Math.max.apply(Math,g);m>1&&(o/=m,i/=m,a/=m,s/=m,l/=m,d/=m,u/=m,h/=m);var v=n.width-a,f=n.height-d,w=n.width-l,B=n.height-h,b=e.borderTopWidth,y=e.borderRightWidth,x=e.borderBottomWidth,C=e.borderLeftWidth,Q=ie(e.paddingTop,t.bounds.width),S=ie(e.paddingRight,t.bounds.width),F=ie(e.paddingBottom,t.bounds.width),U=ie(e.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=o>0||i>0?Ki(n.left+C/3,n.top+b/3,o-C/3,i-b/3,li.TOP_LEFT):new Di(n.left+C/3,n.top+b/3),this.topRightBorderDoubleOuterBox=o>0||i>0?Ki(n.left+v,n.top+b/3,a-y/3,s-b/3,li.TOP_RIGHT):new Di(n.left+n.width-y/3,n.top+b/3),this.bottomRightBorderDoubleOuterBox=l>0||d>0?Ki(n.left+w,n.top+f,l-y/3,d-x/3,li.BOTTOM_RIGHT):new Di(n.left+n.width-y/3,n.top+n.height-x/3),this.bottomLeftBorderDoubleOuterBox=u>0||h>0?Ki(n.left+C/3,n.top+B,u-C/3,h-x/3,li.BOTTOM_LEFT):new Di(n.left+C/3,n.top+n.height-x/3),this.topLeftBorderDoubleInnerBox=o>0||i>0?Ki(n.left+2*C/3,n.top+2*b/3,o-2*C/3,i-2*b/3,li.TOP_LEFT):new Di(n.left+2*C/3,n.top+2*b/3),this.topRightBorderDoubleInnerBox=o>0||i>0?Ki(n.left+v,n.top+2*b/3,a-2*y/3,s-2*b/3,li.TOP_RIGHT):new Di(n.left+n.width-2*y/3,n.top+2*b/3),this.bottomRightBorderDoubleInnerBox=l>0||d>0?Ki(n.left+w,n.top+f,l-2*y/3,d-2*x/3,li.BOTTOM_RIGHT):new Di(n.left+n.width-2*y/3,n.top+n.height-2*x/3),this.bottomLeftBorderDoubleInnerBox=u>0||h>0?Ki(n.left+2*C/3,n.top+B,u-2*C/3,h-2*x/3,li.BOTTOM_LEFT):new Di(n.left+2*C/3,n.top+n.height-2*x/3),this.topLeftBorderStroke=o>0||i>0?Ki(n.left+C/2,n.top+b/2,o-C/2,i-b/2,li.TOP_LEFT):new Di(n.left+C/2,n.top+b/2),this.topRightBorderStroke=o>0||i>0?Ki(n.left+v,n.top+b/2,a-y/2,s-b/2,li.TOP_RIGHT):new Di(n.left+n.width-y/2,n.top+b/2),this.bottomRightBorderStroke=l>0||d>0?Ki(n.left+w,n.top+f,l-y/2,d-x/2,li.BOTTOM_RIGHT):new Di(n.left+n.width-y/2,n.top+n.height-x/2),this.bottomLeftBorderStroke=u>0||h>0?Ki(n.left+C/2,n.top+B,u-C/2,h-x/2,li.BOTTOM_LEFT):new Di(n.left+C/2,n.top+n.height-x/2),this.topLeftBorderBox=o>0||i>0?Ki(n.left,n.top,o,i,li.TOP_LEFT):new Di(n.left,n.top),this.topRightBorderBox=a>0||s>0?Ki(n.left+v,n.top,a,s,li.TOP_RIGHT):new Di(n.left+n.width,n.top),this.bottomRightBorderBox=l>0||d>0?Ki(n.left+w,n.top+f,l,d,li.BOTTOM_RIGHT):new Di(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=u>0||h>0?Ki(n.left,n.top+B,u,h,li.BOTTOM_LEFT):new Di(n.left,n.top+n.height),this.topLeftPaddingBox=o>0||i>0?Ki(n.left+C,n.top+b,Math.max(0,o-C),Math.max(0,i-b),li.TOP_LEFT):new Di(n.left+C,n.top+b),this.topRightPaddingBox=a>0||s>0?Ki(n.left+Math.min(v,n.width-y),n.top+b,v>n.width+y?0:Math.max(0,a-y),Math.max(0,s-b),li.TOP_RIGHT):new Di(n.left+n.width-y,n.top+b),this.bottomRightPaddingBox=l>0||d>0?Ki(n.left+Math.min(w,n.width-C),n.top+Math.min(f,n.height-x),Math.max(0,l-y),Math.max(0,d-x),li.BOTTOM_RIGHT):new Di(n.left+n.width-y,n.top+n.height-x),this.bottomLeftPaddingBox=u>0||h>0?Ki(n.left+C,n.top+Math.min(B,n.height-x),Math.max(0,u-C),Math.max(0,h-x),li.BOTTOM_LEFT):new Di(n.left+C,n.top+n.height-x),this.topLeftContentBox=o>0||i>0?Ki(n.left+C+U,n.top+b+Q,Math.max(0,o-(C+U)),Math.max(0,i-(b+Q)),li.TOP_LEFT):new Di(n.left+C+U,n.top+b+Q),this.topRightContentBox=a>0||s>0?Ki(n.left+Math.min(v,n.width+C+U),n.top+b+Q,v>n.width+C+U?0:a-C+U,s-(b+Q),li.TOP_RIGHT):new Di(n.left+n.width-(y+S),n.top+b+Q),this.bottomRightContentBox=l>0||d>0?Ki(n.left+Math.min(w,n.width-(C+U)),n.top+Math.min(f,n.height+b+Q),Math.max(0,l-(y+S)),d-(x+F),li.BOTTOM_RIGHT):new Di(n.left+n.width-(y+S),n.top+n.height-(x+F)),this.bottomLeftContentBox=u>0||h>0?Ki(n.left+C+U,n.top+B,Math.max(0,u-(C+U)),h-(x+F),li.BOTTOM_LEFT):new Di(n.left+C+U,n.top+n.height-(x+F))};!function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(li||(li={}));var Ki=function(t,e,n,A,o){var i=(Math.sqrt(2)-1)/3*4,r=n*i,a=A*i,s=t+n,c=e+A;switch(o){case li.TOP_LEFT:return new Pi(new Di(t,c),new Di(t,c-a),new Di(s-r,e),new Di(s,e));case li.TOP_RIGHT:return new Pi(new Di(t,e),new Di(t+r,e),new Di(s,c-a),new Di(s,c));case li.BOTTOM_RIGHT:return new Pi(new Di(s,e),new Di(s,e+a),new Di(t+r,c),new Di(t,c));case li.BOTTOM_LEFT:default:return new Pi(new Di(s,c),new Di(s-r,c),new Di(t,e+a),new Di(t,e))}},Oi=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},Vi=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},Ni=function(t,e,n){this.offsetX=t,this.offsetY=e,this.matrix=n,this.type=0,this.target=6},ji=function(t,e){this.path=t,this.target=e,this.type=1},Gi=function(t){this.opacity=t,this.type=2,this.target=6},zi=function(t){return 1===t.type},Wi=function(t,e){return t.length===e.length&&t.some(function(t,n){return t===e[n]})},qi=function(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},Xi=function(){function t(t,e){if(this.container=t,this.parent=e,this.effects=[],this.curves=new Ri(this.container),this.container.styles.opacity<1&&this.effects.push(new Gi(this.container.styles.opacity)),null!==this.container.styles.transform){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,A=this.container.bounds.top+this.container.styles.transformOrigin[1].number,o=this.container.styles.transform;this.effects.push(new Ni(n,A,o))}if(0!==this.container.styles.overflowX){var i=Oi(this.curves),r=Vi(this.curves);Wi(i,r)?this.effects.push(new ji(i,6)):(this.effects.push(new ji(i,2)),this.effects.push(new ji(r,4)))}}return t.prototype.getEffects=function(t){for(var e=-1===[2,3].indexOf(this.container.styles.position),n=this.parent,A=this.effects.slice(0);n;){var o=n.effects.filter(function(t){return!zi(t)});if(e||0!==n.container.styles.position||!n.parent){if(A.unshift.apply(A,o),e=-1===[2,3].indexOf(n.container.styles.position),0!==n.container.styles.overflowX){var i=Oi(n.curves),r=Vi(n.curves);Wi(i,r)||A.unshift(new ji(r,6))}}else A.unshift.apply(A,o);n=n.parent}return A.filter(function(e){return lA(e.target,t)})},t}(),Yi=function(t,e,n,A){t.container.elements.forEach(function(o){var i=lA(o.flags,4),r=lA(o.flags,2),a=new Xi(o,t);lA(o.styles.display,2048)&&A.push(a);var s=lA(o.flags,8)?[]:A;if(i||r){var c=i||o.styles.isPositioned()?n:e,l=new qi(a);if(o.styles.isPositioned()||o.styles.opacity<1||o.styles.isTransformed()){var d=o.styles.zIndex.order;if(d<0){var p=0;c.negativeZIndex.some(function(t,e){return d>t.element.container.styles.zIndex.order?(p=e,!1):p>0}),c.negativeZIndex.splice(p,0,l)}else if(d>0){var u=0;c.positiveZIndex.some(function(t,e){return d>=t.element.container.styles.zIndex.order?(u=e+1,!1):u>0}),c.positiveZIndex.splice(u,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else o.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);Yi(a,l,i?l:n,s)}else o.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),Yi(a,e,n,s);lA(o.flags,8)&&Ji(o,s)})},Ji=function(t,e){for(var n=t instanceof po?t.start:1,A=t instanceof po&&t.reversed,o=0;o<e.length;o++){var i=e[o];i.container instanceof lo&&"number"==typeof i.container.value&&0!==i.container.value&&(n=i.container.value),i.listValue=ai(n,i.container.styles.listStyleType,!0),n+=A?-1:1}},Zi=function(t,e){switch(e){case 0:return tr(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return tr(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return tr(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);default:return tr(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},$i=function(t,e){var n=[];return Li(t)?n.push(t.subdivide(.5,!1)):n.push(t),Li(e)?n.push(e.subdivide(.5,!0)):n.push(e),n},tr=function(t,e,n,A){var o=[];return Li(t)?o.push(t.subdivide(.5,!1)):o.push(t),Li(n)?o.push(n.subdivide(.5,!0)):o.push(n),Li(A)?o.push(A.subdivide(.5,!0).reverse()):o.push(A),Li(e)?o.push(e.subdivide(.5,!1).reverse()):o.push(e),o},er=function(t){var e=t.bounds,n=t.styles;return e.add(n.borderLeftWidth,n.borderTopWidth,-(n.borderRightWidth+n.borderLeftWidth),-(n.borderTopWidth+n.borderBottomWidth))},nr=function(t){var e=t.styles,n=t.bounds,A=ie(e.paddingLeft,n.width),o=ie(e.paddingRight,n.width),i=ie(e.paddingTop,n.width),r=ie(e.paddingBottom,n.width);return n.add(A+e.borderLeftWidth,i+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+A+o),-(e.borderTopWidth+e.borderBottomWidth+i+r))},Ar=function(t,e,n){var A=function(t,e){return 0===t?e.bounds:2===t?nr(e):er(e)}(ar(t.styles.backgroundOrigin,e),t),o=function(t,e){return 0===t?e.bounds:2===t?nr(e):er(e)}(ar(t.styles.backgroundClip,e),t),i=rr(ar(t.styles.backgroundSize,e),n,A),r=i[0],a=i[1],s=oe(ar(t.styles.backgroundPosition,e),A.width-r,A.height-a);return[sr(ar(t.styles.backgroundRepeat,e),s,i,A,o),Math.round(A.left+s[0]),Math.round(A.top+s[1]),r,a]},or=function(t){return Gt(t)&&t.value===Oe.AUTO},ir=function(t){return"number"==typeof t},rr=function(t,e,n){var A=e[0],o=e[1],i=e[2],r=t[0],a=t[1];if(!r)return[0,0];if($t(r)&&a&&$t(a))return[ie(r,n.width),ie(a,n.height)];var s=ir(i);if(Gt(r)&&(r.value===Oe.CONTAIN||r.value===Oe.COVER))return ir(i)?n.width/n.height<i!=(r.value===Oe.COVER)?[n.width,n.width/i]:[n.height*i,n.height]:[n.width,n.height];var c=ir(A),l=ir(o),d=c||l;if(or(r)&&(!a||or(a)))return c&&l?[A,o]:s||d?d&&s?[c?A:o*i,l?o:A/i]:[c?A:n.width,l?o:n.height]:[n.width,n.height];if(s){var p=0,u=0;return $t(r)?p=ie(r,n.width):$t(a)&&(u=ie(a,n.height)),or(r)?p=u*i:a&&!or(a)||(u=p/i),[p,u]}var h=null,g=null;if($t(r)?h=ie(r,n.width):a&&$t(a)&&(g=ie(a,n.height)),null===h||a&&!or(a)||(g=c&&l?h/A*o:n.height),null!==g&&or(r)&&(h=c&&l?g/o*A:n.width),null!==h&&null!==g)return[h,g];throw new Error("Unable to calculate background-size for element")},ar=function(t,e){var n=t[e];return void 0===n?t[0]:n},sr=function(t,e,n,A,o){var i=e[0],r=e[1],a=n[0],s=n[1];switch(t){case 2:return[new Di(Math.round(A.left),Math.round(A.top+r)),new Di(Math.round(A.left+A.width),Math.round(A.top+r)),new Di(Math.round(A.left+A.width),Math.round(s+A.top+r)),new Di(Math.round(A.left),Math.round(s+A.top+r))];case 3:return[new Di(Math.round(A.left+i),Math.round(A.top)),new Di(Math.round(A.left+i+a),Math.round(A.top)),new Di(Math.round(A.left+i+a),Math.round(A.height+A.top)),new Di(Math.round(A.left+i),Math.round(A.height+A.top))];case 1:return[new Di(Math.round(A.left+i),Math.round(A.top+r)),new Di(Math.round(A.left+i+a),Math.round(A.top+r)),new Di(Math.round(A.left+i+a),Math.round(A.top+r+s)),new Di(Math.round(A.left+i),Math.round(A.top+r+s))];default:return[new Di(Math.round(o.left),Math.round(o.top)),new Di(Math.round(o.left+o.width),Math.round(o.top)),new Di(Math.round(o.left+o.width),Math.round(o.height+o.top)),new Di(Math.round(o.left),Math.round(o.height+o.top))]}},cr="Hidden Text",lr=function(){function t(t){this._data={},this._document=t}return t.prototype.parseMetrics=function(t,e){var n=this._document.createElement("div"),A=this._document.createElement("img"),o=this._document.createElement("span"),i=this._document.body;n.style.visibility="hidden",n.style.fontFamily=t,n.style.fontSize=e,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",i.appendChild(n),A.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",A.width=1,A.height=1,A.style.margin="0",A.style.padding="0",A.style.verticalAlign="baseline",o.style.fontFamily=t,o.style.fontSize=e,o.style.margin="0",o.style.padding="0",o.appendChild(this._document.createTextNode(cr)),n.appendChild(o),n.appendChild(A);var r=A.offsetTop-o.offsetTop+2;n.removeChild(o),n.appendChild(this._document.createTextNode(cr)),n.style.lineHeight="normal",A.style.verticalAlign="super";var a=A.offsetTop-n.offsetTop+2;return i.removeChild(n),{baseline:r,middle:a}},t.prototype.getMetrics=function(t,e){var n=t+" "+e;return void 0===this._data[n]&&(this._data[n]=this.parseMetrics(t,e)),this._data[n]},t}(),dr=function(t,e){this.context=t,this.options=e},pr=function(t){function n(e,n){var A=t.call(this,e,n)||this;return A._activeEffects=[],A.canvas=n.canvas?n.canvas:document.createElement("canvas"),A.ctx=A.canvas.getContext("2d"),n.canvas||(A.canvas.width=Math.floor(n.width*n.scale),A.canvas.height=Math.floor(n.height*n.scale),A.canvas.style.width=n.width+"px",A.canvas.style.height=n.height+"px"),A.fontMetrics=new lr(document),A.ctx.scale(A.options.scale,A.options.scale),A.ctx.translate(-n.x,-n.y),A.ctx.textBaseline="bottom",A._activeEffects=[],A.context.logger.debug("Canvas renderer initialized ("+n.width+"x"+n.height+") with scale "+n.scale),A}return e(n,t),n.prototype.applyEffects=function(t){for(var e=this;this._activeEffects.length;)this.popEffect();t.forEach(function(t){return e.applyEffect(t)})},n.prototype.applyEffect=function(t){this.ctx.save(),function(t){return 2===t.type}(t)&&(this.ctx.globalAlpha=t.opacity),function(t){return 0===t.type}(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),zi(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},n.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},n.prototype.renderStack=function(t){return A(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return t.element.container.styles.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},n.prototype.renderNode=function(t){return A(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return lA(t.container.flags,16),t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return e.sent(),[4,this.renderNodeContent(t)];case 2:e.sent(),e.label=3;case 3:return[2]}})})},n.prototype.renderTextWithLetterSpacing=function(t,e,n){var A=this;0===e?this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+n):$A(t.text).reduce(function(e,o){return A.ctx.fillText(o,e,t.bounds.top+n),e+A.ctx.measureText(o).width},t.bounds.left)},n.prototype.createFontStyle=function(t){var e=t.fontVariant.filter(function(t){return"normal"===t||"small-caps"===t}).join(""),n=vr(t.fontFamily).join(", "),A=Nt(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,e,t.fontWeight,A,n].join(" "),n,A]},n.prototype.renderTextNode=function(t,e){return A(this,void 0,void 0,function(){var n,A,i,r,a,s,c,l,d=this;return o(this,function(o){return n=this.createFontStyle(e),A=n[0],i=n[1],r=n[2],this.ctx.font=A,this.ctx.direction=1===e.direction?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(i,r),s=a.baseline,c=a.middle,l=e.paintOrder,t.textBounds.forEach(function(t){l.forEach(function(n){switch(n){case 0:d.ctx.fillStyle=he(e.color),d.renderTextWithLetterSpacing(t,e.letterSpacing,s);var A=e.textShadow;A.length&&t.text.trim().length&&(A.slice(0).reverse().forEach(function(n){d.ctx.shadowColor=he(n.color),d.ctx.shadowOffsetX=n.offsetX.number*d.options.scale,d.ctx.shadowOffsetY=n.offsetY.number*d.options.scale,d.ctx.shadowBlur=n.blur.number,d.renderTextWithLetterSpacing(t,e.letterSpacing,s)}),d.ctx.shadowColor="",d.ctx.shadowOffsetX=0,d.ctx.shadowOffsetY=0,d.ctx.shadowBlur=0),e.textDecorationLine.length&&(d.ctx.fillStyle=he(e.textDecorationColor||e.color),e.textDecorationLine.forEach(function(e){switch(e){case 1:d.ctx.fillRect(t.bounds.left,Math.round(t.bounds.top+s),t.bounds.width,1);break;case 2:d.ctx.fillRect(t.bounds.left,Math.round(t.bounds.top),t.bounds.width,1);break;case 3:d.ctx.fillRect(t.bounds.left,Math.ceil(t.bounds.top+c),t.bounds.width,1)}}));break;case 1:e.webkitTextStrokeWidth&&t.text.trim().length&&(d.ctx.strokeStyle=he(e.webkitTextStrokeColor),d.ctx.lineWidth=e.webkitTextStrokeWidth,d.ctx.lineJoin=window.chrome?"miter":"round",d.ctx.strokeText(t.text,t.bounds.left,t.bounds.top+s)),d.ctx.strokeStyle="",d.ctx.lineWidth=0,d.ctx.lineJoin="miter"}})}),[2]})})},n.prototype.renderReplacedElement=function(t,e,n){if(n&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var A=nr(t),o=Vi(e);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,t.intrinsicWidth,t.intrinsicHeight,A.left,A.top,A.width,A.height),this.ctx.restore()}},n.prototype.renderNodeContent=function(t){return A(this,void 0,void 0,function(){var e,A,i,a,s,c,l,d,p,u,h,g,m,v,f,w,B,b;return o(this,function(o){switch(o.label){case 0:this.applyEffects(t.getEffects(4)),e=t.container,A=t.curves,i=e.styles,a=0,s=e.textNodes,o.label=1;case 1:return a<s.length?(c=s[a],[4,this.renderTextNode(c,i)]):[3,4];case 2:o.sent(),o.label=3;case 3:return a++,[3,1];case 4:if(!(e instanceof ao))return[3,8];o.label=5;case 5:return o.trys.push([5,7,,8]),[4,this.context.cache.match(e.src)];case 6:return f=o.sent(),this.renderReplacedElement(e,A,f),[3,8];case 7:return o.sent(),this.context.logger.error("Error loading image "+e.src),[3,8];case 8:if(e instanceof so&&this.renderReplacedElement(e,A,e.canvas),!(e instanceof co))return[3,12];o.label=9;case 9:return o.trys.push([9,11,,12]),[4,this.context.cache.match(e.svg)];case 10:return f=o.sent(),this.renderReplacedElement(e,A,f),[3,12];case 11:return o.sent(),this.context.logger.error("Error loading svg "+e.svg.substring(0,255)),[3,12];case 12:return e instanceof yo&&e.tree?[4,new n(this.context,{scale:this.options.scale,backgroundColor:e.backgroundColor,x:0,y:0,width:e.width,height:e.height}).render(e.tree)]:[3,14];case 13:l=o.sent(),e.width&&e.height&&this.ctx.drawImage(l,0,0,e.width,e.height,e.bounds.left,e.bounds.top,e.bounds.width,e.bounds.height),o.label=14;case 14:if(e instanceof wo&&(d=Math.min(e.bounds.width,e.bounds.height),e.type===go?e.checked&&(this.ctx.save(),this.path([new Di(e.bounds.left+.39363*d,e.bounds.top+.79*d),new Di(e.bounds.left+.16*d,e.bounds.top+.5549*d),new Di(e.bounds.left+.27347*d,e.bounds.top+.44071*d),new Di(e.bounds.left+.39694*d,e.bounds.top+.5649*d),new Di(e.bounds.left+.72983*d,e.bounds.top+.23*d),new Di(e.bounds.left+.84*d,e.bounds.top+.34085*d),new Di(e.bounds.left+.39363*d,e.bounds.top+.79*d)]),this.ctx.fillStyle=he(fo),this.ctx.fill(),this.ctx.restore()):e.type===mo&&e.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(e.bounds.left+d/2,e.bounds.top+d/2,d/4,0,2*Math.PI,!0),this.ctx.fillStyle=he(fo),this.ctx.fill(),this.ctx.restore())),ur(e)&&e.value.length){switch(p=this.createFontStyle(i),B=p[0],u=p[1],h=this.fontMetrics.getMetrics(B,u).baseline,this.ctx.font=B,this.ctx.fillStyle=he(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=gr(e.styles.textAlign),b=nr(e),g=0,e.styles.textAlign){case 1:g+=b.width/2;break;case 2:g+=b.width}m=b.add(g,0,0,-b.height/2+1),this.ctx.save(),this.path([new Di(b.left,b.top),new Di(b.left+b.width,b.top),new Di(b.left+b.width,b.top+b.height),new Di(b.left,b.top+b.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new YA(e.value,m),i.letterSpacing,h),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!lA(e.styles.display,2048))return[3,20];if(null===e.styles.listStyleImage)return[3,19];if(0!==(v=e.styles.listStyleImage).type)return[3,18];f=void 0,w=v.url,o.label=15;case 15:return o.trys.push([15,17,,18]),[4,this.context.cache.match(w)];case 16:return f=o.sent(),this.ctx.drawImage(f,e.bounds.left-(f.width+10),e.bounds.top),[3,18];case 17:return o.sent(),this.context.logger.error("Error loading list-style-image "+w),[3,18];case 18:return[3,20];case 19:t.listValue&&-1!==e.styles.listStyleType&&(B=this.createFontStyle(i)[0],this.ctx.font=B,this.ctx.fillStyle=he(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",b=new r(e.bounds.left,e.bounds.top+ie(e.styles.paddingTop,e.bounds.width),e.bounds.width,Fn(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new YA(t.listValue,b),i.letterSpacing,Fn(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),o.label=20;case 20:return[2]}})})},n.prototype.renderStackContent=function(t){return A(this,void 0,void 0,function(){var e,n,A,i,r,a,s,c,l,d,p,u,h,g,m;return o(this,function(o){switch(o.label){case 0:return lA(t.element.container.flags,16),[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:o.sent(),e=0,n=t.negativeZIndex,o.label=2;case 2:return e<n.length?(m=n[e],[4,this.renderStack(m)]):[3,5];case 3:o.sent(),o.label=4;case 4:return e++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:o.sent(),A=0,i=t.nonInlineLevel,o.label=7;case 7:return A<i.length?(m=i[A],[4,this.renderNode(m)]):[3,10];case 8:o.sent(),o.label=9;case 9:return A++,[3,7];case 10:r=0,a=t.nonPositionedFloats,o.label=11;case 11:return r<a.length?(m=a[r],[4,this.renderStack(m)]):[3,14];case 12:o.sent(),o.label=13;case 13:return r++,[3,11];case 14:s=0,c=t.nonPositionedInlineLevel,o.label=15;case 15:return s<c.length?(m=c[s],[4,this.renderStack(m)]):[3,18];case 16:o.sent(),o.label=17;case 17:return s++,[3,15];case 18:l=0,d=t.inlineLevel,o.label=19;case 19:return l<d.length?(m=d[l],[4,this.renderNode(m)]):[3,22];case 20:o.sent(),o.label=21;case 21:return l++,[3,19];case 22:p=0,u=t.zeroOrAutoZIndexOrTransformedOrOpacity,o.label=23;case 23:return p<u.length?(m=u[p],[4,this.renderStack(m)]):[3,26];case 24:o.sent(),o.label=25;case 25:return p++,[3,23];case 26:h=0,g=t.positiveZIndex,o.label=27;case 27:return h<g.length?(m=g[h],[4,this.renderStack(m)]):[3,30];case 28:o.sent(),o.label=29;case 29:return h++,[3,27];case 30:return[2]}})})},n.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},n.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},n.prototype.formatPath=function(t){var e=this;t.forEach(function(t,n){var A=Li(t)?t.start:t;0===n?e.ctx.moveTo(A.x,A.y):e.ctx.lineTo(A.x,A.y),Li(t)&&e.ctx.bezierCurveTo(t.startControl.x,t.startControl.y,t.endControl.x,t.endControl.y,t.end.x,t.end.y)})},n.prototype.renderRepeat=function(t,e,n,A){this.path(t),this.ctx.fillStyle=e,this.ctx.translate(n,A),this.ctx.fill(),this.ctx.translate(-n,-A)},n.prototype.resizeImage=function(t,e,n){var A;if(t.width===e&&t.height===n)return t;var o=(null!==(A=this.canvas.ownerDocument)&&void 0!==A?A:document).createElement("canvas");return o.width=Math.max(1,e),o.height=Math.max(1,n),o.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,e,n),o},n.prototype.renderBackgroundImage=function(t){return A(this,void 0,void 0,function(){var e,n,A,i,r,a;return o(this,function(s){switch(s.label){case 0:e=t.styles.backgroundImage.length-1,n=function(n){var i,r,a,s,c,l,d,p,u,h,g,m,v,f,w,B,b,y,x,C,Q,S,F,U,E,k,I,T,H,_,D;return o(this,function(o){switch(o.label){case 0:if(0!==n.type)return[3,5];i=void 0,r=n.url,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,A.context.cache.match(r)];case 2:return i=o.sent(),[3,4];case 3:return o.sent(),A.context.logger.error("Error loading background-image "+r),[3,4];case 4:return i&&(a=Ar(t,e,[i.width,i.height,i.width/i.height]),B=a[0],S=a[1],F=a[2],x=a[3],C=a[4],f=A.ctx.createPattern(A.resizeImage(i,x,C),"repeat"),A.renderRepeat(B,f,S,F)),[3,6];case 5:1===n.type?(s=Ar(t,e,[null,null,null]),B=s[0],S=s[1],F=s[2],x=s[3],C=s[4],c=Fe(n.angle,x,C),l=c[0],d=c[1],p=c[2],u=c[3],h=c[4],(g=document.createElement("canvas")).width=x,g.height=C,m=g.getContext("2d"),v=m.createLinearGradient(d,u,p,h),Se(n.stops,l).forEach(function(t){return v.addColorStop(t.stop,he(t.color))}),m.fillStyle=v,m.fillRect(0,0,x,C),x>0&&C>0&&(f=A.ctx.createPattern(g,"repeat"),A.renderRepeat(B,f,S,F))):function(t){return 2===t.type}(n)&&(w=Ar(t,e,[null,null,null]),B=w[0],b=w[1],y=w[2],x=w[3],C=w[4],Q=0===n.position.length?[ne]:n.position,S=ie(Q[0],x),F=ie(Q[Q.length-1],C),U=function(t,e,n,A,o){var i=0,r=0;switch(t.size){case 0:0===t.shape?i=r=Math.min(Math.abs(e),Math.abs(e-A),Math.abs(n),Math.abs(n-o)):1===t.shape&&(i=Math.min(Math.abs(e),Math.abs(e-A)),r=Math.min(Math.abs(n),Math.abs(n-o)));break;case 2:if(0===t.shape)i=r=Math.min(Ue(e,n),Ue(e,n-o),Ue(e-A,n),Ue(e-A,n-o));else if(1===t.shape){var a=Math.min(Math.abs(n),Math.abs(n-o))/Math.min(Math.abs(e),Math.abs(e-A)),s=Ee(A,o,e,n,!0),c=s[0],l=s[1];r=a*(i=Ue(c-e,(l-n)/a))}break;case 1:0===t.shape?i=r=Math.max(Math.abs(e),Math.abs(e-A),Math.abs(n),Math.abs(n-o)):1===t.shape&&(i=Math.max(Math.abs(e),Math.abs(e-A)),r=Math.max(Math.abs(n),Math.abs(n-o)));break;case 3:if(0===t.shape)i=r=Math.max(Ue(e,n),Ue(e,n-o),Ue(e-A,n),Ue(e-A,n-o));else if(1===t.shape){a=Math.max(Math.abs(n),Math.abs(n-o))/Math.max(Math.abs(e),Math.abs(e-A));var d=Ee(A,o,e,n,!1);c=d[0],l=d[1],r=a*(i=Ue(c-e,(l-n)/a))}}return Array.isArray(t.size)&&(i=ie(t.size[0],A),r=2===t.size.length?ie(t.size[1],o):i),[i,r]}(n,S,F,x,C),E=U[0],k=U[1],E>0&&k>0&&(I=A.ctx.createRadialGradient(b+S,y+F,0,b+S,y+F,E),Se(n.stops,2*E).forEach(function(t){return I.addColorStop(t.stop,he(t.color))}),A.path(B),A.ctx.fillStyle=I,E!==k?(T=t.bounds.left+.5*t.bounds.width,H=t.bounds.top+.5*t.bounds.height,D=1/(_=k/E),A.ctx.save(),A.ctx.translate(T,H),A.ctx.transform(1,0,0,_,0,0),A.ctx.translate(-T,-H),A.ctx.fillRect(b,D*(y-H)+H,x,C*D),A.ctx.restore()):A.ctx.fill())),o.label=6;case 6:return e--,[2]}})},A=this,i=0,r=t.styles.backgroundImage.slice(0).reverse(),s.label=1;case 1:return i<r.length?(a=r[i],[5,n(a)]):[3,4];case 2:s.sent(),s.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},n.prototype.renderSolidBorder=function(t,e,n){return A(this,void 0,void 0,function(){return o(this,function(A){return this.path(Zi(n,e)),this.ctx.fillStyle=he(t),this.ctx.fill(),[2]})})},n.prototype.renderDoubleBorder=function(t,e,n,i){return A(this,void 0,void 0,function(){var A,r;return o(this,function(o){switch(o.label){case 0:return e<3?[4,this.renderSolidBorder(t,n,i)]:[3,2];case 1:return o.sent(),[2];case 2:return A=function(t,e){switch(e){case 0:return tr(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return tr(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return tr(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);default:return tr(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}}(i,n),this.path(A),this.ctx.fillStyle=he(t),this.ctx.fill(),r=function(t,e){switch(e){case 0:return tr(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return tr(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return tr(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);default:return tr(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}}(i,n),this.path(r),this.ctx.fill(),[2]}})})},n.prototype.renderNodeBackgroundAndBorders=function(t){return A(this,void 0,void 0,function(){var e,n,A,i,r,a,s,c,l=this;return o(this,function(o){switch(o.label){case 0:return this.applyEffects(t.getEffects(2)),e=t.container.styles,n=!ue(e.backgroundColor)||e.backgroundImage.length,A=[{style:e.borderTopStyle,color:e.borderTopColor,width:e.borderTopWidth},{style:e.borderRightStyle,color:e.borderRightColor,width:e.borderRightWidth},{style:e.borderBottomStyle,color:e.borderBottomColor,width:e.borderBottomWidth},{style:e.borderLeftStyle,color:e.borderLeftColor,width:e.borderLeftWidth}],i=hr(ar(e.backgroundClip,0),t.curves),n||e.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),ue(e.backgroundColor)||(this.ctx.fillStyle=he(e.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:o.sent(),this.ctx.restore(),e.boxShadow.slice(0).reverse().forEach(function(e){l.ctx.save();var n,A,o,i,r,a=Oi(t.curves),s=e.inset?0:1e4,c=(n=a,A=-s+(e.inset?1:-1)*e.spread.number,o=(e.inset?1:-1)*e.spread.number,i=e.spread.number*(e.inset?-2:2),r=e.spread.number*(e.inset?-2:2),n.map(function(t,e){switch(e){case 0:return t.add(A,o);case 1:return t.add(A+i,o);case 2:return t.add(A+i,o+r);case 3:return t.add(A,o+r)}return t}));e.inset?(l.path(a),l.ctx.clip(),l.mask(c)):(l.mask(a),l.ctx.clip(),l.path(c)),l.ctx.shadowOffsetX=e.offsetX.number+s,l.ctx.shadowOffsetY=e.offsetY.number,l.ctx.shadowColor=he(e.color),l.ctx.shadowBlur=e.blur.number,l.ctx.fillStyle=e.inset?he(e.color):"rgba(0,0,0,1)",l.ctx.fill(),l.ctx.restore()}),o.label=2;case 2:r=0,a=0,s=A,o.label=3;case 3:return a<s.length?0!==(c=s[a]).style&&!ue(c.color)&&c.width>0?2!==c.style?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,r,t.curves,2)]:[3,11]:[3,13];case 4:return o.sent(),[3,11];case 5:return 3!==c.style?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,r,t.curves,3)];case 6:return o.sent(),[3,11];case 7:return 4!==c.style?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,r,t.curves)];case 8:return o.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,r,t.curves)];case 10:o.sent(),o.label=11;case 11:r++,o.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},n.prototype.renderDashedDottedBorder=function(t,e,n,i,r){return A(this,void 0,void 0,function(){var A,a,s,c,l,d,p,u,h,g,m,v,f,w,B,b;return o(this,function(o){return this.ctx.save(),A=function(t,e){switch(e){case 0:return $i(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return $i(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return $i(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);default:return $i(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}}(i,n),a=Zi(i,n),2===r&&(this.path(a),this.ctx.clip()),Li(a[0])?(s=a[0].start.x,c=a[0].start.y):(s=a[0].x,c=a[0].y),Li(a[1])?(l=a[1].end.x,d=a[1].end.y):(l=a[1].x,d=a[1].y),p=0===n||2===n?Math.abs(s-l):Math.abs(c-d),this.ctx.beginPath(),3===r?this.formatPath(A):this.formatPath(a.slice(0,2)),u=e<3?3*e:2*e,h=e<3?2*e:e,3===r&&(u=e,h=e),g=!0,p<=2*u?g=!1:p<=2*u+h?(u*=m=p/(2*u+h),h*=m):(v=Math.floor((p+h)/(u+h)),f=(p-v*u)/(v-1),h=(w=(p-(v+1)*u)/v)<=0||Math.abs(h-f)<Math.abs(h-w)?f:w),g&&(3===r?this.ctx.setLineDash([0,u+h]):this.ctx.setLineDash([u,h])),3===r?(this.ctx.lineCap="round",this.ctx.lineWidth=e):this.ctx.lineWidth=2*e+1.1,this.ctx.strokeStyle=he(t),this.ctx.stroke(),this.ctx.setLineDash([]),2===r&&(Li(a[0])&&(B=a[3],b=a[0],this.ctx.beginPath(),this.formatPath([new Di(B.end.x,B.end.y),new Di(b.start.x,b.start.y)]),this.ctx.stroke()),Li(a[1])&&(B=a[1],b=a[2],this.ctx.beginPath(),this.formatPath([new Di(B.end.x,B.end.y),new Di(b.start.x,b.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},n.prototype.render=function(t){return A(this,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=he(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=new Xi(t,null),o=new qi(A),Yi(A,o,o,i=[]),Ji(A.container,i),e=o,[4,this.renderStack(e)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}var A,o,i})})},n}(dr),ur=function(t){return t instanceof bo||t instanceof Bo||t instanceof wo&&t.type!==mo&&t.type!==go},hr=function(t,e){switch(t){case 0:return Oi(e);case 2:return function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]}(e);default:return Vi(e)}},gr=function(t){switch(t){case 1:return"center";case 2:return"right";default:return"left"}},mr=["-apple-system","system-ui"],vr=function(t){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?t.filter(function(t){return-1===mr.indexOf(t)}):t},fr=function(t){function n(e,n){var A=t.call(this,e,n)||this;return A.canvas=n.canvas?n.canvas:document.createElement("canvas"),A.ctx=A.canvas.getContext("2d"),A.options=n,A.canvas.width=Math.floor(n.width*n.scale),A.canvas.height=Math.floor(n.height*n.scale),A.canvas.style.width=n.width+"px",A.canvas.style.height=n.height+"px",A.ctx.scale(A.options.scale,A.options.scale),A.ctx.translate(-n.x,-n.y),A.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+n.width+"x"+n.height+" at "+n.x+","+n.y+") with scale "+n.scale),A}return e(n,t),n.prototype.render=function(t){return A(this,void 0,void 0,function(){var e,n;return o(this,function(A){switch(A.label){case 0:return e=WA(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,wr(e)];case 1:return n=A.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=he(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},n}(dr),wr=function(t){return new Promise(function(e,n){var A=new Image;A.onload=function(){e(A)},A.onerror=n,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(t))})},Br=function(){function t(t){var e=t.id,n=t.enabled;this.id=e,this.enabled=n,this.start=Date.now()}return t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.debug?console.debug.apply(console,i([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},t.prototype.getTime=function(){return Date.now()-this.start},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.enabled&&"undefined"!=typeof window&&window.console&&"function"==typeof console.info&&console.info.apply(console,i([this.id,this.getTime()+"ms"],t))},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.warn?console.warn.apply(console,i([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.error?console.error.apply(console,i([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},t.instances={},t}(),br=function(){function t(e,n){var A;this.windowBounds=n,this.instanceName="#"+t.instanceCount++,this.logger=new Br({id:this.instanceName,enabled:e.logging}),this.cache=null!==(A=e.cache)&&void 0!==A?A:new Si(this,e)}return t.instanceCount=1,t}();"undefined"!=typeof window&&Qi.setContext(window);var yr=function(t,e){return A(void 0,void 0,void 0,function(){var A,i,s,c,l,d,p,u,h,g,m,v,f,w,B,b,y,x,C,Q,S,F,U,E,k,I,T,H,_,D,M,P,L,R,K,O,V,N;return o(this,function(o){switch(o.label){case 0:if(!t||"object"!=typeof t)return[2,Promise.reject("Invalid element provided as first argument")];if(!(A=t.ownerDocument))throw new Error("Element is not attached to a Document");if(!(i=A.defaultView))throw new Error("Document is not attached to a Window");return s={allowTaint:null!==(F=e.allowTaint)&&void 0!==F&&F,imageTimeout:null!==(U=e.imageTimeout)&&void 0!==U?U:15e3,proxy:e.proxy,useCORS:null!==(E=e.useCORS)&&void 0!==E&&E},c=n({logging:null===(k=e.logging)||void 0===k||k,cache:e.cache},s),l={windowWidth:null!==(I=e.windowWidth)&&void 0!==I?I:i.innerWidth,windowHeight:null!==(T=e.windowHeight)&&void 0!==T?T:i.innerHeight,scrollX:null!==(H=e.scrollX)&&void 0!==H?H:i.pageXOffset,scrollY:null!==(_=e.scrollY)&&void 0!==_?_:i.pageYOffset},d=new r(l.scrollX,l.scrollY,l.windowWidth,l.windowHeight),p=new br(c,d),u=null!==(D=e.foreignObjectRendering)&&void 0!==D&&D,h={allowTaint:null!==(M=e.allowTaint)&&void 0!==M&&M,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:u,copyStyles:u},p.logger.debug("Starting document clone with size "+d.width+"x"+d.height+" scrolled to "+-d.left+","+-d.top),g=new ci(p,t,h),(m=g.clonedReferenceElement)?[4,g.toIFrame(A,d)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=o.sent(),f=Po(m)||"HTML"===m.tagName?function(t){var e=t.body,n=t.documentElement;if(!e||!n)throw new Error("Unable to get document size");var A=Math.max(Math.max(e.scrollWidth,n.scrollWidth),Math.max(e.offsetWidth,n.offsetWidth),Math.max(e.clientWidth,n.clientWidth)),o=Math.max(Math.max(e.scrollHeight,n.scrollHeight),Math.max(e.offsetHeight,n.offsetHeight),Math.max(e.clientHeight,n.clientHeight));return new r(0,0,A,o)}(m.ownerDocument):a(p,m),w=f.width,B=f.height,b=f.left,y=f.top,x=xr(p,m,e.backgroundColor),C={canvas:e.canvas,backgroundColor:x,scale:null!==(L=null!==(P=e.scale)&&void 0!==P?P:i.devicePixelRatio)&&void 0!==L?L:1,x:(null!==(R=e.x)&&void 0!==R?R:0)+b,y:(null!==(K=e.y)&&void 0!==K?K:0)+y,width:null!==(O=e.width)&&void 0!==O?O:Math.ceil(w),height:null!==(V=e.height)&&void 0!==V?V:Math.ceil(B)},u?(p.logger.debug("Document cloned, using foreign object rendering"),[4,new fr(p,C).render(m)]):[3,3];case 2:return Q=o.sent(),[3,5];case 3:return p.logger.debug("Document cloned, element located at "+b+","+y+" with size "+w+"x"+B+" using computed rendering"),p.logger.debug("Starting DOM parsing"),S=So(p,m),x===S.styles.backgroundColor&&(S.styles.backgroundColor=ye.TRANSPARENT),p.logger.debug("Starting renderer for element at "+C.x+","+C.y+" with size "+C.width+"x"+C.height),[4,new pr(p,C).render(S)];case 4:Q=o.sent(),o.label=5;case 5:return(null===(N=e.removeContainer)||void 0===N||N)&&(ci.destroy(v)||p.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),p.logger.debug("Finished rendering"),[2,Q]}})})},xr=function(t,e,n){var A=e.ownerDocument,o=A.documentElement?be(t,getComputedStyle(A.documentElement).backgroundColor):ye.TRANSPARENT,i=A.body?be(t,getComputedStyle(A.body).backgroundColor):ye.TRANSPARENT,r="string"==typeof n?be(t,n):null===n?ye.TRANSPARENT:4294967295;return e===A.documentElement?ue(o)?ue(i)?r:i:o:r};return function(t,e){return void 0===e&&(e={}),yr(t,e)}}()}},i={};function r(t){var e=i[t];if(void 0!==e)return e.exports;var n=i[t]={exports:{}};return o[t].call(n.exports,n,n.exports,r),n.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var a={};r.r(a),r.d(a,{checkPermissionState:()=>te,getDeviceInfo:()=>Zt,getPermissionInstructions:()=>ne,openSettings:()=>Ae,shouldUseMobileVoiceCallUI:()=>$t});var s={};r.r(s),r.d(s,{showBlockedModal:()=>ce,showNoMicrophoneModal:()=>le,showPrePromptModal:()=>se,showServerDisclaimerModal:()=>de});const c=class{constructor(){this.events={}}on(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this}off(t,e){return this.events[t]?(this.events[t]=this.events[t].filter(t=>t!==e),this):this}emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),A=1;A<e;A++)n[A-1]=arguments[A];return!!this.events[t]&&(this.events[t].forEach(t=>{t(...n)}),!0)}once(t,e){var n=this,A=function(){e(...arguments),n.off(t,A)};return this.on(t,A)}removeAllListeners(t){return t?delete this.events[t]:this.events={},this}},l=class{constructor(){this.name="PCM"}decode(t){if(t instanceof ArrayBuffer)return t;if(t instanceof Uint8Array)return t.buffer;throw new Error("Invalid PCM data type")}encode(t){return t}},d=class{constructor(){this.name="PCMU"}decode(t){for(var e=t instanceof Uint8Array?t:new Uint8Array(t),n=new Int16Array(e.length),A=0;A<e.length;A++)n[A]=this.mulawToLinear(e[A]);return n.buffer}encode(t){for(var e=t instanceof Int16Array?t:new Int16Array(t),n=new Uint8Array(e.length),A=0;A<e.length;A++)n[A]=this.linearToMulaw(e[A]);return n}mulawToLinear(t){var e=1<<3+(t>>4&7);return(128&t?-1:1)*(132+(15&t)*e+(e>>1)-4)}linearToMulaw(t){var e=t>>8&128;e&&(t=-t),t>32635&&(t=32635),t+=132;for(var n=7,A=16384;0===(t&A)&&n>0;n--,A>>=1);return 255&~(e|n<<4|t>>n+3&15)}},p=class{constructor(){this.name="PCMA"}decode(t){for(var e=t instanceof Uint8Array?t:new Uint8Array(t),n=new Int16Array(e.length),A=0;A<e.length;A++)n[A]=this.alawToLinear(e[A]);return n.buffer}encode(t){for(var e=t instanceof Int16Array?t:new Int16Array(t),n=new Uint8Array(e.length),A=0;A<e.length;A++)n[A]=this.linearToAlaw(e[A]);return n}alawToLinear(t){var e=(t^=85)>>4&7,n=15&t;return(128&t?-1:1)*(0===e?8+(n<<4):264+(n<<4)<<e-1)}linearToAlaw(t){var e,n,A=t>>8&128;if(A&&(t=-t),t>32635&&(t=32635),t<256)e=0,n=t>>4;else{e=7;for(var o=16384;0===(t&o)&&e>0;e--,o>>=1);n=t>>e+3&15}return 85^(A|e<<4|n)}};function u(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function h(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){u(i,A,o,r,a,"next",t)}function a(t){u(i,A,o,r,a,"throw",t)}r(void 0)})}}var g=null,m=null;const v=class extends c{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),console.log("%c✅ TTP Agent SDK loaded","background: #10b981; color: white; font-size: 14px; font-weight: bold; padding: 4px 8px; border-radius: 4px;"),console.log(""),this.config=t,this.audioContext=null,this.gainNode=null,this._audioContextPrimed=!1,this._waitForReadyStateHandler=null,this.audioQueue=[],this.isPlaying=!1,this.isProcessingQueue=!1,this.currentSource=null,this.outputFormat=null,this.nextStartTime=0,this.scheduledBuffers=0,this.scheduledSources=new Set,this.pcmChunkQueue=[],this.preparedBuffer=[],this.MAX_PREPARED_BUFFER_SIZE=200,this.MAX_PCM_CHUNK_QUEUE_SIZE=50,this.isProcessingPcmQueue=!1,this.isSchedulingFrames=!1,this._emptySentenceTimeout=null,this.MAX_LOOKAHEAD_SECONDS=.02,this.pendingSentenceText=null,this.pendingSynced=null,this.sentenceTimings=[],this.isCheckingTranscripts=!1,this._isStopped=!1,this._currentSentenceId=0,this.codecs={pcm:new l,pcmu:new d,pcma:new p},this.SUPPORTED_CONTAINERS=["wav","raw"],this.SUPPORTED_ENCODINGS=["pcm","pcmu","pcma"],this.SUPPORTED_SAMPLE_RATES=[8e3,16e3,22050,24e3,44100,48e3],this.SUPPORTED_BIT_DEPTHS=[8,16,24],this.SUPPORTED_CHANNELS=[1],console.log("🎵 AudioPlayer v2 initialized")}setOutputFormat(t){var e;this.validateFormat(t)||(console.warn("⚠️ AudioPlayer: Invalid format, using defaults:",t),t=this.getDefaultFormat());var n=null===(e=this.outputFormat)||void 0===e?void 0:e.sampleRate,A=t.sampleRate;this.outputFormat=t,console.log("✅ AudioPlayer v2: Format set:",t),this.audioContext&&n&&n!==A&&(console.warn("⚠️ AudioPlayer: Sample rate changed, recreating AudioContext"),console.warn(" Old: ".concat(n,"Hz → New: ").concat(A,"Hz")),this.stopImmediate(),this._cleanupAudioContext(),console.log("ℹ️ AudioContext will be recreated on next audio chunk with correct sample rate"))}validateFormat(t){var e,n;if(!t)return!1;var A=null===(e=t.container)||void 0===e?void 0:e.toLowerCase(),o=null===(n=t.encoding)||void 0===n?void 0:n.toLowerCase();return A&&o&&this.SUPPORTED_CONTAINERS.includes(A)&&this.SUPPORTED_ENCODINGS.includes(o)&&this.SUPPORTED_SAMPLE_RATES.includes(t.sampleRate)&&this.SUPPORTED_BIT_DEPTHS.includes(t.bitDepth)&&(!t.channels||this.SUPPORTED_CHANNELS.includes(t.channels))}getDefaultFormat(){return{container:"raw",encoding:"pcm",sampleRate:16e3,channels:1,bitDepth:16}}playAudio(t){if(this._isStopped)console.log("🛑 AudioPlayer: Ignoring audio chunk - playback was stopped (barge-in)");else try{var e=this.createAudioBlob(t);this.audioQueue.push(e),this.isPlaying||this.isProcessingQueue||this.currentSource||setTimeout(()=>this.processQueue(),50)}catch(t){console.error("❌ AudioPlayer v2: Playback error:",t),this.emit("playbackError",t)}}playChunk(t){var e=this;return h(function*(){if(e._isStopped)console.log("🛑 AudioPlayer: Ignoring PCM chunk - playback was stopped (barge-in)");else{var n,A=e.prepareChunk(t);if(A)e._emptySentenceTimeout&&(clearTimeout(e._emptySentenceTimeout),e._emptySentenceTimeout=null),e.preparedBuffer.length>=e.MAX_PREPARED_BUFFER_SIZE&&(e.preparedBuffer.shift(),console.warn("⚠️ AudioPlayer: preparedBuffer at max size (".concat(e.MAX_PREPARED_BUFFER_SIZE,"), dropped oldest frame"))),e.preparedBuffer.push(A),e.isSchedulingFrames||e._isStopped?setTimeout(()=>{e.preparedBuffer.length>0&&!e.isSchedulingFrames&&!e._isStopped&&e.schedulePreparedFrames()},5):e.schedulePreparedFrames(),e.pcmChunkQueue.length>0&&!e.isProcessingPcmQueue&&e.processPcmQueue();else console.error("❌ AudioPlayer: playChunk failed - prepareChunk returned null"),console.error(" pcmData length:",(null==t?void 0:t.byteLength)||"undefined"),console.error(" outputFormat:",e.outputFormat),console.error(" audioContext:",e.audioContext?"initialized":"not initialized"),console.error(" audioContext state:",(null===(n=e.audioContext)||void 0===n?void 0:n.state)||"N/A"),e.emit("playbackError",new Error("Failed to prepare PCM chunk for playback"))}})()}prepareChunk(t){try{var e;if(!this.outputFormat)return console.error("❌ AudioPlayer: Cannot prepare chunk - outputFormat not set"),console.error(" Call setOutputFormat() before playing audio chunks"),null;if(this.audioContext||this.initializeAudioContext(),!this.audioContext)return console.error("❌ AudioPlayer: Cannot prepare chunk - AudioContext not available"),null;var n=t;if(t.byteLength%2!=0){console.warn("⚠️ Odd PCM chunk size, padding:",t.byteLength);var A=new Uint8Array(t.byteLength+1);A.set(new Uint8Array(t),0),A[t.byteLength]=0,n=A.buffer}for(var o=new Int16Array(n),i=new Float32Array(o.length),r=1/32768,a=o.length,s=0;s<a;s++)i[s]=o[s]*r;var c=(null===(e=this.outputFormat)||void 0===e?void 0:e.sampleRate)||this.audioContext.sampleRate,l=this.audioContext.sampleRate,d=this.audioContext.createBuffer(1,i.length,c);d.getChannelData(0).set(i);var p=d.duration,u=i.length,h=p;return l!==c&&(h=u/l),{buffer:d,duration:h,sampleRate:c,contextSampleRate:l}}catch(t){return console.error("❌ AudioPlayer: Error preparing chunk:",t),null}}applyFadeOut(t){return t}schedulePreparedFrames(){var t=this;return h(function*(){if(t._isStopped)console.log("🛑 AudioPlayer: Not scheduling frames - playback was stopped (barge-in)");else if(!t.isSchedulingFrames){t.isSchedulingFrames=!0;var e=t.preparedBuffer.length,n=Math.min(e,5);0===n&&e>0&&(n=1);try{t.audioContext||t.initializeAudioContext(),yield t.waitForAudioContextReady();for(var A=0,o=function*(){if(t._isStopped)return console.log("🛑 AudioPlayer: Stopping frame scheduling - playback was stopped"),0;var e=t.preparedBuffer.shift();if(!e)return 0;var n=t.audioContext.createBufferSource();n.buffer=e.buffer,n.connect(t.gainNode||t.audioContext.destination),t.scheduledSources.add(n);var o=t.audioContext.currentTime;if(0===t.scheduledBuffers){var i=.03;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(t._audioContextPrimed?i=0:(i=2,console.warn("⚠️ AudioPlayer: Audio not primed yet, using 2000ms fallback buffer"))),t.nextStartTime=o+i,console.log("🎵 [scheduleWAV] FIRST FRAME - primed: ".concat(t._audioContextPrimed,", buffer: ").concat(1e3*i,"ms"))}else{var r=o+t.MAX_LOOKAHEAD_SECONDS;t.nextStartTime<r&&(t.nextStartTime=r,console.warn("⚠️ AudioPlayer: Fell behind schedule, adjusting nextStartTime to ".concat(t.nextStartTime.toFixed(4),"s")))}t.pendingSentenceText&&(t.sentenceTimings.push({startTime:t.nextStartTime,text:t.pendingSentenceText,synced:t.pendingSynced,displayed:!1}),console.log("📝 AudioPlayer: Sentence scheduled at ".concat(t.nextStartTime.toFixed(3),'s: "').concat(t.pendingSentenceText.substring(0,40),'..." (synced: ').concat(t.pendingSynced?t.pendingSynced.length:0,")")),t.pendingSentenceText=null,t.pendingSynced=null,t.isCheckingTranscripts||t.startTranscriptChecker()),n.start(t.nextStartTime),t.nextStartTime+=e.duration,t.nextStartTime=Math.round(1e6*t.nextStartTime)/1e6;var a=t.nextStartTime-e.duration;t.scheduledBuffers<5&&(console.log("🎵 AudioPlayer: Scheduled frame ".concat(t.scheduledBuffers+1," at ").concat(a.toFixed(4),"s, next at ").concat(t.nextStartTime.toFixed(4),"s")),console.log(" Duration: ".concat(e.duration.toFixed(4),"s (").concat((1e3*e.duration).toFixed(2),"ms), Queued: ").concat(t.preparedBuffer.length,", Scheduled: ").concat(t.scheduledBuffers))),t.scheduledBuffers++,A++,n.onended=()=>{if(!t._isStopped&&t.scheduledSources.has(n))if(t.scheduledSources.delete(n),!t._isStopped&&t.scheduledBuffers>0&&t.scheduledBuffers--,0!==t.scheduledBuffers||0!==t.preparedBuffer.length||0!==t.pcmChunkQueue.length||t._isStopped){if(t.preparedBuffer.length>0&&!t._isStopped)setTimeout(()=>{t.preparedBuffer.length>0&&!t.isSchedulingFrames&&!t._isStopped&&t.schedulePreparedFrames()},0);else if(t.scheduledBuffers>0&&!t._isStopped){var e=()=>{t._isStopped||(t.preparedBuffer.length>0&&!t.isSchedulingFrames&&t.scheduledBuffers>0?t.schedulePreparedFrames():t.scheduledBuffers>0&&!t._isStopped&&setTimeout(e,10))};setTimeout(e,10)}}else t.isPlaying=!1,t.isSchedulingFrames=!1,console.log("🛑 AudioPlayer: Emitting playbackStopped event (all buffers finished)"),t.emit("playbackStopped")},t.isPlaying||(t.isPlaying=!0,console.log("🎵 AudioPlayer: Emitting playbackStarted event"),t.emit("playbackStarted"))};t.preparedBuffer.length>0&&A<n&&0!==(yield*o()););t.isSchedulingFrames=!1,t.preparedBuffer.length>0&&!t._isStopped&&requestAnimationFrame(()=>{t.preparedBuffer.length>0&&!t.isSchedulingFrames&&!t._isStopped&&t.schedulePreparedFrames()}),t.scheduledBuffers>0&&!t._isStopped&&setTimeout(()=>{t.preparedBuffer.length>0&&!t.isSchedulingFrames&&t.scheduledBuffers>0&&!t._isStopped?t.schedulePreparedFrames():t.scheduledBuffers>0&&!t._isStopped&&setTimeout(()=>{t.preparedBuffer.length>0&&!t.isSchedulingFrames&&t.scheduledBuffers>0&&!t._isStopped&&t.schedulePreparedFrames()},10)},10)}catch(e){console.error("❌ AudioPlayer v2: Error scheduling frames:",e),t.emit("playbackError",e),t.isSchedulingFrames=!1}}})()}processPcmQueue(){var t=this;return h(function*(){if(t._isStopped)console.log("🛑 AudioPlayer: Not processing PCM queue - playback was stopped (barge-in)");else if(!t.isProcessingPcmQueue){t.isProcessingPcmQueue=!0;try{for(t.audioContext||t.initializeAudioContext(),yield t.waitForAudioContextReady();t.pcmChunkQueue.length>0;){var e,n;if(t._isStopped){console.log("🛑 AudioPlayer: Stopping PCM queue processing - playback was stopped");break}var A=t.pcmChunkQueue.shift();if(A){var o=A;if(A.byteLength%2!=0){console.warn("⚠️ Odd PCM chunk size, padding:",A.byteLength);var i=new Uint8Array(A.byteLength+1);i.set(new Uint8Array(A),0),i[A.byteLength]=0,o=i.buffer}for(var r=new Int16Array(o),a=new Float32Array(r.length),s=1/32768,c=r.length,l=0;l<c;l++)a[l]=r[l]*s;var d=(null===(e=t.outputFormat)||void 0===e?void 0:e.sampleRate)||t.audioContext.sampleRate,p=t.audioContext.sampleRate;null!==(n=t.outputFormat)&&void 0!==n&&n.sampleRate?t.scheduledBuffers<3&&console.log("🎵 AudioPlayer: Creating buffer at ".concat(d,"Hz (AudioContext: ").concat(p,"Hz)")):console.warn("⚠️ AudioPlayer: outputFormat.sampleRate not set! Using AudioContext sample rate:",p);var u=t.audioContext.createBuffer(1,a.length,d);u.getChannelData(0).set(a);var h=t.audioContext.createBufferSource();h.buffer=u,h.connect(t.gainNode||t.audioContext.destination);var g=t.audioContext.currentTime;t.nextStartTime<g&&(t.nextStartTime=g,0===t.scheduledBuffers&&console.log("🎵 Starting playback at current time:",g));var m=u.duration,v=a.length,f=m;if(p!==d&&(f=v/p,t.scheduledBuffers<3&&(console.log("🔄 Resampling detected: ".concat(d,"Hz → ").concat(p,"Hz")),console.log(" Buffer duration: ".concat(m.toFixed(4),"s, Calculated: ").concat(f.toFixed(4),"s")))),h.start(t.nextStartTime),t.nextStartTime+=f,t.nextStartTime=Math.round(1e6*t.nextStartTime)/1e6,t.scheduledBuffers<3){var w=t.nextStartTime-f;console.log("🎵 AudioPlayer: Scheduled chunk ".concat(t.scheduledBuffers+1," at ").concat(w.toFixed(4),"s, next at ").concat(t.nextStartTime.toFixed(4),"s")),console.log(" Duration: ".concat(f.toFixed(4),"s (").concat((1e3*f).toFixed(2),"ms)"))}t.scheduledBuffers++,h.onended=()=>{t.scheduledBuffers--,0===t.scheduledBuffers&&0===t.pcmChunkQueue.length&&(t.isPlaying=!1,t.isProcessingPcmQueue=!1,t.emit("playbackStopped"))},t.isPlaying||(t.isPlaying=!0,t.emit("playbackStarted"))}}t.isProcessingPcmQueue=!1}catch(e){console.error("❌ AudioPlayer v2: Error playing chunk:",e),t.emit("playbackError",e),t.isProcessingPcmQueue=!1}}})()}createAudioBlob(t){var e=new Uint8Array(t);console.log("🎵 AudioPlayer: Processing ".concat(e.length," bytes")),console.log("🎵 AudioPlayer: Negotiated format:",this.outputFormat);var n=this.outputFormat&&this.outputFormat.container&&"wav"===this.outputFormat.container.toLowerCase(),A=this.outputFormat&&this.outputFormat.container&&"raw"===this.outputFormat.container.toLowerCase(),o=this.isWavFile(e);if(o&&console.log("🎵 AudioPlayer: Data has WAV header (RIFF)"),A&&o)return console.error("❌ AudioPlayer: CRITICAL MISMATCH!"),console.error(" Negotiated format: RAW"),console.error(" Actual data: WAV (RIFF header detected)"),console.error(" Backend is ignoring format request and sending WAV anyway."),console.warn("⚠️ AudioPlayer: Processing as WAV to avoid playback failure, but UI configuration was bypassed."),this.handleWavFile(e);if(A&&!o)console.log("🎵 AudioPlayer: Processing as RAW data (as negotiated)");else{if(n&&o)return console.log("✅ AudioPlayer: Processing as WAV file (matches negotiation)"),this.handleWavFile(e);if(n&&!o)return console.warn("⚠️ AudioPlayer: Negotiated WAV but data lacks WAV header. Attempting WAV processing anyway."),this.handleWavFile(e);if(!this.outputFormat&&o)return console.log("🎵 AudioPlayer: No format negotiated, auto-detecting WAV"),this.handleWavFile(e);this.outputFormat||o||(console.warn("⚠️ AudioPlayer: No format negotiated and data not WAV, using defaults"),this.outputFormat=this.getDefaultFormat())}return this.outputFormat||(console.warn("⚠️ AudioPlayer: No format set, using defaults"),this.outputFormat=this.getDefaultFormat()),console.log("🎵 AudioPlayer: Processing as RAW data with encoding:",this.outputFormat.encoding),this.handleRawData(e)}isWavFile(t){return t.length>=44&&82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]}handleWavFile(t){var e=this.parseWavHeader(t);if(console.log("🎵 WAV file detected:",{format:e.audioFormat,encoding:this.getEncodingName(e.audioFormat),sampleRate:e.sampleRate,channels:e.channels,bitDepth:e.bitsPerSample}),1===e.audioFormat)return console.log("✅ PCM WAV - using directly"),new Blob([t],{type:"audio/wav"});var n=this.getCodecForWavFormat(e.audioFormat);if(!n)throw new Error("Unsupported WAV format code: ".concat(e.audioFormat));console.log("🔄 Non-PCM WAV - converting to PCM WAV");var A=t.slice(44),o=n.decode(A),i=this.createWavHeader(o.byteLength,e.sampleRate,e.channels,16);return new Blob([i,o],{type:"audio/wav"})}handleRawData(t){var e,n,A=this.outputFormat.encoding.toLowerCase(),o=this.getCodec(A);if(!o)throw new Error("No codec found for encoding: ".concat(A));if(console.log("🎵 AudioPlayer: Decoding ".concat(A.toUpperCase()," to PCM")),console.log("🎵 AudioPlayer: Input format - bitDepth: ".concat(this.outputFormat.bitDepth,", sampleRate: ").concat(this.outputFormat.sampleRate)),"pcm"===A){var i=this.outputFormat.bitDepth||16;t.length,24===i?(console.warn("⚠️ AudioPlayer: Format says 24-bit PCM, but browser support is limited."),console.warn(" Treating as 16-bit PCM. If audio sounds wrong, backend should send 16-bit instead."),e=this.convert24BitTo16Bit(t),n=16):8===i?(console.log("🔄 AudioPlayer: Converting 8-bit PCM to 16-bit PCM"),e=this.convert8BitTo16Bit(t),n=16):(e=t.buffer,n=i,console.log("✅ AudioPlayer: Using native ".concat(i,"-bit PCM (no conversion needed)")))}else e=o.decode(t),n=16,console.log("🔄 AudioPlayer: Decoded ".concat(A.toUpperCase()," to 16-bit PCM"));var r=this.createWavHeader(e.byteLength,this.outputFormat.sampleRate,this.outputFormat.channels,n);return new Blob([r,e],{type:"audio/wav"})}convert24BitTo16Bit(t){for(var e=Math.floor(t.length/3),n=new Int16Array(e),A=0;A<e;A++){var o=t[3*A],i=t[3*A+1],r=t[3*A+2],a=o|i<<8|(255&r)<<16;128&r&&(a|=4278190080),n[A]=Math.max(-32768,Math.min(32767,Math.round(a/256)))}return n.buffer}convert8BitTo16Bit(t){for(var e=t.length,n=new Int16Array(e),A=0;A<e;A++){var o=t[A];n[A]=256*(o-128)}return n.buffer}getCodec(t){var e={pcm:"pcm",linear:"pcm",l16:"pcm",pcmu:"pcmu",ulaw:"pcmu",mulaw:"pcmu",g711u:"pcmu",pcma:"pcma",alaw:"pcma",g711a:"pcma"}[t.toLowerCase()];return this.codecs[e]}getCodecForWavFormat(t){switch(t){case 1:return this.codecs.pcm;case 6:return this.codecs.pcma;case 7:return this.codecs.pcmu;default:return null}}getEncodingName(t){switch(t){case 1:return"PCM";case 6:return"A-law";case 7:return"μ-law";default:return"Unknown (".concat(t,")")}}parseWavHeader(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{audioFormat:e.getUint16(20,!0),channels:e.getUint16(22,!0),sampleRate:e.getUint32(24,!0),byteRate:e.getUint32(28,!0),blockAlign:e.getUint16(32,!0),bitsPerSample:e.getUint16(34,!0)}}createWavHeader(t,e,n,A){var o=new ArrayBuffer(44),i=new DataView(o);return i.setUint32(0,1380533830,!1),i.setUint32(4,36+t,!0),i.setUint32(8,1463899717,!1),i.setUint32(12,1718449184,!1),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,n,!0),i.setUint32(24,e,!0),i.setUint32(28,e*n*A/8,!0),i.setUint16(32,n*A/8,!0),i.setUint16(34,A,!0),i.setUint32(36,1684108385,!1),i.setUint32(40,t,!0),o}waitForAudioContextReady(){var t=this;return h(function*(){if(t.audioContext||t.initializeAudioContext(),!t.audioContext)return console.error("❌ AudioPlayer: Failed to create AudioContext"),Promise.resolve();var e=t.audioContext;return"running"===e.state?Promise.resolve():"suspended"===e.state&&(yield e.resume(),"running"!==e.state)?new Promise(n=>{var A=setTimeout(()=>{e&&t._waitForReadyStateHandler&&(e.removeEventListener("statechange",t._waitForReadyStateHandler),t._waitForReadyStateHandler=null),console.warn("⚠️ AudioPlayer: AudioContext did not become running within timeout - proceeding anyway"),n()},2e3),o=()=>{if(!e)return clearTimeout(A),t._waitForReadyStateHandler=null,console.warn("⚠️ AudioPlayer: AudioContext became null during state change"),void n();"running"===e.state&&(clearTimeout(A),t._waitForReadyStateHandler&&(e.removeEventListener("statechange",t._waitForReadyStateHandler),t._waitForReadyStateHandler=null),n())};t._waitForReadyStateHandler=o,e.addEventListener("statechange",o),e&&"running"===e.state&&(clearTimeout(A),t._waitForReadyStateHandler&&(e.removeEventListener("statechange",t._waitForReadyStateHandler),t._waitForReadyStateHandler=null),n())}):"closed"===e.state?(console.warn("⚠️ AudioPlayer: AudioContext was closed, recreating..."),t.initializeAudioContext(),t.waitForAudioContextReady()):Promise.resolve()})()}initializeAudioContext(){var t,e,n=(null===(t=this.outputFormat)||void 0===t?void 0:t.sampleRate)||44100;if(48e3!==n&&44100!==n&&(console.log("ℹ️ AudioPlayer: Backend requested ".concat(n,"Hz, but browser may resample")),console.log(" Consider requesting 44100Hz or 48000Hz from backend to avoid resampling and improve quality")),this.audioContext){var A=this.audioContext.sampleRate;if(!(Math.abs(A-n)>100))return;console.warn("⚠️ AudioPlayer: AudioContext sample rate (".concat(A,"Hz) doesn't match format (").concat(n,"Hz), recreating...")),this.stopImmediate(),this._cleanupAudioContext()}if(g&&"closed"!==g.state&&m===n){console.log("♻️ AudioPlayer: Reusing shared AudioContext at ".concat(n,"Hz (iOS-safe)")),this.audioContext=g;var o=()=>{if(this.setupAudioContextStateMonitoring(),this.gainNode)try{this.gainNode.disconnect()}catch(t){console.warn("⚠️ AudioPlayer: Error disconnecting old GainNode:",t)}this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.gainNode.connect(this.audioContext.destination),this._audioContextPrimed||this._primeAudioContext()};"suspended"===this.audioContext.state?this.audioContext.resume().then(()=>o()).catch(t=>{console.warn("⚠️ AudioPlayer: Error resuming shared context:",t),o()}):o()}else{if(console.log("🎵 AudioPlayer: Creating AudioContext at ".concat(n,"Hz (from outputFormat: ").concat((null===(e=this.outputFormat)||void 0===e?void 0:e.sampleRate)||"not set",")")),g&&"closed"!==g.state){console.log("🔄 AudioPlayer: Closing old shared AudioContext (sample rate changed)");try{g.close()}catch(t){console.warn("⚠️ AudioPlayer: Error closing old shared context:",t)}}try{this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n,latencyHint:"playback"}),g=this.audioContext,m=n,console.log("✅ AudioContext created at ".concat(this.audioContext.sampleRate,"Hz (requested: ").concat(n,"Hz)")),Math.abs(this.audioContext.sampleRate-n)>100?(console.error("❌ CRITICAL: Browser sample rate mismatch!"),console.error(" Requested: ".concat(n,"Hz")),console.error(" Got: ".concat(this.audioContext.sampleRate,"Hz")),console.error(" This WILL cause audio distortion/noise!"),console.error(" Solution: Backend should send ".concat(this.audioContext.sampleRate,"Hz audio instead"))):this.audioContext.sampleRate!==n&&(console.warn("⚠️ Browser adjusted sample rate: ".concat(n,"Hz → ").concat(this.audioContext.sampleRate,"Hz")),console.warn(" Browser will automatically resample audio.")),this.setupAudioContextStateMonitoring(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.gainNode.connect(this.audioContext.destination),console.log("✅ AudioPlayer: GainNode created for volume control"),this._primeAudioContext()}catch(t){console.error("❌ Failed to create AudioContext:",t),this.audioContext=new(window.AudioContext||window.webkitAudioContext),g=this.audioContext,m=this.audioContext.sampleRate,console.log("ℹ️ Using browser default: ".concat(this.audioContext.sampleRate,"Hz")),this.setupAudioContextStateMonitoring(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.gainNode.connect(this.audioContext.destination),console.log("✅ AudioPlayer: GainNode created for volume control (fallback)"),this._primeAudioContext()}}}_primeAudioContext(){var t=this;return h(function*(){try{if(!t.audioContext||t._audioContextPrimed)return;var e=t.audioContext.sampleRate,n=t.audioContext.createBuffer(1,.15*e,e),A=t.audioContext.createBufferSource();A.buffer=n,A.connect(t.audioContext.destination),A.start(),yield new Promise(t=>setTimeout(t,150)),t._audioContextPrimed=!0,console.log("✅ AudioPlayer: Audio hardware primed with silent buffer")}catch(t){console.error("❌ AudioPlayer: Audio priming failed:",t)}})()}_cleanupAudioContext(){if(console.log("[TTP AudioPlayer] 🧹 Cleaning up AudioContext (iOS-safe: keeping shared context alive)"),this.gainNode){try{this.gainNode.disconnect()}catch(t){}this.gainNode=null}this._audioContextStateChangeHandler&&this.audioContext&&(this.audioContext.removeEventListener("statechange",this._audioContextStateChangeHandler),this._audioContextStateChangeHandler=null),this._waitForReadyStateHandler&&this.audioContext&&(this.audioContext.removeEventListener("statechange",this._waitForReadyStateHandler),this._waitForReadyStateHandler=null),this.audioContext&&"running"===this.audioContext.state&&this.audioContext.suspend().catch(t=>{console.warn("⚠️ AudioPlayer: Error suspending AudioContext during cleanup:",t)}),this.audioContext=null,this._audioContextPrimed=!1}static closeSharedContext(){g&&"closed"!==g.state&&(console.log("🗑️ AudioPlayer: Closing shared AudioContext"),g.close()),g=null,m=null}setupAudioContextStateMonitoring(){this.audioContext&&(this._audioContextStateChangeHandler&&this.audioContext.removeEventListener("statechange",this._audioContextStateChangeHandler),this._audioContextStateChangeHandler=()=>{this.audioContext?(console.log("🎵 AudioPlayer: AudioContext state changed to: ".concat(this.audioContext.state)),"suspended"===this.audioContext.state&&this.isPlaying?console.warn("⚠️ AudioPlayer: AudioContext suspended during playback"):"running"===this.audioContext.state&&!this.isPlaying&&(this.audioQueue.length>0||this.pcmChunkQueue.length>0||this.preparedBuffer.length>0)&&(console.log("✅ AudioPlayer: AudioContext resumed - resuming queue processing"),this.audioQueue.length>0&&!this.isProcessingQueue&&setTimeout(()=>this.processQueue(),50),this.pcmChunkQueue.length>0&&!this.isProcessingPcmQueue&&setTimeout(()=>this.processPcmQueue(),50),this.preparedBuffer.length>0&&!this.isSchedulingFrames&&setTimeout(()=>this.scheduleFrames(),50))):console.warn("⚠️ AudioPlayer: State change handler fired but AudioContext is null")},this.audioContext.addEventListener("statechange",this._audioContextStateChangeHandler))}processQueue(){var t=this;return h(function*(){if(t._isStopped)console.log("🛑 AudioPlayer: Not processing queue - playback was stopped (barge-in)");else if(!t.isProcessingQueue&&0!==t.audioQueue.length){t.isProcessingQueue=!0;var e=t.audioQueue.shift();if(e)try{var n=!t.isPlaying&&null===t.currentSource;t.audioContext||t.initializeAudioContext(),yield t.waitForAudioContextReady();var A=t.audioContext,o=yield e.arrayBuffer(),i=yield A.decodeAudioData(o),r=n&&!t.isPlaying&&null===t.currentSource,a=A.createBufferSource();a.buffer=i,a.connect(t.gainNode||A.destination),t.currentSource=a,t.isPlaying=!0,r&&t.emit("playbackStarted"),a.onended=()=>{t.currentSource=null,t.isProcessingQueue=!1,t.audioQueue.length>0?setTimeout(()=>t.processQueue(),50):setTimeout(()=>{0!==t.audioQueue.length||t.currentSource||(t.isPlaying=!1,t.emit("playbackStopped"))},100)},a.start()}catch(e){console.error("❌ AudioPlayer v2: Error processing queue:",e),t.currentSource=null,t.emit("playbackError",e),t.audioQueue.length>0?(t.isProcessingQueue=!1,setTimeout(()=>t.processQueue(),100)):(t.isPlaying=!1,t.isProcessingQueue=!1,t.emit("playbackStopped"))}else t.isProcessingQueue=!1}})()}stop(){this.stopImmediate()}reset(){this.stop(),this.audioQueue=[],this.pcmChunkQueue=[]}stopImmediate(){var t=this.isPlaying||null!==this.currentSource||this.scheduledSources.size>0;if(console.log("🛑 AudioPlayer.stopImmediate() called"),console.log(" isPlaying:",this.isPlaying),console.log(" currentSource:",null!==this.currentSource),console.log(" scheduledSources.size:",this.scheduledSources.size),console.log(" scheduledBuffers:",this.scheduledBuffers),this._isStopped=!0,this.isSchedulingFrames=!1,this.currentSource){try{console.log(" Stopping currentSource..."),this.currentSource.stop()}catch(t){console.log(" currentSource already stopped or error:",t.message)}this.currentSource=null}if(this.scheduledSources.size>0){console.log(" Stopping ".concat(this.scheduledSources.size," scheduled sources..."));var e=0,n=Array.from(this.scheduledSources),A=n.length;for(var o of(this.scheduledSources.clear(),this.scheduledBuffers=0,n))try{o.stop(),e++}catch(t){console.log(" Source already stopped or not started:",t.message)}console.log(" Stopped ".concat(e," sources (cleared ").concat(A," from scheduledSources)"))}this.isPlaying=!1,this.isProcessingQueue=!1,this.audioQueue=[],this.pcmChunkQueue=[],this.preparedBuffer=[],this.isProcessingPcmQueue=!1,this.isSchedulingFrames=!1,this._emptySentenceTimeout&&(clearTimeout(this._emptySentenceTimeout),this._emptySentenceTimeout=null),this.nextStartTime=0,this.clearTranscriptState(),t&&(console.log("🛑 AudioPlayer: Emitting playbackStopped event (stopImmediate called)"),this.emit("playbackStopped"))}markNewSentence(t,e){var n=this._isStopped,A=this.isPlaying||this.scheduledSources.size>0;this._isStopped?(console.log("🛑 AudioPlayer: Clearing stopped flag - new audio starting after barge-in"),this._isStopped=!1,this.nextStartTime=0,this.scheduledBuffers<0&&console.log("🔄 AudioPlayer: scheduledBuffers was negative (".concat(this.scheduledBuffers,"), resetting to 0")),this.scheduledBuffers=0,this.preparedBuffer.length>0&&console.log("🔄 AudioPlayer: Clearing ".concat(this.preparedBuffer.length," prepared frames from previous sentence (after barge-in)")),this.preparedBuffer=[],this.pcmChunkQueue.length>0&&console.log("🔄 AudioPlayer: Clearing ".concat(this.pcmChunkQueue.length," raw PCM chunks from previous sentence (after barge-in)")),this.pcmChunkQueue=[],this.isProcessingPcmQueue=!1,console.log("🔄 AudioPlayer: Reset scheduling state for new sentence (after barge-in)")):A&&console.log("📝 AudioPlayer: New sentence queued while audio playing - will start after current sentence finishes"),this.pendingSentenceText=t,this.pendingSynced=e||null,console.log('📝 AudioPlayer: New sentence marked: "'.concat(t.substring(0,40),'..." (wasStopped: ').concat(n,", isPlaying: ").concat(A,", synced: ").concat(e?e.length:0,")")),this._emptySentenceTimeout&&clearTimeout(this._emptySentenceTimeout);var o=t;this._emptySentenceTimeout=setTimeout(()=>{this.pendingSentenceText!==o||0!==this.scheduledBuffers||0!==this.preparedBuffer.length||0!==this.pcmChunkQueue.length||this._isStopped||(console.warn('⚠️ AudioPlayer: Empty sentence detected after 5s timeout - no chunks received for: "'.concat(o.substring(0,40),'..."')),this.pendingSentenceText===o&&(this.pendingSentenceText=null),this.isPlaying||0!==this.scheduledSources.size||(console.log("🛑 AudioPlayer: Emitting playbackStopped for empty sentence timeout"),this.emit("playbackStopped"))),this._emptySentenceTimeout=null},5e3)}startTranscriptChecker(){if(!this.isCheckingTranscripts){this.isCheckingTranscripts=!0,console.log("📝 AudioPlayer: Transcript checker started");var t=()=>{if(this.isCheckingTranscripts&&this.audioContext){var e=this.audioContext.currentTime;for(var n of this.sentenceTimings)if(!n.displayed&&e>=n.startTime){n.displayed=!0;var A={text:n.text};n.synced&&(A.synced=n.synced),console.log("📝 AudioPlayer: Display transcript at ".concat(e.toFixed(3),'s: "').concat(n.text.substring(0,40),'..." (synced: ').concat(n.synced?n.synced.length:0,")")),this.emit("transcriptDisplay",A)}this.isPlaying||this.scheduledBuffers>0?requestAnimationFrame(t):(this.isCheckingTranscripts=!1,console.log("📝 AudioPlayer: Transcript checker stopped"))}};requestAnimationFrame(t)}}clearTranscriptState(){this.pendingSentenceText=null,this.pendingSynced=null,this.sentenceTimings=[],this.isCheckingTranscripts=!1,console.log("📝 AudioPlayer: Transcript state cleared")}resumeAudioContext(){var t=this;return h(function*(){if(t.audioContext&&"closed"!==t.audioContext.state){if("suspended"===t.audioContext.state)try{yield t.audioContext.resume(),console.log("✅ AudioPlayer v2: AudioContext resumed after mic permission")}catch(t){console.warn("⚠️ AudioPlayer v2: Failed to resume AudioContext:",t)}}else yield t.initializeAudioContext()})()}setVolume(t){this.gainNode?(this.gainNode.gain.value=Math.max(0,Math.min(1,t)),console.log("🔊 AudioPlayer: Volume set to ".concat(this.gainNode.gain.value))):console.warn("⚠️ AudioPlayer: Cannot set volume - gainNode not initialized")}setMuted(t){this.setVolume(t?0:1)}getStatus(){return{isPlaying:this.isPlaying,isProcessingQueue:this.isProcessingQueue,queueLength:this.audioQueue.length,audioContextState:this.audioContext?this.audioContext.state:"closed",outputFormat:this.outputFormat,scheduledBuffers:this.scheduledBuffers,preparedBufferLength:this.preparedBuffer.length,scheduledSourcesCount:this.scheduledSources.size}}destroy(){this.stop(),this._cleanupAudioContext(),this.removeAllListeners()}};class f{constructor(){this.events={}}on(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e)}off(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(t=>t!==e))}emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),A=1;A<e;A++)n[A-1]=arguments[A];this.events[t]&&this.events[t].forEach(e=>{try{e(...n)}catch(e){console.error("Error in event listener for ".concat(t,":"),e)}})}removeAllListeners(t){t?delete this.events[t]:this.events={}}}function w(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function B(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){w(i,A,o,r,a,"next",t)}function a(t){w(i,A,o,r,a,"throw",t)}r(void 0)})}}function b(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?b(Object(n),!0).forEach(function(e){x(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function x(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function C(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Q(t){var e,n,A,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null!==(e=null===(n=navigator.mediaDevices)||void 0===n||null===(A=n.getSupportedConstraints)||void 0===A?void 0:A.call(n))&&void 0!==e?e:{},r={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:i.channelCount?{ideal:1}:1};return i.sampleRate&&t&&(r.sampleRate={ideal:t}),C()&&i.voiceIsolation&&(r.voiceIsolation=!0),y(y({},r),o)}var S=null,F=null,U=!1,E=null;class k extends f{constructor(t){super(),this.config=t,this.audioContext=null,this.audioWorkletNode=null,this._recorderSinkGain=null,this.mediaStream=null,this.isRecording=!1,this._starting=!1}getAudioProcessorPath(){if(this.config.audioProcessorPath)return this.config.audioProcessorPath;var t=document.getElementsByTagName("script");for(var e of t){var n=e.src;if(n&&(n.includes("agent-widget.js")||n.includes("ttp-agent-sdk")))try{new URL(n);var A=n.substring(0,n.lastIndexOf("/"));return"".concat(A,"/audio-processor.js")}catch(t){var o=n.substring(0,n.lastIndexOf("/"));return"".concat(o,"/audio-processor.js")}}return"https://cdn.talktopc.com/audio-processor.js"}checkPermissionState(){return B(function*(){try{if(navigator.permissions&&navigator.permissions.query)return(yield navigator.permissions.query({name:"microphone"})).state}catch(t){console.log("⚠️ AudioRecorder: Permissions API not available or not supported for microphone")}return null})()}requestPermission(){var t=this;return B(function*(){try{if("granted"===(yield t.checkPermissionState()))return console.log("✅ AudioRecorder: Microphone permission already granted"),!0;console.log("🎤 AudioRecorder: Requesting microphone permission...");var e=Q(t.config.sampleRate||t.config.outputSampleRate||44100,t.config.audioConstraints);return(yield navigator.mediaDevices.getUserMedia({audio:e})).getTracks().forEach(t=>t.stop()),console.log("✅ AudioRecorder: Microphone permission granted"),!0}catch(t){return console.error("❌ AudioRecorder: Failed to get microphone permission:",t),!1}})()}_getUserMediaStream(t){var e=this;return B(function*(){var n=Q(t,e.config.audioConstraints);return navigator.mediaDevices.getUserMedia({audio:n})})()}start(){var t=arguments,e=this;return B(function*(){var n=t.length>0&&void 0!==t[0]?t[0]:{};if(e._starting)console.warn("⚠️ AudioRecorder: start() already in progress, ignoring duplicate call");else{e._starting=!0;try{var A=e.config.sampleRate||e.config.outputSampleRate||44100,o=n.existingMediaStream;if(o&&o.getTracks){var i,r,a,s=null!==(i=null===(r=o.getAudioTracks)||void 0===r?void 0:r.call(o))&&void 0!==i?i:null===(a=o.getTracks)||void 0===a?void 0:a.call(o);s&&s.length>0&&s.some(t=>"live"===t.readyState)?(console.log("🎤 AudioRecorder: Using existing MediaStream (iOS single-stream fix)"),e.mediaStream=o):(console.warn("⚠️ AudioRecorder: Existing stream has no live tracks, falling back to getUserMedia"),e.mediaStream=yield e._getUserMediaStream(A))}else{console.log("🎤 AudioRecorder: Requesting microphone access...");var c=yield e.checkPermissionState();c&&console.log("📋 AudioRecorder: Current permission state: ".concat(c)),e.mediaStream=yield e._getUserMediaStream(A)}if(e.config.checkConnection&&"function"==typeof e.config.checkConnection&&!e.config.checkConnection()){e.mediaStream.getTracks().forEach(t=>t.stop()),e.mediaStream=null;var l=new Error("Connection lost - server may have rejected the call");throw l.name="ServerRejected",l.isServerRejection=!0,l}if(S&&"closed"!==S.state&&F===A)console.log("♻️ AudioRecorder: Reusing shared AudioContext (iOS-safe)"),e.audioContext=S,"suspended"===e.audioContext.state&&(yield e.audioContext.resume());else{if(S&&"closed"!==S.state){console.log("🔄 AudioRecorder: Sample rate changed, closing old shared AudioContext");try{yield S.close()}catch(t){console.warn("⚠️ AudioRecorder: Error closing old shared context:",t)}U=!1,E=null}e.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:A}),S=e.audioContext,F=A,U=!1,console.log("🎵 AudioRecorder: Created new shared AudioContext at",A,"Hz")}if("suspended"===e.audioContext.state&&(yield e.audioContext.resume()),e.config.checkConnection&&"function"==typeof e.config.checkConnection&&!e.config.checkConnection()){e.mediaStream.getTracks().forEach(t=>t.stop()),e.mediaStream=null,e.audioContext=null;var d=new Error("Connection lost - server may have rejected the call");throw d.name="ServerRejected",d.isServerRejection=!0,d}var p=e.getAudioProcessorPath();if(U&&E===p?console.log("♻️ AudioRecorder: AudioWorklet module already loaded, skipping"):(yield e.audioContext.audioWorklet.addModule(p),U=!0,E=p,console.log("✅ AudioRecorder: AudioWorklet module loaded")),e.config.checkConnection&&"function"==typeof e.config.checkConnection&&!e.config.checkConnection()){e.mediaStream.getTracks().forEach(t=>t.stop()),e.mediaStream=null,e.audioContext=null;var u=new Error("Connection lost - server may have rejected the call");throw u.name="ServerRejected",u.isServerRejection=!0,u}e.audioWorkletNode=new AudioWorkletNode(e.audioContext,"audio-processor",{processorOptions:{sampleRate:A,outputSampleRate:e.config.outputSampleRate}});var h=e.audioContext.createMediaStreamSource(e.mediaStream);h.connect(e.audioWorkletNode),e._recorderSinkGain=e.audioContext.createGain(),e._recorderSinkGain.gain.value=0,e.audioWorkletNode.connect(e._recorderSinkGain),e._recorderSinkGain.connect(e.audioContext.destination),e.mediaStreamSource=h;var g=e.config.sampleRate||16e3,m=e.audioContext.sampleRate;Math.abs(m-g)>1&&console.log("ℹ️ AudioRecorder: Context sample rate ".concat(m,"Hz ≠ negotiated uplink ").concat(g,"Hz — resampling in main thread")),e.audioWorkletNode.port.onmessage=t=>{var n=t.data,{type:A,data:o}=n;if("pcm_audio_data"===A){var i=n.sampleRate||m,r=e.config.sampleRate||16e3;i&&r&&Math.abs(i-r)>1?e.emit("audioData",function(t,e,n){if(!t||0===t.length||e===n)return t;for(var A=e/n,o=Math.max(1,Math.floor(t.length/A)),i=new Int16Array(o),r=0;r<o;r++){var a=r*A,s=Math.floor(a),c=Math.min(s+1,t.length-1),l=a-s,d=t[s],p=d+(t[c]-d)*l;i[r]=Math.max(-32768,Math.min(32767,Math.round(p)))}return i}(o,i,r)):e.emit("audioData",o)}},e.audioWorkletNode.port.postMessage({type:"setForceContinuous",data:{enabled:!0,bypassVad:C()}}),console.log("✅ AudioRecorder: Microphone access granted"),e.isRecording=!0,e.emit("recordingStarted")}catch(l){if(l.isServerRejection||"ServerRejected"===l.name)throw l;var v=l.message;if("NotAllowedError"===l.name||"PermissionDeniedError"===l.name){var f=yield e.checkPermissionState();"denied"===f?(v='Microphone access was blocked. To enable it: 1) Click the lock icon (🔒) in your browser\'s address bar, 2) Find "Microphone" and change it to "Allow", 3) Refresh this page and try again.',console.error("❌ AudioRecorder: Permission explicitly denied. User must change in browser settings.")):"prompt"===f?(v='Microphone permission was denied. Click the "Voice Call" button again to see the permission prompt.',console.error('❌ AudioRecorder: Permission denied but state is "prompt" - user can try again.')):(v="Microphone permission was denied. Click the button again to retry, or enable microphone access in your browser settings (lock icon 🔒 in address bar).",console.error("❌ AudioRecorder: Permission denied. User can try again or change in browser settings."))}else"NotFoundError"===l.name||"DevicesNotFoundError"===l.name?(v="No microphone found. Please connect a microphone and try again.",console.error("❌ AudioRecorder: No microphone device found.")):"NotReadableError"===l.name||"TrackStartError"===l.name?(v="Microphone is already in use by another application. Please close other apps using the microphone and try again.",console.error("❌ AudioRecorder: Microphone is busy or not readable.")):"SecurityError"!==l.name&&"PermissionDeniedError"!==l.name||(v="Microphone access blocked. On mobile devices, please tap the recording button directly (not from an iframe or popup).",console.error("❌ AudioRecorder: User agent blocked microphone access. This often happens on mobile when not called from direct user interaction."));var w=new Error(v);throw w.name=l.name,w.originalError=l,e.emit("error",w),w}finally{e._starting=!1}}})()}stop(){var t=this;return B(function*(){if(t.isRecording)try{if(t.mediaStreamSource)try{console.log("🛑 AudioRecorder: Disconnecting media stream source to stop audio flow..."),t.mediaStreamSource.disconnect(),t.mediaStreamSource=null,console.log("✅ AudioRecorder: Media stream source disconnected")}catch(t){console.warn("⚠️ AudioRecorder: Error disconnecting source:",t)}if(t.audioWorkletNode){console.log("🛑 AudioRecorder: Sending stop message to AudioWorklet to stop VAD..."),t.audioWorkletNode.port.postMessage({type:"stop"}),yield new Promise(t=>setTimeout(t,150)),t.audioWorkletNode.port.postMessage({type:"flush"}),yield new Promise(t=>setTimeout(t,50));try{t.audioWorkletNode.disconnect(),console.log("✅ AudioRecorder: AudioWorkletNode disconnected")}catch(t){console.log("⚠️ AudioRecorder: AudioWorkletNode already disconnected")}}if(t._recorderSinkGain){try{t._recorderSinkGain.disconnect()}catch(t){}t._recorderSinkGain=null}t.mediaStream&&(console.log("🛑 AudioRecorder: Stopping media stream tracks..."),t.mediaStream.getTracks().forEach(t=>{t.stop(),console.log("✅ AudioRecorder: Stopped track:",t.kind)}),t.mediaStream=null),t.audioContext&&"running"===t.audioContext.state&&(console.log("🛑 AudioRecorder: Suspending AudioContext (kept alive for reuse)..."),yield t.audioContext.suspend(),console.log("✅ AudioRecorder: AudioContext suspended")),t.audioContext=null,t.audioWorkletNode=null,t.isRecording=!1,t.emit("recordingStopped"),console.log("✅ AudioRecorder: Recording stopped, VAD should be stopped")}catch(e){throw t.emit("error",e),e}})()}resumeAudioContext(){var t=this;return B(function*(){if(t.isRecording&&t.audioContext)try{if("suspended"===t.audioContext.state&&(console.log("🔄 AudioRecorder: Resuming suspended AudioContext..."),yield t.audioContext.resume(),console.log("✅ AudioRecorder: AudioContext resumed")),t.mediaStream){var e=t.mediaStream.getAudioTracks();0===e.filter(t=>"live"===t.readyState).length&&e.length>0&&(console.warn("⚠️ AudioRecorder: All audio tracks are inactive. Recording may have stopped."),t.emit("tracksInactive"))}}catch(e){console.error("❌ AudioRecorder: Failed to resume AudioContext:",e),t.emit("error",e)}})()}getStatus(){return{isRecording:this.isRecording,audioContextState:this.audioContext?this.audioContext.state:"closed"}}destroy(){this.stop()}static closeSharedContext(){S&&"closed"!==S.state&&(console.log("🗑️ AudioRecorder: Closing shared AudioContext"),S.close()),S=null,F=null,U=!1,E=null}static primeSharedContext(){var t=arguments;return B(function*(){if("undefined"!=typeof window){var e=(t.length>0&&void 0!==t[0]?t[0]:16e3)||16e3;try{if(S&&"closed"!==S.state)return"suspended"===S.state&&(yield S.resume()),void console.log("♻️ AudioRecorder.primeSharedContext: reused context",S.sampleRate,"Hz");var n=new(window.AudioContext||window.webkitAudioContext)({sampleRate:e});S=n,F=e,U=!1,E=null,"suspended"===n.state&&(yield n.resume()),console.log("🎵 AudioRecorder.primeSharedContext: primed requested",e,"Hz, actual",n.sampleRate,"Hz")}catch(t){console.warn("⚠️ AudioRecorder.primeSharedContext failed (non-fatal):",t)}}})()}}class I{static extractPcmFromWav(t){var e=t instanceof Uint8Array?t:new Uint8Array(t);if(e.length<44)throw new Error("WAV data too short (< 44 bytes)");if("RIFF"!==String.fromCharCode(e[0],e[1],e[2],e[3]))throw new Error("Not a valid WAV file - missing RIFF header");if("WAVE"!==String.fromCharCode(e[8],e[9],e[10],e[11]))throw new Error("Not a valid WAV file - missing WAVE format");for(var n=e[22]|e[23]<<8,A=e[24]|e[25]<<8|e[26]<<16|e[27]<<24,o=e[34]|e[35]<<8,i=-1,r=12;r<e.length-8;r+=4){if("data"===String.fromCharCode(e[r],e[r+1],e[r+2],e[r+3])){i=r;break}r+=4+(e[r+4]|e[r+5]<<8|e[r+6]<<16|e[r+7]<<24)}if(-1===i)throw new Error("No data chunk found in WAV");var a=e[i+4]|e[i+5]<<8|e[i+6]<<16|e[i+7]<<24,s=i+8,c=Math.min(a,e.length-s);return{pcmData:e.slice(s,s+c).buffer,format:{sampleRate:A,channels:n,bitDepth:o}}}static isWavFile(t){return t.length>=44&&82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]}static createWavHeader(t,e,n,A){var o=new ArrayBuffer(44),i=new DataView(o);return i.setUint32(0,1380533830,!1),i.setUint32(4,36+t,!0),i.setUint32(8,1463899717,!1),i.setUint32(12,1718449184,!1),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,n,!0),i.setUint32(24,e,!0),i.setUint32(28,e*n*A/8,!0),i.setUint16(32,n*A/8,!0),i.setUint16(34,A,!0),i.setUint32(36,1684108385,!1),i.setUint32(40,t,!0),o}static wrapPcmInWav(t,e){var n=I.createWavHeader(t.byteLength,e.sampleRate,e.channels||1,e.bitDepth||16),A=new Uint8Array(n.byteLength+t.byteLength);return A.set(new Uint8Array(n),0),A.set(new Uint8Array(t),n.byteLength),A.buffer}}const T=I,H=class{constructor(){this.codecs={pcm:new l,pcmu:new d,pcma:new p}}decodeToPcm(t,e){var n=null==e?void 0:e.toLowerCase();if(!n||"pcm"===n)return t instanceof ArrayBuffer?t:t instanceof Uint8Array?t.buffer:t;var A=this.codecs[n];if(!A)throw new Error("Unsupported encoding: ".concat(e));var o=t instanceof Uint8Array?t:new Uint8Array(t);return A.decode(o)}encodeFromPcm(t,e){var n=null==e?void 0:e.toLowerCase();if(!n||"pcm"===n)return t;var A=this.codecs[n];if(!A)throw new Error("Unsupported target encoding: ".concat(e));var o=A.encode(t);return o instanceof Uint8Array?o.buffer:o}getCodec(t){var e=null==t?void 0:t.toLowerCase();return this.codecs[e]||null}};class _{static convert(t,e,n){if(e===n)return t;if(8===e)throw new Error("Source bit depth cannot be 8-bit (only 16-bit or 24-bit supported)");var A=e/8,o=n/8,i=t.byteLength/A;if(new ArrayBuffer(i*o),16===e&&16===n)return t;if(24===e&&16===n)return _.convert24To16(t);if(16===e&&24===n)return _.convert16To24(t);if(16===e&&8===n)return _.convert16To8(t);if(24===e&&8===n)return _.convert24To8(t);throw new Error("Unsupported bit depth conversion: ".concat(e,"-bit → ").concat(n,"-bit"))}static convert24To16(t){for(var e=new Uint8Array(t),n=Math.floor(e.length/3),A=new Int16Array(n),o=0;o<n;o++){var i=e[3*o],r=e[3*o+1],a=e[3*o+2],s=i|r<<8|(255&a)<<16;128&a&&(s|=4278190080),A[o]=Math.max(-32768,Math.min(32767,Math.round(s/256)))}return A.buffer}static convert16To24(t){for(var e=new Int16Array(t),n=new Uint8Array(3*e.length),A=0;A<e.length;A++){var o=256*e[A];n[3*A]=255&o,n[3*A+1]=o>>8&255,n[3*A+2]=o>>16&255}return n.buffer}static convert16To8(t){for(var e=new Int16Array(t),n=new Uint8Array(e.length),A=0;A<e.length;A++){var o=e[A];n[A]=Math.max(0,Math.min(255,Math.round(o/256+128)))}return n.buffer}static convert24To8(t){var e=_.convert24To16(t);return _.convert16To8(e)}}const D=_;function M(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}const P=class{static resample(t,e,n){return(A=function*(){if(e===n)return t;for(var A=new Int16Array(t),o=new Float32Array(A.length),i=1/32768,r=0;r<A.length;r++)o[r]=A[r]*i;var a=Math.ceil(o.length*n/e),s=new OfflineAudioContext(1,a,n),c=s.createBuffer(1,o.length,e);c.getChannelData(0).set(o);var l=s.createBufferSource();l.buffer=c,l.connect(s.destination),l.start();for(var d=(yield s.startRendering()).getChannelData(0),p=new Int16Array(d.length),u=0;u<d.length;u++){var h=Math.max(-1,Math.min(1,d[u]));p[u]=Math.round(32767*h)}return p.buffer},function(){var t=this,e=arguments;return new Promise(function(n,o){var i=A.apply(t,e);function r(t){M(i,n,o,r,a,"next",t)}function a(t){M(i,n,o,r,a,"throw",t)}r(void 0)})})();var A}};class L{static convert(t,e,n){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16;if(e===n)return t;if(1===e&&1===n)return t;if(1===e&&2===n)return L.monoToStereo(t,A);if(2===e&&1===n)return L.stereoToMono(t,A);throw new Error("Unsupported channel conversion: ".concat(e," → ").concat(n))}static monoToStereo(t,e){for(var n=e/8,A=t.byteLength/n,o=new ArrayBuffer(A*n*2),i=new Uint8Array(t),r=new Uint8Array(o),a=0;a<A;a++)for(var s=a*n,c=a*n*2,l=0;l<n;l++)r[c+l]=i[s+l],r[c+n+l]=i[s+l];return o}static stereoToMono(t,e){var n=e/8,A=t.byteLength/(2*n),o=new ArrayBuffer(A*n),i=new Uint8Array(t),r=new Uint8Array(o);if(16===e)for(var a=0;a<A;a++){var s=a*n*2,c=s+n,l=(i[s]|i[s+1]<<8)<<16>>16,d=(i[c]|i[c+1]<<8)<<16>>16,p=Math.round((l+d)/2),u=a*n;r[u]=255&p,r[u+1]=p>>8&255}else for(var h=0;h<A;h++)for(var g=h*n*2,m=h*n,v=0;v<n;v++)r[m+v]=i[g+v];return o}}const R=L;function K(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function O(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?K(Object(n),!0).forEach(function(e){V(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function V(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function N(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}const j=class{constructor(t,e){this.requestedFormat=t,this.actualFormat=e,this.encodingConverter=new H,this.conversionSteps=[],this._analyzeConversions()}_analyzeConversions(){this.conversionSteps=[],this.actualFormat.container!==this.requestedFormat.container&&("wav"===this.actualFormat.container?this.conversionSteps.push("extract_wav"):"wav"===this.requestedFormat.container&&this.conversionSteps.push("wrap_wav")),this.actualFormat.encoding!==this.requestedFormat.encoding&&("pcm"!==this.actualFormat.encoding&&this.conversionSteps.push("decode_encoding"),"pcm"!==this.requestedFormat.encoding&&this.conversionSteps.push("encode_encoding")),this.actualFormat.sampleRate!==this.requestedFormat.sampleRate&&this.conversionSteps.push("resample"),this.actualFormat.bitDepth!==this.requestedFormat.bitDepth&&this.conversionSteps.push("convert_bitdepth"),this.actualFormat.channels!==this.requestedFormat.channels&&this.conversionSteps.push("convert_channels")}needsConversion(){return this.conversionSteps.length>0}getConversionSteps(){var t=[];return this.conversionSteps.includes("extract_wav")&&t.push("Extract PCM from WAV (".concat(this.actualFormat.container," → raw)")),this.conversionSteps.includes("decode_encoding")&&t.push("Decode ".concat(this.actualFormat.encoding.toUpperCase()," → PCM")),this.conversionSteps.includes("resample")&&t.push("Resample ".concat(this.actualFormat.sampleRate,"Hz → ").concat(this.requestedFormat.sampleRate,"Hz")),this.conversionSteps.includes("convert_bitdepth")&&t.push("Convert bit depth ".concat(this.actualFormat.bitDepth,"-bit → ").concat(this.requestedFormat.bitDepth,"-bit")),this.conversionSteps.includes("convert_channels")&&t.push("Convert channels ".concat(this.actualFormat.channels," → ").concat(this.requestedFormat.channels)),this.conversionSteps.includes("encode_encoding")&&t.push("Encode PCM → ".concat(this.requestedFormat.encoding.toUpperCase())),this.conversionSteps.includes("wrap_wav")&&t.push("Wrap in WAV container (raw → ".concat(this.requestedFormat.container,")")),t}convert(t){var e,n=this;return(e=function*(){if(!n.needsConversion())return t instanceof ArrayBuffer?t:t.buffer;var e=t instanceof ArrayBuffer?t:t.buffer,A=O({},n.actualFormat);if(n.conversionSteps.includes("extract_wav")){var o=T.extractPcmFromWav(e);e=o.pcmData,A=O(O({},A),{},{container:"raw",sampleRate:o.format.sampleRate,channels:o.format.channels,bitDepth:o.format.bitDepth}),console.log("🔄 AudioFormatConverter: Extracted PCM from WAV",o.format)}if(n.conversionSteps.includes("decode_encoding")&&(e=n.encodingConverter.decodeToPcm(e,A.encoding),A.encoding="pcm",A.bitDepth=16,console.log("🔄 AudioFormatConverter: Decoded ".concat(n.actualFormat.encoding.toUpperCase()," → PCM"))),24===A.bitDepth&&A.bitDepth!==n.requestedFormat.bitDepth&&(n.conversionSteps.includes("resample")||n.conversionSteps.includes("convert_channels")||24!==n.requestedFormat.bitDepth)&&(e=D.convert(e,24,16),A.bitDepth=16,console.log("🔄 AudioFormatConverter: Normalized 24-bit → 16-bit PCM")),n.conversionSteps.includes("resample")&&(e=yield P.resample(e,A.sampleRate,n.requestedFormat.sampleRate),A.sampleRate=n.requestedFormat.sampleRate,console.log("🔄 AudioFormatConverter: Resampled ".concat(n.actualFormat.sampleRate,"Hz → ").concat(n.requestedFormat.sampleRate,"Hz"))),n.conversionSteps.includes("convert_channels")&&(e=R.convert(e,A.channels,n.requestedFormat.channels,A.bitDepth),A.channels=n.requestedFormat.channels,console.log("🔄 AudioFormatConverter: Converted channels ".concat(n.actualFormat.channels," → ").concat(n.requestedFormat.channels))),n.conversionSteps.includes("convert_bitdepth")&&(e=D.convert(e,A.bitDepth,n.requestedFormat.bitDepth),A.bitDepth=n.requestedFormat.bitDepth,console.log("🔄 AudioFormatConverter: Converted bit depth ".concat(n.actualFormat.bitDepth,"-bit → ").concat(n.requestedFormat.bitDepth,"-bit"))),n.conversionSteps.includes("encode_encoding")){var i=n.encodingConverter.encodeFromPcm(e,n.requestedFormat.encoding);e=i instanceof ArrayBuffer?i:i.buffer,A.encoding=n.requestedFormat.encoding,console.log("🔄 AudioFormatConverter: Encoded PCM → ".concat(n.requestedFormat.encoding.toUpperCase()))}return n.conversionSteps.includes("wrap_wav")&&(e=T.wrapPcmInWav(e,A),A.container="wav",console.log("🔄 AudioFormatConverter: Wrapped in WAV container")),console.log("✅ AudioFormatConverter: Conversion complete"),e},function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(t){N(i,A,o,r,a,"next",t)}function a(t){N(i,A,o,r,a,"throw",t)}r(void 0)})})()}};function G(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function z(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class W{constructor(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>null;this.handlers=new Map,this.sendMessage=t,this.getConversationId=e}registerHandler(t,e){if("function"!=typeof e)throw new Error("Handler for tool '".concat(t,"' must be a function"));this.handlers.set(t,e),console.log("🔧 ClientTools: Registered handler for '".concat(t,"'"))}unregisterHandler(t){this.handlers.delete(t),console.log("🔧 ClientTools: Unregistered handler for '".concat(t,"'"))}hasHandler(t){return this.handlers.has(t)}getRegisteredTools(){return Array.from(this.handlers.keys())}handleToolCall(t){var e,n=this;return(e=function*(){var{toolCallId:e,toolName:A,parameters:o}=t,i=Date.now(),r=(new Date).toISOString();console.log("🔧 ClientTools: [".concat(r,"] Received tool call '").concat(A,"' (id: ").concat(e,")")),console.log(" 📋 Full message received:",JSON.stringify(t,null,2)),console.log(" ⏱️ Start time: ".concat(i,"ms (").concat(new Date(i).toISOString(),")"));var a=n.handlers.get(A);if(!a){var s=Array.from(n.handlers.keys());return console.error("🔧 ClientTools: No handler registered for '".concat(A,"'")),console.error(" 📋 Currently registered tools:",s),console.error(" 📋 Total registered: ".concat(s.length)),void n.sendError(e,A,"No handler registered for tool '".concat(A,"'"),"NO_HANDLER",i)}try{var c=yield a(o),l=Date.now()-i;console.log("🔧 ClientTools: Tool '".concat(A,"' completed in ").concat(l,"ms")),n.sendResult(e,A,c,l)}catch(t){var d,p,u=Date.now()-i;console.error("🔧 ClientTools: Tool '".concat(A,"' failed:"),t);var h="EXECUTION_ERROR";"NotAllowedError"===t.name||null!==(d=t.message)&&void 0!==d&&d.includes("permission")?h="PERMISSION_DENIED":("NotSupportedError"===t.name||null!==(p=t.message)&&void 0!==p&&p.includes("not supported"))&&(h="API_UNAVAILABLE"),n.sendError(e,A,t.message||"Unknown error",h,u)}},function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(t){G(i,A,o,r,a,"next",t)}function a(t){G(i,A,o,r,a,"throw",t)}r(void 0)})})()}sendResult(t,e,n,A){var o=this.getConversationId(),i=(new Date).toISOString(),r=n&&"object"==typeof n&&n.image&&n.mimeType?W.MAX_IMAGE_RESULT_SIZE:W.MAX_RESULT_SIZE,a=0;try{a=JSON.stringify(n).length}catch(t){a=0}if(a>r){var s=Math.round(a/1024),c=Math.round(r/1024);return console.error("🔧 ClientTools: Result for '".concat(e,"' exceeds size limit (").concat(s,"KB > ").concat(c,"KB)")),void this.sendError(t,e,"Result too large: ".concat(s,"KB exceeds ").concat(c,"KB limit"),"RESULT_TOO_LARGE",A)}var l={t:"client_tool_result",toolCallId:t,toolName:e,conversationId:o,result:n,executionTimeMs:A};console.log("🔧 ClientTools: [".concat(i,"] Sending result for tool '").concat(e,"' (").concat(Math.round(a/1024),"KB)")),console.log(" 📋 toolCallId: ".concat(t)),console.log(" 📋 conversationId: ".concat(o||"null")),console.log(" 📋 toolName: ".concat(e)),this.sendMessage(l),console.log("✅ ClientTools: Result message sent at ".concat(i))}sendError(t,e,n,A,o){var i="number"==typeof o?Date.now()-o:o,r=(new Date).toISOString(),a=this.getConversationId(),s={t:"client_tool_error",toolCallId:t,toolName:e,conversationId:a,error:n,errorCode:A,executionTimeMs:i};console.log("🔧 ClientTools: [".concat(r,"] Sending error for tool '").concat(e,"'")),console.log(" 📋 toolCallId: ".concat(t)),console.log(" 📋 conversationId: ".concat(a||"null")),console.log(" 📋 toolName: ".concat(e)),console.log(" 📋 error: ".concat(n,", errorCode: ").concat(A)),console.log(" 📋 Full message:",JSON.stringify(s,null,2)),this.sendMessage(s),console.log("✅ ClientTools: Error message sent at ".concat(r))}setSendMessage(t){this.sendMessage=t}}z(W,"MAX_RESULT_SIZE",5e4),z(W,"MAX_IMAGE_RESULT_SIZE",512e3);const q=W;var X=r(354),Y=r.n(X);function J(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function Z(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?J(Object(n),!0).forEach(function(e){$(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function $(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tt(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}var et={useCORS:!0,allowTaint:!1,backgroundColor:"#ffffff",scale:1,logging:!1,imageTimeout:15e3};function nt(){return At.apply(this,arguments)}function At(){var t;return t=function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:e=null,format:n="jpeg",quality:A=.85,scale:o=1,maxWidth:i=1280,maxHeight:r=1280,fullPage:a=!1}=t;console.log("📸 SDK Screenshot: Starting capture with options:",t);var s=Date.now();try{var c=document.body;if(e){var l=document.querySelector(e);if(!l)throw new Error("Element not found: ".concat(e));c=l,console.log("📸 SDK Screenshot: Capturing element: ".concat(e))}else console.log("📸 SDK Screenshot: Capturing entire page");var d=Z(Z({},et),{},{scale:o});a&&!e&&(d.windowHeight=document.documentElement.scrollHeight,d.height=document.documentElement.scrollHeight,d.y=0);var p=yield Y()(c,d);console.log("📸 SDK Screenshot: Canvas created (".concat(p.width,"x").concat(p.height,")"));var u=p;(i||r)&&(u=function(t,e,n){var{width:A,height:o}=t,i=1;if(e&&A>e&&(i=Math.min(i,e/A)),n&&o>n&&(i=Math.min(i,n/o)),1===i)return t;var r=Math.round(A*i),a=Math.round(o*i),s=document.createElement("canvas");return s.width=r,s.height=a,s.getContext("2d").drawImage(t,0,0,r,a),s}(p,i,r),u!==p&&console.log("📸 SDK Screenshot: Resized to ".concat(u.width,"x").concat(u.height)));var h="jpeg"===n?"image/jpeg":"image/png",g=u.toDataURL(h,"jpeg"===n?A:void 0).split(",")[1],m=Date.now()-s;return console.log("📸 SDK Screenshot: Capture completed in ".concat(m,"ms")),console.log("📸 SDK Screenshot: Size: ".concat(Math.round(g.length/1024),"KB")),{image:g,mimeType:h,width:u.width,height:u.height,captureTimeMs:m,selector:e||"body"}}catch(t){throw console.error("📸 SDK Screenshot: Capture failed:",t),new Error("Screenshot capture failed: ".concat(t.message))}},At=function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){tt(i,A,o,r,a,"next",t)}function a(t){tt(i,A,o,r,a,"throw",t)}r(void 0)})},At.apply(this,arguments)}var ot={types:["password"],names:["cc","card","credit","cvv","cvc","csc","expir","cardnumber","card-number","card_number","cardholder","card-holder","card_holder","password","pwd","passwd","pass","secret","token","auth","api-key","apikey","api_key","access-key","accesskey","access_key","secret-key","secretkey","secret_key","private-key","privatekey","private_key","bearer","jwt","ssn","social-security","social_security","socialsecurity","tax-id","taxid","tax_id","national-id","nationalid","national_id","credential","private","secure"],autocomplete:["cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc","cc-name","cc-type","current-password","new-password"],dataAttributes:["data-secret","data-sensitive","data-private","data-api-key","data-token","data-auth"]};function it(t){if(!t)return!1;var e=(t.type||"").toLowerCase(),n=(t.name||"").toLowerCase(),A=(t.id||"").toLowerCase(),o=(t.className||"").toLowerCase(),i=(t.autocomplete||"").toLowerCase(),r=(t.placeholder||"").toLowerCase(),a=(t.getAttribute("aria-label")||"").toLowerCase(),s="".concat(n," ").concat(A," ").concat(o," ").concat(r," ").concat(a);if(ot.types.includes(e))return!0;if(ot.autocomplete.includes(i))return!0;for(var c of ot.names)if(s.includes(c))return!0;for(var l of ot.dataAttributes)if(t.hasAttribute(l))return!0;return"password"===(t.inputMode||"").toLowerCase()}function rt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function at(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?rt(Object(n),!0).forEach(function(e){st(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function st(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ct(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}var lt={buttons:20,links:30,forms:5,fieldsPerForm:15,sections:10,headings:15,maxTextLength:100,maxSummaryLength:150};function dt(t){var e,n;if(!t||!t.tagName)return null;if(null!==(e=t.dataset)&&void 0!==e&&e.testid)return'[data-testid="'.concat(t.dataset.testid,'"]');if(null!==(n=t.dataset)&&void 0!==n&&n.cy)return'[data-cy="'.concat(t.dataset.cy,'"]');var A=t.getAttribute("aria-label");if(A&&A.length<50)return'[aria-label="'.concat(A.replace(/"/g,'\\"'),'"]');if(t.id&&!pt(t.id))return"#".concat(CSS.escape(t.id));if(t.name){var o=t.tagName.toLowerCase();return"".concat(o,'[name="').concat(t.name,'"]')}if(["BUTTON","A"].includes(t.tagName)){var i,r=null===(i=t.innerText)||void 0===i?void 0:i.trim();if(r&&r.length<30&&r.length>0){var a=t.tagName.toLowerCase(),s=document.querySelectorAll("".concat(a));if(1===Array.from(s).filter(t=>{var e;return(null===(e=t.innerText)||void 0===e?void 0:e.trim())===r}).length)return"".concat(a,':contains("').concat(r.replace(/"/g,'\\"'),'")')}}return function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=[],A=t,o=0;A&&A!==document.body&&o<e;){var i=A.tagName.toLowerCase();if(A.id&&!pt(A.id)){n.unshift("#".concat(CSS.escape(A.id)));break}var r=ut(A);if(r)n.unshift("".concat(i,".").concat(r));else{var a,s=null===(a=A.parentElement)||void 0===a?void 0:a.children;if(s&&s.length>1){var c=Array.from(s).indexOf(A)+1;n.unshift("".concat(i,":nth-child(").concat(c,")"))}else n.unshift(i)}A=A.parentElement,o++}return n.join(" > ")}(t)}function pt(t){return[/^:r[0-9a-z]+:$/,/^react-/i,/^ng-/i,/^vue-/i,/^ember[0-9]+/i,/^_[a-z0-9]{8,}$/i,/^[a-f0-9]{8}-[a-f0-9]{4}/i,/^uid-/i,/^id[0-9]+$/i].some(e=>e.test(t))}function ut(t){var e=Array.from(t.classList||[]),n=[/^(flex|grid|block|inline|hidden)$/,/^(m|p|w|h|min|max)-/,/^(text|font|bg|border)-/,/^(col|row)-/,/^(sm|md|lg|xl|2xl):/,/^hover:|focus:|active:/,/^[a-z]{1,3}-[0-9]+$/];return e.filter(t=>!n.some(e=>e.test(t))&&t.length>2&&t.length<30)[0]||null}function ht(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=t.getBoundingClientRect();return n.bottom>=-e&&n.top<=window.innerHeight+e&&n.right>=0&&n.left<=window.innerWidth}function gt(t){if(!t)return!1;var e=window.getComputedStyle(t);return"none"!==e.display&&"hidden"!==e.visibility&&"0"!==e.opacity&&t.offsetWidth>0&&t.offsetHeight>0}function mt(){return vt.apply(this,arguments)}function vt(){return t=function*(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=at(at({},lt),e.limits),A=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lt,e=[],n=document.querySelectorAll('button, [type="submit"], [type="button"], [role="button"], .btn, .button');for(var A of n){if(e.length>=t.buttons)break;if(gt(A)){var o=(A.innerText||A.value||A.getAttribute("aria-label")||"").trim();o&&e.push({selector:dt(A),text:o.substring(0,t.maxTextLength),type:A.type||"button",disabled:A.disabled||!1,inViewport:ht(A,0)})}}return e}(n),o=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lt,e=[],n=document.querySelectorAll("a[href]"),A=window.location.origin;for(var o of n){if(e.length>=t.links)break;if(gt(o)){var i=(o.innerText||o.getAttribute("aria-label")||"").trim();if(i&&!(i.length<2)){var r=o.href;if(r&&!r.startsWith("javascript:")&&"#"!==r){var a=!1;try{a=new URL(r).origin===A}catch(t){}e.push({selector:dt(o),text:i.substring(0,t.maxTextLength),href:r,internal:a,inViewport:ht(o,0)})}}}}return e}(n),{forms:i,sensitiveCount:r}=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lt,e=[],n=document.querySelectorAll("form"),A=0;for(var o of n){if(e.length>=t.forms)break;if(gt(o)){var i=[],r=o.querySelectorAll("input, textarea, select");for(var a of r){var s,c;if(i.length>=t.fieldsPerForm)break;if("hidden"!==a.type)if(it(a))A++;else{var l=null;if(a.id){var d,p=document.querySelector('label[for="'.concat(a.id,'"]'));l=null==p||null===(d=p.innerText)||void 0===d?void 0:d.trim()}!l&&a.getAttribute("aria-label")&&(l=a.getAttribute("aria-label")),!l&&a.placeholder&&(l=a.placeholder),i.push({selector:dt(a),name:a.name||null,type:a.type||"text",label:(null===(s=l)||void 0===s?void 0:s.substring(0,50))||null,placeholder:(null===(c=a.placeholder)||void 0===c?void 0:c.substring(0,50))||null,required:a.required||!1})}}0!==i.length&&e.push({selector:dt(o),id:o.id||null,action:o.action||null,method:(o.method||"get").toUpperCase(),fields:i})}}return{forms:e,sensitiveCount:A}}(n),a=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lt,e=[],n=document.querySelectorAll('section, article, main, [role="main"], [role="region"], .section');for(var A of n){var o,i,r;if(e.length>=t.sections)break;if(gt(A)){var a=A.querySelector("h1, h2, h3"),s=(null==a||null===(o=a.innerText)||void 0===o?void 0:o.trim())||"",c=A.querySelector("p"),l=s||(null==c||null===(i=c.innerText)||void 0===i?void 0:i.trim().substring(0,t.maxSummaryLength))||(null===(r=A.innerText)||void 0===r?void 0:r.trim().substring(0,t.maxSummaryLength))||"";e.push({selector:dt(A),id:A.id||null,tagName:A.tagName.toLowerCase(),summary:l.substring(0,t.maxSummaryLength),inViewport:ht(A,0)})}}return e}(n),s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lt,e=[],n=document.querySelectorAll("h1, h2, h3");for(var A of n){var o;if(e.length>=t.headings)break;if(gt(A)){var i=null===(o=A.innerText)||void 0===o?void 0:o.trim();i&&e.push({selector:dt(A),level:A.tagName.toLowerCase(),text:i.substring(0,t.maxTextLength),inViewport:ht(A,0)})}}return e}(n),c=A.length+o.length+i.reduce((t,e)=>t+e.fields.length,0)+a.length+s.length,l=A.filter(t=>t.inViewport).length+o.filter(t=>t.inViewport).length+a.filter(t=>t.inViewport).length+s.filter(t=>t.inViewport).length,d=document.documentElement.lang||(null===(t=document.querySelector("html"))||void 0===t?void 0:t.getAttribute("lang"))||null,p=navigator.language||navigator.languages&&navigator.languages[0]||null,u=d||p||null;return{url:window.location.href,title:document.title,timestamp:Date.now(),language:u,viewport:{width:window.innerWidth,height:window.innerHeight,scrollX:window.scrollX,scrollY:window.scrollY,pageHeight:document.documentElement.scrollHeight},buttons:A,links:o,forms:i,sections:a,headings:s,metadata:{totalElements:c,visibleInViewport:l,formsCount:i.length,sensitiveFieldsFiltered:r}}},vt=function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){ct(i,A,o,r,a,"next",t)}function a(t){ct(i,A,o,r,a,"throw",t)}r(void 0)})},vt.apply(this,arguments);var t}function ft(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function wt(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){ft(i,A,o,r,a,"next",t)}function a(t){ft(i,A,o,r,a,"throw",t)}r(void 0)})}}function Bt(){return Bt=wt(function*(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:n,color:A="#6366f1",duration:o=3e3}=e;if(!n)return{success:!1,error:"Selector is required"};var i=document.querySelector(n);if(!i)return{success:!1,error:"Element not found: ".concat(n)};i.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),yield St(400);var r=i.getBoundingClientRect();bt();var a=document.createElement("div");return a.className="ttp-highlight-overlay",a.style.cssText="\n position: fixed;\n top: ".concat(r.top-4,"px;\n left: ").concat(r.left-4,"px;\n width: ").concat(r.width+8,"px;\n height: ").concat(r.height+8,"px;\n --ttp-highlight-color: ").concat(A,";\n border-color: ").concat(A,";\n box-shadow: 0 0 20px ").concat(A,"80, 0 0 40px ").concat(A,"40;\n pointer-events: none;\n z-index: 2147483647;\n "),document.body.appendChild(a),setTimeout(()=>{a.classList.add("ttp-fade-out"),setTimeout(()=>{a.remove()},300)},o),{success:!0,selector:n,elementInfo:{tag:i.tagName.toLowerCase(),id:i.id||null,text:(null===(t=i.innerText)||void 0===t?void 0:t.trim().substring(0,100))||null,position:{top:r.top,left:r.left,width:r.width,height:r.height}}}}),Bt.apply(this,arguments)}function bt(){if(!document.getElementById("ttp-highlight-styles")){var t=document.createElement("style");t.id="ttp-highlight-styles",t.textContent="\n @keyframes ttp-pulse {\n 0%, 100% {\n box-shadow: 0 0 20px var(--ttp-highlight-color, #6366f1)80,\n 0 0 40px var(--ttp-highlight-color, #6366f1)40;\n }\n 50% {\n box-shadow: 0 0 30px var(--ttp-highlight-color, #6366f1)99,\n 0 0 60px var(--ttp-highlight-color, #6366f1)60;\n }\n }\n \n .ttp-highlight-overlay {\n border: 3px solid var(--ttp-highlight-color, #6366f1);\n border-radius: 8px;\n animation: ttp-pulse 1s ease-in-out infinite;\n transition: opacity 0.3s ease;\n }\n \n .ttp-highlight-overlay.ttp-fade-out {\n opacity: 0;\n }\n \n .ttp-fill-success {\n outline: 3px solid #22c55e !important;\n outline-offset: 2px;\n transition: outline 0.3s ease;\n }\n ",document.head.appendChild(t)}}function yt(){return yt=wt(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:e,x:n,y:A,direction:o,amount:i=500,position:r="center",behavior:a="smooth"}=t;if(e){var s=document.querySelector(e);if(!s)return{success:!1,error:"Element not found: ".concat(e)};var c="top"===r?"start":"bottom"===r?"end":"center";s.scrollIntoView({behavior:a,block:c,inline:"nearest"}),yield St("smooth"===a?500:100);var l=s.getBoundingClientRect();return{success:!0,scrollType:"element",selector:e,elementPosition:{top:l.top,left:l.left}}}if("up"===o||"down"===o){var d,p=i||500,u=window.scrollY,h=document.documentElement.scrollHeight-window.innerHeight;return d="up"===o?Math.max(0,u-p):Math.min(h,u+p),window.scrollTo({top:d,left:window.scrollX,behavior:a}),yield St("smooth"===a?500:100),{success:!0,scrollType:"relative",direction:o,amount:p,scrolledFrom:{y:u},scrolledTo:{y:window.scrollY},atTop:0===window.scrollY,atBottom:window.scrollY>=h-1}}return void 0!==n||void 0!==A?(window.scrollTo({top:null!=A?A:window.scrollY,left:null!=n?n:window.scrollX,behavior:a}),yield St("smooth"===a?500:100),{success:!0,scrollType:"position",scrolledTo:{x:null!=n?n:window.scrollX,y:null!=A?A:window.scrollY}}):{success:!1,error:"Either selector, x/y position, or direction (up/down) required"}}),yt.apply(this,arguments)}function xt(){return xt=wt(function*(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{url:n}=e;if(!n)return{success:!1,error:"URL is required"};try{t=new URL(n,window.location.origin)}catch(t){return{success:!1,error:"Invalid URL: ".concat(n)}}if(!["http:","https:"].includes(t.protocol))return{success:!1,error:"Invalid protocol: ".concat(t.protocol)};if(t.origin!==window.location.origin)try{return window.open(t.href,"_blank","noopener,noreferrer"),{success:!0,openedInNewTab:!0,navigatedTo:t.href,message:"Opened external link in a new tab"}}catch(e){return{success:!1,error:"Failed to open external link in new tab: "+e.message,attempted:t.href}}var A=window.location.href;return window.location.href=t.href,{success:!0,navigatedTo:t.href,from:A}}),xt.apply(this,arguments)}function Ct(){return Ct=wt(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:e,value:n,triggerEvents:A=!0}=t;if(!e)return{success:!1,error:"Selector is required"};if(null==n)return{success:!1,error:"Value is required"};var o=document.querySelector(e);if(!o)return{success:!1,error:"Element not found: ".concat(e)};var i=o.tagName.toLowerCase();if(!["input","textarea","select"].includes(i))return{success:!1,error:"Element is not a form field: ".concat(i)};if(it(o))return{success:!1,error:"Cannot fill sensitive fields (password, credit card, etc.)",blocked:!0,fieldType:o.type,fieldName:o.name};if(o.scrollIntoView({behavior:"smooth",block:"center"}),yield St(300),o.focus(),"select"===i){var r=Array.from(o.options).find(t=>t.value===n||t.text.toLowerCase()===n.toLowerCase());o.value=r?r.value:n}else if("checkbox"===o.type||"radio"===o.type){var a=!0===n||"true"===n||"1"===n;o.checked=a}else o.value=n;if(A){var s;o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0}));var c=null===(s=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))||void 0===s?void 0:s.set;c&&(c.call(o,n),o.dispatchEvent(new Event("input",{bubbles:!0})))}return bt(),o.classList.add("ttp-fill-success"),setTimeout(()=>{o.classList.remove("ttp-fill-success")},2e3),{success:!0,selector:e,fieldType:o.type||i,fieldName:o.name||null,filled:!0}}),Ct.apply(this,arguments)}function Qt(){return Qt=wt(function*(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:n,waitForNavigation:A=!1,openInNewTab:o=!1,isExternal:i=!1,href:r=null}=e;if(!n)return{success:!1,error:"Selector is required"};var a=document.querySelector(n);if(!a)return{success:!1,error:"Element not found: ".concat(n)};var s=a.getBoundingClientRect();if(0===s.width||0===s.height)return{success:!1,error:"Element is not visible (zero size)"};if(a.disabled)return{success:!1,error:"Element is disabled"};a.scrollIntoView({behavior:"smooth",block:"center"}),yield St(300);var c=document.createElement("div");if(c.style.cssText="\n position: fixed;\n top: ".concat(s.top-2,"px;\n left: ").concat(s.left-2,"px;\n width: ").concat(s.width+4,"px;\n height: ").concat(s.height+4,"px;\n border: 2px solid #22c55e;\n border-radius: 4px;\n pointer-events: none;\n z-index: 2147483647;\n transition: opacity 0.2s;\n "),document.body.appendChild(c),yield St(200),c.remove(),o||i){var l=r||a.href||("A"===a.tagName?a.getAttribute("href"):null);if(l&&"#"!==l&&!l.startsWith("javascript:"))try{var d;return window.open(l,"_blank","noopener,noreferrer"),{success:!0,selector:n,clicked:!0,openedInNewTab:!0,url:l,elementInfo:{tag:a.tagName.toLowerCase(),text:(null===(d=a.innerText)||void 0===d?void 0:d.trim().substring(0,50))||null},message:"Opened link in a new tab"}}catch(t){console.warn("[TTP] Failed to open in new tab:",t)}}if(A){var p,u=window.location.href,h=new Promise(t=>{var e=setTimeout(()=>{t({navigated:!1})},5e3),n=()=>{clearTimeout(e),window.removeEventListener("beforeunload",n),t({navigated:!0})};window.addEventListener("beforeunload",n)});a.click();var g=yield h;return{success:!0,selector:n,clicked:!0,elementInfo:{tag:a.tagName.toLowerCase(),text:(null===(p=a.innerText)||void 0===p?void 0:p.trim().substring(0,50))||null},navigated:g.navigated||window.location.href!==u}}return a.click(),{success:!0,selector:n,clicked:!0,elementInfo:{tag:a.tagName.toLowerCase(),text:(null===(t=a.innerText)||void 0===t?void 0:t.trim().substring(0,50))||null}}}),Qt.apply(this,arguments)}function St(t){return new Promise(e=>setTimeout(e,t))}function Ft(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function Ut(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){Ft(i,A,o,r,a,"next",t)}function a(t){Ft(i,A,o,r,a,"throw",t)}r(void 0)})}}function Et(t){t.registerHandler("read_page",Ut(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] 📋 Reading page structure...");var e=yield mt(t);return console.log("[TTP] ✅ Page structure extracted:",{buttons:e.buttons.length,links:e.links.length,forms:e.forms.length,headings:e.headings.length}),e})),t.registerHandler("highlight_element",Ut(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] ✨ Highlighting element:",t.selector);var e=yield function(){return Bt.apply(this,arguments)}(t);return e.success?console.log("[TTP] ✅ Element highlighted"):console.warn("[TTP] ⚠️ Highlight failed:",e.error),e})),t.registerHandler("scroll_to_element",Ut(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.selector)console.log("[TTP] 📜 Scrolling to element:",t.selector);else if(t.direction)console.log("[TTP] 📜 Scrolling",t.direction,"by",t.amount||500,"px");else if(void 0!==t.x||void 0!==t.y){var e,n;console.log("[TTP] 📜 Scrolling to position:","(".concat(null!==(e=t.x)&&void 0!==e?e:"current",", ").concat(null!==(n=t.y)&&void 0!==n?n:"current",")"))}else console.log("[TTP] 📜 Scroll called with params:",t);var A=yield function(){return yt.apply(this,arguments)}(t);return A.success?console.log("[TTP] ✅ Scrolled successfully"):console.warn("[TTP] ⚠️ Scroll failed:",A.error),A})),t.registerHandler("navigate_to",Ut(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] 🔗 Navigating to:",t.url);var e=yield function(){return xt.apply(this,arguments)}(t);return e.success?console.log("[TTP] ✅ Navigation initiated"):console.warn("[TTP] ⚠️ Navigation blocked:",e.error),e})),t.registerHandler("fill_field",Ut(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] 📝 Filling field:",t.selector);var e=yield function(){return Ct.apply(this,arguments)}(t);return e.success?console.log("[TTP] ✅ Field filled"):console.warn("[TTP] ⚠️ Fill failed:",e.error),e})),t.registerHandler("click_element",Ut(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("[TTP] 👆 Clicking element:",t.selector);var e=yield function(){return Qt.apply(this,arguments)}(t);return e.success?console.log("[TTP] ✅ Element clicked"):console.warn("[TTP] ⚠️ Click failed:",e.error),e}));var e=t.getRegisteredTools(),n=["read_page","highlight_element","scroll_to_element","navigate_to","fill_field","click_element"].filter(t=>!e.includes(t));n.length>0&&console.error("[TTP] ❌ Some visual tools failed to register:",n)}function kt(){return(kt=Ut(function*(){var t=yield mt();return{url:t.url,title:t.title,timestamp:t.timestamp,language:t.language,viewport:t.viewport,dom:{buttons:t.buttons,links:t.links,forms:t.forms,sections:t.sections,headings:t.headings,metadata:t.metadata}}})).apply(this,arguments)}function It(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function Tt(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){It(i,A,o,r,a,"next",t)}function a(t){It(i,A,o,r,a,"throw",t)}r(void 0)})}}function Ht(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function _t(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ht(Object(n),!0).forEach(function(e){Dt(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Dt(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Mt extends c{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.version="2.0.0",t.signedUrl&&!t.websocketUrl&&(console.warn("⚠️ VoiceSDK: signedUrl is deprecated — use websocketUrl for custom backend URLs, or just provide agentId + appId"),t.websocketUrl=t.signedUrl),this.config={websocketUrl:t.websocketUrl||"wss://speech.talktopc.com/ws/conv",agentId:t.agentId,appId:t.appId,sampleRate:t.sampleRate||16e3,channels:t.channels||1,bitDepth:t.bitDepth||16,audioProcessorPath:t.audioProcessorPath,outputContainer:t.outputContainer||this.getDefaultContainer(t),outputEncoding:t.outputEncoding||t.outputCodec||"pcm",outputSampleRate:t.outputSampleRate||16e3,outputChannels:t.outputChannels||1,outputBitDepth:t.outputBitDepth||16,outputFrameDurationMs:t.outputFrameDurationMs||600,outputCodec:t.outputCodec,agentSettingsOverride:t.agentSettingsOverride||null,visualAssistant:t.visualAssistant||null,variables:t.variables||null,autoReconnect:!1!==t.autoReconnect,audioConstraints:t.audioConstraints||null,protocolVersion:t.protocolVersion||2,flavor:t.flavor||null},this.isConnected=!1,this.hasEverConnected=!1,this.helloAckReceived=!1,this.disclaimersPending=!1,this.disclaimersHash=null,this.lastDisclaimerPayload=null,this._gracefulHangupInitiated=!1,this.isRecording=!1,this.isPlaying=!1,this.isDestroyed=!1,this.outputAudioFormat=null,this.requestedOutputFormat=null,this.formatConverter=null,this.websocket=null,this.conversationId=null,this.transcriptQueue=[],this.currentPlayingSentenceId=null,this.audioFrameCount=0,this.lastAudioStartTime=0,this.wakeLock=null,this._wakeLockRequesting=!1,this.pendingInjections=new Map,this.injectionCounter=0,this.audioPlayer=new v(this.config);var e=_t(_t({},this.config),{},{checkConnection:()=>this.isConnected&&this.websocket&&this.websocket.readyState===WebSocket.OPEN});this.audioRecorder=new k(e),this.setupAudioPlayerEvents(),this.setupAudioRecorderEvents(),this.clientToolsRegistry=new q(t=>this.sendMessage(t),()=>this.conversationId),this._registerBuiltInTools(),this.validateConfig(),this._setupPageUnloadHandler()}_registerBuiltInTools(){var t=this;console.log("📸 VoiceSDK: _registerBuiltInTools() called"),console.log("📸 VoiceSDK: captureScreenshot available?",void 0!==nt);try{if(void 0===nt)return console.error("❌ VoiceSDK: captureScreenshot is undefined - import may have failed"),void console.error(" This will prevent capture_screen tool from working");console.log("📸 VoiceSDK: Registering capture_screen tool, captureScreenshot type:",typeof nt),this.clientToolsRegistry.registerHandler("capture_screen",Tt(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("📸 VoiceSDK: capture_screen tool called with params:",e);var{selector:n=null,format:A="jpeg",quality:o=.85,scale:i=1,fullPage:r=!1,maxWidth:a=1280,maxHeight:s=1280}=e;try{var c=yield nt({selector:n,format:A,quality:o,scale:i,fullPage:r,maxWidth:a,maxHeight:s});return console.log("📸 VoiceSDK: Screenshot captured: ".concat(c.width,"x").concat(c.height,", ").concat(Math.round(c.image.length/1024),"KB")),t.emit("screenshotCaptured",{width:c.width,height:c.height,sizeKB:Math.round(c.image.length/1024),selector:c.selector}),c}catch(e){throw console.error("📸 VoiceSDK: Screenshot capture failed:",e),t.emit("screenshotError",{error:e.message}),e}})),console.log("📸 VoiceSDK: Built-in capture_screen tool registered")}catch(t){console.error("❌ VoiceSDK: Error registering built-in tools:",t),console.error(" Error details:",t.message,t.stack)}try{Et(this.clientToolsRegistry);var e=this.clientToolsRegistry.getRegisteredTools(),n=["read_page","click_element","fill_field","highlight_element","scroll_to_element","navigate_to"],A=e.filter(t=>n.includes(t));if(A.length!==n.length){var o=n.filter(t=>!A.includes(t));console.error("❌ VoiceSDK: Some visual tools failed to register:",o),console.error(" Registered visual tools:",A)}}catch(t){console.error("❌ VoiceSDK: Error registering visual assistant tools:",t),console.error(" Error details:",t.message,t.stack)}var i=this.clientToolsRegistry.getRegisteredTools(),r=["read_page","capture_screen","highlight_element","click_element","fill_field","scroll_to_element","navigate_to"],a=i.filter(t=>r.includes(t));if(a.length!==r.length){var s=r.filter(t=>!a.includes(t));console.error("❌ VoiceSDK: Missing internal tools:",s),console.error(" Expected 7 internal tools:",r),console.error(" Registered:",a)}}getStoredConversationId(){try{if("undefined"==typeof sessionStorage)return console.warn("⚠️ VoiceSDK v2: sessionStorage not available (private mode?)"),null;var t=sessionStorage.getItem(Mt.RESUME_STORAGE_KEY);if(t){var e=JSON.parse(t);if(e&&e.conversationId)return console.log("📦 VoiceSDK v2: Found stored conversationId:",e.conversationId),e.conversationId}return null}catch(t){return console.warn("⚠️ VoiceSDK v2: Error reading sessionStorage:",t),null}}storeConversationId(t){if(t)try{if("undefined"==typeof sessionStorage)return void console.warn("⚠️ VoiceSDK v2: sessionStorage not available (private mode?)");var e={},n=sessionStorage.getItem(Mt.RESUME_STORAGE_KEY);if(n)try{e=JSON.parse(n)}catch(t){}e.conversationId=t,e.timestamp=Date.now(),e.fromPage=e.fromPage||window.location.pathname+window.location.search,sessionStorage.setItem(Mt.RESUME_STORAGE_KEY,JSON.stringify(e)),console.log("💾 VoiceSDK v2: Stored conversationId:",t)}catch(t){console.warn("⚠️ VoiceSDK v2: Error writing to sessionStorage:",t)}}clearStoredConversationId(){try{if("undefined"==typeof sessionStorage)return;sessionStorage.removeItem(Mt.RESUME_STORAGE_KEY),console.log("🗑️ VoiceSDK v2: Cleared stored conversationId")}catch(t){console.warn("⚠️ VoiceSDK v2: Error clearing sessionStorage:",t)}}_getResumeState(){try{if("undefined"==typeof sessionStorage)return null;var t=sessionStorage.getItem(Mt.RESUME_STORAGE_KEY);if(!t)return null;var e=JSON.parse(t),n=Date.now()-e.timestamp;return n>Mt.RESUME_TTL_MS?(console.log("[VoiceSDK] Resume state expired:",n,"ms"),this._clearResumeState(),null):(console.log("[VoiceSDK] Found valid resume state:",e,"age:",n,"ms"),e)}catch(t){return console.warn("[VoiceSDK] Failed to get resume state:",t),null}}_clearResumeState(){try{if("undefined"==typeof sessionStorage)return;sessionStorage.removeItem(Mt.RESUME_STORAGE_KEY)}catch(t){}}_setupPageUnloadHandler(){window.addEventListener("beforeunload",()=>{this.conversationId&&this.websocket&&this.websocket.readyState===WebSocket.OPEN&&this.storeConversationId(this.conversationId)}),document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&(this.isRecording&&this.isConnected&&this._requestWakeLock(),this.isRecording&&this.audioRecorder&&this.audioRecorder.resumeAudioContext().catch(t=>{console.error("VoiceSDK v2: Error resuming AudioContext on visibility change:",t)}),this.audioPlayer&&this.audioPlayer.resumeAudioContext().catch(t=>{console.error("VoiceSDK v2: Error resuming playback AudioContext on visibility change:",t)})),"hidden"===document.visibilityState&&this.conversationId&&this.websocket&&this.websocket.readyState===WebSocket.OPEN&&this.storeConversationId(this.conversationId)})}checkAndResume(){var t=this._getResumeState();if(!t)return null;var e=window.location.pathname+window.location.search;return console.log("[VoiceSDK] Auto-resuming conversation:",t.conversationId),console.log("[VoiceSDK] Page change:",t.fromPage,"→",e),{conversationId:t.conversationId,fromPage:t.fromPage,toPage:e}}getDefaultContainer(t){return"wav"===t.outputCodec?"wav":"raw"}validateInputFormat(t){var e;if(!t)return"Input format is required";var n=null===(e=t.encoding)||void 0===e?void 0:e.toLowerCase();return n&&Mt.SUPPORTED_INPUT_ENCODINGS.includes(n)?t.sampleRate&&Mt.SUPPORTED_INPUT_SAMPLE_RATES.includes(t.sampleRate)?t.bitDepth&&Mt.SUPPORTED_INPUT_BIT_DEPTHS.includes(t.bitDepth)?t.channels&&Mt.SUPPORTED_INPUT_CHANNELS.includes(t.channels)?null:"Unsupported input channels: ".concat(t.channels,". Supported: ").concat(Mt.SUPPORTED_INPUT_CHANNELS.join(", ")):"Unsupported input bit depth: ".concat(t.bitDepth,". Supported: ").concat(Mt.SUPPORTED_INPUT_BIT_DEPTHS.join(", ")):"Unsupported input sample rate: ".concat(t.sampleRate,". Supported: ").concat(Mt.SUPPORTED_INPUT_SAMPLE_RATES.join(", ")):"Unsupported input encoding: ".concat(t.encoding,". Supported: ").concat(Mt.SUPPORTED_INPUT_ENCODINGS.join(", "))}validateOutputFormat(t){var e,n;if(!t)return"Output format is required";var A=null===(e=t.encoding)||void 0===e?void 0:e.toLowerCase();if(!A||!Mt.SUPPORTED_OUTPUT_ENCODINGS.includes(A))return"Unsupported output encoding: ".concat(t.encoding,". Supported: ").concat(Mt.SUPPORTED_OUTPUT_ENCODINGS.join(", "));if(!t.sampleRate||!Mt.SUPPORTED_OUTPUT_SAMPLE_RATES.includes(t.sampleRate))return"Unsupported output sample rate: ".concat(t.sampleRate,". Supported: ").concat(Mt.SUPPORTED_OUTPUT_SAMPLE_RATES.join(", "));if(!t.bitDepth||!Mt.SUPPORTED_OUTPUT_BIT_DEPTHS.includes(t.bitDepth))return"Unsupported output bit depth: ".concat(t.bitDepth,". Supported: ").concat(Mt.SUPPORTED_OUTPUT_BIT_DEPTHS.join(", "));if(!t.channels||!Mt.SUPPORTED_OUTPUT_CHANNELS.includes(t.channels))return"Unsupported output channels: ".concat(t.channels,". Supported: ").concat(Mt.SUPPORTED_OUTPUT_CHANNELS.join(", "));var o=null===(n=t.container)||void 0===n?void 0:n.toLowerCase();return o&&Mt.SUPPORTED_OUTPUT_CONTAINERS.includes(o)?null:"Unsupported output container: ".concat(t.container,". Supported: ").concat(Mt.SUPPORTED_OUTPUT_CONTAINERS.join(", "))}validateConfig(){var t={encoding:"pcm",sampleRate:this.config.sampleRate,channels:this.config.channels,bitDepth:this.config.bitDepth},e=this.validateInputFormat(t);if(e)return console.error("❌ VoiceSDK v2: Invalid input format:",e),void this.emit("error",new Error(e));var n={encoding:this.config.outputEncoding,sampleRate:this.config.outputSampleRate,channels:this.config.outputChannels,bitDepth:this.config.outputBitDepth,container:this.config.outputContainer},A=this.validateOutputFormat(n);return A?(console.error("❌ VoiceSDK v2: Invalid output format:",A),void this.emit("error",new Error(A))):void 0}setupAudioPlayerEvents(){this.audioPlayer.on("playbackStarted",()=>{this.isPlaying=!0,this.emit("playbackStarted"),this.isConnected?(console.log("📤 VoiceSDK v2: Sending audio_started_playing message to server"),this.sendMessage({t:"audio_started_playing"})):console.warn("⚠️ VoiceSDK v2: Cannot send audio_started_playing - not connected")}),this.audioPlayer.on("transcriptDisplay",t=>{var e=this.currentPlayingSentenceId?this.currentPlayingSentenceId+1:1;this.currentPlayingSentenceId=e;var n={text:t.text,role:"assistant",sentenceId:e,final:!0,timestamp:Date.now()};if(console.log("📝 VoiceSDK v2: Emitting synced transcriptDisplay from AudioPlayer:",n),this.emit("transcriptDisplay",n),this.emit("transcript",n),t.synced&&Array.isArray(t.synced))for(var A of(console.log("📝 VoiceSDK v2: Emitting ".concat(t.synced.length," synced action(s) as message events")),t.synced))this.emit("message",A)}),this.audioPlayer.on("playbackStopped",()=>{this.isPlaying=!1,this.emit("playbackStopped"),this.isConnected?(console.log("📤 VoiceSDK v2: Sending audio_stopped_playing message to server"),this.sendMessage({t:"audio_stopped_playing"})):console.warn("⚠️ VoiceSDK v2: Cannot send audio_stopped_playing - not connected")}),this.audioPlayer.on("playbackError",t=>{this.emit("playbackError",t),this.emit("error",t)})}setupAudioRecorderEvents(){this.audioRecorder.on("recordingStarted",()=>{this.isRecording=!0,this.emit("recordingStarted")}),this.audioRecorder.on("recordingStopped",()=>{this.isRecording&&(this.isRecording=!1,this.emit("recordingStopped"),console.log("🛑 VoiceSDK v2: Recording stopped (from audioRecorder event)"))}),this.audioRecorder.on("audioData",t=>{this.isConnected&&this.sendBinary(t)}),this.audioRecorder.on("error",t=>{t.isServerRejection||"ServerRejected"===t.name||(console.error("❌ AudioRecorder error:",t),this.emit("error",t))})}buildWebSocketUrl(){var t=this.config.websocketUrl,e=new URL(t,"wss://placeholder.com"),n=e.searchParams;n.delete("signed_token"),this.config.agentId&&!n.has("agentId")&&n.append("agentId",this.config.agentId),this.config.appId&&!n.has("appId")&&n.append("appId",this.config.appId);var A=this.getStoredConversationId();A&&!n.has("conversationId")&&(n.append("conversationId",A),console.log("🔄 VoiceSDK v2: Attempting resume via query param:",A));var o=window.location.pathname+window.location.search;o&&!n.has("currentPage")&&n.append("currentPage",o);var i=n.toString();return i?"".concat(e.origin).concat(e.pathname,"?").concat(i):"".concat(e.origin).concat(e.pathname)}connect(){var t=this;return Tt(function*(){if(t.isDestroyed)return console.warn("VoiceSDK v2: Cannot connect - SDK is destroyed"),!1;if(t.isConnected)return console.warn("VoiceSDK v2: Already connected"),!0;try{var e=t.buildWebSocketUrl();return"undefined"!=typeof __DEV__&&__DEV__&&(console.log("[TTPAgentSDK] WebSocket URL:",e),console.log("🔌 VoiceSDK v2: Connecting to",e)),yield new Promise((n,A)=>{t.websocket=new WebSocket(e),t.websocket.onopen=()=>{if(t.isConnected=!0,t.hasEverConnected=!0,t.clientToolsRegistry){t.clientToolsRegistry.setSendMessage(e=>t.sendMessage(e));var e=t.clientToolsRegistry.getRegisteredTools(),A=["read_page","capture_screen","highlight_element","click_element","fill_field","scroll_to_element","navigate_to"].filter(t=>!e.includes(t));if(A.length>0){console.warn("⚠️ VoiceSDK v2: Missing tools detected, re-registering:",A),t._registerBuiltInTools();var o=t.clientToolsRegistry.getRegisteredTools();console.log("🔧 VoiceSDK v2: Tools after re-registration:",o)}}t.sendHelloMessage(),t.emit("connected"),n(!0)},t.websocket.onerror=t=>{console.error("❌ VoiceSDK v2: WebSocket error:",t),A(t)},t.websocket.onclose=e=>{if(console.log("🔌 VoiceSDK v2: WebSocket closed:",e.code,e.reason),t.isConnected=!1,t.helloAckReceived=!1,t.disclaimersPending=!1,t.isRecording&&t.stopRecording().catch(t=>console.error("Error stopping recording:",t)),t._releaseWakeLock(),t.pendingInjections.size>0){console.warn("VoiceSDK v2: Rejecting ".concat(t.pendingInjections.size," pending data injections due to disconnect"));var n=new Error("Connection closed - data injection cancelled");n.error="CONNECTION_CLOSED",t.pendingInjections.forEach((e,A)=>{clearTimeout(e.timeout),e.reject(n),t.emit("dataInjectionError",{error:"CONNECTION_CLOSED",message:"Connection closed - data injection cancelled",correlationId:A})}),t.pendingInjections.clear()}t.emit("disconnected",e),t.config.autoReconnect&&!t.isDestroyed&&t.hasEverConnected?(console.log("🔄 VoiceSDK v2: Auto-reconnecting in 3s..."),setTimeout(()=>{t.isDestroyed||t.isConnected||t.connect()},3e3)):t.config.autoReconnect&&!t.hasEverConnected&&console.log("⚠️ VoiceSDK v2: Initial connection failed. Auto-reconnect disabled to prevent retry loop.")},t.websocket.onmessage=e=>{t.handleMessage(e)}})}catch(e){return console.error("🔌 VoiceSDK v2: Connection failed:",e),t.emit("error",e),!1}})()}detectBrowserLocale(){var t,e,n=navigator.language||(null===(t=navigator.languages)||void 0===t?void 0:t[0])||"en-US";return{language:(null===(e=n.split("-")[0])||void 0===e?void 0:e.toLowerCase())||"en",fullLocale:n}}sendHelloMessage(){var t=this;return Tt(function*(){if(t.isConnected){var e={encoding:"pcm",sampleRate:t.config.sampleRate,channels:t.config.channels,bitDepth:t.config.bitDepth},n={encoding:t.config.outputEncoding,sampleRate:t.config.outputSampleRate,channels:t.config.outputChannels,bitDepth:t.config.outputBitDepth,container:t.config.outputContainer},A=t.validateInputFormat(e);if(A)return console.error("❌ VoiceSDK v2: Cannot send hello - invalid input format:",A),void t.emit("error",new Error("Invalid input format: ".concat(A)));var o=t.validateOutputFormat(n);if(o)return console.error("❌ VoiceSDK v2: Cannot send hello - invalid output format:",o),void t.emit("error",new Error("Invalid output format: ".concat(o)));var i={t:"hello",v:t.config.protocolVersion,inputFormat:e,requestedOutputFormat:n,outputFrameDurationMs:t.config.outputFrameDurationMs};t.config.agentSettingsOverride&&(i.agentSettingsOverride=t.config.agentSettingsOverride),i.locale=t.detectBrowserLocale(),console.log("🌍 VoiceSDK v2: Auto-detected locale:",i.locale),console.log("🔍 VoiceSDK v2: Checking variables:",{hasVariables:!!t.config.variables,variables:t.config.variables,keys:t.config.variables?Object.keys(t.config.variables):[]}),t.config.variables&&Object.keys(t.config.variables).length>0?(i.variables=t.config.variables,console.log("📝 VoiceSDK v2: Including variables in hello:",Object.keys(t.config.variables))):console.log("⚠️ VoiceSDK v2: Variables NOT included - condition failed"),t.config.flavor&&(i.flavor=t.config.flavor),i.lastBuildTime="2026-03-26T01:56:50.079Z",console.log("📤 VoiceSDK v2: Sending hello:",{version:i.v,requestedFormat:i.requestedOutputFormat,variables:i.variables?Object.keys(i.variables):void 0}),console.log("📤 VoiceSDK v2: Requested output format:",{container:i.requestedOutputFormat.container,encoding:i.requestedOutputFormat.encoding,sampleRate:i.requestedOutputFormat.sampleRate,bitDepth:i.requestedOutputFormat.bitDepth}),console.log("📤 VoiceSDK v2: Full hello message being sent:",JSON.stringify(i,null,2));try{t.sendMessage(i)}catch(e){console.error("VoiceSDK v2: Failed to send hello:",e),t.emit("error",e)}}else console.warn("VoiceSDK v2: Cannot send hello - not connected")})()}handleMessage(t){var e;if(t.data instanceof ArrayBuffer||t.data instanceof Blob)this.handleBinaryMessage(t.data);else try{var n=JSON.parse(t.data);switch("audio"!==n.t&&console.log("📥 VoiceSDK v2: Received message type:",n.t,"Full message:",JSON.stringify(n).substring(0,200)),!this.conversationId&&n.conversationId&&(this.conversationId=n.conversationId,console.log("🔍 VoiceSDK v2: Captured conversationId from message:",this.conversationId),this.emit("conversationIdChanged",this.conversationId)),"audio"!==n.t&&console.log("📨 VoiceSDK v2: Received message type:",n.t,n),n.t){case"hello_ack":this.handleHelloAck(n);break;case"transcript":console.log("📝 VoiceSDK v2: Processing transcript message:",n),this.handleTranscript(n);break;case"user_transcript":console.log("📝 VoiceSDK v2: Received user_transcript:",n),this.emit("user_transcript",{text:n.text,final:!1!==n.final,timestamp:n.timestamp||Date.now()});break;case"agent_response":if(console.log("📝 VoiceSDK v2: Received agent_response:",n),(n.text||n.transcript)&&(console.log("📝 VoiceSDK v2: agent_response contains transcript data:",n.text||n.transcript),n.sentenceId&&(n.text||n.transcript))){var A={t:"transcript",sentenceId:n.sentenceId,text:n.text||n.transcript,role:n.role||"assistant",final:!1!==n.final,timestamp:n.timestamp||Date.now()};console.log("📝 VoiceSDK v2: Converting agent_response to transcript:",A),this.handleTranscript(A)}this.emit("message",n);break;case"error":if(n.code&&String(n.code).startsWith("DISCLAIMER_"))if("DISCLAIMER_PENDING"===n.code){var o=new Error(n.message||"Disclaimer acknowledgement required first");o.code="DISCLAIMER_PENDING",this.emit("error",o)}else this.disclaimersPending=!1,this.emit("disclaimerRejected",{code:n.code,message:n.message||""});this.emit("message",n);break;case"barge_in":this.emit("bargeIn",n),this.stopAudioPlayback();break;case"stop_playing":var i=Date.now()-this.lastAudioStartTime;if(i<200){console.warn("⚠️ VoiceSDK v2: Ignoring premature stop_playing (".concat(i,"ms after audio_start, minimum ").concat(200,"ms required)"));break}this.emit("stopPlaying",n),this.stopAudioPlayback();break;case"audio_start":if(console.log("📝 VoiceSDK v2: Received audio_start with text:",n.text),this.lastAudioStartTime=Date.now(),this.audioPlayer&&(this.audioPlayer.isPlaying||(null===(e=this.audioPlayer.scheduledSources)||void 0===e?void 0:e.size)>0)&&console.log("📝 VoiceSDK v2: New sentence received while audio playing - will queue and wait for current sentence to finish"),n.text&&this.audioPlayer){var r=Array.isArray(n.synced)?n.synced:null;r&&console.log("📝 VoiceSDK v2: audio_start carries ".concat(r.length," synced action(s)")),this.audioPlayer.markNewSentence(n.text,r)}this.emit("message",n);break;case"client_tool_call":this.clientToolsRegistry.handleToolCall(n);break;case"text_inject_ack":this.handleTextInjectAck(n);break;case"data_inject_ack":this.handleDataInjectAck(n);break;case"data_inject_error":this.handleDataInjectError(n);break;case"hangup_ack":console.log("📞 VoiceSDK v2: Hangup acknowledged by server"),this.websocket&&this.websocket.readyState===WebSocket.OPEN&&(this.websocket.close(1e3,"User hangup"),this.websocket=null),this.isConnected=!1,this.emit("hangupAcknowledged");break;case"get_page_context":console.log("📖 [VISUAL ASSISTANT] Backend requested page context"),function(){return kt.apply(this,arguments)}().then(t=>{this.sendMessage({t:"page_context",pageContext:t}),console.log("📖 [VISUAL ASSISTANT] Page context sent:",t.url)}).catch(t=>{console.error("❌ [VISUAL ASSISTANT] Failed to scan page:",t),this.sendMessage({t:"page_context",pageContext:null,error:t.message})});break;case"get_screenshot":console.log("📸 [VISUAL ASSISTANT] Backend requested screenshot");try{nt().then(t=>{this.sendMessage({t:"screenshot",screenshot:{image:t.base64,mimeType:t.mimeType||"image/png",width:t.width,height:t.height}}),console.log("📸 [VISUAL ASSISTANT] Screenshot sent:",t.width+"x"+t.height)}).catch(t=>{console.error("❌ [VISUAL ASSISTANT] Screenshot capture failed:",t),this.sendMessage({t:"screenshot",screenshot:null,error:t.message})})}catch(t){console.error("❌ [VISUAL ASSISTANT] Screenshot error:",t),this.sendMessage({t:"screenshot",screenshot:null,error:t.message})}break;case"page_context_ack":n.ok?console.log("✅ [VISUAL ASSISTANT] Page context acknowledged"):console.warn("⚠️ [VISUAL ASSISTANT] Page context error:",n.error);break;case"screenshot_ack":n.ok?console.log("✅ [VISUAL ASSISTANT] Screenshot acknowledged"):console.warn("⚠️ [VISUAL ASSISTANT] Screenshot error:",n.error);break;case"show_items":case"show_products":case"cart_updated":case"add_to_store_cart":this.emit("message",n);break;default:if(console.log("VoiceSDK v2: Unknown message type:",n.t,"Full message:",JSON.stringify(n).substring(0,300)),(n.text||n.transcript||n.transcription)&&(console.log("📝 VoiceSDK v2: Unknown message contains transcript-like data:",{text:n.text,transcript:n.transcript,transcription:n.transcription,sentenceId:n.sentenceId,role:n.role}),n.sentenceId&&(n.text||n.transcript||n.transcription))){var a={t:"transcript",sentenceId:n.sentenceId,text:n.text||n.transcript||n.transcription,role:n.role||"assistant",final:!1!==n.final,timestamp:n.timestamp||Date.now()};console.log("📝 VoiceSDK v2: Attempting to process unknown message as transcript:",a),this.handleTranscript(a)}this.emit("message",n)}}catch(e){var s,c,l="string"==typeof t.data?t.data:String(t.data),d=(null===(s=e.message)||void 0===s||null===(s=s.match(/position (\d+)/))||void 0===s?void 0:s[1])||"unknown",p=parseInt(d,10);if(console.error("VoiceSDK v2: Error parsing message:",e),console.error("VoiceSDK v2: Raw message length:",l.length),console.error("VoiceSDK v2: Error at position:",p),"unknown"!==p&&p>0){var u=Math.max(0,p-50),h=Math.min(l.length,p+50),g=l.substring(u,h),m=" ".repeat(p-u)+"^";console.error("VoiceSDK v2: Context around error:"),console.error(g),console.error(m);var v=l.charAt(p),f=v.charCodeAt(0);console.error('VoiceSDK v2: Problematic character: "'.concat(v,'" (charCode: ').concat(f,")")),f<32&&9!==f&&10!==f&&13!==f&&console.error("VoiceSDK v2: This is an unescaped control character. The backend should escape it in JSON strings.")}var w=l.includes("client_tool_call")||l.includes('"t":"client_tool_call"');if(w){console.error("⚠️ VoiceSDK v2: CRITICAL - Failed to parse client_tool_call message!"),console.error("⚠️ VoiceSDK v2: This means a tool execution (like form filling) was lost due to JSON parsing error."),console.error("⚠️ VoiceSDK v2: The backend sent malformed JSON with unescaped control characters.");var B=l.match(/"toolName"\s*:\s*"([^"]+)"/);B&&console.error('⚠️ VoiceSDK v2: Attempted tool: "'.concat(B[1],'"'));var b=l.match(/"toolCallId"\s*:\s*"([^"]+)"/);b&&console.error('⚠️ VoiceSDK v2: Tool call ID: "'.concat(b[1],'"'))}if(null!==(c=e.message)&&void 0!==c&&c.includes("Bad control character")){console.warn("VoiceSDK v2: Attempting to recover by sanitizing control characters...");try{var y=l;y=y.replace(/([^\\])([\x00-\x08\x0B\x0C\x0E-\x1F])/g,(t,e,n)=>{var A=n.charCodeAt(0);return e+({0:"\\u0000",1:"\\u0001",2:"\\u0002",3:"\\u0003",4:"\\u0004",5:"\\u0005",6:"\\u0006",7:"\\u0007",8:"\\b",11:"\\u000B",12:"\\f",14:"\\u000E",15:"\\u000F",16:"\\u0010",17:"\\u0011",18:"\\u0012",19:"\\u0013",20:"\\u0014",21:"\\u0015",22:"\\u0016",23:"\\u0017",24:"\\u0018",25:"\\u0019",26:"\\u001A",27:"\\u001B",28:"\\u001C",29:"\\u001D",30:"\\u001E",31:"\\u001F"}[A]||"\\u".concat(A.toString(16).padStart(4,"0")))});var x=JSON.parse(y);if(console.warn("✅ VoiceSDK v2: Successfully recovered message after sanitization!"),console.warn("✅ VoiceSDK v2: Processing recovered message..."),"client_tool_call"===x.t&&this.clientToolsRegistry)console.warn("✅ VoiceSDK v2: Recovered client_tool_call - executing tool"),this.clientToolsRegistry.handleToolCall(x);else{var C=x;"audio"!==C.t&&console.log("📥 VoiceSDK v2: Received message type:",C.t,"Full message:",JSON.stringify(C).substring(0,200)),!this.conversationId&&C.conversationId&&(this.conversationId=C.conversationId,console.log("🔍 VoiceSDK v2: Captured conversationId from message:",this.conversationId),this.emit("conversationIdChanged",this.conversationId)),"audio"!==C.t&&console.log("📨 VoiceSDK v2: Received message type:",C.t,C),"client_tool_call"===C.t?this.clientToolsRegistry.handleToolCall(C):this.emit("message",C)}return}catch(t){console.error("❌ VoiceSDK v2: Recovery attempt failed:",t)}}console.error("VoiceSDK v2: First 500 chars of raw message:",l.substring(0,500)),this.emit("error",{type:"json_parse_error",error:e,rawMessage:l.substring(0,1e3),position:p,wasToolCall:w})}}handleHelloAck(t){if(console.log("📥 VoiceSDK v2: Received hello_ack:",{hasOutputFormat:!!t.outputAudioFormat,outputFormat:t.outputAudioFormat,hasConversationId:!!t.conversationId,messageType:t.t}),t.conversationId&&(this.conversationId=t.conversationId,console.log("🔍 VoiceSDK v2: Received conversationId:",this.conversationId),this.emit("conversationIdChanged",this.conversationId),this.storeConversationId(this.conversationId)),!0===t.resumed?(console.log("✅ VoiceSDK v2: Conversation resumed successfully"),this.emit("callResumed",{conversationId:this.conversationId,timestamp:Date.now()})):!1===t.resumed&&t.resumeRejectedReason&&(console.warn("⚠️ VoiceSDK v2: Resume rejected:",t.resumeRejectedReason),this.clearStoredConversationId(),this.emit("resumeRejected",{reason:t.resumeRejectedReason,conversationId:t.conversationId||null,timestamp:Date.now()})),t.inputAudioFormat){var e=t.inputAudioFormat.sampleRate;e&&e!==this.config.sampleRate&&(console.log("🔄 VoiceSDK v2: Input format negotiated by server: ".concat(this.config.sampleRate,"Hz → ").concat(e,"Hz")),this.config.sampleRate=e),t.inputAudioFormat.channels&&(this.config.channels=t.inputAudioFormat.channels),t.inputAudioFormat.bitDepth&&(this.config.bitDepth=t.inputAudioFormat.bitDepth),this.audioRecorder&&this.audioRecorder.config&&(this.audioRecorder.config.sampleRate=this.config.sampleRate,this.audioRecorder.config.channels=this.config.channels,this.audioRecorder.config.bitDepth=this.config.bitDepth),this.emit("inputFormatNegotiated",t.inputAudioFormat)}if(this.disclaimersPending=!0===t.disclaimersRequired,this.disclaimersHash=this.disclaimersPending&&t.disclaimersHash||null,this.helloAckReceived=!0,t.outputAudioFormat){this.outputAudioFormat=t.outputAudioFormat,this.audioPlayer.setOutputFormat(t.outputAudioFormat),console.log("✅ VoiceSDK v2: Format negotiated by server:",this.outputAudioFormat),this.requestedOutputFormat={container:this.config.outputContainer||"wav",encoding:this.config.outputEncoding||"pcm",sampleRate:this.config.outputSampleRate||16e3,bitDepth:this.config.outputBitDepth||16,channels:this.config.outputChannels||1};var n={container:this.outputAudioFormat.container||"unknown",encoding:this.outputAudioFormat.encoding||"unknown",sampleRate:this.outputAudioFormat.sampleRate||0,bitDepth:this.outputAudioFormat.bitDepth||0,channels:this.outputAudioFormat.channels||0},A=[];if(this.requestedOutputFormat.container!==n.container&&A.push('container: "'.concat(this.requestedOutputFormat.container,'" → "').concat(n.container,'"')),this.requestedOutputFormat.encoding!==n.encoding&&A.push('encoding: "'.concat(this.requestedOutputFormat.encoding,'" → "').concat(n.encoding,'"')),this.requestedOutputFormat.sampleRate!==n.sampleRate&&A.push("sampleRate: ".concat(this.requestedOutputFormat.sampleRate,"Hz → ").concat(n.sampleRate,"Hz")),this.requestedOutputFormat.bitDepth!==n.bitDepth&&A.push("bitDepth: ".concat(this.requestedOutputFormat.bitDepth,"-bit → ").concat(n.bitDepth,"-bit")),this.requestedOutputFormat.channels!==n.channels&&A.push("channels: ".concat(this.requestedOutputFormat.channels," → ").concat(n.channels)),A.length>0){console.warn("⚠️ VoiceSDK v2: Format negotiation mismatch!"),console.warn(" Requested:",this.requestedOutputFormat),console.warn(" Negotiated:",n),console.warn(" Differences:",A.join(", "));try{if(this.formatConverter=new j(this.requestedOutputFormat,n),this.formatConverter.needsConversion()){var o=this.formatConverter.getConversionSteps();console.log("🔄 VoiceSDK v2: Format conversion enabled"),console.log(" Conversion steps:",o.join(", ")),console.log(" Audio will be automatically converted to requested format")}}catch(t){console.error("❌ VoiceSDK v2: Failed to create format converter:",t),console.warn(" Will use backend format without conversion"),this.formatConverter=null}}else console.log("✅ VoiceSDK v2: Format perfectly matched!",n),this.formatConverter=null;this.emit("formatNegotiated",this.outputAudioFormat)}else{this.config.protocolVersion>=2&&(console.warn("⚠️ VoiceSDK v2: hello_ack received but no outputAudioFormat in response."),console.warn(" This may happen if:"),console.warn(" 1. Backend is not sending outputAudioFormat (check backend logs)"),console.warn(" 2. Hello message missing v2 fields (v, inputFormat, requestedOutputFormat)"),console.warn(" 3. Backend validation failed (check backend error logs)"),console.warn(" Using default format from config..."));var i={container:this.config.outputContainer||"wav",encoding:this.config.outputEncoding||"pcm",sampleRate:this.config.outputSampleRate||16e3,channels:this.config.outputChannels||1,bitDepth:this.config.outputBitDepth||16};this.outputAudioFormat=i,this.requestedOutputFormat=i,this.audioPlayer.setOutputFormat(i),this.formatConverter=null}if(this.disclaimersPending){var r={texts:Array.isArray(t.disclaimerTexts)?t.disclaimerTexts:[],disclaimersHash:this.disclaimersHash,disclaimersVersion:t.disclaimersVersion,disclaimerTimeoutMs:t.disclaimerTimeoutMs,conversationId:this.conversationId};this.lastDisclaimerPayload=r,this.emit("disclaimersRequired",r)}else this.lastDisclaimerPayload=null}sendDisclaimerAck(t){if(this.isConnected&&this.websocket&&this.websocket.readyState===WebSocket.OPEN){var e={t:"disclaimer_ack",accepted:!!t,disclaimersHash:this.disclaimersHash||"",conversationId:this.conversationId||void 0};try{this.websocket.send(JSON.stringify(e)),console.log("📤 VoiceSDK v2: disclaimer_ack sent",{accepted:e.accepted}),this.disclaimersPending=!1}catch(t){console.error("VoiceSDK v2: disclaimer_ack send failed",t)}}else console.warn("VoiceSDK v2: Cannot send disclaimer_ack — socket not open")}handleTextInjectAck(t){console.log("📝 VoiceSDK v2: Text inject ack received:",t),this.emit("textInjectAck",t)}injectData(t){var e=arguments,n=this;return Tt(function*(){var A=e.length>1&&void 0!==e[1]?e[1]:{},o=null==t?void 0:t.trim();if(!o){var i={error:"EMPTY_DATA",message:"Cannot inject empty data"};throw console.warn("VoiceSDK v2: Cannot inject empty data"),n.emit("dataInjectionError",i),new Error(i.message)}if(!n.isConnected||!n.websocket){var r={error:"NOT_CONNECTED",message:"Voice call is not active"};throw console.warn("VoiceSDK v2: Cannot inject data - not connected"),n.emit("dataInjectionError",r),new Error(r.message)}if(o.length>5e3){var a={error:"DATA_TOO_LONG",message:"Data exceeds maximum length of 5000 characters",maxLength:5e3,currentLength:o.length};throw console.warn("VoiceSDK v2: Data too long (max 5000 characters)"),n.emit("dataInjectionError",a),new Error(a.message)}var s=n.generateCorrelationId(),c=A.timeout||1e4,l=A.source||"programmatic",d={t:"data_inject",data:o,correlationId:s,source:l,timestamp:Date.now()};return A.metadata&&(d.metadata=A.metadata),new Promise((t,e)=>{var A=setTimeout(()=>{n.pendingInjections.delete(s);var t={error:"TIMEOUT",message:"Data injection timeout - no response from server",correlationId:s,timeout:c};console.warn("VoiceSDK v2: Data injection timeout:",s),n.emit("dataInjectionError",t),e(new Error(t.message))},c);if(n.pendingInjections.set(s,{resolve:e=>{clearTimeout(A),t(e)},reject:t=>{clearTimeout(A),e(t)},timeout:A}),n.sendMessage(d))console.log("📤 VoiceSDK v2: Sent data_inject message:",{correlationId:s,dataLength:o.length,source:l});else{n.pendingInjections.delete(s),clearTimeout(A);var i={error:"SEND_FAILED",message:"Failed to send data injection message"};console.warn("VoiceSDK v2: Failed to send data injection message"),n.emit("dataInjectionError",i),e(new Error(i.message))}})})()}handleDataInjectAck(t){var e=t.correlationId;if(e){var n=this.pendingInjections.get(e);n?(this.pendingInjections.delete(e),n.resolve(t),this.emit("dataInjected",{correlationId:e,data:t.data,metadata:t.metadata}),console.log("✅ VoiceSDK v2: Data injection acknowledged:",e)):console.warn("VoiceSDK v2: data_inject_ack received for unknown correlationId:",e)}else console.warn("VoiceSDK v2: data_inject_ack received without correlationId")}handleDataInjectError(t){var e=t.correlationId;if(e){var n=this.pendingInjections.get(e);if(n){this.pendingInjections.delete(e);var A=new Error(t.message||"Data injection failed");A.error=t.error,A.correlationId=e,n.reject(A),this.emit("dataInjectionError",{error:t.error,message:t.message,correlationId:e}),console.warn("❌ VoiceSDK v2: Data injection error:",e,t.error)}else console.warn("VoiceSDK v2: data_inject_error received for unknown correlationId:",e)}else console.warn("VoiceSDK v2: data_inject_error received without correlationId")}handleTranscript(t){if(t.sentenceId&&t.text){var e=t.sentenceId,n={text:t.text,role:t.role||"assistant",sentenceId:e,final:!1!==t.final,timestamp:t.timestamp||Date.now()};this.transcriptQueue.push(n),console.log("📝 VoiceSDK v2: Received transcript for sentence",e,":",n.text),console.log(" Transcript queue length:",this.transcriptQueue.length),console.log(" Current playing sentence:",this.currentPlayingSentenceId),console.log("📝 VoiceSDK v2: Displaying transcript for completed sentence",e),this.emit("transcriptDisplay",n),this.currentPlayingSentenceId=e,this.emit("transcript",n)}else console.warn("⚠️ VoiceSDK v2: Invalid transcript message:",t)}handleBinaryMessage(t){var e=this;return Tt(function*(){var n,A=n=t instanceof Blob?yield t.arrayBuffer():t;if(e.formatConverter&&e.formatConverter.needsConversion())try{A=yield e.formatConverter.convert(n),console.log("✅ VoiceSDK v2: Audio converted to requested format")}catch(t){console.error("❌ VoiceSDK v2: Format conversion failed:",t),console.warn(" Using backend format without conversion"),A=n}var o=e.formatConverter&&e.formatConverter.needsConversion()?e.requestedOutputFormat:e.outputAudioFormat||{container:e.config.outputContainer||"raw",encoding:e.config.outputEncoding||"pcm",sampleRate:e.config.outputSampleRate||16e3,bitDepth:e.config.outputBitDepth||16,channels:e.config.outputChannels||1},i=o.container||"raw",r=(o.encoding||"pcm").toLowerCase();if("raw"===i){var a=A;if("pcm"!==r){var s=e.audioPlayer.getCodec(r);if(s){var c=s.decode(new Uint8Array(A));a=c.buffer,console.log("🔄 VoiceSDK v2: Decoded ".concat(r.toUpperCase()," to PCM (").concat(c.byteLength," bytes)"))}else console.warn("⚠️ VoiceSDK v2: No codec for ".concat(r,", treating as PCM"))}e.audioPlayer.outputFormat||(console.warn("⚠️ VoiceSDK v2: outputFormat not set on AudioPlayer, setting from playbackFormat"),e.audioPlayer.setOutputFormat(o)),e.audioFrameCount++,e.audioPlayer.playChunk(a)}else e.audioFrameCount++,e.audioPlayer.playAudio(A)})()}sendMessage(t){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return console.warn("VoiceSDK v2: Cannot send message - not connected"),!1;try{var e=(new Date).toISOString(),n=this.websocket?this.websocket.readyState:"NO_WEBSOCKET",A=this.websocket?{0:"CONNECTING",1:"OPEN",2:"CLOSING",3:"CLOSED"}[n]:"NO_WEBSOCKET";if("client_tool_result"!==t.t&&"client_tool_error"!==t.t||(console.log("📤 VoiceSDK v2: [".concat(e,"] Sending tool ").concat(t.t)),console.log(" 🔌 WebSocket state: ".concat(A," (").concat(n,")")),console.log(" 📋 toolCallId: ".concat(t.toolCallId)),console.log(" 📋 conversationId: ".concat(t.conversationId||"null")),console.log(" 📋 toolName: ".concat(t.toolName)),"client_tool_result"===t.t?console.log(" 📋 result:",t.result):console.log(" 📋 error: ".concat(t.error,", errorCode: ").concat(t.errorCode)),console.log(" 📋 Full message:",JSON.stringify(t,null,2))),!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return console.error("❌ VoiceSDK v2: Cannot send message - WebSocket not open (state: ".concat(A,")")),!1;var o=JSON.stringify(t);return this.websocket.send(o),"client_tool_result"!==t.t&&"client_tool_error"!==t.t||console.log("✅ VoiceSDK v2: [".concat(e,"] Tool ").concat(t.t," message sent successfully (").concat(o.length," bytes)")),!0}catch(t){return console.error("VoiceSDK v2: Error sending message:",t),this.emit("error",t),!1}}sendBinary(t){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return console.warn("VoiceSDK v2: Cannot send audio - not connected"),!1;try{return this.websocket.send(t),!0}catch(t){return console.error("VoiceSDK v2: Error sending audio:",t),this.emit("error",t),!1}}hangup(){if(this.websocket&&this.websocket.readyState===WebSocket.OPEN){console.log("📞 VoiceSDK v2: Hanging up call..."),this._gracefulHangupInitiated=!0,this.clearStoredConversationId(),this.stopRecording(),this._releaseWakeLock(),this.audioPlayer&&this.stopAudioPlayback();try{this.sendMessage({t:"hangup"}),setTimeout(()=>{this.websocket&&this.websocket.readyState===WebSocket.OPEN&&(this.websocket.close(1e3,"User hangup"),this.websocket=null),this.isConnected=!1},100)}catch(t){console.error("VoiceSDK v2: Error sending hangup message:",t),this.websocket&&(this.websocket.close(1e3,"User hangup"),this.websocket=null),this.isConnected=!1}}}startRecording(){var t=arguments,e=this;return Tt(function*(){var n=t.length>0&&void 0!==t[0]?t[0]:null;if(!e.isConnected){var A=new Error("Not connected to voice server");throw e.emit("error",A),A}if(e.isRecording)return console.warn("VoiceSDK v2: Already recording"),!0;if(e.disclaimersPending){var o=new Error("Server disclaimers must be accepted before recording. Call sendDisclaimerAck(true) first.");throw o.code="DISCLAIMER_PENDING",e.emit("error",o),o}console.log("🎤 VoiceSDK v2: Starting recording...");try{if(console.log("🎤 VoiceSDK v2: Requesting microphone permission (mobile-friendly)..."),yield e.audioRecorder.start(n?{existingMediaStream:n}:{}),!e.isConnected||!e.websocket||e.websocket.readyState!==WebSocket.OPEN){try{yield e.audioRecorder.stop()}catch(t){}var i=new Error("Connection lost - server may have rejected the call");throw i.name="ServerRejected",i.isServerRejection=!0,i}return yield e.audioPlayer.resumeAudioContext(),e.sendMessage({t:"start_continuous_mode",ttpId:e.generateTtpId()}),e._requestWakeLock(),!0}catch(A){if(e.audioRecorder&&e.audioRecorder.isRecording)try{yield e.audioRecorder.stop()}catch(t){}if(A.isServerRejection||"ServerRejected"===A.name)return!1;if(console.error("❌ VoiceSDK v2: Failed to start recording:",A),"NotAllowedError"===A.name||"PermissionDeniedError"===A.name){var r=new Error("Microphone permission denied. Please allow microphone access in your browser settings and try again.");r.name=A.name,r.originalError=A,e.emit("error",r)}else e.emit("error",A);return!1}})()}stopRecording(){var t=this;return Tt(function*(){if(!t.isRecording)return console.warn("VoiceSDK v2: Not recording"),!0;console.log("🛑 VoiceSDK v2: Stopping recording...");try{return t.sendMessage({t:"stop_continuous_mode",ttpId:t.generateTtpId()}),t.isRecording=!1,t.emit("recordingStopped"),console.log("🛑 VoiceSDK v2: Recording stopped (emitted before audioRecorder.stop())"),t._releaseWakeLock(),yield t.audioRecorder.stop(),t.stopAudioPlayback(),!0}catch(e){return console.error("VoiceSDK v2: Error stopping recording:",e),t.emit("error",e),!1}})()}toggleRecording(){var t=this;return Tt(function*(){return t.isRecording?yield t.stopRecording():yield t.startRecording()})()}clearTranscriptState(){this.currentPlayingSentenceId=null,console.log("📝 VoiceSDK v2: Cleared transcript state")}_requestWakeLock(){var t=this;return Tt(function*(){if("wakeLock"in navigator)if(null!==t.wakeLock||t._wakeLockRequesting)console.log("📱 VoiceSDK v2: Wake lock already active or being requested");else try{t._wakeLockRequesting=!0,t.wakeLock=yield navigator.wakeLock.request("screen"),console.log("📱 VoiceSDK v2: Screen wake lock activated - screen will stay on during call"),t.wakeLock.addEventListener("release",()=>{console.log("📱 VoiceSDK v2: Wake lock released by system"),t.wakeLock=null})}catch(e){console.warn("📱 VoiceSDK v2: Failed to request wake lock:",e.message),t.wakeLock=null}finally{t._wakeLockRequesting=!1}else console.log("📱 VoiceSDK v2: Wake Lock API not available in this browser")})()}_releaseWakeLock(){var t=this;return Tt(function*(){if(null!==t.wakeLock)try{yield t.wakeLock.release(),t.wakeLock=null,console.log("📱 VoiceSDK v2: Screen wake lock released")}catch(e){console.warn("📱 VoiceSDK v2: Error releasing wake lock:",e.message),t.wakeLock=null}})()}stopAudioPlayback(){this.audioPlayer.stopImmediate(),this.clearTranscriptState()}handleBargeIn(){var t=this;return Tt(function*(){t.stopAudioPlayback(),t.isRecording||(yield t.startRecording())})()}getStatus(){return{version:this.version,isConnected:this.isConnected,isRecording:this.isRecording,isPlaying:this.isPlaying,outputFormat:this.outputAudioFormat,conversationId:this.conversationId,audioPlayer:this.audioPlayer.getStatus(),audioRecorder:this.audioRecorder.getStatus()}}updateConfig(t){this.config=_t(_t({},this.config),t)}generateTtpId(){return"sdk_"+Math.random().toString(36).substr(2,9)+"_"+Date.now()}generateCorrelationId(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();this.injectionCounter++;var t=Date.now(),e=Math.random().toString(36).substr(2,9);return"inj_".concat(t,"_").concat(this.injectionCounter,"_").concat(e)}registerToolHandler(t,e){return this.clientToolsRegistry.registerHandler(t,e)}unregisterToolHandler(t){return this.clientToolsRegistry.unregisterHandler(t)}hasToolHandler(t){return this.clientToolsRegistry.hasHandler(t)}getRegisteredTools(){return this.clientToolsRegistry.getRegisteredTools()}destroy(){if(!this.isDestroyed){if(console.log("🗑️ VoiceSDK v2: Destroying..."),this.isDestroyed=!0,this.isRecording&&this.stopRecording(),this._releaseWakeLock(),this._wakeLockRequesting=!1,this.audioPlayer&&this.stopAudioPlayback(),this.websocket&&(this.websocket.close(),this.websocket=null),this.isConnected=!1,this.helloAckReceived&&!this._gracefulHangupInitiated&&this.clearStoredConversationId(),this.pendingInjections.size>0){console.warn("VoiceSDK v2: Rejecting ".concat(this.pendingInjections.size," pending data injections due to destroy"));var t=new Error("SDK destroyed - data injection cancelled");t.error="SDK_DESTROYED",this.pendingInjections.forEach((e,n)=>{clearTimeout(e.timeout),e.reject(t)}),this.pendingInjections.clear()}this.audioPlayer&&this.audioPlayer.destroy(),this.audioRecorder&&this.audioRecorder.destroy(),v.closeSharedContext(),k.closeSharedContext(),this.clientToolsRegistry&&this.clientToolsRegistry.getRegisteredTools().forEach(t=>this.clientToolsRegistry.unregisterHandler(t)),this.removeAllListeners()}}}Dt(Mt,"RESUME_STORAGE_KEY","voice_resume_state"),Dt(Mt,"RESUME_TTL_MS",1e4),Dt(Mt,"SUPPORTED_INPUT_ENCODINGS",["pcm","pcmu","pcma"]),Dt(Mt,"SUPPORTED_INPUT_SAMPLE_RATES",[8e3,16e3,22050,24e3,44100,48e3]),Dt(Mt,"SUPPORTED_INPUT_BIT_DEPTHS",[8,16,24]),Dt(Mt,"SUPPORTED_INPUT_CHANNELS",[1]),Dt(Mt,"SUPPORTED_OUTPUT_ENCODINGS",["pcm","pcmu","pcma"]),Dt(Mt,"SUPPORTED_OUTPUT_SAMPLE_RATES",[8e3,16e3,22050,24e3,44100,48e3]),Dt(Mt,"SUPPORTED_OUTPUT_BIT_DEPTHS",[8,16,24]),Dt(Mt,"SUPPORTED_OUTPUT_CHANNELS",[1]),Dt(Mt,"SUPPORTED_OUTPUT_CONTAINERS",["raw","wav"]);const Pt=Mt;function Lt(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function Rt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function Kt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Rt(Object(n),!0).forEach(function(e){Ot(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ot(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Vt extends f{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var e=this.readScriptTagConfig();this.config=Kt({baseWsUrl:"wss://backend.talktopc.com/chat/websocket",appId:t.appId||e.appId,agentId:t.agentId||e.agentId,conversationId:void 0!==t.conversationId?t.conversationId:this.getPersistedConversationId(),forceConversationId:t.forceConversationId,queue:[],inFlight:!1},t),this.fullResponseBuffer=""}readScriptTagConfig(){try{var t=Array.from(document.getElementsByTagName("script")).reverse().find(t=>t.dataset&&(t.dataset.appId||t.dataset.agentId)||t.src&&t.src.includes("agent-widget"));return t?{appId:t.dataset.appId,agentId:t.dataset.agentId}:{}}catch(t){return{}}}buildWebSocketUrl(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.baseWsUrl,e=new URLSearchParams;return this.config.appId&&e.append("appId",this.config.appId),this.config.agentId&&e.append("agentId",this.config.agentId),this.config.conversationId&&e.append("conversationId",this.config.conversationId),"".concat(t,"?").concat(e.toString())}sendMessage(t){var e,n=this;return(e=function*(){return new Promise((e,A)=>{if(t&&t.trim())if(n.config.appId&&n.config.agentId){var o={text:t,resolve:e,reject:A};n.config.inFlight?n.config.queue.push(o):n.executeTask(o)}else A(new Error("Missing appId or agentId"));else A(new Error("Message is empty"))})},function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(t){Lt(i,A,o,r,a,"next",t)}function a(t){Lt(i,A,o,r,a,"throw",t)}r(void 0)})})()}executeTask(t){if(this.config.inFlight=!0,this.fullResponseBuffer="",!this.config.conversationId){var e=this.getPersistedConversationId();e&&(this.config.conversationId=e,console.log("🔍 TextChatSDK hydrated conversationId from storage:",e))}var n=this.buildWebSocketUrl(this.config.baseWsUrl);"undefined"!=typeof __DEV__&&__DEV__&&console.log("[TTPAgentSDK] WebSocket URL:",n);var A=this.config.baseWsUrl.endsWith("/websocket")?this.config.baseWsUrl.replace(/\/websocket$/,""):"".concat(this.config.baseWsUrl,"/websocket"),o=this.buildWebSocketUrl(A),i=!1,r=!1,a=null,s=e=>{if(!r)try{var n={message:t.text},A=this.config.forceConversationId||this.config.conversationId;A&&(n.conversationId=A,this.config.forceConversationId&&!this.config.conversationId&&(this.config.conversationId=A,this.persistConversationId(A))),console.log("🔍 TextChatSDK sending payload:",n,"conversationId in config:",this.config.conversationId),e.send(JSON.stringify(n)),r=!0}catch(n){t.reject(n),this.emit("error",n);try{e.close()}catch(t){}}},c=t=>()=>{this.config.conversationId?s(t):a=setTimeout(()=>s(t),200)},l=e=>n=>{try{try{console.log("🔎 [TextChatSDK] WS <= raw:",n.data)}catch(t){}var A=JSON.parse(n.data);try{console.log("🔎 [TextChatSDK] WS <= parsed:",A)}catch(t){}if("hello"===A.type&&A.conversationId){if(console.log("🔍 TextChatSDK received conversationId:",A.conversationId),this.config.conversationId=A.conversationId,this.persistConversationId(A.conversationId),this.emit&&this.emit("conversationIdChanged",A.conversationId),!r&&e&&1===e.readyState){if(a)try{clearTimeout(a)}catch(t){}s(e)}return}if(!this.config.conversationId&&A.conversationId&&(console.log("🔍 TextChatSDK captured conversationId from message:",A.conversationId),this.config.conversationId=A.conversationId,this.persistConversationId(A.conversationId)),"chunk"===A.type&&"string"==typeof A.content)this.fullResponseBuffer+=A.content,this.emit("chunk",A.content);else if("done"===A.type){try{var o=A.text||A.content||A.answer||A.message||"";o&&!this.fullResponseBuffer&&(this.fullResponseBuffer=o)}catch(t){}!this.config.conversationId&&A.conversationId&&(console.log("🔍 TextChatSDK captured conversationId from done:",A.conversationId),this.config.conversationId=A.conversationId),this.persistConversationId(this.config.conversationId),this.emit("done",{text:this.fullResponseBuffer}),t.resolve({conversationId:this.config.conversationId,fullText:this.fullResponseBuffer});try{e.close()}catch(t){}}else if("error"===A.type){var i=new Error(A.message||"Server error");this.emit("error",i),t.reject(i);try{e.close()}catch(t){}}}catch(t){}},d=e=>{if(1008===e.code&&e.reason&&(e.reason.includes("Domain not whitelisted")||e.reason.includes("domain")||e.reason.includes("whitelist"))){var n=new Error("DOMAIN_NOT_WHITELISTED");return n.reason=e.reason,n.code=e.code,this.emit("domainError",n),t.reject(n),this.config.inFlight=!1,void this.drainQueue()}this.config.inFlight=!1,this.drainQueue()},p=new WebSocket(n);p.onopen=c(p),p.onmessage=l(p),p.onerror=(e=>n=>{if(!i){i=!0;try{e.close()}catch(t){}var A=new WebSocket(o);return A.onopen=c(A),A.onmessage=l(A),A.onerror=e=>{this.emit("error",e),t.reject(e)},void(A.onclose=d)}this.emit("error",n),t.reject(n)})(p),p.onclose=d}drainQueue(){if(0!==this.config.queue.length&&!this.config.inFlight){var t=this.config.queue.shift();this.executeTask(t)}}persistConversationId(t){try{t&&localStorage.setItem("ttp_text_chat_conversation_id",t)}catch(t){}}getPersistedConversationId(){try{return localStorage.getItem("ttp_text_chat_conversation_id")||null}catch(t){return null}}updateConfig(t){this.config=Kt(Kt({},this.config),t)}destroy(){this.config.queue=[],this.config.inFlight=!1,this.removeAllListeners()}}function Nt(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}var jt=new class extends f{constructor(){super(),this.connections=new Map,this.connectionCounts=new Map,this.creatingConnections=new Set}getConnection(t){var e,n=this;return(e=function*(){if(n.connections.has(t)){var e=n.connections.get(t);return n.connectionCounts.set(t,(n.connectionCounts.get(t)||0)+1),e}if(n.creatingConnections&&n.creatingConnections.has(t))return new Promise(e=>{var A=()=>{if(n.connections.has(t)){var o=n.connections.get(t);n.connectionCounts.set(t,(n.connectionCounts.get(t)||0)+1),e(o)}else setTimeout(A,50)};A()});n.creatingConnections.add(t);var A=new WebSocket(t);return n.connections.set(t,A),n.connectionCounts.set(t,1),A.addEventListener("open",e=>{n.creatingConnections.delete(t),n.emit("open",e,t)}),A.addEventListener("close",e=>{n.creatingConnections.delete(t),n.connections.delete(t),n.connectionCounts.delete(t),n.emit("close",e,t)}),A.addEventListener("error",e=>{n.creatingConnections.delete(t),n.emit("error",e,t)}),A.addEventListener("message",e=>{n.emit("message",e,t)}),A},function(){var t=this,n=arguments;return new Promise(function(A,o){var i=e.apply(t,n);function r(t){Nt(i,A,o,r,a,"next",t)}function a(t){Nt(i,A,o,r,a,"throw",t)}r(void 0)})})()}releaseConnection(t){if(this.connections.has(t)){var e=this.connectionCounts.get(t)||0,n=Math.max(0,e-1);if(this.connectionCounts.set(t,n),0===n){var A=this.connections.get(t);A&&A.readyState===WebSocket.OPEN&&A.close(1e3,"No more subscribers"),this.connections.delete(t),this.connectionCounts.delete(t)}}}forceClose(t){if(this.connections.has(t)){var e=this.connections.get(t);e&&e.readyState===WebSocket.OPEN&&e.close(1e3,"Force close"),this.connections.delete(t),this.connectionCounts.delete(t)}}getConnectionStatus(t){return this.connections.has(t)?{exists:!0,readyState:this.connections.get(t).readyState,subscribers:this.connectionCounts.get(t)||0}:{exists:!1,readyState:null,subscribers:0}}getAllConnections(){var t={};for(var[e,n]of this.connections.entries())t[e]={readyState:n.readyState,subscribers:this.connectionCounts.get(e)||0};return t}clearAll(){for(var[t,e]of this.connections.entries())e&&e.readyState===WebSocket.OPEN&&e.close(1e3,"Clear all");this.connections.clear(),this.connectionCounts.clear(),this.creatingConnections.clear()}};const Gt=jt;function zt(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}class Wt extends f{constructor(t){super(),this.config=t,this.ws=null,this.isConnected=!1,this.connectionId=null}connect(){var t,e=this;return(t=function*(){return new Promise((t,n)=>{try{e.connectionId=Date.now()+"_"+Math.random().toString(36).substr(2,9),e.connectResolve=t,e.connectReject=n;var A=e.config.websocketUrl;Gt.getConnection(A,e.config).then(n=>{e.ws=n,e.setupEventListeners(),n.readyState===WebSocket.OPEN&&(e.isConnected=!0,e.emit("connected"),t(),e.connectResolve=null,e.connectReject=null)}).catch(t=>{console.error("🔌 WebSocketManager: Connection failed ".concat(e.connectionId),t),n(t),e.connectResolve=null,e.connectReject=null})}catch(t){console.error("🔌 WebSocketManager: Connection error ".concat(e.connectionId),t),n(t),e.connectResolve=null,e.connectReject=null}})},function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){zt(i,A,o,r,a,"next",t)}function a(t){zt(i,A,o,r,a,"throw",t)}r(void 0)})})()}setupEventListeners(){if(this.ws){var t=(t,e)=>{e===this.config.websocketUrl&&(this.isConnected=!0,this.emit("connected"),this.connectResolve&&(this.connectResolve(),this.connectResolve=null,this.connectReject=null))},e=(t,e)=>{e===this.config.websocketUrl&&(this.isConnected=!1,this.emit("disconnected",t))},n=(t,e)=>{e===this.config.websocketUrl&&(this.emit("error",t),this.connectReject&&(this.connectReject(t),this.connectResolve=null,this.connectReject=null))},A=(t,e)=>{e===this.config.websocketUrl&&this.handleMessage(t)};Gt.on("open",t),Gt.on("close",e),Gt.on("error",n),Gt.on("message",A),this.eventHandlers={open:t,close:e,error:n,message:A}}}disconnect(){this.eventHandlers&&(Gt.off("open",this.eventHandlers.open),Gt.off("close",this.eventHandlers.close),Gt.off("error",this.eventHandlers.error),Gt.off("message",this.eventHandlers.message));var t=this.config.websocketUrl;t&&Gt.releaseConnection(t),this.ws=null,this.isConnected=!1}sendMessage(t){if(this.isConnected&&this.ws)try{this.ws.send(JSON.stringify(t))}catch(t){console.warn("🔌 WebSocketManager: Failed to send message:",t.message)}}sendBinary(t){if(this.isConnected&&this.ws)try{this.ws.send(t)}catch(t){console.warn("🔌 WebSocketManager: Failed to send binary data:",t.message)}}handleMessage(t){if(t.data instanceof ArrayBuffer)this.emit("binaryAudio",t.data);else if(t.data instanceof Blob)t.data.arrayBuffer().then(t=>{this.emit("binaryAudio",t)}).catch(t=>{console.error("🔌 WebSocketManager: Error converting Blob to ArrayBuffer:",t)});else try{var e=JSON.parse(t.data);"barge_in_ack"!==e.t&&"stop_sending"!==e.t||this.emit("bargeIn",e),"stop_playing"===e.t&&this.emit("stopPlaying",e),this.emit("message",e)}catch(t){this.emit("error",t)}}getStatus(){return{isConnected:this.isConnected,readyState:this.ws?this.ws.readyState:null,connectionId:this.connectionId}}static getSingletonStatus(){return Gt.getAllConnections()}static clearAllConnections(){Gt.clearAll()}}function qt(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function Xt(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){qt(i,A,o,r,a,"next",t)}function a(t){qt(i,A,o,r,a,"throw",t)}r(void 0)})}}class Yt extends f{constructor(t){super(),this.config=t,this.audioContext=null,this.audioQueue=[],this.isPlaying=!1,this.isProcessingQueue=!1,this.currentSource=null,this.audioContextReady=!1,this.initializeAudioContext().catch(()=>{})}initializeAudioContext(){var t=this;return Xt(function*(){if(!t.audioContext||"closed"===t.audioContext.state)try{var e={sampleRate:t.config.sampleRate||t.config.outputSampleRate||44100};if(t.audioContext=new(window.AudioContext||window.webkitAudioContext)(e),"suspended"===t.audioContext.state&&(yield t.audioContext.resume()),"running"===t.audioContext.state)try{var n=t.audioContext.sampleRate,A=t.audioContext.createBuffer(1,.01*n,n),o=t.audioContext.createBufferSource();o.buffer=A,o.connect(t.audioContext.destination),o.start(0),o.stop(t.audioContext.currentTime+.01)}catch(t){console.debug("AudioPlayer: AudioContext warmup skipped:",t)}t.audioContextReady=!0}catch(e){console.warn("AudioPlayer: Failed to pre-initialize AudioContext:",e),t.audioContextReady=!1}})()}playAudio(t){try{var e=this.createAudioBlob(t);if(this.audioQueue.push(e),!this.isPlaying&&!this.isProcessingQueue&&!this.currentSource){var n=this.audioContextReady?0:50;setTimeout(()=>this.processQueue(),n)}}catch(t){this.emit("playbackError",t)}}createAudioBlob(t){var e=new Uint8Array(t);if(e.length>=4){if(82===e[0]&&73===e[1]&&70===e[2]&&70===e[3])return new Blob([t],{type:"audio/wav"});if(255===e[0]&&!(224&~e[1]))return new Blob([t],{type:"audio/mpeg"});if(79===e[0]&&103===e[1]&&103===e[2]&&83===e[3])return new Blob([t],{type:"audio/ogg"})}return new Blob([t],{type:"audio/wav"})}processQueue(){var t=this;return Xt(function*(){if(!t.isProcessingQueue&&0!==t.audioQueue.length){t.isProcessingQueue=!0;var e=t.audioQueue.shift();if(e)try{var n=!t.isPlaying&&null===t.currentSource;t.audioContext&&"closed"!==t.audioContext.state||(yield t.initializeAudioContext());var A=t.audioContext;"suspended"===A.state&&(yield A.resume(),n&&(yield new Promise(t=>setTimeout(t,10)))),"running"!==A.state&&(console.warn("AudioPlayer: AudioContext not in running state:",A.state),"suspended"===A.state&&(yield A.resume(),yield new Promise(t=>setTimeout(t,10))));var o=yield e.arrayBuffer(),i=yield A.decodeAudioData(o),r=n&&!t.isPlaying&&null===t.currentSource,a=A.createBufferSource();a.buffer=i,a.connect(A.destination),t.currentSource=a,t.isPlaying=!0,r&&t.emit("playbackStarted"),a.onended=()=>{t.currentSource=null,t.isProcessingQueue=!1,t.audioQueue.length>0?setTimeout(()=>t.processQueue(),0):setTimeout(()=>{0!==t.audioQueue.length||t.currentSource||(t.isPlaying=!1,t.emit("playbackStopped"))},100)},a.start()}catch(e){t.currentSource=null,t.emit("playbackError",e),t.audioQueue.length>0?(t.isProcessingQueue=!1,setTimeout(()=>t.processQueue(),100)):(t.isPlaying=!1,t.isProcessingQueue=!1,t.emit("playbackStopped"))}else t.isProcessingQueue=!1}})()}stop(){this.stopImmediate()}stopImmediate(){var t=this.isPlaying||null!==this.currentSource;if(this.currentSource){try{this.currentSource.stop()}catch(t){}this.currentSource=null}this.isPlaying=!1,this.isProcessingQueue=!1,this.audioQueue=[],t&&this.emit("playbackStopped")}resumeAudioContext(){var t=this;return Xt(function*(){if(t.audioContext&&"closed"!==t.audioContext.state){if("suspended"===t.audioContext.state)try{yield t.audioContext.resume(),console.log("✅ AudioPlayer: AudioContext resumed after mic permission")}catch(t){console.warn("⚠️ AudioPlayer: Failed to resume AudioContext:",t)}}else yield t.initializeAudioContext()})()}getStatus(){return{isPlaying:this.isPlaying,isProcessingQueue:this.isProcessingQueue,queueLength:this.audioQueue.length,audioContextState:this.audioContext?this.audioContext.state:"closed"}}destroy(){this.stop(),this.audioContext&&"closed"!==this.audioContext.state&&(this.audioContext.close(),this.audioContext=null),this.audioContextReady=!1}}function Jt(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function Zt(){var t=navigator.userAgent,e=/iPad|iPhone|iPod/.test(t)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,n=/Android/.test(t),A=/Mac/.test(t)&&!e,o=/Win/.test(t),i=/Chrome/.test(t)&&!/Edg|OPR/.test(t),r=/Safari/.test(t)&&!/Chrome/.test(t),a=/Firefox/.test(t),s=/Edg/.test(t),c=/SamsungBrowser/.test(t),l="unknown";e?l="safari":c?l="samsung":i?l="chrome":r?l="safari":a?l="firefox":s&&(l="edge");var d="unknown";return e?d="ios":n?d="android":A?d="mac":o&&(d="windows"),{platform:d,browser:l,isIOS:e,isAndroid:n,isMac:A,isWindows:o,isMobile:e||n,isDesktop:!e&&!n}}function $t(){var{isIOS:t,isAndroid:e}=Zt();if(t||e)return!0;if("undefined"==typeof window)return!1;if(window.innerWidth>768)return!1;var n=navigator.maxTouchPoints>0,A=!1;try{A=window.matchMedia("(pointer: coarse)").matches}catch(t){}return n||A}function te(){return ee.apply(this,arguments)}function ee(){var t;return t=function*(){try{if(navigator.permissions&&navigator.permissions.query)return(yield navigator.permissions.query({name:"microphone"})).state}catch(t){console.log("⚠️ MicPermissionUtils: Permissions API not available or not supported for microphone")}return"unknown"},ee=function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){Jt(i,A,o,r,a,"next",t)}function a(t){Jt(i,A,o,r,a,"throw",t)}r(void 0)})},ee.apply(this,arguments)}function ne(t){var{platform:e,browser:n}=t,A={ios:{title:"Enable Microphone on iPhone/iPad",icon:"📱",steps:["Tap the <strong>lock icon 🔒</strong>, <strong>information icon ℹ️</strong>, or <strong>AA icon</strong> in the address bar","Tap <strong>Website Settings</strong> or <strong>Permissions</strong>","Find <strong>Microphone</strong> and set it to <strong>Allow</strong>","Return to this page and refresh"],altTitle:"Alternative Method",altSteps:["Open the <strong>Settings</strong> app on your device","Scroll down and tap <strong>Safari</strong> (or your browser app)",'Tap <strong>Microphone</strong> under "Settings for Websites"',"Set it to <strong>Allow</strong> or <strong>Ask</strong>","Return to this page and refresh"],note:"On iOS, you can also change permissions in the browser address bar or in device Settings.",canOpenSettings:!0,settingsButtonText:"Open Settings App"},android_chrome:{title:"Enable Microphone in Chrome",icon:"🤖",steps:["Tap the <strong>lock icon 🔒</strong>, <strong>information icon ℹ️</strong>, or <strong>settings icon ⋮</strong> in the address bar","Tap <strong>Permissions</strong>","Tap <strong>Microphone</strong>","Select <strong>Allow</strong>","The page will refresh automatically"],altTitle:"Alternative Method",altSteps:["Tap the <strong>⋮ menu</strong> (three dots)","Tap <strong>Settings → Site settings → Microphone</strong>","Find this website and set to <strong>Allow</strong>"],canOpenSettings:!0,settingsButtonText:"Open App Settings"},android_firefox:{title:"Enable Microphone in Firefox",icon:"🦊",steps:["Tap the <strong>lock icon 🔒</strong> or <strong>information icon ℹ️</strong> in the address bar","Tap <strong>Edit Site Permissions</strong>","Toggle <strong>Microphone</strong> to enabled","Refresh the page"],canOpenSettings:!1},android_samsung:{title:"Enable Microphone in Samsung Browser",icon:"📱",steps:["Tap the <strong>menu icon</strong> (three lines)","Tap <strong>Settings → Sites and downloads</strong>","Tap <strong>Site permissions → Microphone</strong>","Find this website and set to <strong>Allow</strong>","Return and refresh the page"],canOpenSettings:!1},desktop_chrome:{title:"Enable Microphone in Chrome",icon:"🌐",steps:["Click the <strong>lock icon 🔒</strong> or <strong>information icon ℹ️</strong> in the address bar (left side)","Find <strong>Microphone</strong> in the dropdown menu",'Change it from "Block" to <strong>Allow</strong>',"Click the <strong>Refresh</strong> button or press F5"],showAddressBarHint:!0,canOpenSettings:!1},desktop_safari:{title:"Enable Microphone in Safari",icon:"🧭",steps:["Click <strong>Safari</strong> in the menu bar (top of screen)","Click <strong>Settings for This Website...</strong>","Find <strong>Microphone</strong> in the popup","Change it to <strong>Allow</strong>","Close settings and refresh the page"],canOpenSettings:!1},desktop_firefox:{title:"Enable Microphone in Firefox",icon:"🦊",steps:["Click the <strong>lock icon 🔒</strong> in the address bar",'Click the <strong>X</strong> next to "Blocked" for Microphone',"Refresh the page (press F5)","Click <strong>Allow</strong> when prompted again"],note:"Firefox requires you to clear the block and then re-allow on the next prompt.",showAddressBarHint:!0,canOpenSettings:!1},desktop_edge:{title:"Enable Microphone in Edge",icon:"🌐",steps:["Click the <strong>lock icon 🔒</strong> in the address bar","Find <strong>Microphone</strong> in the permissions list","Change it to <strong>Allow</strong>","Refresh the page"],showAddressBarHint:!0,canOpenSettings:!1},unknown:{title:"Enable Microphone Access",icon:"🎤",steps:["Look for a <strong>lock icon 🔒</strong>, <strong>information icon ℹ️</strong>, or <strong>settings icon</strong> in your browser's address bar","Find the <strong>Microphone</strong> permission setting","Change it to <strong>Allow</strong>","Refresh this page"],canOpenSettings:!1}};return"ios"===e?A.ios:"android"===e?A["android_".concat(n)]||A.android_chrome:A["desktop_".concat(n)]||A.desktop_chrome}function Ae(t){var{isIOS:e,isAndroid:n,browser:A}=t;if(e)try{return window.location.href="app-settings:",!0}catch(t){return console.warn("Could not open iOS settings:",t),!1}if(n&&"chrome"===A)try{return window.location.href="intent:#Intent;action=android.settings.APPLICATION_DETAILS_SETTINGS;data=package:com.android.chrome;end",!0}catch(t){return console.warn("Could not open Android settings:",t),!1}return!1}function oe(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function ie(){var t;return t=function*(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{default:0,android:3e3,ios:0},{isIOS:A,isAndroid:o}=Zt(),i=null!==(t=n.default)&&void 0!==t?t:0;if(o)i=null!==(e=n.android)&&void 0!==e?e:i;else if(A){var r;i=null!==(r=n.ios)&&void 0!==r?r:i}i>0&&(console.log("📱 applyDelay: waiting ".concat(i,"ms for mobile audio session (").concat(o?"Android":"iOS",")")),yield new Promise(t=>setTimeout(t,i)))},ie=function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){oe(i,A,o,r,a,"next",t)}function a(t){oe(i,A,o,r,a,"throw",t)}r(void 0)})},ie.apply(this,arguments)}class re{constructor(){this.overlay=null,this.modal=null}createOverlay(){var t=document.createElement("div");return t.className="mic-permission-overlay",t.setAttribute("dir","ltr"),t.style.cssText="\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.6);\n backdrop-filter: blur(4px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 100001;\n padding: 20px;\n animation: mic-fadeIn 0.2s ease-out;\n ",document.getElementById("mic-permission-styles")||this.injectStyles(),t}injectStyles(){if(!document.getElementById("mic-permission-styles")){var t=document.createElement("style");t.id="mic-permission-styles",t.textContent="\n @keyframes mic-fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n @keyframes mic-slideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n \n @keyframes mic-bounce {\n 0%, 100% { transform: translateY(0); }\n 50% { transform: translateY(-5px); }\n }\n \n /* direction ltr: host page may be RTL (e.g. Hebrew); keep overlay + modal English copy readable */\n .mic-permission-overlay {\n position: fixed;\n inset: 0;\n direction: ltr;\n background: rgba(0, 0, 0, 0.6);\n backdrop-filter: blur(4px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 100001;\n padding: 20px;\n animation: mic-fadeIn 0.2s ease-out;\n }\n \n .mic-permission-modal {\n direction: ltr;\n unicode-bidi: isolate;\n background: #ffffff;\n border-radius: 16px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n max-width: 480px;\n width: 100%;\n padding: 32px;\n position: relative;\n animation: mic-slideUp 0.3s ease-out;\n max-height: 90vh;\n overflow-y: auto;\n }\n \n .mic-permission-modal__close {\n position: absolute;\n top: 16px;\n right: 16px;\n background: none;\n border: none;\n font-size: 20px;\n cursor: pointer;\n color: #6b7280;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.2s;\n }\n \n .mic-permission-modal__close:hover {\n background: #e5e7eb;\n }\n \n .mic-permission-modal__icon {\n font-size: 48px;\n text-align: center;\n margin-bottom: 16px;\n }\n \n .mic-permission-modal__title {\n font-size: 24px;\n font-weight: 700;\n color: #111827;\n margin: 0 0 12px;\n line-height: 1.3;\n text-align: center;\n }\n \n .mic-permission-modal__description {\n color: #6b7280;\n font-size: 16px;\n line-height: 1.6;\n margin: 0 0 20px;\n text-align: center;\n }\n \n .mic-permission-modal__highlight {\n display: flex;\n align-items: center;\n gap: 12px;\n background: linear-gradient(135deg, #dbeafe, #ede9fe);\n padding: 16px 20px;\n border-radius: 8px;\n margin-bottom: 20px;\n border: 1px solid #bfdbfe;\n }\n \n .mic-permission-modal__highlight-icon {\n font-size: 24px;\n animation: mic-bounce 1s infinite;\n }\n \n .mic-permission-modal__status {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: #fef2f2;\n color: #ef4444;\n padding: 12px 16px;\n border-radius: 8px;\n margin-bottom: 20px;\n font-weight: 500;\n }\n \n .mic-permission-modal__note {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n background: #fffbeb;\n color: #92400e;\n padding: 12px 16px;\n border-radius: 8px;\n margin-bottom: 20px;\n font-size: 14px;\n line-height: 1.5;\n border: 1px solid #fde68a;\n }\n \n .mic-permission-modal__steps {\n margin-bottom: 20px;\n }\n \n .mic-permission-modal__steps h3 {\n font-size: 14px;\n font-weight: 600;\n color: #6b7280;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin: 0 0 12px;\n }\n \n .mic-permission-modal__steps ol {\n margin: 0;\n padding-left: 24px;\n counter-reset: step-counter;\n list-style: none;\n }\n \n .mic-permission-modal__steps li {\n position: relative;\n padding: 12px 0 12px 16px;\n border-left: 2px solid #e5e7eb;\n color: #111827;\n font-size: 15px;\n line-height: 1.5;\n counter-increment: step-counter;\n }\n \n .mic-permission-modal__steps li::before {\n content: counter(step-counter);\n position: absolute;\n left: -14px;\n top: 10px;\n width: 24px;\n height: 24px;\n background: #4f46e5;\n color: white;\n border-radius: 50%;\n font-size: 12px;\n font-weight: 600;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .mic-permission-modal__steps li:last-child {\n border-left-color: transparent;\n }\n \n .mic-permission-modal__actions {\n display: flex;\n flex-direction: column;\n gap: 10px;\n margin-top: 24px;\n }\n \n .mic-permission-modal__btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 14px 24px;\n border-radius: 8px;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n border: none;\n width: 100%;\n }\n \n .mic-permission-modal__btn--primary {\n background: #4f46e5;\n color: white;\n }\n \n .mic-permission-modal__btn--primary:hover {\n background: #4338ca;\n transform: translateY(-1px);\n }\n \n .mic-permission-modal__btn--secondary {\n background: #e5e7eb;\n color: #111827;\n }\n \n .mic-permission-modal__btn--secondary:hover {\n background: #d1d5db;\n }\n \n .mic-permission-modal__footer {\n text-align: center;\n font-size: 13px;\n color: #6b7280;\n margin-top: 20px;\n margin-bottom: 0;\n }\n \n .mic-permission-modal__visual-guide {\n width: 100%;\n max-width: 380px;\n height: auto;\n margin: 20px auto;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n display: block;\n }\n \n .mic-permission-modal__visual-guide-container {\n text-align: center;\n margin: 20px 0;\n }\n \n @media (max-width: 480px) {\n .mic-permission-modal {\n padding: 24px 20px;\n margin: 10px;\n max-height: 85vh;\n }\n \n .mic-permission-modal__title {\n font-size: 20px;\n }\n \n .mic-permission-modal__icon {\n font-size: 40px;\n }\n \n .mic-permission-modal__visual-guide {\n max-width: 100%;\n }\n }\n \n /* Mobile pre-prompt: compact, action-first layout - buttons always visible above safe area */\n .mic-permission-modal--mobile {\n max-height: none;\n padding: 20px 20px 24px;\n padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));\n margin: 12px;\n align-self: flex-end;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__icon {\n font-size: 36px;\n margin-bottom: 12px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__title {\n font-size: 18px;\n margin-bottom: 8px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__description {\n font-size: 14px;\n margin-bottom: 12px;\n line-height: 1.5;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__highlight {\n padding: 12px 16px;\n margin-bottom: 12px;\n font-size: 14px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__note {\n padding: 10px 14px;\n margin-bottom: 16px;\n font-size: 13px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__actions {\n margin-top: 16px;\n gap: 10px;\n }\n \n .mic-permission-modal--mobile .mic-permission-modal__btn {\n padding: 16px 24px;\n font-size: 16px;\n min-height: 48px;\n }\n ",document.head.appendChild(t)}}close(){this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay),this.overlay=null,this.modal=null}show(){this.overlay&&this.modal&&document.body.appendChild(this.overlay)}}function ae(){var t=Zt();return t.isIOS||t.isAndroid}function se(t,e){var n=new re,A=n.createOverlay(),o=Zt(),i=ae();A.style.background="rgba(0, 0, 0, 0.3)",A.style.backdropFilter="none",A.style.webkitBackdropFilter="none";var r=document.createElement("div");r.className="mic-permission-modal"+(i?" mic-permission-modal--mobile":"");var a=i?"Allow Microphone":"Enable Your Microphone",s=i?"Tap Continue, then tap Allow when your browser asks.":"To start a voice call with our agent, we need access to your microphone.",c=i?'Tap <strong>"Allow"</strong> on the popup':'Please click <strong>"Allow"</strong> on the next popup';return r.innerHTML='\n <div class="mic-permission-modal__icon">🎤</div>\n <h2 class="mic-permission-modal__title">'.concat(a,'</h2>\n <p class="mic-permission-modal__description">').concat(s,'</p>\n <div class="mic-permission-modal__highlight">\n <span class="mic-permission-modal__highlight-icon">👆</span>\n <span>').concat(c,"</span>\n </div>\n ").concat(o.isIOS?'\n <div class="mic-permission-modal__note">\n <span>ℹ️</span>\n <span>'.concat(i?"If blocked, enable in Settings → Safari/App → Microphone":"On iPhone/iPad, you may need to allow microphone access in your device Settings.","</span>\n </div>\n "):"",'\n <div class="mic-permission-modal__actions">\n <button class="mic-permission-modal__btn mic-permission-modal__btn--primary" data-action="accept">\n Continue\n </button>\n <button class="mic-permission-modal__btn mic-permission-modal__btn--secondary" data-action="cancel">\n Not Now\n </button>\n </div>\n '),i&&(A.style.alignItems="flex-end",A.style.paddingBottom="max(20px, env(safe-area-inset-bottom, 20px))",A.style.paddingTop="20px"),A.appendChild(r),n.overlay=A,n.modal=r,r.querySelector('[data-action="accept"]').addEventListener("click",()=>{n.close(),t()}),r.querySelector('[data-action="cancel"]').addEventListener("click",()=>{n.close(),e()}),A.addEventListener("click",t=>{t.target===A&&(n.close(),e())}),n.show(),n}function ce(t,e){var n,A,o,i=new re,r=i.createOverlay(),a=Zt(),s=ne(a),c=document.createElement("div");c.className="mic-permission-modal";var l="";s.altSteps&&s.altSteps.length>0&&(l='\n <div style="margin-top: 20px; border-top: 1px solid #e5e7eb; padding-top: 16px;">\n <button class="mic-permission-modal__alt-toggle" style="background: none; border: none; color: #4f46e5; font-size: 14px; font-weight: 500; cursor: pointer; padding: 0; margin-bottom: 12px;">\n ▼ '.concat(s.altTitle||"Alternative method",'\n </button>\n <ol style="margin: 0; padding-left: 20px; display: none;">\n ').concat(s.altSteps.map(t=>'<li style="padding: 8px 0; font-size: 14px; color: #6b7280;">'.concat(t,"</li>")).join(""),"\n </ol>\n </div>\n "));var d=function(t){var{platform:e,browser:n}=t,A=document.getElementsByTagName("script"),o="";for(var i of A){var r=i.src;if(r&&(r.includes("agent-widget.js")||r.includes("ttp-agent-sdk")||r.includes("ttp-sdk-front")))try{new URL(r),o=r.substring(0,r.lastIndexOf("/"));break}catch(t){var a=r.match(/^(.*\/)[^\/]+$/);if(a){o=a[1];break}}}var s;if(s="ios"===e?"ios-settings.svg":"android"===e?"android-chrome.svg":"chrome"===n?"desktop-chrome.svg":"safari"===n?"desktop-safari.svg":"firefox"===n?"desktop-firefox.svg":"edge"===n?"desktop-edge.svg":"desktop-chrome.svg",!o||""===o||o.startsWith("/")){for(var c of A){var l=c.src;if(l&&(l.includes("cdn.talktopc.com")||l.includes("talktopc.com"))){if(l.includes("/ttp-agent-sdk/")||l.includes("/ttp-sdk-front/")){var d=l.match(/(https?:\/\/[^\/]+(?:\/[^\/]+)*)/);if(d){o=d[1].replace(/\/[^\/]+\.js$/,"");break}}if(!o&&(l.includes("cdn.talktopc.com")||l.includes("talktopc.com"))){o="https://cdn.talktopc.com/ttp-agent-sdk";break}}}if(!o||""===o)if(window.location.hostname.includes("cdn.talktopc.com")||window.location.hostname.includes("talktopc.com"))o="https://cdn.talktopc.com/ttp-agent-sdk";else{var p=window.location.pathname.split("/");p.pop(),(o=window.location.origin+p.join("/"))&&o!==window.location.origin||(o=window.location.origin)}}o=o.replace(/\/$/,"");var u="".concat(o,"/shared/mic-permission-assets/").concat(s);return"undefined"!=typeof console&&console.log&&console.log("[MicPermission] Visual guide path:",u,"Base path:",o,"Platform:",e,"Browser:",n),u}(a);c.innerHTML='\n <button class="mic-permission-modal__close" data-action="close">✕</button>\n <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 20px;">\n <span style="font-size: 32px;">'.concat(s.icon,'</span>\n <h2 class="mic-permission-modal__title" style="text-align: left; margin: 0;">').concat(s.title,'</h2>\n </div>\n <div class="mic-permission-modal__status">\n <span>🚫</span>\n <span>Microphone access is currently blocked</span>\n </div>\n ').concat(s.note?'\n <div class="mic-permission-modal__note">\n <span>ℹ️</span>\n <span>'.concat(s.note,"</span>\n </div>\n "):"",'\n <div class="mic-permission-modal__visual-guide-container">\n <img src="').concat(d,'" alt="Visual guide for enabling microphone" class="mic-permission-modal__visual-guide" \n onerror="console.error(\'[MicPermission] Failed to load image:\', this.src); this.style.display=\'none\';" \n onload="console.log(\'[MicPermission] Image loaded successfully:\', this.src);" />\n </div>\n <div class="mic-permission-modal__steps">\n <h3>Follow these steps:</h3>\n <ol>\n ').concat(s.steps.map(t=>"<li>".concat(t,"</li>")).join(""),"\n </ol>\n </div>\n ").concat(l,'\n <div class="mic-permission-modal__actions">\n ').concat(s.canOpenSettings?'\n <button class="mic-permission-modal__btn mic-permission-modal__btn--primary" data-action="open-settings">\n '.concat(s.settingsButtonText||"Open Settings","\n </button>\n "):"","\n ").concat(s.showAddressBarHint?'\n <button class="mic-permission-modal__btn mic-permission-modal__btn--primary" data-action="show-hint">\n Show Me Where\n </button>\n ':"",'\n <button class="mic-permission-modal__btn mic-permission-modal__btn--secondary" data-action="refresh">\n 🔄 Refresh Page\n </button>\n </div>\n <p class="mic-permission-modal__footer">\n After enabling microphone access, return here and click "Refresh Page"\n </p>\n '),r.appendChild(c),i.overlay=r,i.modal=c,null===(n=c.querySelector('[data-action="close"]'))||void 0===n||n.addEventListener("click",()=>{i.close(),t()}),null===(A=c.querySelector('[data-action="open-settings"]'))||void 0===A||A.addEventListener("click",()=>{Ae(a)}),null===(o=c.querySelector('[data-action="refresh"]'))||void 0===o||o.addEventListener("click",()=>{window.location.reload()});var p=c.querySelector('[data-action="show-hint"]');p&&p.addEventListener("click",()=>{i.close(),t(),function(){var t=document.getElementById("mic-address-bar-hint");t&&t.remove(),Zt();var e=document.getElementsByTagName("script"),n="";for(var A of e){var o=A.src;if(o&&(o.includes("agent-widget.js")||o.includes("ttp-agent-sdk")||o.includes("ttp-sdk-front")))try{new URL(o),n=o.substring(0,o.lastIndexOf("/"));break}catch(t){var i=o.match(/^(.*\/)[^\/]+$/);if(i){n=i[1];break}}}if(!n||""===n||n.startsWith("/")){for(var r of e){var a=r.src;if(a&&(a.includes("cdn.talktopc.com")||a.includes("talktopc.com"))){if(a.includes("/ttp-agent-sdk/")||a.includes("/ttp-sdk-front/")){var s=a.match(/(https?:\/\/[^\/]+(?:\/[^\/]+)*)/);if(s){n=s[1].replace(/\/[^\/]+\.js$/,"");break}}if(!n&&(a.includes("cdn.talktopc.com")||a.includes("talktopc.com"))){n="https://cdn.talktopc.com/ttp-agent-sdk";break}}}if(!n||""===n)if(window.location.hostname.includes("cdn.talktopc.com")||window.location.hostname.includes("talktopc.com"))n="https://cdn.talktopc.com/ttp-agent-sdk";else{var c=window.location.pathname.split("/");c.pop(),(n=window.location.origin+c.join("/"))&&n!==window.location.origin||(n=window.location.origin)}}n=n.replace(/\/$/,"");var l="".concat(n,"/shared/mic-permission-assets/address-bar-hint.svg"),d=document.createElement("div");d.id="mic-address-bar-hint",d.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n z-index: 10001;\n padding: 10px 20px;\n pointer-events: none;\n animation: mic-fadeIn 0.3s ease-out;\n display: flex;\n justify-content: center;\n ";var p=document.createElement("div");p.style.cssText="\n display: flex;\n align-items: center;\n gap: 12px;\n background: #f59e0b;\n color: white;\n padding: 12px 20px;\n border-radius: 0 0 8px 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n pointer-events: all;\n animation: mic-slideDown 0.3s ease-out;\n max-width: 540px;\n ";var u=document.createElement("div");u.style.cssText="\n flex-shrink: 0;\n ";var h=document.createElement("img");h.src=l,h.alt="Address bar hint",h.style.cssText="\n width: auto;\n height: 80px;\n display: block;\n ",h.onerror=()=>{u.style.display="none"},u.appendChild(h);var g=document.createElement("div");g.style.cssText="\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n ";var m=document.createElement("div");m.style.cssText="\n font-size: 15px;\n font-weight: 500;\n ",m.innerHTML="Click the <strong>lock icon 🔒</strong>, <strong>information icon ℹ️</strong>, or <strong>settings icon ⋮</strong> in the address bar to enable microphone";var v=document.createElement("button");if(v.style.cssText="\n background: rgba(255, 255, 255, 0.2);\n border: none;\n color: white;\n width: 28px;\n height: 28px;\n border-radius: 50%;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n transition: background 0.2s;\n flex-shrink: 0;\n ",v.textContent="✕",v.addEventListener("click",()=>{d.remove()}),v.addEventListener("mouseenter",()=>{v.style.background="rgba(255, 255, 255, 0.3)"}),v.addEventListener("mouseleave",()=>{v.style.background="rgba(255, 255, 255, 0.2)"}),!document.getElementById("mic-address-bar-hint-styles")){var f=document.createElement("style");f.id="mic-address-bar-hint-styles",f.textContent="\n @keyframes mic-slideDown {\n from {\n opacity: 0;\n transform: translateY(-100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n \n @keyframes mic-pointUp {\n 0%, 100% {\n transform: translate(0, 0);\n }\n 50% {\n transform: translate(-5px, -5px);\n }\n }\n ",document.head.appendChild(f)}g.appendChild(m),p.appendChild(u),p.appendChild(g),p.appendChild(v),d.appendChild(p),document.body.appendChild(d),setTimeout(()=>{d.parentNode&&(d.style.opacity="0",d.style.transition="opacity 0.3s ease-out",setTimeout(()=>{d.parentNode&&d.remove()},300))},1e4)}()});var u=c.querySelector(".mic-permission-modal__alt-toggle");if(u&&s.altSteps){var h=u.nextElementSibling;h&&(h.style.display="none",u.addEventListener("click",()=>{"none"===h.style.display?(h.style.display="block",u.innerHTML="▼ ".concat(s.altTitle||"Alternative method")):(h.style.display="none",u.innerHTML="▶ ".concat(s.altTitle||"Alternative method"))}))}return r.addEventListener("click",e=>{e.target===r&&(i.close(),t())}),i.show(),i}function le(t){var e=new re,n=e.createOverlay(),A=document.createElement("div");return A.className="mic-permission-modal",A.innerHTML='\n <div class="mic-permission-modal__icon">🎤❌</div>\n <h2 class="mic-permission-modal__title">No Microphone Found</h2>\n <p class="mic-permission-modal__description">\n We couldn\'t detect a microphone on your device. Please make sure:\n </p>\n <ul style="list-style: none; padding: 0; margin: 0 0 24px;">\n <li style="padding: 10px 0 10px 32px; position: relative; color: #111827; border-bottom: 1px solid #e5e7eb;">\n <span style="position: absolute; left: 0; font-size: 18px;">☐</span>\n Your microphone is properly connected\n </li>\n <li style="padding: 10px 0 10px 32px; position: relative; color: #111827; border-bottom: 1px solid #e5e7eb;">\n <span style="position: absolute; left: 0; font-size: 18px;">☐</span>\n Your microphone is not muted at the hardware level\n </li>\n <li style="padding: 10px 0 10px 32px; position: relative; color: #111827;">\n <span style="position: absolute; left: 0; font-size: 18px;">☐</span>\n No other app is exclusively using the microphone\n </li>\n </ul>\n <div class="mic-permission-modal__actions">\n <button class="mic-permission-modal__btn mic-permission-modal__btn--primary" data-action="retry">\n Retry\n </button>\n <button class="mic-permission-modal__btn mic-permission-modal__btn--secondary" data-action="close">\n Close\n </button>\n </div>\n ',n.appendChild(A),e.overlay=n,e.modal=A,A.querySelector('[data-action="retry"]').addEventListener("click",()=>{window.location.reload()}),A.querySelector('[data-action="close"]').addEventListener("click",()=>{e.close(),t()}),n.addEventListener("click",A=>{A.target===n&&(e.close(),t())}),e.show(),e}function de(t){var{texts:e,onAccept:n,onCancel:A}=t,o=new re,i=o.createOverlay();i.style.background="rgba(0, 0, 0, 0.5)",i.style.backdropFilter="blur(2px)";var r=ae(),a=document.createElement("div");a.className="mic-permission-modal"+(r?" mic-permission-modal--mobile":"");var s=(e||[]).map(t=>String(t).trim()).filter(Boolean),c=(s.length?s.join("\n\n"):"Please confirm to continue.").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return a.innerHTML='\n <h2 class="mic-permission-modal__title">Notice</h2>\n <div class="mic-permission-modal__description" style="white-space:pre-wrap;max-height:50vh;overflow:auto;text-align:left;font-size:15px;line-height:1.5;">'.concat(c,'</div>\n <div class="mic-permission-modal__actions">\n <button type="button" class="mic-permission-modal__btn mic-permission-modal__btn--primary" data-action="accept">Accept</button>\n <button type="button" class="mic-permission-modal__btn mic-permission-modal__btn--secondary" data-action="cancel">Decline</button>\n </div>\n '),r&&(i.style.alignItems="flex-end",i.style.paddingBottom="max(20px, env(safe-area-inset-bottom, 20px))",i.style.paddingTop="20px"),i.appendChild(a),o.overlay=i,o.modal=a,a.querySelector('[data-action="accept"]').addEventListener("click",()=>{o.close(),n()}),a.querySelector('[data-action="cancel"]').addEventListener("click",()=>{o.close(),A()}),i.addEventListener("click",t=>{t.target===i&&(o.close(),A())}),o.show(),o}function pe(t){var e=null!=t&&String(t).trim()||"";if(!e)return"";try{var n=new URL(e);return"http:"!==n.protocol&&"https:"!==n.protocol?"":n.href}catch(t){return""}}function ue(t){return String(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}function he(t){if(!t)return"";var e=t.voice||{},n=[t.headerAvatarImageUrl,e.headerAvatarImageUrl,t.header_avatar_image_url,e.header_avatar_image_url,e.avatarImageUrl,t.avatarImageUrl,e.avatar_image_url,t.avatar_image_url];for(var A of n){var o=pe(A);if(o)return o}return""}class ge{constructor(t){this.voiceInterface=t,this.config=t.config}t(t){return this.voiceInterface.t(t)}getText(t,e){return this.voiceInterface.getText(t,e)}getTooltip(t){return this.voiceInterface.getTooltip(t)}generateHTML(){var t;if(this.voiceInterface.isMobile)return this.generateMobileHTML();var e=null!=this.config.agentName&&""!==String(this.config.agentName).trim()?String(this.config.agentName).trim():"Sasha",n=this.config.agentRole||"AI Voice Assistant",A=this.config.headline||this.config.startCallTitle||"Hi there 👋",o=this.config.subline||this.config.startCallSubtitle||"Ask me anything — I respond instantly<br>in voice or text.",i=e.charAt(0).toUpperCase(),r=he(this.config),a=r?'<img src="'.concat(ue(r),'" alt="" class="ttp-avatar-img" />'):i,s=r?"ttp-avatar ttp-avatar--image":"ttp-avatar",c="rtl"===this.config.direction?"rtl":"ltr";return'<div class="voice-interface" id="voiceInterface">\n \x3c!-- Idle View --\x3e\n <div id="voiceIdleState">\n <div class="ttp-hero">\n <div class="ttp-header">\n <div class="ttp-agent">\n <div class="ttp-avatar-wrap">\n <div class="'.concat(s,'">').concat(a,'</div>\n <div class="ttp-online-dot"></div>\n </div>\n <div>\n <div class="ttp-agent-name">').concat(e,'</div>\n <div class="ttp-agent-role">').concat(n,'</div>\n </div>\n </div>\n <button type="button" class="ttp-close-btn" id="ttpCloseIdle" aria-label="Close widget">\n <svg width="10" height="10" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M10 2L2 10M2 2l8 8"/>\n </svg>\n </button>\n </div>\n <div class="ttp-headline">').concat(A,'</div>\n <div class="ttp-subline">').concat(o,'</div>\n </div>\n\n <div class="ttp-body">\n <button type="button" class="ttp-btn-primary" id="startCallBtn">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="').concat(this.config.startCallButtonTextColor||"white",'" stroke-width="2">\n <path d="M12 2a3 3 0 0 1 3 3v7a3 3 0 0 1-6 0V5a3 3 0 0 1 3-3z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2M12 19v3M8 22h8"/>\n </svg>\n ').concat(this.getText("startCallButtonText","startCall")||"Start Voice Call",'\n </button>\n <button type="button" class="ttp-btn-secondary" id="startTextBtn">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>\n </svg>\n ').concat(this.config.sendMessageText||this.getText("sendMessageText","sendMessage")||"Send a Message","\n </button>\n ").concat(null!==(t=this.config.whatsapp)&&void 0!==t&&t.number?'\n <a class="ttp-btn-wa" id="ttpWhatsAppBtn"\n href="https://wa.me/'.concat(this.config.whatsapp.number).concat(this.config.whatsapp.text?"?text="+encodeURIComponent(this.config.whatsapp.text):"",'"\n target="_blank" rel="noopener">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="#25d366">\n <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.655-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/>\n </svg>\n WhatsApp\n </a>\n '):"",'\n </div>\n </div>\n\n \x3c!-- Active Call View --\x3e\n <div id="voiceActiveState" style="display: none;">\n \x3c!-- Full voice section (hidden when items/rooms are shown) --\x3e\n <div class="desktop-voice-section" id="desktopVoiceSection">\n <div class="ttp-call-hero">\n <div class="ttp-call-topbar">\n <div class="ttp-rec">\n <div class="ttp-rec-dot"></div>\n <span class="ttp-timer" id="desktopTimerText">00:00</span>\n </div>\n <span class="ttp-call-label">Voice call active</span>\n <button type="button" class="ttp-close-btn" id="ttpCloseActive" aria-label="Close widget">\n <svg width="9" height="9" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M10 2L2 10M2 2l8 8"/>\n </svg>\n </button>\n </div>\n\n <div class="ttp-orb-wrap">\n <div class="ttp-orb-rings">\n <div class="ttp-ring ttp-ring-1"></div>\n <div class="ttp-ring ttp-ring-2"></div>\n <div class="ttp-orb" id="desktopMainWaveform">\n <div class="ttp-wave" id="ttp-wave"></div>\n </div>\n </div>\n <div class="ttp-listen-label" id="desktopStatusText">').concat(this.t("listening")||"Listening to you...",'</div>\n </div>\n </div>\n\n <div class="ttp-controls">\n <button type="button" class="ttp-ctrl-btn" id="desktopMuteBtn" title="').concat(this.getTooltip("mute"),'" aria-label="Mute microphone">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" class="desktop-mic-icon">\n <path d="M12 1a3 3 0 0 1 3 3v7a3 3 0 0 1-6 0V4a3 3 0 0 1 3-3z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n </svg>\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" class="desktop-mic-off-icon" style="display: none; position: absolute;">\n <path d="M12 1a3 3 0 0 1 3 3v7a3 3 0 0 1-6 0V4a3 3 0 0 1 3-3z" stroke="currentColor" stroke-width="1.8" fill="none"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2" stroke="currentColor" stroke-width="1.8" fill="none"/>\n <line x1="5" y1="5" x2="19" y2="19" stroke="#ef4444" stroke-width="1.5" stroke-linecap="round" opacity="0.85"/>\n </svg>\n </button>\n <button type="button" class="ttp-end-btn" id="desktopEndCallBtn" title="').concat(this.getTooltip("endCall"),'" aria-label="End call">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.99 12 19.79 19.79 0 0 1 1.97 3.4 2 2 0 0 1 3.95 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>\n </svg>\n </button>\n <button type="button" class="ttp-ctrl-btn" id="desktopSpeakerBtn" title="').concat(this.getTooltip("speaker"),'" aria-label="Toggle speaker">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" class="desktop-speaker-icon">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07"/>\n </svg>\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" class="desktop-speaker-off-icon" style="display: none; position: absolute;">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" stroke="currentColor" stroke-width="1.8" fill="none"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07" stroke="currentColor" stroke-width="1.8" fill="none"/>\n <line x1="5" y1="5" x2="19" y2="19" stroke="#ef4444" stroke-width="1.5" stroke-linecap="round" opacity="0.85"/>\n </svg>\n </button>\n </div>\n </div>\n\n \x3c!-- Compact voice section (shown when items/rooms are visible) --\x3e\n <div class="compact-voice-section" id="compactVoiceSection" style="display: none;">\n <div class="compact-left">\n <div class="compact-avatar" id="desktopAvatarCompact">\n <div class="ttp-orb compact-orb" id="desktopMainWaveformCompact">\n <div class="ttp-wave"></div>\n </div>\n </div>\n <div class="compact-info">\n <div class="compact-timer" id="desktopTimerCompact">\n <span class="ttp-rec-dot"></span>\n <span id="compactTimerText">00:00</span>\n </div>\n <div class="compact-status" id="desktopStatusCompact">\n <span id="compactStatusText">').concat(this.t("listening")||"Listening...",'</span>\n </div>\n </div>\n </div>\n <div class="compact-controls">\n <button type="button" class="compact-control-btn secondary" id="desktopMuteBtnCompact" title="').concat(this.getTooltip("mute"),'" aria-label="Mute microphone">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" class="desktop-mic-icon">\n <path d="M12 1a3 3 0 0 1 3 3v7a3 3 0 0 1-6 0V4a3 3 0 0 1 3-3z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n </svg>\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" class="desktop-mic-off-icon" style="display: none; position: absolute;">\n <path d="M12 1a3 3 0 0 1 3 3v7a3 3 0 0 1-6 0V4a3 3 0 0 1 3-3z" stroke="currentColor" stroke-width="1.8" fill="none"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2" stroke="currentColor" stroke-width="1.8" fill="none"/>\n <line x1="5" y1="5" x2="19" y2="19" stroke="#ef4444" stroke-width="1.5" stroke-linecap="round" opacity="0.85"/>\n </svg>\n </button>\n <button type="button" class="compact-control-btn danger" id="desktopEndCallBtnCompact" title="').concat(this.getTooltip("endCall"),'" aria-label="End call">\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="overflow: visible;">\n <path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.99 12 19.79 19.79 0 0 1 1.97 3.4 2 2 0 0 1 3.95 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z" transform="rotate(135 12 12)"/>\n </svg>\n </button>\n <button type="button" class="compact-control-btn secondary" id="desktopSpeakerBtnCompact" title="').concat(this.getTooltip("speaker"),'" aria-label="Toggle speaker">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" class="desktop-speaker-icon">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07"/>\n </svg>\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" class="desktop-speaker-off-icon" style="display: none; position: absolute;">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" stroke="currentColor" stroke-width="1.8" fill="none"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07" stroke="currentColor" stroke-width="1.8" fill="none"/>\n <line x1="5" y1="5" x2="19" y2="19" stroke="#ef4444" stroke-width="1.5" stroke-linecap="round" opacity="0.85"/>\n </svg>\n </button>\n </div>\n </div>\n\n \x3c!-- Transcript --\x3e\n <div class="ttp-transcript desktop-conversation-panel" id="desktopConversationPanel" dir="').concat(c,'">\n <div class="ttp-transcript-hdr" id="conversationHeader">\n <span class="ttp-live-label">Live</span>\n <span class="ttp-toggle-text" id="conversationToggleText">Show history</span>\n <div class="ttp-dots">\n <div class="ttp-dot"></div>\n <div class="ttp-dot"></div>\n <div class="ttp-dot"></div>\n </div>\n </div>\n <div class="live-transcript-collapsed" id="liveTranscriptCollapsed">\n <div class="ttp-transcript-text" id="liveTextCollapsed">\n ').concat(this.t("transcriptWillAppear")||"Transcript will appear here...",'<span class="ttp-cursor"></span>\n </div>\n </div>\n <div class="conversation-history" id="conversationHistory">\n <div class="conversation-messages" id="conversationMessages"></div>\n <div class="live-message-row" id="liveMessageRow" style="display: none;">\n <div class="message-bubble" dir="').concat(c,'">\n <span class="live-badge">Live</span>\n <span id="liveMessageText"></span><span class="ttp-cursor"></span>\n </div>\n </div>\n </div>\n </div>\n\n \x3c!-- Type row --\x3e\n <div class="ttp-type-row voice-text-input-area">\n <input class="ttp-input" type="text" id="voiceTextInput" dir="').concat(c,'" placeholder="').concat(this.getText("inputPlaceholder","typeMessage")||"Or type here…",'" aria-label="Type a message" />\n <button type="button" class="ttp-send-btn" id="voiceSendBtn" aria-label="Send message">\n <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">\n <line x1="22" y1="2" x2="11" y2="13"/>\n <polygon points="22 2 15 22 11 13 2 9 22 2"/>\n </svg>\n </button>\n </div>\n </div>\n </div>')}generateMobileHTML(){var t="rtl"===this.config.direction?"rtl":"ltr",e=he(this.config),n=e?'<img src="'.concat(ue(e),'" alt="" class="voice-avatar-img" />'):"🤖",A=e?"voice-avatar voice-avatar--image":"voice-avatar";return'<div class="voice-interface mobile-voice-interface" id="voiceInterface" dir="'.concat(t,'">\n \x3c!-- Before Call State (same as desktop) --\x3e\n <div id="voiceIdleState">\n <div class="').concat(A,'" id="voiceAvatar">').concat(n,'</div>\n <div class="voice-status">\n <div class="voice-status-title">').concat(this.getText("startCallTitle","clickToStartCall"),'</div>\n <div class="voice-status-subtitle">').concat(this.getText("startCallSubtitle","realTimeVoice"),'</div>\n </div>\n <button type="button" class="start-call-btn" id="startCallBtn">\n <svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">\n <path d="M20.01 15.38c-1.23 0-2.42-.2-3.53-.56-.35-.12-.74-.03-1.01.24l-1.57 1.97c-2.83-1.35-5.48-3.9-6.89-6.83l1.95-1.66c.27-.28.35-.67.24-1.02-.37-1.11-.56-2.3-.56-3.53 0-.54-.45-.99-.99-.99H4.19C3.65 3 3 3.24 3 3.99 3 13.28 10.73 21 20.01 21c.71 0 .99-.63.99-1.18v-3.45c0-.54-.45-.99-.99-.99z"/>\n </svg>\n <span>').concat(this.getText("startCallButtonText","startCall"),'</span>\n </button>\n </div>\n \n \x3c!-- Mobile Active Call State - Hidden placeholder (actual bar will be appended to body) --\x3e\n <div id="voiceActiveState" class="mobile-active-state" style="display: none;">\n \x3c!-- Duration Badge --\x3e\n <div class="mobile-duration-badge" id="mobileDurationBadge">\n <div class="mobile-duration-dot"></div>\n <span id="mobileDurationText">00:00</span>\n </div>\n \n \x3c!-- Main Bar --\x3e\n <div class="mobile-voice-bar">\n \x3c!-- Top Row: Status, Waveform, Controls --\x3e\n <div class="mobile-top-row">\n \x3c!-- Status Indicator --\x3e\n <div class="mobile-status-indicator">\n <div class="mobile-status-dot" id="mobileStatusDot"></div>\n <span class="mobile-status-text" id="mobileStatusText">Listening...</span>\n </div>\n \n \x3c!-- Centered Waveform --\x3e\n <div class="mobile-waveform-center" id="mobileWaveform">\n ').concat(Array(8).fill(0).map((t,e)=>'<div class="mobile-waveform-bar" data-index="'.concat(e,'"></div>')).join(""),'\n </div>\n \n \x3c!-- Controls --\x3e\n <div class="mobile-controls">\n <button type="button" class="mobile-control-btn" id="mobileMuteBtn" aria-label="Mute microphone">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-mic-icon">\n <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n <line x1="12" x2="12" y1="19" y2="22"/>\n </svg>\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-mic-off-icon" style="display: none;">\n <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n <line x1="12" x2="12" y1="19" y2="22"/>\n <line x1="4" y1="4" x2="20" y2="20" stroke="#ef4444" stroke-width="1.5" opacity="0.85"/>\n </svg>\n </button>\n \n <button type="button" class="mobile-control-btn" id="mobileSpeakerBtn" aria-label="Toggle speaker">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-speaker-icon">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07"/>\n </svg>\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-speaker-off-icon" style="display: none;">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07"/>\n <line x1="4" y1="4" x2="20" y2="20" stroke="#ef4444" stroke-width="1.5" opacity="0.85"/>\n </svg>\n </button>\n \n <button type="button" class="mobile-end-call-btn" id="mobileEndCallBtn" aria-label="End call">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/>\n <line x1="22" x2="2" y1="2" y2="22"/>\n </svg>\n </button>\n </div>\n </div>\n \n \x3c!-- Bottom Row: Transcript (expandable) --\x3e\n <button type="button" class="mobile-transcript-row" id="mobileTranscriptRow">\n <p class="mobile-transcript-text" id="mobileTranscriptText" dir="').concat(t,'">').concat(this.t("transcriptWillAppear"),'</p>\n <div class="mobile-transcript-footer">\n <span class="mobile-expand-hint">tap to expand & type</span>\n <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="opacity: 0.6;">\n <path d="M7 17L17 7M17 7H7M17 7V17"/>\n </svg>\n </div>\n </button>\n </div>\n </div>\n \n \x3c!-- Expanded Transcript Overlay --\x3e\n <div class="mobile-transcript-overlay" id="mobileTranscriptOverlay">\n <div class="mobile-expanded-transcript" id="mobileExpandedTranscript">\n \x3c!-- Header --\x3e\n <div class="mobile-transcript-header">\n <div class="mobile-header-left">\n <div class="mobile-header-status">\n <div class="mobile-header-status-dot"></div>\n <span class="mobile-header-status-text" id="mobileHeaderStatusText">Listening...</span>\n <span class="mobile-header-duration" id="mobileHeaderDuration">00:00</span>\n </div>\n <span class="mobile-transcript-label">CONVERSATION</span>\n </div>\n <button type="button" class="mobile-close-transcript-btn" id="mobileCloseTranscriptBtn">\n <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n \x3c!-- Messages Container --\x3e\n <div class="mobile-messages-container" id="mobileMessagesContainer">\n \x3c!-- Messages will be dynamically added here --\x3e\n </div>\n \n \x3c!-- Text Input Area --\x3e\n <div class="mobile-input-area">\n <div class="mobile-input-wrapper">\n <input\n type="text"\n placeholder="Type a message..."\n id="mobileTextInput"\n class="mobile-text-input"\n dir="').concat(t,'"\n />\n <button type="button" class="mobile-send-btn" id="mobileSendBtn" disabled>\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"/>\n </svg>\n </button>\n </div>\n <p class="mobile-input-hint">🎙️ Voice is still active • Type or speak</p>\n </div>\n </div>\n </div>\n </div>')}}class me{constructor(t){this.voiceInterface=t,this.config=t.config}generateCSS(){var t=" !important",e=this.config,n=e.heroGradient1||"#2a2550",A=e.heroGradient2||"#1a1a2e",o=e.avatarGradient1||"#6d56f5",i=e.avatarGradient2||"#a78bfa",r=e.onlineDotColor||"#22c55e",a=e.agentNameColor||"#f0eff8",s=e.agentRoleColor||"rgba(255,255,255,0.35)",c=e.headlineColor||"#ffffff",l=e.sublineColor||"rgba(255,255,255,0.45)",d=e.primaryBtnGradient1||e.startCallButtonColor||"#6d56f5",p=e.primaryBtnGradient2||e.startCallButtonColor||"#9d8df8",u=e._talkToPcLinkColor||d,h=e.startCallButtonTextColor||"#fff",g=e.secondaryBtnBg||"rgba(255,255,255,0.05)",m=e.secondaryBtnBorder||"rgba(255,255,255,0.09)",v=e.secondaryBtnTextColor||"rgba(255,255,255,0.6)",f=e.panelBackgroundColor||"#16161e",w=e.endCallButtonColor||"#ef4444",B=e.sendButtonColor||d,b="linear-gradient(160deg, ".concat(n," 0%, ").concat(A," 100%)");return"\n /* Voice Interface - Dark Theme Desktop */\n .voice-interface {\n display: none".concat(t,";\n flex: 1").concat(t,";\n flex-direction: column").concat(t,";\n align-items: stretch").concat(t,";\n justify-content: flex-start").concat(t,";\n padding: 0").concat(t,";\n background: ").concat(f,";\n overflow: hidden").concat(t,";\n min-height: 0").concat(t,";\n height: 100%").concat(t,";\n width: 100%").concat(t,";\n box-sizing: border-box").concat(t,";\n }\n .voice-interface.active {\n display: flex").concat(t,";\n background: ").concat(b).concat(t,';\n }\n\n .voice-interface.active:has(#voiceIdleState:not([style*="display: none"]):not([style*="display:none"])) {\n background: transparent').concat(t,";\n }\n\n /* Footer: same in-call purple as voice area (parent also sets bg; this covers any layout gaps) */\n .voice-interface.active ~ .ttp-footer {\n background: ").concat(b).concat(t,";\n border-top-color: rgba(255,255,255,0.06)").concat(t,";\n }\n .voice-interface.active ~ .ttp-footer span { color: rgba(255,255,255,0.35)").concat(t,"; }\n .voice-interface.active ~ .ttp-footer a { color: ").concat(u).concat(t,"; }\n\n #voiceIdleState {\n display: flex").concat(t,";\n flex-direction: column").concat(t,";\n flex: 1").concat(t,";\n min-height: 0").concat(t,";\n width: 100%").concat(t,";\n box-sizing: border-box").concat(t,";\n background: transparent").concat(t,';\n }\n #voiceIdleState[style*="display: none"],\n #voiceIdleState[style*="display:none"] {\n display: none !important;\n }\n\n #voiceActiveState {\n display: flex').concat(t,";\n flex-direction: column").concat(t,";\n width: 100%").concat(t,";\n height: 100%").concat(t,";\n min-height: 0").concat(t,";\n overflow: hidden").concat(t,";\n flex: 1").concat(t,";\n box-sizing: border-box").concat(t,';\n }\n #voiceActiveState[style*="display: none"],\n #voiceActiveState[style*="display:none"] {\n display: none !important;\n }\n\n /* ── IDLE HERO — transparent; gradient is on #voiceIdleState so hero + body share one surface ── */\n .ttp-hero {\n position: relative').concat(t,";\n padding: 24px 22px 22px").concat(t,";\n background: transparent").concat(t,";\n border-bottom: none").concat(t,";\n overflow: hidden").concat(t,";\n }\n .ttp-hero::after {\n content: ''").concat(t,";\n position: absolute").concat(t,";\n top: -40px").concat(t,"; right: -40px").concat(t,";\n width: 140px").concat(t,"; height: 140px").concat(t,";\n border-radius: 50%").concat(t,";\n background: radial-gradient(circle, ").concat(d,"2e 0%, transparent 70%);\n pointer-events: none").concat(t,";\n }\n .ttp-header {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: space-between").concat(t,";\n margin-bottom: 20px").concat(t,";\n position: relative").concat(t,";\n z-index: 1").concat(t,";\n }\n .ttp-agent { display: flex").concat(t,"; align-items: center").concat(t,"; gap: 10px").concat(t,"; }\n .ttp-avatar-wrap { position: relative").concat(t,"; }\n .ttp-avatar {\n width: 36px").concat(t,"; height: 36px").concat(t,"; border-radius: 50%").concat(t,";\n background: linear-gradient(135deg, ").concat(o,", ").concat(i,");\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n font-size: 14px").concat(t,"; font-weight: 500").concat(t,"; color: #fff").concat(t,";\n }\n .ttp-avatar.ttp-avatar--image {\n padding: 0").concat(t,";\n overflow: hidden").concat(t,";\n }\n .ttp-avatar-img {\n width: 100%").concat(t,";\n height: 100%").concat(t,";\n object-fit: cover").concat(t,";\n display: block").concat(t,";\n border-radius: 50%").concat(t,";\n }\n .ttp-online-dot {\n position: absolute").concat(t,"; bottom: 0").concat(t,"; right: 0").concat(t,";\n width: 10px").concat(t,"; height: 10px").concat(t,"; border-radius: 50%").concat(t,";\n background: ").concat(r,"; border: 2px solid ").concat(A,";\n }\n .ttp-agent-name { font-size: 14px").concat(t,"; font-weight: 500").concat(t,"; color: ").concat(a,"; }\n .ttp-agent-role { font-size: 10px").concat(t,"; color: ").concat(s,"; margin-top: 1px").concat(t,"; }\n .ttp-close-btn {\n width: 26px").concat(t,"; height: 26px").concat(t,"; border-radius: 50%").concat(t,";\n background: rgba(255,255,255,0.07)").concat(t,"; border: none").concat(t,"; cursor: pointer").concat(t,";\n color: rgba(255,255,255,0.4)").concat(t,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n transition: background 0.2s").concat(t,";\n }\n .ttp-close-btn:hover { background: rgba(255,255,255,0.14)").concat(t,"; }\n .ttp-headline {\n font-size: 22px").concat(t,"; font-weight: 500").concat(t,"; color: ").concat(c,";\n line-height: 1.2").concat(t,"; margin-bottom: 6px").concat(t,"; position: relative").concat(t,"; z-index: 1").concat(t,";\n }\n .ttp-subline {\n font-size: 13px").concat(t,"; color: ").concat(l,";\n line-height: 1.5").concat(t,"; position: relative").concat(t,"; z-index: 1").concat(t,";\n }\n\n /* ── DOMAIN ERROR CARD ── */\n .ttp-domain-error-card {\n display: flex").concat(t,";\n align-items: flex-start").concat(t,";\n gap: 12px").concat(t,";\n padding: 14px 16px").concat(t,";\n border-radius: 12px").concat(t,";\n background: rgba(239,68,68,0.08)").concat(t,";\n border: 1px solid rgba(239,68,68,0.18)").concat(t,";\n }\n .ttp-domain-error-icon {\n flex-shrink: 0").concat(t,";\n margin-top: 1px").concat(t,";\n }\n .ttp-domain-error-text {\n font-size: 12px").concat(t,";\n line-height: 1.55").concat(t,";\n color: rgba(252,165,165,0.85)").concat(t,";\n }\n .ttp-domain-error-text strong {\n color: #fca5a5").concat(t,";\n font-weight: 600").concat(t,";\n }\n\n /* ── IDLE BODY ── */\n .ttp-body {\n padding: 10px 18px 14px").concat(t,";\n display: flex").concat(t,"; flex-direction: column").concat(t,"; gap: 6px").concat(t,";\n }\n .ttp-btn-primary {\n width: 100%").concat(t,"; padding: 11px").concat(t,"; border-radius: 12px").concat(t,";\n background: linear-gradient(135deg, ").concat(d,", ").concat(p,");\n border: none").concat(t,"; cursor: pointer").concat(t,";\n font-size: 13px").concat(t,"; font-weight: 500").concat(t,"; color: ").concat(h,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,"; gap: 8px").concat(t,";\n box-shadow: 0 4px 18px ").concat(d,"59;\n transition: opacity 0.2s, transform 0.15s").concat(t,";\n font-family: inherit").concat(t,";\n }\n .ttp-btn-primary:hover { opacity: 0.9").concat(t,"; transform: translateY(-1px)").concat(t,"; }\n .ttp-btn-primary:disabled { cursor: not-allowed").concat(t,"; opacity: 0.6").concat(t,"; }\n .ttp-btn-secondary {\n width: 100%").concat(t,"; padding: 10px").concat(t,"; border-radius: 12px").concat(t,";\n background: ").concat(g,";\n border: 1px solid ").concat(m,";\n cursor: pointer").concat(t,"; font-size: 13px").concat(t,"; color: ").concat(v,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,"; gap: 8px").concat(t,";\n transition: background 0.2s").concat(t,"; font-family: inherit").concat(t,";\n }\n .ttp-btn-secondary:hover { background: ").concat(g,"; }\n\n /* WhatsApp button */\n .ttp-btn-wa {\n width: 100%").concat(t,"; padding: 10px").concat(t,"; border-radius: 12px").concat(t,";\n background: rgba(37,211,102,0.08)").concat(t,";\n border: 1px solid rgba(37,211,102,0.2)").concat(t,";\n cursor: pointer").concat(t,"; font-size: 13px").concat(t,"; font-weight: 500").concat(t,"; color: #4ade80").concat(t,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,"; gap: 8px").concat(t,";\n transition: background 0.2s").concat(t,"; font-family: inherit").concat(t,";\n text-decoration: none").concat(t,";\n box-sizing: border-box").concat(t,";\n }\n .ttp-btn-wa:hover { background: rgba(37,211,102,0.14)").concat(t,"; }\n\n /* Connecting Spinner (reused from old design) */\n .connecting-spinner {\n display: inline-block").concat(t,";\n width: 16px").concat(t,"; height: 16px").concat(t,";\n border: 2px solid rgba(255,255,255,0.3)").concat(t,";\n border-top-color: #fff").concat(t,";\n border-radius: 50%").concat(t,";\n animation: ttp-spin 1s linear infinite").concat(t,";\n margin-right: 8px").concat(t,";\n vertical-align: middle").concat(t,";\n }\n @keyframes ttp-spin { to { transform: rotate(360deg); } }\n\n /* ── ACTIVE CALL ── */\n .ttp-call-hero {\n background: transparent").concat(t,";\n padding: 22px 20px 18px").concat(t,";\n border-bottom: 1px solid rgba(255,255,255,0.06)").concat(t,";\n }\n .ttp-call-topbar {\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: space-between").concat(t,";\n margin-bottom: 18px").concat(t,";\n }\n .ttp-rec { display: flex").concat(t,"; align-items: center").concat(t,"; gap: 7px").concat(t,"; }\n .ttp-rec-dot {\n width: 7px").concat(t,"; height: 7px").concat(t,"; border-radius: 50%").concat(t,"; background: #f87171").concat(t,";\n animation: ttp-pulse 1s ease-in-out infinite").concat(t,";\n }\n ").concat(!1===this.config.useShadowDOM?"\n /* Regular DOM (e.g. Shopify): theme rules often strip span/div sizing — recording dot + pulse */\n #ttp-widget-container .ttp-call-topbar .ttp-rec,\n #text-chat-panel .ttp-call-topbar .ttp-rec {\n display: flex !important;\n align-items: center !important;\n gap: 7px !important;\n flex-shrink: 0 !important;\n }\n #ttp-widget-container .ttp-rec-dot,\n #ttp-widget-container .compact-timer .ttp-rec-dot,\n #text-chat-panel .ttp-rec-dot,\n #text-chat-panel .compact-timer .ttp-rec-dot {\n display: block !important;\n flex-shrink: 0 !important;\n box-sizing: content-box !important;\n width: 7px !important;\n height: 7px !important;\n min-width: 7px !important;\n min-height: 7px !important;\n max-width: none !important;\n max-height: none !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n border-radius: 50% !important;\n background: #f87171 !important;\n background-color: #f87171 !important;\n opacity: 1 !important;\n visibility: visible !important;\n -webkit-animation: ttp-pulse 1s ease-in-out infinite !important;\n animation: ttp-pulse 1s ease-in-out infinite !important;\n }\n #ttp-widget-container .ttp-transcript-hdr .ttp-dot,\n #text-chat-panel .ttp-transcript-hdr .ttp-dot {\n display: flex !important;\n width: 3px !important;\n height: 3px !important;\n min-width: 3px !important;\n min-height: 3px !important;\n border-radius: 50% !important;\n background: ".concat(i," !important;\n background-color: ").concat(i," !important;\n opacity: 1 !important;\n visibility: visible !important;\n -webkit-animation: ttp-pulse 0.8s ease-in-out infinite !important;\n animation: ttp-pulse 0.8s ease-in-out infinite !important;\n }\n /* Orb waveform: same motion as shadow DOM (ttp-wave keyframes). Do not set opacity !important\n on bars — it overrides keyframe opacity and changes the look. */\n #ttp-widget-container .ttp-wave,\n #text-chat-panel .ttp-wave {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 3px !important;\n height: 26px !important;\n min-height: 26px !important;\n width: auto !important;\n min-width: 36px !important;\n overflow: visible !important;\n flex-shrink: 0 !important;\n }\n #ttp-widget-container .ttp-wave-bar,\n #text-chat-panel .ttp-wave-bar {\n display: block !important;\n box-sizing: content-box !important;\n width: 2.5px !important;\n min-width: 2.5px !important;\n max-width: none !important;\n flex-shrink: 0 !important;\n border-radius: 3px !important;\n background: rgba(255, 255, 255, 0.9) !important;\n background-color: rgba(255, 255, 255, 0.9) !important;\n visibility: visible !important;\n transform-origin: center center !important;\n -webkit-animation: ttp-wave 0.75s ease-in-out infinite alternate !important;\n animation: ttp-wave 0.75s ease-in-out infinite alternate !important;\n }\n #ttp-widget-container .ttp-orb,\n #text-chat-panel .ttp-orb {\n overflow: visible !important;\n }\n "):"","\n .ttp-timer { font-size: 11px").concat(t,"; color: rgba(255,255,255,0.4)").concat(t,"; letter-spacing: 0.05em").concat(t,"; }\n .ttp-call-label { font-size: 11px").concat(t,"; color: rgba(255,255,255,0.25)").concat(t,"; }\n\n /* ── ORB ── */\n .ttp-orb-wrap {\n display: flex").concat(t,"; flex-direction: column").concat(t,"; align-items: center").concat(t,";\n gap: 12px").concat(t,"; padding: 8px 0").concat(t,";\n }\n .ttp-orb-rings {\n position: relative").concat(t,"; width: 72px").concat(t,"; height: 72px").concat(t,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n }\n .ttp-ring {\n position: absolute").concat(t,"; border-radius: 50%").concat(t,";\n border: 1.5px solid ").concat(d,"33;\n animation: ttp-ring 2s ease-in-out infinite").concat(t,";\n }\n .ttp-ring-1 { inset: -8px").concat(t,"; }\n .ttp-ring-2 { inset: -16px").concat(t,"; border-width: 1px").concat(t,"; border-color: ").concat(d,"1a; animation-delay: 0.5s").concat(t,"; }\n .ttp-orb {\n width: 72px").concat(t,"; height: 72px").concat(t,"; border-radius: 50%").concat(t,";\n background: linear-gradient(135deg, ").concat(d,", ").concat(p,");\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n animation: ttp-orb-breathe 1.4s ease-in-out infinite").concat(t,";\n box-shadow: 0 6px 24px ").concat(d,"66;\n }\n .ttp-wave { display: flex").concat(t,"; align-items: center").concat(t,"; gap: 3px").concat(t,"; height: 26px").concat(t,"; }\n .ttp-wave-bar {\n width: 2.5px").concat(t,"; border-radius: 3px").concat(t,"; background: rgba(255,255,255,0.9)").concat(t,";\n animation: ttp-wave 0.75s ease-in-out infinite alternate").concat(t,";\n }\n .ttp-listen-label { font-size: 12px").concat(t,"; color: rgba(255,255,255,0.4)").concat(t,"; }\n\n /* ── CONTROLS ── */\n .ttp-controls {\n padding: 16px 20px").concat(t,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,"; gap: 14px").concat(t,";\n }\n .ttp-ctrl-btn {\n width: 42px").concat(t,"; height: 42px").concat(t,"; border-radius: 50%").concat(t,";\n background: rgba(255,255,255,0.06)").concat(t,";\n border: 1px solid rgba(255,255,255,0.09)").concat(t,";\n cursor: pointer").concat(t,"; display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n color: rgba(255,255,255,0.4)").concat(t,"; transition: background 0.2s").concat(t,";\n position: relative").concat(t,";\n }\n .ttp-ctrl-btn:hover { background: rgba(255,255,255,0.12)").concat(t,"; }\n .ttp-ctrl-btn.muted {\n background: rgba(239, 68, 68, 0.15)").concat(t,";\n border-color: rgba(239, 68, 68, 0.3)").concat(t,";\n }\n .ttp-end-btn {\n width: 52px").concat(t,"; height: 52px").concat(t,"; border-radius: 50%").concat(t,";\n background: ").concat(w,"; border: none").concat(t,"; cursor: pointer").concat(t,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n color: #fff").concat(t,"; transform: rotate(135deg)").concat(t,";\n box-shadow: 0 4px 16px ").concat(w,"59;\n transition: background 0.2s").concat(t,";\n }\n .ttp-end-btn:hover { background: ").concat(w,"; opacity: 0.85").concat(t,"; }\n\n /* Mute/speaker icon toggle */\n .desktop-mic-icon, .desktop-speaker-icon { display: block").concat(t,"; }\n .desktop-mic-off-icon, .desktop-speaker-off-icon {\n position: absolute").concat(t,"; top: 50%").concat(t,"; left: 50%").concat(t,";\n transform: translate(-50%, -50%)").concat(t,";\n width: 16px").concat(t,"; height: 16px").concat(t,"; z-index: 10").concat(t,";\n }\n\n /* ── DESKTOP VOICE SECTION WRAPPER ── */\n .desktop-voice-section { flex-shrink: 0").concat(t,"; }\n\n /* ── COMPACT VOICE SECTION (shown when items/rooms are visible) ── */\n .compact-voice-section {\n padding: 10px 14px").concat(t,";\n background: transparent").concat(t,";\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: space-between").concat(t,";\n flex-shrink: 0").concat(t,";\n border-bottom: 1px solid rgba(255,255,255,0.06)").concat(t,";\n }\n .compact-left { display: flex").concat(t,"; align-items: center").concat(t,"; gap: 10px").concat(t,"; }\n .compact-avatar {\n width: 42px").concat(t,"; height: 42px").concat(t,"; min-width: 42px").concat(t,";\n border-radius: 50%").concat(t,";\n background: linear-gradient(135deg, ").concat(o,", ").concat(i,");\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n flex-shrink: 0").concat(t,";\n }\n .compact-orb {\n width: 32px !important; height: 32px !important;\n border-radius: 50% !important;\n }\n .compact-info { display: flex").concat(t,"; flex-direction: column").concat(t,"; gap: 2px").concat(t,"; }\n .compact-timer {\n display: flex").concat(t,"; align-items: center").concat(t,"; gap: 5px").concat(t,";\n font-size: 11px").concat(t,"; font-weight: 600").concat(t,"; color: #e8e4f0").concat(t,";\n }\n .compact-status {\n font-size: 10px").concat(t,"; color: rgba(255,255,255,0.4)").concat(t,";\n }\n .compact-controls { display: flex").concat(t,"; align-items: center").concat(t,"; gap: 6px").concat(t,"; }\n .compact-control-btn {\n width: 36px").concat(t,"; height: 36px").concat(t,"; min-width: 36px").concat(t,";\n border-radius: 50%").concat(t,"; border: none").concat(t,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n cursor: pointer").concat(t,"; transition: all 0.15s").concat(t,";\n position: relative").concat(t,";\n }\n .compact-control-btn svg { width: 16px").concat(t,"; height: 16px").concat(t,"; }\n .compact-control-btn .desktop-mic-off-icon,\n .compact-control-btn .desktop-speaker-off-icon {\n width: 16px").concat(t,"; height: 16px").concat(t,";\n }\n .compact-control-btn.secondary {\n background: rgba(255,255,255,0.08)").concat(t,"; color: rgba(255,255,255,0.5)").concat(t,";\n }\n .compact-control-btn.secondary:hover {\n background: rgba(255,255,255,0.14)").concat(t,"; color: rgba(255,255,255,0.7)").concat(t,";\n }\n .compact-control-btn.secondary.muted {\n background: rgba(239, 68, 68, 0.15)").concat(t,"; color: #ef4444").concat(t,";\n }\n .compact-control-btn.secondary.muted .desktop-mic-icon,\n .compact-control-btn.secondary.muted .desktop-speaker-icon {\n stroke: #ef4444").concat(t,";\n }\n .compact-control-btn.secondary.muted .desktop-mic-off-icon,\n .compact-control-btn.secondary.muted .desktop-speaker-off-icon {\n width: 16px").concat(t,"; height: 16px").concat(t,";\n }\n .compact-control-btn.danger {\n width: 40px").concat(t,"; height: 40px").concat(t,"; min-width: 40px").concat(t,";\n background: #ef4444").concat(t,"; color: #fff").concat(t,";\n box-shadow: 0 3px 10px rgba(239,68,68,0.35)").concat(t,";\n }\n .compact-control-btn.danger:hover {\n transform: scale(1.05)").concat(t,";\n box-shadow: 0 4px 14px rgba(239,68,68,0.45)").concat(t,";\n }\n .compact-control-btn.danger svg { width: 18px").concat(t,"; height: 18px").concat(t,"; overflow: visible").concat(t,"; }\n\n /* ── TRANSCRIPT ── */\n .ttp-transcript {\n margin: 0 16px 16px").concat(t,";\n padding: 12px 14px").concat(t,";\n background: ").concat(d,"24;\n border: 1px solid ").concat(d,"4d;\n border-radius: 12px").concat(t,";\n }\n .ttp-transcript-hdr {\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: space-between").concat(t,";\n margin-bottom: 7px").concat(t,";\n }\n .ttp-live-label {\n font-size: 10px").concat(t,"; color: ").concat(p,";\n text-transform: uppercase").concat(t,"; letter-spacing: 0.1em").concat(t,";\n font-weight: 600").concat(t,";\n }\n .ttp-toggle-text {\n font-size: 10px").concat(t,"; color: rgba(255,255,255,0.35)").concat(t,";\n cursor: pointer").concat(t,"; margin-left: auto").concat(t,"; margin-right: 8px").concat(t,";\n transition: color 0.2s").concat(t,";\n }\n .ttp-toggle-text:hover { color: ").concat(p,"; }\n .ttp-transcript-hdr { cursor: pointer").concat(t,"; }\n .ttp-dots { display: flex").concat(t,"; gap: 3px").concat(t,"; align-items: center").concat(t,"; }\n .ttp-dot {\n width: 3px").concat(t,"; height: 3px").concat(t,"; border-radius: 50%").concat(t,"; background: ").concat(p,";\n animation: ttp-pulse 0.8s ease-in-out infinite").concat(t,";\n }\n .ttp-dot:nth-child(2) { animation-delay: 0.2s").concat(t,"; }\n .ttp-dot:nth-child(3) { animation-delay: 0.4s").concat(t,"; }\n .ttp-transcript-text {\n font-size: 12px").concat(t,"; color: #e2e0f0").concat(t,"; line-height: 1.55").concat(t,";\n unicode-bidi: isolate").concat(t,";\n text-align: start").concat(t,";\n }\n .ttp-transcript-text .name { color: #c4b5fd").concat(t,"; font-weight: 600").concat(t,"; }\n .ttp-cursor {\n display: inline-block").concat(t,"; width: 2px").concat(t,"; height: 12px").concat(t,";\n background: ").concat(p,"; vertical-align: middle").concat(t,"; margin-inline-start: 2px").concat(t,";\n animation: ttp-blink 0.9s infinite").concat(t,";\n }\n\n /* Transcript collapsed/expanded state */\n .live-transcript-collapsed { display: block").concat(t,"; }\n .conversation-history { display: none").concat(t,"; }\n\n .ttp-transcript.expanded {\n flex: 1").concat(t,";\n display: flex").concat(t,";\n flex-direction: column").concat(t,";\n min-height: 0").concat(t,";\n overflow: hidden").concat(t,";\n }\n .ttp-transcript.expanded .live-transcript-collapsed { display: none").concat(t,"; }\n .ttp-transcript.expanded .conversation-history {\n display: flex").concat(t,";\n flex-direction: column").concat(t,";\n flex: 1").concat(t,";\n min-height: 0").concat(t,";\n overflow-y: auto").concat(t,";\n max-height: 260px").concat(t,";\n scrollbar-width: thin").concat(t,";\n scrollbar-color: ").concat(d,"4d transparent;\n }\n .ttp-transcript.expanded .conversation-history::-webkit-scrollbar { width: 4px").concat(t,"; }\n .ttp-transcript.expanded .conversation-history::-webkit-scrollbar-track { background: transparent").concat(t,"; }\n .ttp-transcript.expanded .conversation-history::-webkit-scrollbar-thumb {\n background: ").concat(d,"4d; border-radius: 2px").concat(t,";\n }\n\n /* Message rows in history */\n .conversation-messages { display: flex").concat(t,"; flex-direction: column").concat(t,"; gap: 8px").concat(t,"; padding-bottom: 4px").concat(t,"; }\n .message-row {\n display: flex").concat(t,"; align-items: flex-start").concat(t,"; gap: 8px").concat(t,";\n animation: ttp-msg-in 0.2s ease-out").concat(t,";\n }\n .message-row.user { flex-direction: row-reverse").concat(t,"; }\n .message-avatar {\n width: 26px").concat(t,"; height: 26px").concat(t,"; min-width: 26px").concat(t,";\n border-radius: 50%").concat(t,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n font-size: 10px").concat(t,"; font-weight: 600").concat(t,"; flex-shrink: 0").concat(t,";\n }\n .message-avatar.user {\n background: rgba(255,255,255,0.12)").concat(t,"; color: rgba(255,255,255,0.6)").concat(t,";\n }\n .message-avatar.assistant {\n background: linear-gradient(135deg, ").concat(o,", ").concat(i,");\n }\n .message-avatar .orb {\n width: 12px").concat(t,"; height: 12px").concat(t,"; border-radius: 50%").concat(t,";\n background: rgba(255,255,255,0.9)").concat(t,";\n }\n .message-bubble {\n padding: 8px 12px").concat(t,";\n border-radius: 12px").concat(t,";\n font-size: 12px").concat(t,"; line-height: 1.5").concat(t,";\n max-width: 80%").concat(t,"; word-wrap: break-word").concat(t,";\n unicode-bidi: plaintext").concat(t,";\n text-align: start").concat(t,";\n }\n .message-row.assistant .message-bubble {\n background: rgba(255,255,255,0.08)").concat(t,";\n color: #e2e0f0").concat(t,";\n border-bottom-left-radius: 4px").concat(t,";\n }\n .message-row.user .message-bubble {\n background: ").concat(d,"40;\n color: #e8e4f0").concat(t,";\n border-bottom-right-radius: 4px").concat(t,";\n }\n .live-message-row {\n display: flex").concat(t,"; align-items: flex-start").concat(t,"; gap: 8px").concat(t,";\n margin-top: 6px").concat(t,";\n }\n .live-message-row .message-bubble {\n position: relative").concat(t,";\n padding: 14px 12px 8px").concat(t,";\n border-radius: 12px").concat(t,";\n font-size: 12px").concat(t,"; line-height: 1.5").concat(t,";\n background: rgba(255,255,255,0.08)").concat(t,";\n color: #e2e0f0").concat(t,";\n max-width: 80%").concat(t,"; word-wrap: break-word").concat(t,";\n }\n .live-message-row .live-badge {\n position: absolute").concat(t,"; top: 0").concat(t,"; left: 10px").concat(t,";\n transform: translateY(-50%)").concat(t,";\n background: ").concat(d,"; color: #fff").concat(t,";\n font-size: 8px").concat(t,"; font-weight: 700").concat(t,";\n padding: 2px 6px").concat(t,"; border-radius: 4px").concat(t,";\n text-transform: uppercase").concat(t,"; letter-spacing: 0.05em").concat(t,";\n }\n .typing-cursor {\n display: inline-block").concat(t,"; width: 2px").concat(t,"; height: 12px").concat(t,";\n background: ").concat(p,"; vertical-align: middle").concat(t,"; margin-inline-start: 2px").concat(t,";\n animation: ttp-blink 0.9s infinite").concat(t,";\n }\n @keyframes ttp-msg-in {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n /* ── TYPE ROW ── */\n .ttp-type-row { display: flex").concat(t,"; gap: 8px").concat(t,"; padding: 0 16px 16px").concat(t,"; flex-wrap: wrap").concat(t,"; }\n .ttp-input {\n flex: 1").concat(t,"; padding: 9px 12px").concat(t,";\n background: rgba(255,255,255,0.05)").concat(t,";\n border: 1px solid rgba(255,255,255,0.09)").concat(t,";\n border-radius: 10px").concat(t,"; color: rgba(255,255,255,0.6)").concat(t,";\n font-size: 12px").concat(t,"; outline: none").concat(t,"; font-family: inherit").concat(t,";\n transition: border-color 0.2s").concat(t,";\n text-align: start").concat(t,";\n }\n .ttp-input::placeholder { color: rgba(255,255,255,0.25)").concat(t,"; }\n .ttp-input:focus { border-color: ").concat(d,"80; }\n .ttp-send-btn {\n width: 34px").concat(t,"; height: 34px").concat(t,"; border-radius: 9px").concat(t,";\n background: ").concat(B,"; border: none").concat(t,"; cursor: pointer").concat(t,";\n display: flex").concat(t,"; align-items: center").concat(t,"; justify-content: center").concat(t,";\n flex-shrink: 0").concat(t,"; transition: background 0.2s").concat(t,";\n }\n .ttp-send-btn:hover { background: ").concat(B,"; opacity: 0.85").concat(t,"; }\n\n /* ── KEYFRAMES ── */\n @keyframes ttp-pulse { 0%,100%{opacity:1} 50%{opacity:.3} }\n @keyframes ttp-blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }\n @keyframes ttp-ring { 0%,100%{transform:scale(1);opacity:.6} 50%{transform:scale(1.22);opacity:0} }\n @keyframes ttp-orb-breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }\n @keyframes ttp-wave { from{transform:scaleY(.15);opacity:.3} to{transform:scaleY(1);opacity:.9} }\n @keyframes ttp-pill-pulse { 0%,100%{box-shadow:0 0 0 0 ").concat(d,"80} 60%{box-shadow:0 0 0 7px ").concat(d,"00} }\n\n /* Mobile Voice Call UI - Shared styles (also used in generateMobileCSS) */\n ").concat(this._getSharedMobileCSS(t),"\n\n ")}_getSharedMobileCSS(t){var e=this.config,n=e.avatarGradient1||"#6d56f5",A=e.avatarGradient2||"#a78bfa",o=e.pillGradient||"linear-gradient(135deg, #581c87, #312e81, #1e1b4b)",i=e.primaryBtnGradient1||e.startCallButtonColor||"#6d56f5",r=e.primaryBtnGradient2||e.startCallButtonColor||"#9d8df8",a=e.sendButtonColor||i,s=e.endCallButtonColor||"#ef4444",c="linear-gradient(135deg, ".concat(a,", ").concat(r,")");return"\n /* Mobile voice idle: optional header image replaces 🤖 */\n .mobile-voice-interface #voiceIdleState .voice-avatar {\n width: 80px".concat(t,";\n height: 80px").concat(t,";\n margin: 12px auto 16px").concat(t,";\n border-radius: 50%").concat(t,";\n background: linear-gradient(135deg, ").concat(n,", ").concat(A,")").concat(t,";\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: center").concat(t,";\n font-size: 40px").concat(t,";\n line-height: 1").concat(t,";\n flex-shrink: 0").concat(t,";\n }\n .mobile-voice-interface #voiceIdleState .voice-avatar.voice-avatar--image {\n padding: 0").concat(t,";\n overflow: hidden").concat(t,";\n }\n .mobile-voice-interface #voiceIdleState .voice-avatar-img {\n width: 100%").concat(t,";\n height: 100%").concat(t,";\n object-fit: cover").concat(t,";\n border-radius: 50%").concat(t,";\n display: block").concat(t,";\n }\n\n /* Idle hero copy: light text on dark / gradient panels (host themes often force dark body color) */\n .mobile-voice-interface #voiceIdleState .voice-status {\n text-align: center").concat(t,";\n }\n .mobile-voice-interface #voiceIdleState .voice-status-title {\n color: rgba(255,255,255,0.96)").concat(t,";\n }\n .mobile-voice-interface #voiceIdleState .voice-status-subtitle {\n color: rgba(255,255,255,0.78)").concat(t,";\n }\n\n .mobile-duration-dot {\ndisplay: block !important;\n width: 6px").concat(t,";\n height: 6px").concat(t,";\n border-radius: 50%").concat(t,";\n background-color: #ef4444").concat(t,";\n animation: mobilePulse 1.5s ease-in-out infinite").concat(t,";\n }\n\n @keyframes mobilePulse {\n 0%, 100% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.5; transform: scale(0.95); }\n }\n\n .mobile-voice-bar {\n display: flex").concat(t,";\n flex-direction: column").concat(t,";\n gap: 10px").concat(t,";\n padding: 14px").concat(t,";\n position: relative").concat(t,";\n background: ").concat(o).concat(t,";\n border-radius: 24px 24px 0 0").concat(t,";\n box-shadow:\n 0 -8px 32px rgba(0, 0, 0, 0.3),\n 0 -2px 8px rgba(0, 0, 0, 0.35),\n inset 0 1px 0 rgba(255, 255, 255, 0.1)").concat(t,";\n width: 100% !important;\n max-width: 100% !important;\n pointer-events: auto").concat(t,";\n overflow: hidden !important;\n margin: 0 !important;\n }\n\n .mobile-top-row {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: space-between").concat(t,";\n position: relative").concat(t,";\n }\n\n .mobile-status-indicator {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n gap: 5px").concat(t,";\n min-width: 85px").concat(t,";\n }\n\n .mobile-status-dot {\ndisplay: block !important;\n width: 7px").concat(t,";\n height: 7px").concat(t,";\n border-radius: 50%").concat(t,";\n background-color: #22c55e").concat(t,";\n box-shadow: 0 0 8px #22c55e").concat(t,";\n transition: all 0.3s ease").concat(t,";\n }\n\n .mobile-status-text {\n font-size: 11px").concat(t,";\n font-weight: 700").concat(t,";\n color: rgba(255,255,255,0.95)").concat(t,";\n text-transform: uppercase").concat(t,";\n letter-spacing: 0.3px").concat(t,";\n }\n\n .mobile-waveform-center {\n position: absolute !important;\n left: 50% !important;\n transform: translateX(-50%) !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 3px !important;\n height: 24px !important;\n visibility: visible !important;\n }\n\n .mobile-waveform-bars {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 3px !important;\n }\n\n .mobile-waveform-bar {\n display: block !important;\n width: 4px !important;\n min-height: 4px !important;\n background-color: #fff !important;\n border-radius: 2px !important;\n transition: height 0.12s ease-out !important;\n box-shadow: 0 0 8px rgba(255,255,255,0.5) !important;\n visibility: visible !important;\n }\n\n .mobile-controls {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n gap: 6px").concat(t,";\n pointer-events: auto").concat(t,";\n touch-action: manipulation").concat(t,";\n position: relative").concat(t,";\n z-index: 120").concat(t,";\n }\n\n .mobile-control-btn {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: center").concat(t,";\n width: 32px").concat(t,";\n height: 32px").concat(t,";\n min-width: 32px").concat(t,";\n min-height: 32px").concat(t,";\n max-width: 32px").concat(t,";\n max-height: 32px").concat(t,";\n border-radius: 50%").concat(t,";\n border: none").concat(t,";\n cursor: pointer").concat(t,";\n transition: all 0.2s ease").concat(t,";\n background-color: rgba(255,255,255,0.15)").concat(t,";\n position: relative").concat(t,";\n overflow: hidden").concat(t,";\n padding: 0").concat(t,";\n margin: 0").concat(t,";\n box-sizing: border-box").concat(t,";\n }\n\n .mobile-control-btn:hover {\n background-color: rgba(255,255,255,0.25)").concat(t,";\n }\n\n .mobile-control-btn.muted {\n background-color: rgba(239, 68, 68, 0.3)").concat(t,";\n }\n\n .mobile-control-btn .mobile-mic-icon,\n .mobile-control-btn .mobile-speaker-icon {\n position: absolute").concat(t,";\n top: 50%").concat(t,";\n left: 50%").concat(t,";\n transform: translate(-50%, -50%)").concat(t,";\n display: block").concat(t,";\n visibility: visible").concat(t,";\n opacity: 1").concat(t,";\n width: 15px").concat(t,";\n height: 15px").concat(t,";\n margin: 0").concat(t,";\n padding: 0").concat(t,";\n }\n\n .mobile-control-btn .mobile-mic-off-icon,\n .mobile-control-btn .mobile-speaker-off-icon {\n position: absolute").concat(t,";\n top: 50%").concat(t,";\n left: 50%").concat(t,";\n transform: translate(-50%, -50%)").concat(t,";\n width: 15px").concat(t,";\n height: 15px").concat(t,";\n margin: 0").concat(t,";\n padding: 0").concat(t,";\n }\n\n .mobile-control-btn:not(.muted) .mobile-mic-off-icon,\n .mobile-control-btn:not(.muted) .mobile-speaker-off-icon {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n }\n\n .mobile-control-btn.muted .mobile-mic-icon,\n .mobile-control-btn.muted .mobile-speaker-icon {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n }\n\n .mobile-control-btn.muted .mobile-mic-off-icon,\n .mobile-control-btn.muted .mobile-speaker-off-icon {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n }\n\n .mobile-end-call-btn {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: center").concat(t,";\n width: 36px").concat(t,";\n height: 36px").concat(t,";\n min-width: 36px").concat(t,";\n min-height: 36px").concat(t,";\n max-width: 36px").concat(t,";\n max-height: 36px").concat(t,";\n border-radius: 50%").concat(t,";\n border: none").concat(t,";\n cursor: pointer").concat(t,";\n background-color: ").concat(s).concat(t,";\n box-shadow: 0 4px 14px ").concat(s,"80").concat(t,";\n transition: all 0.2s ease").concat(t,";\n overflow: hidden").concat(t,";\n padding: 0").concat(t,";\n margin: 0").concat(t,";\n box-sizing: border-box").concat(t,";\n }\n\n .mobile-end-call-btn svg {\n display: block").concat(t,";\n visibility: visible").concat(t,";\n opacity: 1").concat(t,";\n width: 15px").concat(t,";\n height: 15px").concat(t,";\n margin: 0").concat(t,";\n padding: 0").concat(t,";\n position: relative").concat(t,";\n }\n\n /* ID-specific selectors for WordPress/Shopify compatibility */\n #mobileMuteBtn.mobile-control-btn,\n #mobileSpeakerBtn.mobile-control-btn,\n #mobileEndCallBtn.mobile-end-call-btn {\n border-radius: 50% !important;\n overflow: hidden !important;\n pointer-events: auto !important;\n touch-action: manipulation !important;\n -webkit-appearance: none !important;\n appearance: none !important;\n text-decoration: none !important;\n line-height: 1 !important;\n font-size: 0 !important;\n letter-spacing: 0 !important;\n text-indent: 0 !important;\n text-transform: none !important;\n color: transparent !important;\n }\n\n #mobileMuteBtn.mobile-control-btn,\n #mobileSpeakerBtn.mobile-control-btn {\n width: 32px !important;\n height: 32px !important;\n min-width: 32px !important;\n min-height: 32px !important;\n max-width: 32px !important;\n max-height: 32px !important;\n }\n\n #mobileEndCallBtn.mobile-end-call-btn {\n width: 36px !important;\n height: 36px !important;\n min-width: 36px !important;\n min-height: 36px !important;\n max-width: 36px !important;\n max-height: 36px !important;\n }\n\n #mobileMuteBtn.mobile-control-btn .mobile-mic-icon,\n #mobileMuteBtn.mobile-control-btn .mobile-mic-off-icon,\n #mobileSpeakerBtn.mobile-control-btn .mobile-speaker-icon,\n #mobileSpeakerBtn.mobile-control-btn .mobile-speaker-off-icon,\n #mobileEndCallBtn.mobile-end-call-btn svg {\n width: 15px !important;\n height: 15px !important;\n max-width: 15px !important;\n max-height: 15px !important;\n margin: 0 !important;\n padding: 0 !important;\n pointer-events: none !important;\n overflow: visible !important;\n }\n\n #mobile-voice-call-bar-container svg path,\n #mobile-voice-call-bar-container svg line,\n #mobile-voice-call-bar-container svg polygon,\n #mobile-voice-call-bar-container svg circle {\n pointer-events: none !important;\n vector-effect: none !important;\n }\n\n .mobile-end-call-btn:hover {\n transform: scale(1.05)").concat(t,";\n }\n\n .mobile-transcript-row {\n width: 100%").concat(t,";\n display: flex").concat(t,";\n flex-direction: column").concat(t,";\n gap: 6px").concat(t,";\n padding: 10px 12px").concat(t,";\n background: rgba(255,255,255,0.18)").concat(t,";\n border-radius: 14px").concat(t,";\n border: none").concat(t,";\n cursor: pointer").concat(t,";\n text-align: start").concat(t,";\n backdrop-filter: blur(4px)").concat(t,";\n transition: background 0.2s ease").concat(t,";\n pointer-events: auto !important;\n position: relative !important;\n z-index: 100 !important;\n }\n\n .mobile-transcript-row:hover {\n background: rgba(255,255,255,0.25)").concat(t,";\n }\n\n .mobile-transcript-text {\n margin: 0").concat(t,";\n font-size: 13px").concat(t,";\n color: #fff").concat(t,";\n line-height: 1.4").concat(t,";\n font-weight: 500").concat(t,";\n unicode-bidi: plaintext").concat(t,";\n text-align: start").concat(t,";\n display: -webkit-box !important;\n -webkit-line-clamp: 2 !important;\n -webkit-box-orient: vertical !important;\n overflow: hidden !important;\n min-height: 2.8em !important;\n }\n\n .mobile-transcript-footer {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: space-between").concat(t,";\n }\n\n .mobile-expand-hint {\n font-size: 10px").concat(t,";\n color: rgba(255,255,255,0.6)").concat(t,";\n text-transform: uppercase").concat(t,";\n letter-spacing: 0.5px").concat(t,";\n font-weight: 600").concat(t,";\n }\n\n /* Base: hidden. Inline display:none loses to display:flex!important — use modifier for open state */\n .mobile-transcript-overlay {\n position: fixed").concat(t,";\n top: 0").concat(t,";\n left: 0").concat(t,";\n right: 0").concat(t,";\n bottom: 0").concat(t,";\n background-color: rgba(0,0,0,0.6)").concat(t,";\n display: none").concat(t,";\n padding: 12px").concat(t,";\n z-index: 2147483647").concat(t,";\n pointer-events: auto").concat(t,";\n }\n\n .mobile-transcript-overlay.mobile-transcript-overlay--open {\n display: flex").concat(t,";\n align-items: flex-end").concat(t,";\n }\n\n .mobile-expanded-transcript {\n width: 100%").concat(t,";\n max-height: 75%").concat(t,";\n background: #fff").concat(t,";\n border-radius: 24px 24px 16px 16px").concat(t,";\n overflow: hidden").concat(t,";\n box-shadow: 0 -8px 40px rgba(0,0,0,0.3)").concat(t,";\n display: flex").concat(t,";\n flex-direction: column").concat(t,";\n }\n\n .mobile-transcript-header {\n display: flex").concat(t,";\n justify-content: space-between").concat(t,";\n align-items: center").concat(t,";\n padding: 14px 16px").concat(t,";\n background: ").concat(o).concat(t,";\n flex-shrink: 0").concat(t,";\n }\n\n .mobile-header-left {\n display: flex").concat(t,";\n flex-direction: column").concat(t,";\n gap: 2px").concat(t,";\n }\n\n .mobile-header-status {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n gap: 6px").concat(t,";\n }\n\n .mobile-header-status-dot {\ndisplay: block !important;\n width: 6px").concat(t,";\n height: 6px").concat(t,";\n border-radius: 50%").concat(t,";\n background-color: #22c55e").concat(t,";\n box-shadow: 0 0 6px #22c55e").concat(t,";\n }\n\n .mobile-header-status-text {\n font-size: 10px").concat(t,";\n font-weight: 700").concat(t,";\n color: rgba(255,255,255,0.9)").concat(t,";\n text-transform: uppercase").concat(t,";\n letter-spacing: 0.5px").concat(t,";\n }\n\n .mobile-header-duration {\n font-size: 10px").concat(t,";\n font-weight: 600").concat(t,";\n color: rgba(255,255,255,0.7)").concat(t,";\n margin-left: 8px").concat(t,";\n }\n\n .mobile-transcript-label {\n font-size: 11px").concat(t,";\n font-weight: 800").concat(t,";\n color: rgba(255,255,255,0.7)").concat(t,";\n letter-spacing: 1px").concat(t,";\n }\n\n .mobile-close-transcript-btn {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: center").concat(t,";\n width: 32px").concat(t,";\n height: 32px").concat(t,";\n border-radius: 50%").concat(t,";\n border: none").concat(t,";\n background: rgba(255,255,255,0.2)").concat(t,";\n color: #fff").concat(t,";\n cursor: pointer").concat(t,";\n }\n\n .mobile-close-transcript-btn:hover {\n background: rgba(255,255,255,0.3)").concat(t,";\n }\n\n .mobile-messages-container {\n flex: 1").concat(t,";\n padding: 16px").concat(t,";\n overflow-y: auto").concat(t,";\n display: flex").concat(t,";\n flex-direction: column").concat(t,";\n gap: 12px").concat(t,";\n }\n\n .mobile-message-bubble {\n max-width: 85%").concat(t,";\n padding: 12px 16px").concat(t,";\n border-radius: 18px").concat(t,";\n font-size: 14px").concat(t,";\n line-height: 1.5").concat(t,";\n word-wrap: break-word").concat(t,";\n unicode-bidi: plaintext").concat(t,";\n text-align: start").concat(t,";\n }\n\n .mobile-message-bubble.assistant {\n align-self: flex-start").concat(t,";\n background-color: #f3f4f6").concat(t,";\n color: #374151").concat(t,";\n border-bottom-left-radius: 4px").concat(t,";\n }\n\n .mobile-message-bubble.user {\n align-self: flex-end").concat(t,";\n background: ").concat(c).concat(t,";\n color: #fff").concat(t,";\n border-bottom-right-radius: 4px").concat(t,";\n }\n\n .mobile-input-area {\n padding: 12px 16px 16px").concat(t,";\n border-top: 1px solid #e5e7eb").concat(t,";\n background: #f9fafb").concat(t,";\n flex-shrink: 0").concat(t,";\n }\n\n .mobile-input-wrapper {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n gap: 8px").concat(t,";\n padding: 4px 4px 4px 16px").concat(t,";\n background: #fff").concat(t,";\n border-radius: 24px").concat(t,";\n border: 2px solid #e5e7eb").concat(t,";\n }\n\n .mobile-text-input {\n flex: 1").concat(t,";\n border: none").concat(t,";\n outline: none").concat(t,";\n font-size: 14px").concat(t,";\n color: #374151").concat(t,";\n background: transparent").concat(t,";\n padding: 10px 0").concat(t,";\n text-align: start").concat(t,";\n }\n\n .mobile-text-input::placeholder {\n color: #9ca3af").concat(t,";\n }\n\n .mobile-send-btn {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: center").concat(t,";\n width: 40px").concat(t,";\n height: 40px").concat(t,";\n border-radius: 50%").concat(t,";\n border: none").concat(t,";\n background: ").concat(c).concat(t,";\n color: #fff").concat(t,";\n cursor: pointer").concat(t,";\n transition: all 0.2s ease").concat(t,";\n }\n\n .mobile-send-btn:hover:not(:disabled) {\n transform: scale(1.05)").concat(t,";\n }\n\n .mobile-send-btn:disabled {\n opacity: 0.5").concat(t,";\n cursor: not-allowed").concat(t,";\n }\n\n .mobile-input-hint {\n margin: 8px 0 0").concat(t,";\n font-size: 11px").concat(t,";\n color: #9ca3af").concat(t,";\n text-align: center").concat(t,";\n transition: color 0.2s ease").concat(t,";\n }\n\n /* Mobile text input status states */\n .mobile-input-hint--sending {\n color: #666").concat(t,";\n }\n\n .mobile-input-hint--success {\n color: #28a745").concat(t,";\n }\n\n .mobile-input-hint--queued {\n color: #ffc107").concat(t,";\n }\n\n .mobile-input-hint--error {\n color: #dc3545").concat(t,";\n }\n\n /* Disabled mobile input styling */\n #mobileTextInput:disabled {\n background-color: #f5f5f5").concat(t,";\n cursor: not-allowed").concat(t,";\n }\n\n #mobileSendBtn:disabled {\n opacity: 0.5").concat(t,";\n cursor: not-allowed").concat(t,";\n }\n ")}generateMobileCSS(){var t=" !important";return"\n /* Mobile Voice Call UI - Container positioning */\n #mobile-voice-call-bar-container {\n position: fixed !important;\n bottom: 0 !important;\n left: 0 !important;\n right: 0 !important;\n z-index: 99999 !important;\n font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;\n padding: 0 12px 12px !important;\n pointer-events: none".concat(t,";\n box-sizing: border-box !important;\n width: 100% !important;\n max-width: 100vw !important;\n margin: 0 !important;\n overflow: visible !important;\n isolation: isolate !important;\n }\n\n #mobile-voice-call-bar-container *,\n #mobile-voice-call-bar-container *::before,\n #mobile-voice-call-bar-container *::after {\n box-sizing: border-box !important;\n }\n\n /* Mobile loading: small spinner in waveform area until first audio */\n .mobile-waveform-spinner {\n position: absolute !important;\n left: 50% !important;\n top: 50% !important;\n transform: translate(-50%, -50%) !important;\n width: 16px !important;\n height: 16px !important;\n }\n\n .mobile-waveform-spinner-inner {\n width: 100% !important;\n height: 100% !important;\n border: 2px solid rgba(255,255,255,0.3) !important;\n border-top-color: #fff !important;\n border-radius: 50% !important;\n animation: mobileLoadingSpin 0.8s linear infinite !important;\n }\n\n .mobile-waveform-spinner--hidden {\n display: none !important;\n }\n\n @keyframes mobileLoadingSpin {\n to { transform: rotate(360deg); }\n }\n\n .mobile-waveform-bars--hidden {\n visibility: hidden !important;\n opacity: 0 !important;\n }\n\n .mobile-duration-badge--hidden {\n visibility: hidden !important;\n opacity: 0 !important;\n pointer-events: none !important;\n }\n\n .mobile-duration-badge {\n position: absolute !important;\n top: -28px !important;\n left: 50% !important;\n transform: translateX(-50%) !important;\n display: flex !important;\n align-items: center !important;\n gap: 6px !important;\n padding: 5px 14px !important;\n background: rgba(0,0,0,0.75) !important;\n border-radius: 20px !important;\n font-size: 12px !important;\n font-weight: 700 !important;\n color: #fff !important;\n backdrop-filter: blur(8px) !important;\n -webkit-backdrop-filter: blur(8px) !important;\n z-index: 10 !important;\n pointer-events: auto !important;\n visibility: visible !important;\n opacity: 1 !important;\n }\n\n /* Fly-to-cart target: invisible anchor for animation when cart row is hidden */\n .ttp-fly-target {\n position: absolute").concat(t,";\n bottom: 14px").concat(t,";\n left: 30px").concat(t,";\n width: 24px").concat(t,";\n height: 24px").concat(t,";\n pointer-events: none").concat(t,";\n }\n\n /* ── Mobile Cart Row ── */\n\n .mobile-cart-row {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n justify-content: space-between").concat(t,";\n padding: 7px 16px").concat(t,";\n background: rgba(255, 255, 255, 0.08)").concat(t,";\n border-top: 1px solid rgba(255, 255, 255, 0.1)").concat(t,";\n border-radius: 0 0 16px 16px").concat(t,";\n animation: mobileCartRowIn 0.25s ease-out").concat(t,";\n pointer-events: auto").concat(t,";\n }\n\n @keyframes mobileCartRowIn {\n from { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }\n to { opacity: 1; max-height: 50px; padding-top: 7px; padding-bottom: 7px; }\n }\n\n .mobile-cart-row__content {\n display: flex").concat(t,";\n align-items: center").concat(t,";\n gap: 8px").concat(t,";\n }\n\n .mobile-cart-row__icon {\n font-size: 13px").concat(t,";\n }\n\n .mobile-cart-row__text {\n font-size: 12px").concat(t,";\n font-weight: 600").concat(t,";\n color: rgba(255, 255, 255, 0.9)").concat(t,";\n letter-spacing: 0.2px").concat(t,";\n }\n\n /* Shared mobile styles */\n ").concat(this._getSharedMobileCSS(t),"\n ")}}class ve{constructor(t){this.voiceInterface=t,this.config=t.config,this.conversationMessages=[],this.currentLiveMessage=null}t(t){return this.voiceInterface.t(t)}escapeHtml(t){return this.voiceInterface.escapeHtml(t)}updateTranscript(t){console.log("📝 [TRANSCRIPT] updateTranscript() called with text:",t?t.substring(0,50)+"...":"null/empty");var e=document.getElementById("mobile-voice-call-bar-container");if(e){var n=e.querySelector("#mobileTranscriptText");n&&(n.textContent=t,n.style.color=""),this.voiceInterface.messages.length>0&&"assistant"===this.voiceInterface.messages[this.voiceInterface.messages.length-1].type?this.voiceInterface.messages[this.voiceInterface.messages.length-1].text=t:this.voiceInterface.messages.push({type:"assistant",text:t});var A=e.querySelector("#mobileMessagesContainer");if(A){var o=A.querySelector(".mobile-message-bubble.assistant:last-child");o?o.textContent=t:this.voiceInterface.addMobileMessage("assistant",t)}}else{var i=this.voiceInterface.shadowRoot.getElementById("liveTextCollapsed");if(i)if(i.style.color="",t&&t.trim()){i.textContent=t,i.classList.remove("muted");var r=document.createElement("span");r.className="typing-cursor",i.appendChild(r)}else i.textContent=this.t("transcriptWillAppear")||"Transcript will appear here...",i.classList.add("muted");if(t&&t.trim()?(this.currentLiveMessage&&"assistant"===this.currentLiveMessage.role&&t.startsWith(this.currentLiveMessage.content)?this.currentLiveMessage.content=t:(this.currentLiveMessage&&this.finalizeLiveMessage(),this.currentLiveMessage={role:"assistant",content:t}),this.updateLiveMessageRow()):(this.currentLiveMessage=null,this.updateLiveMessageRow()),this.voiceInterface.conversationExpanded){var a=this.voiceInterface.shadowRoot.getElementById("conversationHistory");a&&setTimeout(()=>{a.scrollTop=a.scrollHeight},10)}}}toggleConversationPanel(){if(!this.voiceInterface.isMobile){this.voiceInterface.conversationExpanded=!this.voiceInterface.conversationExpanded;var t,e=this.voiceInterface.shadowRoot.getElementById("desktopConversationPanel"),n=this.voiceInterface.shadowRoot.getElementById("conversationHeader"),A=this.voiceInterface.shadowRoot.getElementById("conversationToggleText"),o=this.voiceInterface.shadowRoot.getElementById("desktopVoiceSection"),i=this.voiceInterface.shadowRoot.getElementById("compactVoiceSection");e&&(this.voiceInterface.conversationExpanded?(e.classList.remove("collapsed"),e.classList.add("expanded"),n&&n.classList.add("expanded"),A&&(A.textContent="Hide history"),o&&(o.style.display="none"),i&&(i.style.display="flex"),console.log("📝 [TRANSCRIPT] Expanding panel, rendering",(null===(t=this.conversationMessages)||void 0===t?void 0:t.length)||0,"messages"),this.renderConversationMessages()):(e.classList.remove("expanded"),e.classList.add("collapsed"),n&&n.classList.remove("expanded"),A&&(A.textContent="Show history"),o&&(o.style.display=""),i&&(i.style.display="none")))}}finalizeLiveMessage(){this.currentLiveMessage&&this.currentLiveMessage.content&&this.currentLiveMessage.content.trim()&&(this.conversationMessages||(this.conversationMessages=[]),this.conversationMessages.push({role:this.currentLiveMessage.role,content:this.currentLiveMessage.content}),console.log("📝 [TRANSCRIPT] Finalized live message:",this.currentLiveMessage.role,this.currentLiveMessage.content.substring(0,50)+"..."),this.currentLiveMessage=null,this.voiceInterface.conversationExpanded&&this.renderConversationMessages())}addConversationMessage(t,e){if(!this.voiceInterface.isMobile&&e&&e.trim()){if(this.currentLiveMessage&&this.finalizeLiveMessage(),this.conversationMessages||(this.conversationMessages=[]),"user"!==t)return this.currentLiveMessage={role:t,content:e},this.updateLiveMessageRow(),void console.log("📝 [TRANSCRIPT] Assistant message set as live (via addConversationMessage)");this.conversationMessages.push({role:t,content:e}),console.log("📝 [TRANSCRIPT] User message added to history"),this.voiceInterface.conversationExpanded&&this.renderConversationMessages()}}updateLiveMessageRow(){var t=this.voiceInterface.shadowRoot.getElementById("liveMessageRow"),e=this.voiceInterface.shadowRoot.getElementById("liveMessageText"),n=null==t?void 0:t.querySelector(".message-avatar");if(t&&e)if(this.currentLiveMessage&&this.currentLiveMessage.content&&this.currentLiveMessage.content.trim()){n&&("user"===this.currentLiveMessage.role?(n.textContent="U",n.className="message-avatar user"):(n.innerHTML='<div class="orb"></div>',n.className="message-avatar assistant")),e.textContent=this.currentLiveMessage.content,t.style.display="flex";var A=e.querySelector(".typing-cursor")||document.createElement("span");A.className="typing-cursor",e.querySelector(".typing-cursor")||e.appendChild(A)}else t.style.display="none"}clearConversationMessages(){this.conversationMessages=[],this.currentLiveMessage=null;var t=this.voiceInterface.shadowRoot.getElementById("liveMessageRow");t&&(t.style.display="none")}renderConversationMessages(){var t=this.voiceInterface.shadowRoot.getElementById("conversationMessages");if(t){if(!this.conversationMessages||0===this.conversationMessages.length)return console.log("📝 [TRANSCRIPT] No messages to render"),void(t.innerHTML="");var e=[...this.conversationMessages];if(this.currentLiveMessage&&e.length>0){var n=e[e.length-1];n.role===this.currentLiveMessage.role&&n.content===this.currentLiveMessage.content&&(e=e.slice(0,-1))}var A="rtl"===this.config.direction?"rtl":"ltr";console.log("📝 [TRANSCRIPT] Rendering",e.length,"messages (live message excluded)"),t.innerHTML=e.map(t=>{var e="user"===t.role;return'\n <div class="message-row '.concat(t.role,'">\n <div class="message-avatar ').concat(t.role,'">\n ').concat(e?"U":'<div class="orb"></div>','\n </div>\n <div class="message-bubble" dir="').concat(A,'">').concat(this.escapeHtml(t.content),"</div>\n </div>\n ")}).join("");var o=this.voiceInterface.shadowRoot.getElementById("conversationHistory");o&&setTimeout(()=>{o.scrollTop=o.scrollHeight},10)}else console.warn("📝 [TRANSCRIPT] conversationMessages container not found")}}class fe{constructor(t){this.voiceInterface=t,this.config=t.config,this.shadowRoot=t.shadowRoot,this._textInjectTimeout=null,this._mobileTextInjectTimeout=null,this._statusClearTimeout=null,this._mobileStatusClearTimeout=null,this._originalHintText=null,this._originalMobileHintText=null,this._textInjectAckHandler=null}t(t){return this.voiceInterface.t(t)}setupTextInjectAckHandler(){var t;null!==(t=this.voiceInterface.sdk)&&void 0!==t&&t.voiceSDK&&(this._textInjectAckHandler&&this.voiceInterface.sdk.voiceSDK.off("textInjectAck",this._textInjectAckHandler),this._textInjectAckHandler=t=>{this.handleTextInjectAck(t)},this.voiceInterface.sdk.voiceSDK.on("textInjectAck",this._textInjectAckHandler))}cleanup(){this._textInjectTimeout&&(clearTimeout(this._textInjectTimeout),this._textInjectTimeout=null),this._mobileTextInjectTimeout&&(clearTimeout(this._mobileTextInjectTimeout),this._mobileTextInjectTimeout=null),this._statusClearTimeout&&(clearTimeout(this._statusClearTimeout),this._statusClearTimeout=null),this._mobileStatusClearTimeout&&(clearTimeout(this._mobileStatusClearTimeout),this._mobileStatusClearTimeout=null),this._originalHintText=null,this._originalMobileHintText=null}handleTextInjectAck(t){var e,n;this._textInjectTimeout&&(clearTimeout(this._textInjectTimeout),this._textInjectTimeout=null),this._mobileTextInjectTimeout&&(clearTimeout(this._mobileTextInjectTimeout),this._mobileTextInjectTimeout=null);var A=this.shadowRoot.getElementById("voiceTextInput"),o=this.shadowRoot.getElementById("voiceSendBtn");A&&(A.disabled=!1),o&&(o.disabled=!(null!=A&&null!==(e=A.value)&&void 0!==e&&e.trim()));var i=document.getElementById("mobileTextInput"),r=document.getElementById("mobileSendBtn");if(i&&(i.disabled=!1),r&&(r.disabled=!(null!=i&&null!==(n=i.value)&&void 0!==n&&n.trim())),t.success){var a,s=null===(a=t.message)||void 0===a?void 0:a.toLowerCase().includes("queued"),c=s?"queued":"success",l=s?"Message queued":"Message sent";this.voiceInterface.isMobile?this.showMobileTextInputStatus(c,l):this.showDesktopTextInputStatus(c,l)}else{var d=t.message||"Failed to send";this.voiceInterface.isMobile?this.showMobileTextInputStatus("error",d):this.showDesktopTextInputStatus("error",d)}}sendDesktopTextMessage(){var t=this.shadowRoot.getElementById("voiceTextInput"),e=this.shadowRoot.getElementById("voiceSendBtn");if(t&&e){var n=t.value.trim();n&&this._sendTextMessage(n,t,e,!1)}else console.warn("VoiceInterface: Missing UI elements for desktop text send")}sendMobileTextMessage(){var t=document.getElementById("mobile-voice-call-bar-container"),e=null==t?void 0:t.querySelector("#mobileTextInput"),n=null==t?void 0:t.querySelector("#mobileSendBtn");e&&n?this._sendTextMessage(e.value.trim(),e,n,!0):console.warn("VoiceInterface: Missing UI elements for mobile text send")}_sendTextMessage(t,e,n,A){var o;if(this.voiceInterface.isActive&&null!==(o=this.voiceInterface.sdk)&&void 0!==o&&o.voiceSDK){var i=null==t?void 0:t.trim();if(i){e.value="",n&&(n.disabled=!0);try{var r=this.voiceInterface.sdk.voiceSDK;null!=r&&r.stopAudioPlayback&&r.stopAudioPlayback()}catch(t){}this.showTextInputStatus(A?"mobile":"desktop","sending","Sending...");try{if(this.voiceInterface.sdk.voiceSDK.sendMessage({t:"text_inject",text:i})){var a=setTimeout(()=>{A?this._mobileTextInjectTimeout=null:this._textInjectTimeout=null,e.disabled=!1,n&&(n.disabled=!1),this.showTextInputStatus(A?"mobile":"desktop","error","No response")},5e3);A?this._mobileTextInjectTimeout=a:this._textInjectTimeout=a,A?this.voiceInterface.addMobileMessage("user",i):this.voiceInterface.addConversationMessage("user",i)}else e.disabled=!1,n&&(n.disabled=!1),this.showTextInputStatus(A?"mobile":"desktop","error","Failed to send")}catch(t){console.error("Error sending text message:",t),e.disabled=!1,n&&(n.disabled=!1),this.showTextInputStatus(A?"mobile":"desktop","error","Error sending")}}else this.showTextInputStatus(A?"mobile":"desktop","error","Enter text first")}else console.warn("VoiceInterface: Cannot send text - call not active")}showTextInputStatus(t,e,n){"mobile"===t?this.showMobileTextInputStatus(e,n):this.showDesktopTextInputStatus(e,n)}showDesktopTextInputStatus(t,e){var n=this.shadowRoot.querySelector(".voice-input-hint");n&&(this._originalHintText||(this._originalHintText=n.textContent),n.classList.remove("voice-input-hint--sending","voice-input-hint--success","voice-input-hint--queued","voice-input-hint--error"),"sending"===t?(n.classList.add("voice-input-hint--sending"),n.textContent=e||"Sending..."):"success"===t?(n.classList.add("voice-input-hint--success"),n.textContent=e||"Sent",this.clearTextInputStatusAfterDelay(3e3)):"queued"===t?(n.classList.add("voice-input-hint--queued"),n.textContent=e||"Queued"):"error"===t?(n.classList.add("voice-input-hint--error"),n.textContent=e||"Error",this.clearTextInputStatusAfterDelay(3e3)):"clear"===t&&(n.textContent=this._originalHintText||this.t("voiceActive")||"Voice is still active • Type or speak",this._originalHintText=null))}showMobileTextInputStatus(t,e){var n=document.querySelector(".mobile-input-hint");n&&(this._originalMobileHintText||(this._originalMobileHintText=n.textContent),n.classList.remove("mobile-input-hint--sending","mobile-input-hint--success","mobile-input-hint--queued","mobile-input-hint--error"),"sending"===t?(n.classList.add("mobile-input-hint--sending"),n.textContent=e||"Sending..."):"success"===t?(n.classList.add("mobile-input-hint--success"),n.textContent=e||"Sent",this.clearMobileTextInputStatusAfterDelay(3e3)):"queued"===t?(n.classList.add("mobile-input-hint--queued"),n.textContent=e||"Queued"):"error"===t?(n.classList.add("mobile-input-hint--error"),n.textContent=e||"Error",this.clearMobileTextInputStatusAfterDelay(3e3)):"clear"===t&&(n.textContent=this._originalMobileHintText||"🎙️ Voice is still active • Type or speak",this._originalMobileHintText=null))}clearTextInputStatusAfterDelay(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;this._statusClearTimeout&&clearTimeout(this._statusClearTimeout),this._statusClearTimeout=setTimeout(()=>{this.showDesktopTextInputStatus("clear"),this._statusClearTimeout=null},t)}clearMobileTextInputStatusAfterDelay(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;this._mobileStatusClearTimeout&&clearTimeout(this._mobileStatusClearTimeout),this._mobileStatusClearTimeout=setTimeout(()=>{this.showMobileTextInputStatus("clear"),this._mobileStatusClearTimeout=null},t)}}class we{constructor(t){this.voiceInterface=t,this.config=t.config,this.shadowRoot=t.shadowRoot}setupEventHandlers(t){var e=this.shadowRoot.getElementById("startCallBtn"),n=this.shadowRoot.getElementById("desktopEndCallBtn"),A=this.shadowRoot.getElementById("desktopMuteBtn"),o=this.shadowRoot.getElementById("desktopSpeakerBtn"),i=this.shadowRoot.getElementById("desktopEndCallBtnCompact"),r=this.shadowRoot.getElementById("desktopMuteBtnCompact"),a=this.shadowRoot.getElementById("desktopSpeakerBtnCompact");if(e&&(e.onclick=()=>this.voiceInterface.startVoiceCall()),n&&(n.onclick=()=>this.voiceInterface.endVoiceCall()),A&&(A.onclick=()=>this.voiceInterface.toggleMute()),o&&(o.onclick=()=>this.voiceInterface.toggleSpeaker()),i&&(i.onclick=()=>this.voiceInterface.endVoiceCall()),r&&(r.onclick=()=>this.voiceInterface.toggleMute()),a&&(a.onclick=()=>this.voiceInterface.toggleSpeaker()),!this.voiceInterface.isMobile){var s=this.shadowRoot.getElementById("voiceTextInput"),c=this.shadowRoot.getElementById("voiceSendBtn");s&&(s.addEventListener("input",()=>{c&&(c.disabled=!s.value.trim())}),s.addEventListener("keypress",t=>{"Enter"===t.key&&!t.shiftKey&&s.value.trim()&&(t.preventDefault(),c&&!c.disabled&&c.click())})),c&&(c.onclick=()=>{this.voiceInterface.sendDesktopTextMessage()});var l=this.shadowRoot.getElementById("conversationHeader");l&&l.addEventListener("click",()=>{this.voiceInterface.transcript.toggleConversationPanel()})}}setupMobileEventHandlers(){var t;if(this.voiceInterface.isMobile){var e=document.getElementById("mobile-voice-call-bar-container");if(e){var n=e.querySelector("#mobileMuteBtn"),A=e.querySelector("#mobileSpeakerBtn"),o=e.querySelector("#mobileEndCallBtn"),i=e.querySelector("#mobileTranscriptRow"),r=e.querySelector("#mobileCloseTranscriptBtn"),a=e.querySelector("#mobileTextInput"),s=e.querySelector("#mobileSendBtn"),c=(t,e,n)=>{if(!n)return!1;var A=n.getBoundingClientRect();return t>=A.left&&t<=A.right&&e>=A.top&&e<=A.bottom};null===(t=this._mobileTouchCleanup)||void 0===t||t.call(this);var l=null,d=t=>{document.getElementById("mobile-voice-call-bar-container")&&t.touches.length&&(l={x:t.touches[0].clientX,y:t.touches[0].clientY})},p=t=>{var e,n,A=document.getElementById("mobile-voice-call-bar-container");if(A&&l&&t.changedTouches.length){var o=t.changedTouches[0],i=o.clientX,r=o.clientY,a=Math.abs(i-l.x),s=Math.abs(r-l.y);if(l=null,!(a>15||s>15)){var d=A.querySelector("#mobileMuteBtn"),p=A.querySelector("#mobileSpeakerBtn"),u=A.querySelector("#mobileEndCallBtn"),h=A.querySelector("#mobileTranscriptRow"),g=A.querySelector("#mobileCloseTranscriptBtn"),m=A.querySelector("#mobileSendBtn"),v=A.querySelector("#mobileTextInput"),f=A.querySelector("#mobileTranscriptOverlay"),w=!(null==f||null===(e=f.classList)||void 0===e||!e.contains("mobile-transcript-overlay--open"));c(i,r,u)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.endVoiceCall()):c(i,r,d)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.toggleMute()):c(i,r,p)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.toggleSpeaker()):w&&c(i,r,g)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.collapseMobileTranscript()):w&&c(i,r,m)&&null!=v&&null!==(n=v.value)&&void 0!==n&&n.trim()?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.sendMobileTextMessage()):!w&&c(i,r,h)&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.expandMobileTranscript())}}else l=null};document.addEventListener("touchstart",d,{passive:!0,capture:!0}),document.addEventListener("touchend",p,{passive:!1,capture:!0}),this._mobileTouchCleanup=()=>{document.removeEventListener("touchstart",d,{capture:!0}),document.removeEventListener("touchend",p,{capture:!0})},n&&n.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),this.voiceInterface.toggleMute()}),A&&A.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),this.voiceInterface.toggleSpeaker()}),o&&o.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),this.voiceInterface.endVoiceCall()}),i&&i.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),this.voiceInterface.expandMobileTranscript()}),r&&r.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),this.voiceInterface.collapseMobileTranscript()});var u=()=>{s&&a&&(s.disabled=!a.value.trim())};a&&(a.addEventListener("input",u),a.addEventListener("keyup",u),a.addEventListener("keypress",t=>{"Enter"===t.key&&!t.shiftKey&&a.value.trim()&&(t.preventDefault(),s&&!s.disabled&&s.click())})),s&&s.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),this.voiceInterface.sendMobileTextMessage()})}}}}class Be{constructor(t){this.voiceInterface=t,this.config=t.config,this.shadowRoot=t.shadowRoot,this._liveWaveformInterval=null}t(t){return this.voiceInterface.t(t)}adjustSizesForContainer(){var t=this.shadowRoot.getElementById("voiceInterface");if(t){var e,n,A,o,i,r,a=t.clientHeight||t.offsetHeight||400,s=t.clientWidth||t.offsetWidth||400;a<=350?(e=80,n=80,A=48,o=54,i=6,r=12):a<=450?(e=100,n=100,A=56,o=62,i=8,r=14):a<=550?(e=120,n=120,A=64,o=70,i=10,r=16):a<=700?(e=140,n=140,A=72,o=78,i=12,r=18):(e=160,n=160,A=80,o=86,i=14,r=20);var c=this.shadowRoot.querySelector(".voice-avatar, .voice-avatar-active");c&&(c.style.width="".concat(e,"px"),c.style.height="".concat(e,"px"),c.style.fontSize="".concat(.5*e,"px"));var l=this.shadowRoot.querySelector(".voice-status-title"),d=this.shadowRoot.querySelector(".voice-status-subtitle");l&&(l.style.fontSize="".concat(r,"px")),d&&(d.style.fontSize="".concat(Math.max(10,r-4),"px"));var p=this.shadowRoot.querySelector(".voice-transcript");p&&(p.style.minHeight="".concat(n,"px"),p.style.maxHeight="".concat(n,"px"),p.style.height="".concat(n,"px"),p.style.width="min(360px, ".concat(s-40,"px)"),p.style.boxSizing="border-box");var u=this.shadowRoot.querySelector(".transcript-label");u&&(u.style.fontSize="".concat(Math.max(8,r-4),"px"));var h=this.shadowRoot.querySelector(".transcript-text");h&&(h.style.fontSize="".concat(Math.max(10,r-2),"px"));var g=this.shadowRoot.querySelector(".voice-text-input-area");if(g){var m=g.querySelector(".voice-input-wrapper"),v=g.querySelector(".voice-text-input"),f=g.querySelector(".voice-send-btn"),w=g.querySelector(".voice-input-hint");if(m&&f){var B=Math.max(32,Math.min(40,.7*A));f.style.width="".concat(B,"px"),f.style.height="".concat(B,"px");var b=f.querySelector("svg");if(b){var y=Math.max(14,Math.min(18,.45*B));b.style.width="".concat(y,"px"),b.style.height="".concat(y,"px")}}v&&(v.style.fontSize="".concat(Math.max(11,Math.min(14,r)),"px"),v.style.padding="".concat(Math.max(6,Math.min(10,Math.floor(.15*A))),"px 0")),w&&(w.style.fontSize="".concat(Math.max(8,Math.min(11,r-4)),"px"),w.style.marginTop="".concat(Math.max(3,Math.min(6,Math.floor(.6*i))),"px"))}this.shadowRoot.querySelectorAll(".voice-control-btn.secondary").forEach(t=>{t.style.width="".concat(A,"px"),t.style.height="".concat(A,"px");var e=t.querySelector("svg");if(e){var n=.65*A;e.style.setProperty("width","".concat(n,"px"),"important"),e.style.setProperty("height","".concat(n,"px"),"important"),e.style.setProperty("min-width","".concat(n,"px"),"important"),e.style.setProperty("min-height","".concat(n,"px"),"important")}});var x=this.shadowRoot.querySelector(".voice-control-btn.primary");if(x){x.style.width="".concat(o,"px"),x.style.height="".concat(o,"px");var C=x.querySelector("svg");if(C){var Q=.7*o;C.style.setProperty("width","".concat(Q,"px"),"important"),C.style.setProperty("height","".concat(Q,"px"),"important"),C.style.setProperty("min-width","".concat(Q,"px"),"important"),C.style.setProperty("min-height","".concat(Q,"px"),"important")}}var S=this.shadowRoot.querySelector(".start-call-btn");if(S){var F,U;a<=350?(F=48,U=14):a<=450?(F=52,U=15):a<=550?(F=58,U=17):a<=700?(F=62,U=18):(F=64,U=18),S.style.height="".concat(F,"px"),S.style.fontSize="".concat(U,"px");var E=S.querySelector("svg");if(E){var k=Math.max(22,.5*F);E.style.width="".concat(k,"px"),E.style.height="".concat(k,"px")}}}}startDesktopWaveformAnimation(){if(!this.voiceInterface.isMobile){var t=this.shadowRoot.getElementById("desktopWaveform");t&&(t.classList.remove("paused"),this.updateDesktopStatus())}}stopDesktopWaveformAnimation(){if(!this.voiceInterface.isMobile){var t=this.shadowRoot.getElementById("desktopWaveform");t&&t.classList.add("paused")}}updateDesktopStatus(){if(!this.voiceInterface.isMobile){var t=this.shadowRoot.getElementById("compactStatusText")||this.shadowRoot.getElementById("desktopStatusText");if(t){var e,n=this.config.statusText;e=n||(this.voiceInterface.isActive&&!this.voiceInterface.isMicMuted?this.t("listening"):this.t("connected")),t.textContent=e;var A=this.shadowRoot.getElementById("desktopStatusText");A&&A!==t&&(A.textContent=e)}}}updateLiveWaveform(t){if(!this.voiceInterface.isMobile){var e=this.shadowRoot.getElementById("desktopLiveWaveform");e&&e.querySelectorAll(".desktop-live-bar").forEach((e,n)=>{if(t){var A=40*Math.random()+8;e.style.height="".concat(A,"px")}else e.style.height="8px"})}}showError(t){var e=this.shadowRoot.getElementById("transcriptText");e&&(e.textContent="".concat(this.t("error"),": ").concat(t),e.classList.remove("empty"))}showDomainError(){console.log("🚫 Showing domain error in widget UI...");var t=this.shadowRoot.getElementById("voiceIdleState");if(t){var e=this.t("domainNotValidated"),n=this.t("domainErrorMessage");t.dataset.domainError="true";var A=t.querySelector(".ttp-headline"),o=t.querySelector(".ttp-subline"),i=t.querySelector(".ttp-online-dot"),r=t.querySelector(".ttp-agent-role");A&&(A.textContent=e,A.style.color="#fca5a5"),o&&(o.textContent=n,o.style.color="rgba(252,165,165,0.6)"),i&&(i.style.background="#ef4444"),r&&(r.textContent="Unavailable",r.style.color="rgba(252,165,165,0.5)");var a=t.querySelector(".ttp-body");if(a){var s=a.querySelector("#startCallBtn"),c=a.querySelector("#startTextBtn");s&&(s.style.display="none"),c&&(c.style.display="none");var l=a.querySelector(".ttp-domain-error-card");l&&l.remove();var d=a.querySelector("#domainErrorDismissBtn");d&&d.remove();var p=document.createElement("div");p.className="ttp-domain-error-card",p.innerHTML='\n <div class="ttp-domain-error-icon">\n <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#fca5a5" stroke-width="2">\n <circle cx="12" cy="12" r="10"/>\n <line x1="12" y1="8" x2="12" y2="12"/>\n <line x1="12" y1="16" x2="12.01" y2="16"/>\n </svg>\n </div>\n <div class="ttp-domain-error-text">\n This website\'s domain is not authorised to use this agent. The site owner needs to whitelist <strong>'.concat(window.location.hostname,"</strong>.\n </div>\n "),a.appendChild(p);var u=document.createElement("button");u.type="button",u.className="ttp-btn-secondary",u.id="domainErrorDismissBtn",u.innerHTML='\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n Dismiss\n ',u.onclick=()=>{this.voiceInterface.isShowingDomainError=!1,this.voiceInterface.resetConnectingState(),this.voiceInterface.config.onShowLanding&&"function"==typeof this.voiceInterface.config.onShowLanding&&this.voiceInterface.config.onShowLanding()},a.appendChild(u)}var h=this.shadowRoot.getElementById("voiceActiveState");h&&(h.style.display="none"),t.style.display="flex",console.log("✅ Domain error displayed in new desktop UI")}else console.warn("⚠️ voiceIdleState element not found, cannot show domain error")}showBackButtonWarning(){var t=this.shadowRoot.getElementById("transcriptText"),e=this.shadowRoot.getElementById("liveTextCollapsed");if(t){var n=t.textContent,A=t.innerHTML;t.innerHTML='\n <div style="font-weight: 600; font-size: 16px; margin-bottom: 8px; color: #92400e; display: flex; align-items: center; gap: 8px;">\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="flex-shrink: 0;">\n <path d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>\n </svg>\n Please end the call first\n </div>\n <div style="font-size: 14px; color: #92400e; line-height: 1.5;">\n You need to end the current call before going back.\n </div>\n ',t.classList.remove("empty"),setTimeout(()=>{t&&(t.innerHTML=A,t.textContent=n,n&&""!==n.trim()||t.classList.add("empty"))},5e3)}else if(e){var o=e.textContent;e.innerHTML='\n <span style="color: #92400e; font-weight: 600;">⚠️ Please end the call first - You need to end the current call before going back.</span>\n ',setTimeout(()=>{e&&(e.textContent=o)},5e3)}}startLiveWaveformInterval(){this.voiceInterface.isMobile||(this._liveWaveformInterval&&clearInterval(this._liveWaveformInterval),this._liveWaveformInterval=setInterval(()=>{this.updateLiveWaveform(this.voiceInterface.isActive&&!this.voiceInterface.isMicMuted)},100))}stopLiveWaveformInterval(){this._liveWaveformInterval&&(clearInterval(this._liveWaveformInterval),this._liveWaveformInterval=null)}cleanup(){this.stopLiveWaveformInterval(),this.stopDesktopWaveformAnimation()}}class be{constructor(t){this.voiceInterface=t,this.config=t.config,this.waveformBars=[.3,.5,.8,.4,.6,.9,.5,.7],this.waveformInterval=null,this.isTranscriptExpanded=!1,this._mobileTimerInterval=null,this._mobileCallStartTime=null,this.voiceInterface.messages||(this.voiceInterface.messages=[])}t(t){return this.voiceInterface.t(t)}createMobileMinimizedBar(){var t=document.getElementById("mobile-voice-call-bar-container");t&&t.remove();var e=document.getElementById("mobile-voice-call-bar-styles");e||((e=document.createElement("style")).id="mobile-voice-call-bar-styles",document.head.appendChild(e)),e.textContent=this.voiceInterface.styles.generateMobileCSS();var n=document.createElement("div");n.id="mobile-voice-call-bar-container";var A="rtl"===this.config.direction?"rtl":"ltr";n.setAttribute("dir",A),n.innerHTML='\n \x3c!-- Duration Badge (hidden until first audio) --\x3e\n <div class="mobile-duration-badge mobile-duration-badge--hidden" id="mobileDurationBadge">\n <div class="mobile-duration-dot"></div>\n <span id="mobileDurationText">00:00</span>\n </div>\n \n \x3c!-- Main Bar --\x3e\n <div class="mobile-voice-bar">\n \x3c!-- Top Row: Status, Waveform/Spinner, Controls --\x3e\n <div class="mobile-top-row">\n \x3c!-- Status Indicator --\x3e\n <div class="mobile-status-indicator">\n <div class="mobile-status-dot" id="mobileStatusDot"></div>\n <span class="mobile-status-text" id="mobileStatusText">'.concat(this.t("listening"),'</span>\n </div>\n \n \x3c!-- Centered: Spinner (loading) or Waveform (after first audio) --\x3e\n <div class="mobile-waveform-center" id="mobileWaveform">\n <div class="mobile-waveform-spinner" id="mobileWaveformSpinner" aria-hidden="false">\n <div class="mobile-waveform-spinner-inner"></div>\n </div>\n <div class="mobile-waveform-bars mobile-waveform-bars--hidden" id="mobileWaveformBars">\n ').concat(Array(8).fill(0).map((t,e)=>'<div class="mobile-waveform-bar" data-index="'.concat(e,'"></div>')).join(""),'\n </div>\n </div>\n \n \x3c!-- Controls --\x3e\n <div class="mobile-controls">\n <button type="button" class="mobile-control-btn" id="mobileMuteBtn" aria-label="Mute microphone">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-mic-icon">\n <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n <line x1="12" x2="12" y1="19" y2="22"/>\n </svg>\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-mic-off-icon" style="display: none;">\n <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/>\n <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>\n <line x1="12" x2="12" y1="19" y2="22"/>\n <line x1="4" y1="4" x2="20" y2="20" stroke="#ef4444" stroke-width="1.5" opacity="0.85"/>\n </svg>\n </button>\n \n <button type="button" class="mobile-control-btn" id="mobileSpeakerBtn" aria-label="Toggle speaker">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-speaker-icon">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07"/>\n </svg>\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mobile-speaker-off-icon" style="display: none;">\n <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>\n <path d="M15.54 8.46a5 5 0 0 1 0 7.07"/>\n <line x1="4" y1="4" x2="20" y2="20" stroke="#ef4444" stroke-width="1.5" opacity="0.85"/>\n </svg>\n </button>\n \n <button type="button" class="mobile-end-call-btn" id="mobileEndCallBtn" aria-label="End call">\n <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/>\n <line x1="22" x2="2" y1="2" y2="22"/>\n </svg>\n </button>\n </div>\n </div>\n \n \x3c!-- Bottom Row: Transcript (expandable) --\x3e\n <button type="button" class="mobile-transcript-row" id="mobileTranscriptRow">\n <p class="mobile-transcript-text" id="mobileTranscriptText" dir="').concat(A,'">').concat(this.t("transcriptWillAppear"),'</p>\n <div class="mobile-transcript-footer">\n <span class="mobile-expand-hint">tap to expand & type</span>\n <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="opacity: 0.6;">\n <path d="M7 17L17 7M17 7H7M17 7V17"/>\n </svg>\n </div>\n </button>\n\n \x3c!-- Fly-to-cart target: always visible for animation (positioned where cart icon appears) --\x3e\n <div id="ttpFlyToCartTarget" class="ttp-fly-target" aria-hidden="true"></div>\n\n \x3c!-- Cart Row - shown when items are in cart --\x3e\n <div class="mobile-cart-row" id="mobileCartRow" style="display: none;">\n <div class="mobile-cart-row__content">\n <span class="mobile-cart-row__icon" data-ttp-fly-target>🛒</span>\n <span class="mobile-cart-row__text" id="mobileCartText">0 items · ₪0.00</span>\n </div>\n </div>\n </div>\n \n \x3c!-- Expanded Transcript Overlay --\x3e\n <div class="mobile-transcript-overlay" id="mobileTranscriptOverlay">\n <div class="mobile-expanded-transcript" id="mobileExpandedTranscript">\n \x3c!-- Header --\x3e\n <div class="mobile-transcript-header">\n <div class="mobile-header-left">\n <div class="mobile-header-status">\n <div class="mobile-header-status-dot"></div>\n <span class="mobile-header-status-text" id="mobileHeaderStatusText">').concat(this.t("listening"),'</span>\n <span class="mobile-header-duration" id="mobileHeaderDuration">00:00</span>\n </div>\n <span class="mobile-transcript-label">CONVERSATION</span>\n </div>\n <button type="button" class="mobile-close-transcript-btn" id="mobileCloseTranscriptBtn">\n <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n \x3c!-- Messages Container --\x3e\n <div class="mobile-messages-container" id="mobileMessagesContainer">\n \x3c!-- Messages will be dynamically added here --\x3e\n </div>\n \n \x3c!-- Text Input Area --\x3e\n <div class="mobile-input-area">\n <div class="mobile-input-wrapper">\n <input\n type="text"\n placeholder="Type a message..."\n id="mobileTextInput"\n class="mobile-text-input"\n dir="').concat(A,'"\n />\n <button type="button" class="mobile-send-btn" id="mobileSendBtn" disabled>\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"/>\n </svg>\n </button>\n </div>\n <p class="mobile-input-hint">🎙️ ').concat(this.t("voiceActive")||"Voice is still active"," • ").concat(this.t("typeOrSpeak")||"Type or speak","</p>\n </div>\n </div>\n </div>\n "),document.body.appendChild(n);var o=n.querySelector("#mobileMuteBtn"),i=n.querySelector("#mobileSpeakerBtn"),r=n.querySelector("#mobileEndCallBtn");if(o){o.style.cssText="\n width: 32px !important;\n height: 32px !important;\n min-width: 32px !important;\n min-height: 32px !important;\n max-width: 32px !important;\n max-height: 32px !important;\n aspect-ratio: 1 !important;\n border-radius: 50% !important;\n overflow: hidden !important;\n padding: 0 !important;\n margin: 0 !important;\n box-sizing: border-box !important;\n ";var a=o.querySelector(".mobile-mic-icon"),s=o.querySelector(".mobile-mic-off-icon");a&&(a.style.cssText="\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n width: 15px !important;\n height: 15px !important;\n margin: 0 !important;\n padding: 0 !important;\n position: absolute !important;\n top: 50% !important;\n left: 50% !important;\n transform: translate(-50%, -50%) !important;\n "),s&&(s.style.cssText="\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n position: absolute !important;\n top: 50% !important;\n left: 50% !important;\n transform: translate(-50%, -50%) !important;\n ")}if(i){i.style.cssText="\n width: 32px !important;\n height: 32px !important;\n min-width: 32px !important;\n min-height: 32px !important;\n max-width: 32px !important;\n max-height: 32px !important;\n aspect-ratio: 1 !important;\n border-radius: 50% !important;\n overflow: hidden !important;\n padding: 0 !important;\n margin: 0 !important;\n box-sizing: border-box !important;\n ";var c=i.querySelector(".mobile-speaker-icon"),l=i.querySelector(".mobile-speaker-off-icon");c&&(c.style.cssText="\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n width: 15px !important;\n height: 15px !important;\n margin: 0 !important;\n padding: 0 !important;\n position: absolute !important;\n top: 50% !important;\n left: 50% !important;\n transform: translate(-50%, -50%) !important;\n "),l&&(l.style.cssText="\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n position: absolute !important;\n top: 50% !important;\n left: 50% !important;\n transform: translate(-50%, -50%) !important;\n ")}if(r){r.style.cssText="\n width: 36px !important;\n height: 36px !important;\n min-width: 36px !important;\n min-height: 36px !important;\n max-width: 36px !important;\n max-height: 36px !important;\n aspect-ratio: 1 !important;\n border-radius: 50% !important;\n overflow: hidden !important;\n padding: 0 !important;\n margin: 0 !important;\n box-sizing: border-box !important;\n ";var d=r.querySelector("svg");d&&(d.style.cssText="\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n width: 15px !important;\n height: 15px !important;\n margin: 0 !important;\n padding: 0 !important;\n ")}this.voiceInterface.setupMobileEventHandlers()}hideMobileLoadingState(){var t=document.getElementById("mobile-voice-call-bar-container"),e=null==t?void 0:t.querySelector("#mobileWaveformSpinner"),n=null==t?void 0:t.querySelector("#mobileWaveformBars"),A=null==t?void 0:t.querySelector("#mobileDurationBadge");e&&(e.classList.add("mobile-waveform-spinner--hidden"),e.setAttribute("aria-hidden","true")),n&&n.classList.remove("mobile-waveform-bars--hidden"),A&&A.classList.remove("mobile-duration-badge--hidden")}startMobileTimer(){if(null==this._mobileCallStartTime&&!this._mobileTimerInterval){this._mobileCallStartTime=Date.now(),console.log("⏱️ [Mobile] Timer started at",new Date(this._mobileCallStartTime).toISOString());var t=()=>{var t=document.getElementById("mobile-voice-call-bar-container");if(t&&this._mobileCallStartTime){var e=Date.now()-this._mobileCallStartTime,n=Math.floor(e/6e4),A=Math.floor(e%6e4/1e3),o="".concat(n.toString().padStart(2,"0"),":").concat(A.toString().padStart(2,"0")),i=t.querySelector("#mobileDurationText"),r=t.querySelector("#mobileHeaderDuration");i&&(i.textContent=o),r&&(r.textContent=o)}};t(),this._mobileTimerInterval=setInterval(t,1e3)}}stopMobileTimer(){this._mobileTimerInterval&&(clearInterval(this._mobileTimerInterval),this._mobileTimerInterval=null,console.log("⏱️ [Mobile] Timer stopped")),this._mobileCallStartTime=null}removeMobileMinimizedBar(){this.stopMobileTimer();var t=document.getElementById("mobile-voice-call-bar-container");t&&t.remove()}expandMobileTranscript(){var t=document.getElementById("mobile-voice-call-bar-container"),e=null==t?void 0:t.querySelector("#mobileTranscriptOverlay");if(e){e.classList.add("mobile-transcript-overlay--open"),this.isTranscriptExpanded=!0;var n=null==t?void 0:t.querySelector("#mobileTextInput"),A=null==t?void 0:t.querySelector("#mobileSendBtn");n&&setTimeout(()=>n.focus(),100),A&&n&&(A.disabled=!n.value.trim());var o=null==t?void 0:t.querySelector("#mobileMessagesContainer");o&&setTimeout(()=>{o.scrollTop=o.scrollHeight},100)}}collapseMobileTranscript(){var t=document.getElementById("mobile-voice-call-bar-container"),e=null==t?void 0:t.querySelector("#mobileTranscriptOverlay");e&&(e.classList.remove("mobile-transcript-overlay--open"),this.isTranscriptExpanded=!1)}updateMobileStatus(t){var e=document.getElementById("mobile-voice-call-bar-container"),n=null==e?void 0:e.querySelector("#mobileStatusText"),A=null==e?void 0:e.querySelector("#mobileHeaderStatusText"),o=null==e?void 0:e.querySelector("#mobileStatusDot");if(n||A){var i=this.config.statusText,r="",a="#6b7280",s=this.config.primaryBtnGradient1||this.config.startCallButtonColor||"#3b82f6",c=this.config.primaryBtnGradient2||this.config.avatarGradient2||s;i?(r=i,a=this.config.statusDotColor||"#10b981"):"connecting"===t?(r=this.t("connecting")||"Connecting...",a=s):"listening"===t||"recording"===t?(r=this.t("listening")||"Listening...",a="#22c55e"):"speaking"===t?(r=this.t("speaking")||"Speaking...",a=c):(r=this.t("paused")||"Paused",a="#facc15"),n&&(n.textContent=r),A&&(A.textContent=r),o&&(o.style.backgroundColor=a,o.style.boxShadow="paused"===t?"none":"0 0 8px ".concat(a))}}addMobileMessage(t,e){this.voiceInterface.messages.push({type:t,text:e});var n=document.getElementById("mobile-voice-call-bar-container"),A=null==n?void 0:n.querySelector("#mobileMessagesContainer");if(A){var o=document.createElement("div");o.className="mobile-message-bubble ".concat(t),o.setAttribute("dir","rtl"===this.config.direction?"rtl":"ltr"),o.textContent=e,A.appendChild(o),A.scrollTop=A.scrollHeight}}startWaveformAnimation(){this.waveformInterval&&clearInterval(this.waveformInterval);var t=document.getElementById("mobile-voice-call-bar-container"),e=null==t?void 0:t.querySelector("#mobileWaveform");e&&(this.waveformInterval=setInterval(()=>{var t=null==e?void 0:e.querySelector("#mobileWaveformBars"),n=t?t.querySelectorAll(".mobile-waveform-bar"):null==e?void 0:e.querySelectorAll(".mobile-waveform-bar");null!=n&&n.length&&n.forEach((t,e)=>{var n=60*Math.random()+10;t.style.height="".concat(n,"px")})},100))}stopWaveformAnimation(){this.waveformInterval&&(clearInterval(this.waveformInterval),this.waveformInterval=null);var t=document.getElementById("mobile-voice-call-bar-container"),e=null==t?void 0:t.querySelector("#mobileWaveform");if(e){var n=e.querySelector("#mobileWaveformBars");(n?n.querySelectorAll(".mobile-waveform-bar"):e.querySelectorAll(".mobile-waveform-bar")).forEach(t=>{t.style.height="10px"})}}cleanup(){this.stopWaveformAnimation(),this.collapseMobileTranscript(),this.removeMobileMinimizedBar(),this.voiceInterface.messages=[]}}function ye(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function xe(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){ye(i,A,o,r,a,"next",t)}function a(t){ye(i,A,o,r,a,"throw",t)}r(void 0)})}}class Ce{constructor(t){var e,n;this.config=t,this.audioStream=null,this.callStartTime=null,this.callTimerInterval=null,this.sdk=null,this.isActive=!1,this.isShowingDomainError=!1,this.shadowRoot=t.shadowRoot||document,this.textSDK=t.textSDK||null,this.deviceInfo=Zt();var A=void 0!==this.config.mobileVoiceUI?this.config.mobileVoiceUI:null===(e=this.config.behavior)||void 0===e?void 0:e.mobileVoiceUI;this.isMobile=!0===A||!1!==A&&$t(),this.conversationExpanded=!1,this.isMicMuted=!1,this.isSpeakerMuted=!1;var o=t.visualAssistant||(null===(n=t.agentSettingsOverride)||void 0===n?void 0:n.visualAssistant);this.sdk=new yA({agentId:t.agentId,appId:t.appId,websocketUrl:t.websocketUrl,agentSettingsOverride:t.agentSettingsOverride,visualAssistant:o,variables:t.variables||{},language:t.language||"en",inputFormat:t.inputFormat,outputContainer:t.outputContainer,outputEncoding:t.outputEncoding,outputSampleRate:t.outputSampleRate,outputChannels:t.outputChannels,outputBitDepth:t.outputBitDepth,onConversationStart:t.onConversationStart,onConversationEnd:t.onConversationEnd,onBargeIn:t.onBargeIn,onAudioStartPlaying:t.onAudioStartPlaying,onAudioStoppedPlaying:t.onAudioStoppedPlaying,onSubtitleDisplay:t.onSubtitleDisplay,flavor:t.flavor}),this.templates=new ge(this),this.styles=new me(this),this.transcript=new ve(this),this.textHandlers=new fe(this),this.handlers=new we(this),this.desktop=new Be(this),this.mobile=new be(this),this.setupSDKEventHandlers(),this.checkAndHandleResume()}getVoiceSDK(){var t;return(null===(t=this.sdk)||void 0===t?void 0:t.voiceSDK)||null}checkAndHandleResume(){if(void 0!==this._resumeInfo)return console.log("🔄 [VOICE INTERFACE] Returning cached resume info:",this._resumeInfo),this._resumeInfo;var t=this.sdk.checkResumeBeforeConnect();return this._resumeInfo=t,t?(console.log("🔄 [WIDGET] Auto-resuming call:",t),console.log(" From:",t.fromPage,"→ To:",t.toPage),this.config.onResume&&this.config.onResume(t),t):null}setupSDKEventHandlers(){var t=this;this.sdk.onTranscript=t=>{console.log("📝 [VOICE INTERFACE] onTranscript called with text:",t),this.updateTranscript(t)},this._pendingUserTranscriptFrame=null,this.sdk.onUserTranscript=(t,e)=>{this._pendingUserTranscriptFrame&&cancelAnimationFrame(this._pendingUserTranscriptFrame),this._pendingUserTranscriptFrame=requestAnimationFrame(()=>{this._pendingUserTranscriptFrame=null;var e=this.getUserTranscriptPrefix();this._renderUserLiveTranscriptSnippet(e,t)}),e&&(this.isMobile?this.addMobileMessage("user",t):(this.transcript.finalizeLiveMessage(),this.addConversationMessage("user",t)))},this.sdk.onPlaybackStarted=()=>{var t,e,n,A;console.log("🔊 [VOICE INTERFACE] Playback started - updating status to listening"),this.isMobile?(null===(t=(e=this.mobile).hideMobileLoadingState)||void 0===t||t.call(e),null===(n=(A=this.mobile).startMobileTimer)||void 0===n||n.call(A),this.updateMobileStatus("listening")):this.updateDesktopStatus()},this.sdk.onAgentSpeaking=t=>{var e=this.shadowRoot.getElementById("voiceAvatarActive");e&&(t?(e.classList.add("speaking"),this.isMobile?(this.updateMobileStatus("speaking"),this.startWaveformAnimation()):(this.updateDesktopStatus(),this.startDesktopWaveformAnimation())):(e.classList.remove("speaking"),this.isMobile?(this.updateMobileStatus("listening"),this.startWaveformAnimation()):(this.updateDesktopStatus(),this.startDesktopWaveformAnimation())))},this.sdk.onDisconnected=function(){var e=xe(function*(e){console.log("🔌 WebSocket disconnected, hanging up call..."),e&&(1008===e.code&&e.reason&&(e.reason.includes("Domain not whitelisted")||e.reason.includes("domain")||e.reason.includes("whitelist"))||1008===e.code&&e.reason&&e.reason.includes("localhost"))?(console.error("❌ Domain not whitelisted - WebSocket closed:",e.code,e.reason),yield t.endCallOnServerRejection()):t.isActive&&(t.isActive=!1,t.endVoiceCall())});return function(t){return e.apply(this,arguments)}}(),this.sdk.onError=function(){var e=xe(function*(e){if(e&&("DOMAIN_NOT_WHITELISTED"===e.message||e.message&&e.message.includes("Domain not whitelisted")))return console.error("❌ Voice SDK Error: Domain not whitelisted:",e),void(yield t.endCallOnServerRejection());e.isServerRejection||"ServerRejected"===e.name||(console.error("❌ Voice SDK Error:",e),t.showError(e.message||e))});return function(t){return e.apply(this,arguments)}}(),this.sdk.onUnsupportedAction=t=>{console.warn('⚠️ Received "'.concat(t,'" but this is not an E-Commerce widget. Use TTPEcommerceWidget instead.'));var e="This widget does not support e-commerce features. Please use TTPEcommerceWidget to display products.";this.config.onErrorToast&&this.config.onErrorToast(e,"warning"),this.isMobile&&this.config.onMobileError&&this.config.onMobileError(e)}}setupTextInjectAckHandler(){return this.textHandlers.setupTextInjectAckHandler()}handleTextInjectAck(t){return this.textHandlers.handleTextInjectAck(t)}sendDesktopTextMessage(){return this.textHandlers.sendDesktopTextMessage()}sendMobileTextMessage(){return this.textHandlers.sendMobileTextMessage()}t(t){var e,n,A=this.config.language||"en";return((null===(e=this.config.translations)||void 0===e?void 0:e[A])||(null===(n=this.config.translations)||void 0===n?void 0:n.en)||{})[t]||t}getText(t,e){return void 0!==this.config[t]&&null!==this.config[t]?this.config[t]:this.t(e)}getUserTranscriptPrefix(){return this.getText("userTranscriptPrefix","userTranscriptPrefix")}_renderUserLiveTranscriptSnippet(t,e){var n="rtl"===this.config.direction,A=(null!=t?String(t):"").replace(/\s+$/,""),o=n?" ":" ",i=document.getElementById("mobile-voice-call-bar-container");if(i){var r=i.querySelector("#mobileTranscriptText");if(!r)return;if(r.textContent="",r.setAttribute("dir",n?"rtl":"ltr"),A){var a=document.createElement("span");a.style.fontWeight="600",a.style.color="#c4b5fd",a.textContent=A,r.appendChild(a),r.appendChild(document.createTextNode(o))}var s=document.createElement("span");return s.setAttribute("dir","auto"),s.textContent=e,r.appendChild(s),void(r.style.color="#fde68a")}var c=this.shadowRoot.getElementById("liveTextCollapsed");if(c){if(c.textContent="",c.classList.remove("muted"),c.style.color="#e8e4f0",c.setAttribute("dir",n?"rtl":"ltr"),A){var l=document.createElement("span");l.className="name ttp-user-live-prefix",l.textContent=A,c.appendChild(l),c.appendChild(document.createTextNode(o))}var d=document.createElement("span");d.className="ttp-user-live-utterance",d.setAttribute("dir","auto"),d.textContent=e,c.appendChild(d)}}getTooltip(t){var e,n=null===(e=this.config.tooltips)||void 0===e?void 0:e[t];return null!=n?n:{mute:this.t("mute"),speaker:this.t("speaker"),endCall:this.t("endCall")}[t]||""}_widgetQueryRoot(){return this.shadowRoot&&this.shadowRoot!==document?this.shadowRoot:document.getElementById("ttp-widget-container")}_queryInWidget(t){var e=this._widgetQueryRoot();return e?e.querySelector(t):null}_updateTimerElements(t,e){var n=this._queryInWidget("#voiceTimer");n&&(n.textContent=t);var A=this._queryInWidget("#desktopTimerText"),o=this._queryInWidget("#compactTimerText");if(A&&(A.textContent=t),o&&(o.textContent=t),!o&&!A&&e<2e3){console.warn("⚠️ Timer elements not found - compactTimerText:",!!o,"desktopTimerText:",!!A,"elapsed:",e);var i=this._widgetQueryRoot(),r=i?i.querySelectorAll('[id*="Timer"], [id*="timer"]'):[];console.log("Found timer-like elements:",Array.from(r).map(t=>t.id))}var a=document.getElementById("mobile-voice-call-bar-container");if(a){var s=a.querySelector("#mobileDurationText"),c=a.querySelector("#mobileHeaderDuration");s&&(s.textContent=t),c&&(c.textContent=t)}}generateHTML(){return this.templates.generateHTML()}generateMobileHTML(){return this.templates.generateMobileHTML()}generateCSS(){return this.styles.generateCSS()}setupEventHandlers(t){this.handlers.setupEventHandlers(t)}setupMobileEventHandlers(){return this.handlers.setupMobileEventHandlers()}adjustSizesForContainer(){return this.desktop.adjustSizesForContainer()}startDesktopWaveformAnimation(){return this.desktop.startDesktopWaveformAnimation()}stopDesktopWaveformAnimation(){return this.desktop.stopDesktopWaveformAnimation()}updateDesktopStatus(){return this.desktop.updateDesktopStatus()}updateLiveWaveform(t){return this.desktop.updateLiveWaveform(t)}showError(t){return this.desktop.showError(t)}showDomainError(){return this.desktop.showDomainError()}startVoiceCall(){var t=this;return xe(function*(){if(t.isActive)console.log("⚠️ Voice call already active");else{console.log("🎤 Starting voice call...");var e=yield te();if(console.log("📋 Current permission state: ".concat(e)),"denied"===e)throw console.log("🚫 Permission is denied, showing blocked modal..."),t.resetConnectingState(),Zt(),ce(()=>{console.log("Blocked modal closed")}),new Error("Microphone permission denied");if("prompt"===e||"unknown"===e){console.log("📋 Permission is in prompt state, showing pre-prompt modal with call view...");var n=t.shadowRoot.getElementById("voiceIdleState"),A=t.shadowRoot.getElementById("voiceActiveState"),o=null,i=!1;return t.isMobile?(n&&(n.style.display="none"),A&&(A.style.display="none"),(o=t.shadowRoot.getElementById("text-chat-panel")||document.getElementById("text-chat-panel"))&&(i=o.classList.contains("open"),o.classList.remove("open"),o.style.display="none")):(n&&(n.style.display="none"),A&&(A.style.display="flex")),new Promise((e,r)=>{se(xe(function*(){console.log("✅ Pre-prompt accepted, proceeding with voice call...");try{yield t.proceedWithVoiceCall(),e()}catch(t){r(t)}}),()=>{console.log("❌ Pre-prompt cancelled"),n&&(n.style.display="flex"),A&&(A.style.display="none"),t.isMobile&&o&&(o.style.display="",i&&o.classList.add("open")),t.resetConnectingState(),r(new Error("Call cancelled by user"))})})}yield t.proceedWithVoiceCall()}})()}resolveServerDisclaimer(t){return xe(function*(){var e,n=t.lastDisclaimerPayload,A=null!=n&&null!==(e=n.texts)&&void 0!==e&&e.length?n.texts:["Please confirm to continue."];return new Promise((e,n)=>{de({texts:A,onAccept:()=>{t.sendDisclaimerAck(!0),e()},onCancel:()=>{t.sendDisclaimerAck(!1),n(new Error("DISCLAIMER_DECLINED"))}})})})()}proceedWithVoiceCall(){var t=this;return xe(function*(){try{if(null!==t._resumeInfo&&void 0!==t._resumeInfo)console.log("🔄 Resume call detected - preserving conversation history");else{console.log("🆕 New call detected - clearing conversation history"),t.transcript.clearConversationMessages(),t.conversationExpanded=!1;var e=t.shadowRoot.getElementById("desktopConversationPanel"),n=t.shadowRoot.getElementById("conversationHeader"),A=t.shadowRoot.getElementById("conversationToggleText"),o=t.shadowRoot.getElementById("desktopVoiceSection"),i=t.shadowRoot.getElementById("compactVoiceSection");e&&(e.classList.remove("expanded"),e.classList.add("collapsed")),n&&n.classList.remove("expanded"),A&&(A.textContent="Show history"),o&&(o.style.display=""),i&&(i.style.display="none")}if(t.isMobile){var r=t.shadowRoot.getElementById("voiceIdleState");r&&(r.style.display="none");var a=t.shadowRoot.getElementById("text-chat-panel");if(a)a.classList.remove("open"),a.style.display="none",console.log("✅ Widget panel hidden (waiting for permission)");else{var s=document.getElementById("text-chat-panel");s&&(s.classList.remove("open"),s.style.display="none",console.log("✅ Widget panel hidden (waiting for permission, fallback)"))}t.showMobileCallBarAwaitingBrowserMic(),console.log("📱 Mobile device - requesting mic permission before connecting...");var c=null;try{var l;c=yield navigator.mediaDevices.getUserMedia({audio:!0}),t._preliminaryInputStream=c,console.log("✅ Mobile: Microphone permission granted - keeping stream alive (ElevenLabs pattern)");var d=(null===(l=t.config.inputFormat)||void 0===l?void 0:l.sampleRate)||t.config.sampleRate||16e3;yield k.primeSharedContext(d),t.applyMobileBarConnectingCopy();var p=t.shadowRoot.getElementById("text-chat-button");if(p)p.style.display="none",console.log("✅ Floating button hidden (permission granted)");else{var u=document.getElementById("text-chat-button");u&&(u.style.display="none",console.log("✅ Floating button hidden (permission granted, fallback)"))}var h=t.shadowRoot.querySelector(".ttp-mobile-fab");h&&(h.style.display="none")}catch(M){console.error("❌ Mobile: Permission denied before connecting:",M),t.resetConnectingState(),document.getElementById("mobile-voice-call-bar-container")&&t.removeMobileMinimizedBar();var g=t.shadowRoot.getElementById("text-chat-button");if(g)g.style.display="";else{var m=document.getElementById("text-chat-button");m&&(m.style.display="")}var v=t.shadowRoot.querySelector(".ttp-mobile-fab");v&&(v.style.display="");var f=t.shadowRoot.getElementById("voiceIdleState");f&&(f.style.display="flex");var w=t.shadowRoot.getElementById("text-chat-panel");if(w)w.style.display="";else{var B=document.getElementById("text-chat-panel");B&&(B.style.display="")}return Zt(),void ce(()=>{t.resetUIState()})}}else{t.resetConnectingState();var b=t.shadowRoot.getElementById("voiceIdleState"),y=t.shadowRoot.getElementById("voiceActiveState");b&&(b.style.display="none"),y&&(y.style.display="flex")}var x=t.shadowRoot.getElementById("voiceInterface");if(setTimeout(()=>t.adjustSizesForContainer(),50),x&&(x.scrollTop=0),!t.config.agentId)throw new Error("agentId is required for voice calls");if(t.sdk&&t.sdk.isConnected){console.log("🔄 SDK already connected, disconnecting for clean retry...");try{t.sdk.disconnect(),yield new Promise(t=>setTimeout(t,100))}catch(t){console.warn("Warning: Error disconnecting existing connection:",t)}}if(t.isMobile){var C,Q=null!==(C=t.config.connectionDelay)&&void 0!==C?C:{default:0,android:3e3,ios:0};yield function(){return ie.apply(this,arguments)}(Q)}var S=yield t.sdk.connect();console.log("✅ Connected to WebSocket, connected:",S),t.setupTextInjectAckHandler();var F=!1,U=t.sdk.onError,E=t.sdk.onDisconnected;t.sdk.onError=e=>{e&&("DOMAIN_NOT_WHITELISTED"===e.message||e.message&&e.message.includes("Domain not whitelisted"))&&(F=!0,console.log("🚫 Server rejected connection before starting audio capture")),U&&U.call(t.sdk,e)},t.sdk.onDisconnected=e=>{e&&1008===e.code&&e.reason&&(e.reason.includes("Domain not whitelisted")||e.reason.includes("domain")||e.reason.includes("whitelist"))&&(F=!0,console.log("🚫 Server disconnected due to domain error before starting audio capture")),E&&E.call(t.sdk,e)};for(var I=0,T=!1;I<150;){if(F)throw console.log("🚫 Server rejected connection, aborting audio capture"),new Error("DOMAIN_NOT_WHITELISTED");if(t.sdk.isConnected){var H=t.sdk.voiceSDK;if(H&&H.isConnected&&H.helloAckReceived&&H.websocket&&H.websocket.readyState===WebSocket.OPEN){if(H.disclaimersPending&&!T){T=!0;try{yield t.resolveServerDisclaimer(H)}catch(e){if("DISCLAIMER_DECLINED"===(null==e?void 0:e.message))throw t.resetConnectingState(),e;throw e}continue}if(!H.disclaimersPending)break}}yield new Promise(t=>setTimeout(t,100)),I++}if(F)throw t.sdk.onError=U,t.sdk.onDisconnected=E,console.log("🚫 Server rejected connection, aborting audio capture"),new Error("DOMAIN_NOT_WHITELISTED");if(!(t.sdk.isConnected&&t.sdk.voiceSDK&&t.sdk.voiceSDK.isConnected&&t.sdk.voiceSDK.websocket&&t.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN))throw t.sdk.onError=U,t.sdk.onDisconnected=E,console.warn("⚠️ Connection lost before starting audio capture"),new Error("Connection lost before starting audio capture");if(t.sdk.onError=U,t.sdk.onDisconnected=E,t.sdk.isConnected&&t.sdk.voiceSDK&&t.sdk.voiceSDK.websocket&&t.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN){console.log("✅ WebSocket ready, starting listening...");try{var _=t._preliminaryInputStream||null;if(_&&(t._preliminaryInputStream=null),yield t.sdk.startListening(_),!(t.sdk.isConnected&&t.sdk.voiceSDK&&t.sdk.voiceSDK.isConnected&&t.sdk.voiceSDK.websocket&&t.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN)){var D;if(null!==(D=t.sdk.voiceSDK)&&void 0!==D&&D.isRecording)try{yield t.sdk.voiceSDK.stopRecording()}catch(t){}var M=new Error("Connection lost - server may have rejected the call");throw M.name="ServerRejected",M.isServerRejection=!0,M}console.log("🎤 Started listening - permission granted"),t._stopPreliminaryInputStream(),t.isActive=!0,t.resetMuteState(),t.isMobile?(document.getElementById("mobile-voice-call-bar-container")?console.log("📱 Mobile device - bar already exists, updating status"):(console.log("📱 Mobile device - permission granted, creating minimized bar"),t.createMobileMinimizedBar()),0===t.messages.length&&t.messages.push({type:"assistant",text:t.t("transcriptWillAppear")}),t.startWaveformAnimation()):(t.startDesktopWaveformAnimation(),t.desktop.startLiveWaveformInterval())}catch(M){if(M.isServerRejection||"ServerRejected"===M.name)throw t.resetConnectingState(),M;if(console.error("❌ Failed to start listening - permission denied or error:",M),t.resetConnectingState(),t.isMobile){document.getElementById("mobile-voice-call-bar-container")&&t.removeMobileMinimizedBar();var P=t.shadowRoot.getElementById("voiceIdleState");P&&(P.style.display="flex");var L=t.shadowRoot.getElementById("text-chat-panel");if(L)L.style.display="";else{var R=document.getElementById("text-chat-panel");R&&(R.style.display="")}var K=t.shadowRoot.getElementById("text-chat-button");if(K)K.style.display="";else{var O=document.getElementById("text-chat-button");O&&(O.style.display="")}}throw M}if(!t.isMobile&&!t.callStartTime){t.callStartTime=Date.now(),console.log("⏱️ Starting call timer at",new Date(t.callStartTime).toISOString());var V=()=>{if(t.callStartTime){var e=Date.now()-t.callStartTime,n=Math.floor(e/6e4),A=Math.floor(e%6e4/1e3),o="".concat(n.toString().padStart(2,"0"),":").concat(A.toString().padStart(2,"0"));t._updateTimerElements(o,e)}};setTimeout(()=>{V(),t.callTimerInterval=setInterval(V,1e3)},100)}}else{if(F)throw console.log("🚫 Server rejected connection, aborting audio capture"),new Error("DOMAIN_NOT_WHITELISTED");if(!(t.sdk.isConnected&&t.sdk.voiceSDK&&t.sdk.voiceSDK.isConnected&&t.sdk.voiceSDK.websocket&&t.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN))throw console.warn("⚠️ Connection not valid, aborting audio capture"),new Error("Connection lost before starting audio capture");console.warn("⚠️ Connection not fully ready, but trying to start listening anyway...");try{var N=t._preliminaryInputStream||null;N&&(t._preliminaryInputStream=null),yield t.sdk.startListening(N),console.log("🎤 Started listening - permission granted"),t._stopPreliminaryInputStream(),t.isActive=!0,t.resetMuteState(),t.isMobile?(document.getElementById("mobile-voice-call-bar-container")?console.log("📱 Mobile device - bar already exists, updating status"):(console.log("📱 Mobile device - permission granted, creating minimized bar"),t.createMobileMinimizedBar()),0===t.messages.length&&t.messages.push({type:"assistant",text:t.t("transcriptWillAppear")}),t.startWaveformAnimation()):(t.startDesktopWaveformAnimation(),t.desktop.startLiveWaveformInterval())}catch(M){if(M.isServerRejection||"ServerRejected"===M.name)throw t.resetConnectingState(),M;if(console.error("❌ Failed to start listening - permission denied or error:",M),t.resetConnectingState(),t.isMobile){document.getElementById("mobile-voice-call-bar-container")&&t.removeMobileMinimizedBar();var j=t.shadowRoot.getElementById("voiceIdleState");j&&(j.style.display="flex");var G=t.shadowRoot.getElementById("text-chat-panel");if(G)G.style.display="";else{var z=document.getElementById("text-chat-panel");z&&(z.style.display="")}var W=t.shadowRoot.getElementById("text-chat-button");if(W)W.style.display="";else{var q=document.getElementById("text-chat-button");q&&(q.style.display="")}}throw M}if(!t.isMobile&&!t.callStartTime){t.callStartTime=Date.now(),console.log("⏱️ Starting call timer at",new Date(t.callStartTime).toISOString());var X=()=>{if(t.callStartTime){var e=Date.now()-t.callStartTime,n=Math.floor(e/6e4),A=Math.floor(e%6e4/1e3),o="".concat(n.toString().padStart(2,"0"),":").concat(A.toString().padStart(2,"0"));t._updateTimerElements(o,e)}};setTimeout(()=>{X(),t.callTimerInterval=setInterval(X,1e3)},100)}}console.log("✅ Voice call started successfully")}catch(M){if(M.isServerRejection||"ServerRejected"===M.name||console.error("❌ Error starting voice call:",M),t._stopPreliminaryInputStream(),t.resetConnectingState(),t.isActive=!1,t.callTimerInterval&&(clearInterval(t.callTimerInterval),t.callTimerInterval=null),t.callStartTime=null,t.sdk&&t.sdk.isConnected)try{t.sdk.disconnect()}catch(t){console.warn("Error disconnecting SDK on error:",t)}"NotAllowedError"===M.name||"PermissionDeniedError"===M.name?(Zt(),ce(()=>{t.resetUIState()})):"NotFoundError"===M.name||"DevicesNotFoundError"===M.name?le(()=>{t.resetUIState()}):M&&("DOMAIN_NOT_WHITELISTED"===M.message||M.message&&M.message.includes("Domain not whitelisted"))?yield t.endCallOnServerRejection():(t.showError(M.message||M),t.resetUIState())}})()}_stopPreliminaryInputStream(){if(this._preliminaryInputStream){try{this._preliminaryInputStream.getTracks().forEach(t=>t.stop())}catch(t){console.warn("⚠️ Error stopping preliminary stream:",t)}this._preliminaryInputStream=null}}resetUIState(){if(this.resetConnectingState(),this.isMobile){this.removeMobileMinimizedBar(),this.stopWaveformAnimation(),this.messages=[];var t=this.shadowRoot.getElementById("text-chat-panel");if(t)t.style.display="";else{var e=document.getElementById("text-chat-panel");e&&(e.style.display="")}}var n=this.shadowRoot.getElementById("voiceIdleState"),A=this.shadowRoot.getElementById("voiceActiveState");n&&(n.style.display="flex"),A&&(A.style.display="none")}endCallOnServerRejection(){var t=this;return xe(function*(){console.log("🚫 Server rejected call - ending call and stopping audio capture/VAD..."),console.log("🚫 Calling endCallOnServerRejection() - will show domain error message");var e=t.shadowRoot.getElementById("voiceInterface"),n=t.shadowRoot.getElementById("landingScreen");if(e&&(e.classList.add("active"),console.log("✅ Made voice interface visible")),n&&(n.classList.remove("active"),console.log("✅ Hid landing screen")),t.config.onShowVoice&&"function"==typeof t.config.onShowVoice&&(console.log("🚫 Calling onShowVoice callback to ensure voice interface is visible..."),t.config.onShowVoice()),t.sdk){try{var A,o,i=null===(A=t.sdk.voiceSDK)||void 0===A?void 0:A.audioRecorder;if(t.sdk.isListening||(null===(o=t.sdk.voiceSDK)||void 0===o?void 0:o.isRecording)||i&&i.isRecording||i&&null!==i.audioWorkletNode||i){if(console.log("🛑 Stopping audio capture/VAD..."),null!=i&&i.audioWorkletNode){console.log("🛑 Sending stop message to AudioWorklet to stop VAD...");try{i.audioWorkletNode.port.postMessage({type:"stop"}),yield new Promise(t=>setTimeout(t,150))}catch(t){console.warn("Error sending stop message to AudioWorklet:",t)}}if(t.sdk.voiceSDK&&"function"==typeof t.sdk.voiceSDK.stopRecording)try{yield t.sdk.voiceSDK.stopRecording(),console.log("✅ stopRecording() completed")}catch(t){console.warn("Error calling stopRecording:",t)}else if(t.sdk.stopListening)try{t.sdk.stopListening(),yield new Promise(t=>setTimeout(t,200))}catch(t){console.warn("Error calling stopListening:",t)}if(i&&"function"==typeof i.stop)try{yield i.stop(),console.log("✅ AudioRecorder.stop() completed")}catch(t){console.warn("Error calling AudioRecorder.stop():",t)}console.log("✅ Audio capture/VAD stopped")}null!=i&&i.mediaStream&&(console.log("🛑 Force stopping media stream tracks (backup cleanup)..."),i.mediaStream.getTracks().forEach(t=>{"ended"!==t.readyState&&(t.stop(),console.log("✅ Force stopped track:",t.kind))})),t.audioStream&&(console.log("🛑 Stopping stored audio stream..."),t.audioStream.getTracks().forEach(t=>{"ended"!==t.readyState&&t.stop()}),t.audioStream=null),t.sdk.hangup()}catch(e){console.warn("Error stopping listening on server rejection:",e);try{var r;null!==(r=t.sdk.voiceSDK)&&void 0!==r&&null!==(r=r.audioRecorder)&&void 0!==r&&r.mediaStream&&t.sdk.voiceSDK.audioRecorder.mediaStream.getTracks().forEach(t=>t.stop()),t.audioStream&&(t.audioStream.getTracks().forEach(t=>t.stop()),t.audioStream=null)}catch(t){console.warn("Error force-stopping media streams:",t)}}if(t.sdk.isConnected)try{t.sdk.disconnect()}catch(t){console.warn("Error disconnecting SDK on server rejection:",t)}}t.isActive=!1,t.config.onCallEnd&&t.config.onCallEnd,t.callTimerInterval&&(clearInterval(t.callTimerInterval),t.callTimerInterval=null);var a=t.shadowRoot.getElementById("voiceActiveState"),s=t.shadowRoot.getElementById("voiceIdleState");if(a&&(a.style.display="none"),s&&(s.style.display="flex",t.isShowingDomainError=!0,console.log("🚫 Setting isShowingDomainError flag to true"),console.log("🚫 Calling showDomainError() to display domain error in widget..."),t.showDomainError(),console.log("🚫 showDomainError() completed, isShowingDomainError:",t.isShowingDomainError)),t.isMobile){var c=t.shadowRoot.getElementById("text-chat-panel");if(c)c.style.display="";else{var l=document.getElementById("text-chat-panel");l&&(l.style.display="")}var d=t.shadowRoot.getElementById("text-chat-button");if(d)d.style.display="";else{var p=document.getElementById("text-chat-button");p&&(p.style.display="")}var u=t.shadowRoot.querySelector(".ttp-mobile-fab");u&&(u.style.display=""),t.removeMobileMinimizedBar(),t.stopWaveformAnimation();var h=t.t("domainNotValidated")||"Domain not whitelisted. Please contact support.";t.config.onMobileError?t.config.onMobileError(h):t.config.onErrorToast&&t.config.onErrorToast(h,"error")}})()}endVoiceCall(){var t;console.log("🔴 Ending voice call..."),this.isMicMuted=!1,this.isSpeakerMuted=!1,["desktopMuteBtn","desktopMuteBtnCompact"].forEach(t=>{var e=this.shadowRoot.getElementById(t);if(e){e.classList.remove("muted");var n=e.querySelector(".desktop-mic-icon"),A=e.querySelector(".desktop-mic-off-icon");n&&(n.style.display="block"),A&&(A.style.display="none")}}),["desktopSpeakerBtn","desktopSpeakerBtnCompact"].forEach(t=>{var e=this.shadowRoot.getElementById(t);if(e){e.classList.remove("muted");var n=e.querySelector(".desktop-speaker-icon"),A=e.querySelector(".desktop-speaker-off-icon");n&&(n.style.display="block"),A&&(A.style.display="none")}});var e=document.getElementById("mobile-voice-call-bar-container"),n=null==e?void 0:e.querySelector("#mobileMuteBtn");if(n){n.classList.remove("muted");var A=n.querySelector(".mobile-mic-icon"),o=n.querySelector(".mobile-mic-off-icon");A&&(A.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"),o&&(o.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;")}var i=null==e?void 0:e.querySelector("#mobileSpeakerBtn");if(i){i.classList.remove("muted");var r=i.querySelector(".mobile-speaker-icon"),a=i.querySelector(".mobile-speaker-off-icon");r&&(r.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"),a&&(a.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;")}if(this._resumeInfo=null,this.sdk&&this.isActive&&(this.sdk.stopListening(),this.sdk.hangup(),this.isActive=!1),this.audioStream&&(this.audioStream.getTracks().forEach(t=>t.stop()),this.audioStream=null),this.callTimerInterval&&(clearInterval(this.callTimerInterval),this.callTimerInterval=null),this._textInjectTimeout&&(clearTimeout(this._textInjectTimeout),this._textInjectTimeout=null),this._statusClearTimeout&&(clearTimeout(this._statusClearTimeout),this._statusClearTimeout=null),this._mobileTextInjectTimeout&&(clearTimeout(this._mobileTextInjectTimeout),this._mobileTextInjectTimeout=null),this._mobileStatusClearTimeout&&(clearTimeout(this._mobileStatusClearTimeout),this._mobileStatusClearTimeout=null),null!==(t=this.sdk)&&void 0!==t&&t.voiceSDK&&this.textHandlers._textInjectAckHandler&&(this.sdk.voiceSDK.off("textInjectAck",this.textHandlers._textInjectAckHandler),this.textHandlers._textInjectAckHandler=null),this._originalHintText=null,this._originalMobileHintText=null,this.isMobile||(this.stopDesktopWaveformAnimation(),this.desktop.stopLiveWaveformInterval(),this.transcript.clearConversationMessages(),this.conversationExpanded=!1),this.isMobile){this.stopWaveformAnimation(),this.collapseMobileTranscript(),this.removeMobileMinimizedBar(),this.messages=[];var s=this.shadowRoot.querySelector(".ttp-mobile-fab");s&&(s.style.display="");var c=this.shadowRoot.getElementById("text-chat-panel");if(c)c.style.display="";else{var l=document.getElementById("text-chat-panel");l&&(l.style.display="")}}var d=this.shadowRoot.getElementById("text-chat-button");if(d)d.style.display="",console.log("✅ Floating button restored (call ended)");else{var p=document.getElementById("text-chat-button");p&&(p.style.display="",console.log("✅ Floating button restored (call ended, fallback)"))}var u=this.shadowRoot.getElementById("voiceActiveState");u&&(u.style.display="none");var h=this.shadowRoot.getElementById("voiceIdleState");if(h&&(h.style.display="flex"),"function"==typeof this.config.onVoiceCallButtonClick)try{this.config.onVoiceCallButtonClick({timestamp:Date.now(),widgetState:"end"})}catch(t){console.error("Error in onVoiceCallButtonClick callback:",t)}this.config.onCallEnd&&this.config.onCallEnd(),setTimeout(()=>this.adjustSizesForContainer(),50);var g=this.shadowRoot.getElementById("transcriptText");g&&(g.textContent=this.t("transcriptWillAppear"),g.classList.add("empty"));var m=document.getElementById("mobile-voice-call-bar-container");if(m){var v=m.querySelector("#mobileTranscriptText");v&&(v.textContent=this.t("transcriptWillAppear"))}var f=this.shadowRoot.getElementById("voiceAvatarActive");f&&f.classList.remove("speaking"),console.log("✅ Voice call ended")}showConnectingState(){if(this.isMobile)console.log("📱 Mobile device - skipping showConnectingState() (minimized bar handles connecting state)");else{var t=this.shadowRoot.getElementById("voiceIdleState"),e=this.shadowRoot.getElementById("voiceActiveState");if(t){var n=t.querySelector(".voice-status-title"),A=t.querySelector(".voice-status-subtitle"),o=t.querySelector("#startCallBtn");if(n&&(n.textContent=this.t("connecting")),A&&(A.textContent=this.t("connectingSubtitle")),o){o.disabled=!0,o.style.opacity="0.6",o.style.cursor="not-allowed";var i=o.querySelector("span");if(i){var r=document.createElement("span");r.className="connecting-spinner",i.textContent="",i.appendChild(r),i.appendChild(document.createTextNode(" "+this.t("connecting")))}}t.style.display="flex"}e&&(e.style.display="none")}}resetConnectingState(){if(this.isShowingDomainError)console.log("🚫 resetConnectingState() called but domain error is displayed - skipping reset");else{var t=this.shadowRoot.getElementById("voiceIdleState");if(t){delete t.dataset.domainError;var e=t.querySelector(".ttp-headline"),n=t.querySelector(".ttp-subline"),A=t.querySelector(".ttp-online-dot"),o=t.querySelector(".ttp-agent-role");e&&(e.textContent=this.config.headline||this.config.startCallTitle||"Hi there 👋",e.style.color=""),n&&(n.innerHTML=this.config.subline||this.config.startCallSubtitle||"Ask me anything — I respond instantly<br>in voice or text.",n.style.color=""),A&&(A.style.background=""),o&&(o.textContent=this.config.agentRole||"AI Voice Assistant",o.style.color="");var i=t.querySelector(".ttp-body");if(i){var r=i.querySelector("#startCallBtn"),a=i.querySelector("#startTextBtn");r&&(r.style.display=""),a&&(a.style.display="");var s=i.querySelector(".ttp-domain-error-card");s&&s.remove();var c=i.querySelector("#domainErrorDismissBtn");c&&c.remove()}var l=t.querySelector(".voice-status-title"),d=t.querySelector(".voice-status-subtitle"),p=t.querySelector("#startCallBtn");l&&(l.textContent=this.getText("startCallTitle","clickToStartCall"),l.style.cssText=""),d&&(d.textContent=this.getText("startCallSubtitle","realTimeVoice"),d.style.cssText=""),p&&(p.disabled=!1,p.style.opacity="",p.style.cursor="",p.style.display="");var u=t.querySelector("#domainErrorBackBtn");null!=u&&u.parentNode&&u.parentNode.removeChild(u)}}}updateTranscript(t){return this.transcript.updateTranscript(t)}toggleConversationPanel(){return this.transcript.toggleConversationPanel()}addConversationMessage(t,e){return this.transcript.addConversationMessage(t,e)}renderConversationMessages(){return this.transcript.renderConversationMessages()}escapeHtml(t){var e=document.createElement("div");return e.textContent=t,e.innerHTML}toggleMute(){if(this.sdk&&this.isActive){var t=null;if(this.sdk.voiceSDK&&this.sdk.voiceSDK.audioRecorder&&this.sdk.voiceSDK.audioRecorder.mediaStream&&(t=this.sdk.voiceSDK.audioRecorder.mediaStream.getAudioTracks()[0]),!t&&this.audioStream&&(t=this.audioStream.getAudioTracks()[0]),t){t.enabled=!t.enabled,this.isMicMuted=!t.enabled;var e=this.shadowRoot.getElementById("desktopMuteBtn"),n=this.shadowRoot.getElementById("desktopMuteBtnCompact");if(this.isMobile||this.updateDesktopStatus(),e){var A=e.querySelector(".desktop-mic-icon"),o=e.querySelector(".desktop-mic-off-icon");A&&o&&(t.enabled?(e.classList.remove("muted"),A.style.display="block",o.style.display="none"):(e.classList.add("muted"),A.style.display="none",o.style.display="block"))}if(n){var i=n.querySelector(".desktop-mic-icon"),r=n.querySelector(".desktop-mic-off-icon");i&&r&&(t.enabled?(n.classList.remove("muted"),i.style.display="block",r.style.display="none"):(n.classList.add("muted"),i.style.display="none",r.style.display="block"))}if(this.isMobile){var a=document.getElementById("mobile-voice-call-bar-container"),s=null==a?void 0:a.querySelector("#mobileMuteBtn"),c=null==s?void 0:s.querySelector(".mobile-mic-icon"),l=null==s?void 0:s.querySelector(".mobile-mic-off-icon");s&&c&&l&&(t.enabled?(s.classList.remove("muted"),c.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;",l.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;"):(s.classList.add("muted"),c.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;",l.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"))}console.log(t.enabled?"🔊 Unmuted":"🔇 Muted")}else console.warn("⚠️ No audio track available for mute toggle")}}toggleSpeaker(){if(this.sdk&&this.isActive){if(this.isSpeakerMuted=!this.isSpeakerMuted,this.sdk.voiceSDK&&this.sdk.voiceSDK.audioPlayer?(this.sdk.voiceSDK.audioPlayer.setMuted(this.isSpeakerMuted),console.log("🔊 Speaker toggle:",this.isSpeakerMuted?"muted":"unmuted")):console.warn("⚠️ Cannot toggle speaker - audioPlayer not available"),!this.isMobile){var t=this.shadowRoot.getElementById("desktopSpeakerBtn"),e=this.shadowRoot.getElementById("desktopSpeakerBtnCompact");if(t){var n=t.querySelector(".desktop-speaker-icon"),A=t.querySelector(".desktop-speaker-off-icon");n&&A&&(this.isSpeakerMuted?(t.classList.add("muted"),n.style.display="none",A.style.display="block"):(t.classList.remove("muted"),n.style.display="block",A.style.display="none"))}if(e){var o=e.querySelector(".desktop-speaker-icon"),i=e.querySelector(".desktop-speaker-off-icon");o&&i&&(this.isSpeakerMuted?(e.classList.add("muted"),o.style.display="none",i.style.display="block"):(e.classList.remove("muted"),o.style.display="block",i.style.display="none"))}}if(this.isMobile){var r=document.getElementById("mobile-voice-call-bar-container"),a=null==r?void 0:r.querySelector("#mobileSpeakerBtn"),s=null==a?void 0:a.querySelector(".mobile-speaker-icon"),c=null==a?void 0:a.querySelector(".mobile-speaker-off-icon");a&&s&&c&&(this.isSpeakerMuted?(a.classList.add("muted"),s.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;",c.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"):(a.classList.remove("muted"),s.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;",c.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;"))}}}updateMobileStatus(t){return this.mobile.updateMobileStatus(t)}createMobileMinimizedBar(){return this.mobile.createMobileMinimizedBar()}showMobileCallBarAwaitingBrowserMic(){document.getElementById("mobile-voice-call-bar-container")||this.createMobileMinimizedBar();var t=document.getElementById("mobile-voice-call-bar-container");if(t){var e=this.t("awaitingBrowserMic"),n=this.t("awaitingBrowserMicDetail"),A=t.querySelector("#mobileStatusText"),o=t.querySelector("#mobileHeaderStatusText");A&&(A.textContent=e),o&&(o.textContent=e);var i=t.querySelector("#mobileTranscriptText");i&&(i.textContent=n)}}applyMobileBarConnectingCopy(){var t=document.getElementById("mobile-voice-call-bar-container");if(t){var e=this.t("connecting"),n=this.t("connectingSubtitle"),A=t.querySelector("#mobileStatusText"),o=t.querySelector("#mobileHeaderStatusText");A&&(A.textContent=e),o&&(o.textContent=e);var i=t.querySelector("#mobileTranscriptText");i&&(i.textContent=n)}}removeMobileMinimizedBar(){return this.mobile.removeMobileMinimizedBar()}expandMobileTranscript(){return this.mobile.expandMobileTranscript()}collapseMobileTranscript(){return this.mobile.collapseMobileTranscript()}addMobileMessage(t,e){return this.mobile.addMobileMessage(t,e)}startWaveformAnimation(){return this.mobile.startWaveformAnimation()}startMobileCallTimerEarly(){if(null==this.callStartTime&&!this.callTimerInterval){this.callStartTime=Date.now();var t=()=>{if(this.callStartTime){var t=Date.now()-this.callStartTime,e=Math.floor(t/6e4),n=Math.floor(t%6e4/1e3),A="".concat(e.toString().padStart(2,"0"),":").concat(n.toString().padStart(2,"0"));this._updateTimerElements(A,t)}};t(),this.callTimerInterval=setInterval(t,1e3)}}stopWaveformAnimation(){return this.mobile.stopWaveformAnimation()}resetMuteState(){var t,e;if(this.isMicMuted=!1,this.isSpeakerMuted=!1,console.log("%c🎤 MIC/SPEAKER RESET - New call starting unmuted","background: #10b981; color: white; font-size: 14px; font-weight: bold; padding: 4px 8px; border-radius: 4px;"),null!==(t=this.sdk)&&void 0!==t&&null!==(t=t.voiceSDK)&&void 0!==t&&null!==(t=t.audioRecorder)&&void 0!==t&&t.mediaStream){var n=this.sdk.voiceSDK.audioRecorder.mediaStream.getAudioTracks()[0];n&&(n.enabled=!0)}null!==(e=this.sdk)&&void 0!==e&&null!==(e=e.voiceSDK)&&void 0!==e&&e.audioPlayer&&this.sdk.voiceSDK.audioPlayer.setMuted(!1),["desktopMuteBtn","desktopMuteBtnCompact"].forEach(t=>{var e=this.shadowRoot.getElementById(t);if(e){e.classList.remove("muted");var n=e.querySelector(".desktop-mic-icon"),A=e.querySelector(".desktop-mic-off-icon");n&&(n.style.display="block"),A&&(A.style.display="none")}}),["desktopSpeakerBtn","desktopSpeakerBtnCompact"].forEach(t=>{var e=this.shadowRoot.getElementById(t);if(e){e.classList.remove("muted");var n=e.querySelector(".desktop-speaker-icon"),A=e.querySelector(".desktop-speaker-off-icon");n&&(n.style.display="block"),A&&(A.style.display="none")}});var A=document.getElementById("mobile-voice-call-bar-container"),o=null==A?void 0:A.querySelector("#mobileMuteBtn");if(o){o.classList.remove("muted");var i=o.querySelector(".mobile-mic-icon"),r=o.querySelector(".mobile-mic-off-icon");i&&(i.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"),r&&(r.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;")}var a=null==A?void 0:A.querySelector("#mobileSpeakerBtn");if(a){a.classList.remove("muted");var s=a.querySelector(".mobile-speaker-icon"),c=a.querySelector(".mobile-speaker-off-icon");s&&(s.style.cssText="display: block !important; visibility: visible !important; opacity: 1 !important; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important;"),c&&(c.style.cssText="display: none !important; visibility: hidden !important; opacity: 0 !important;")}}destroy(){this.isActive&&this.endVoiceCall(),this.audioStream&&(this.audioStream.getTracks().forEach(t=>t.stop()),this.audioStream=null),this.callTimerInterval&&(clearInterval(this.callTimerInterval),this.callTimerInterval=null),this.sdk&&(this.sdk.disconnect(),this.sdk=null)}}function Qe(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function Se(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){Qe(i,A,o,r,a,"next",t)}function a(t){Qe(i,A,o,r,a,"throw",t)}r(void 0)})}}class Fe{constructor(t,e){this.config=t,this.sdk=e,this.streamingEl=null,this.hasStartedStreaming=!1,this.isActive=!1,this.shadowRoot=t.shadowRoot||document,this.eventHandlers={autoResize:null,keydown:null},this.eventHandlersSetup=!1}t(t){var e,n,A=this.config.language||"en";return((null===(e=this.config.translations)||void 0===e?void 0:e[A])||(null===(n=this.config.translations)||void 0===n?void 0:n.en)||{})[t]||t}generateHTML(){var t,e,n,A,o,i,r,a,s,c,l=this.config.inputPlaceholder||(null===(t=this.config.panel)||void 0===t?void 0:t.inputPlaceholder)||this.t("typeMessage")||"Type your message...",d="unified"===(null===(e=this.config.behavior)||void 0===e?void 0:e.mode),p="rtl"===this.config.direction?"→":"←",u=d?'\n <div class="text-interface-top-bar">\n <button type="button" class="text-interface-back-btn" id="textUnifiedBackBtn" aria-label="'.concat(this.t("back"),'">\n <span class="text-interface-back-icon" aria-hidden="true">').concat(p,'</span>\n <span class="text-interface-back-label">').concat(this.t("back"),"</span>\n </button>\n </div>"):"";return'<div class="text-interface" id="textInterface">\n '.concat(u,'\n <div class="messages-container" id="messagesContainer">\n <div class="empty-state">\n <div class="empty-state-icon">💬</div>\n <div class="empty-state-title">').concat(this.t("hello"),'</div>\n <div class="empty-state-text">').concat(this.t("sendMessage"),'</div>\n </div>\n </div>\n <div class="input-container">\n <div class="input-wrapper" style="flex:1;">\n <textarea class="message-input" id="messageInput" placeholder="').concat(l,'" rows="1" dir="').concat(this.config.direction||"ltr",'"></textarea>\n </div>\n <button class="send-button" id="sendButton" aria-label="').concat(this.t("sendMessageAria"),'">').concat(this.config.sendButtonText||"➤","</button>\n ").concat(null!==(n=this.config.sendButtonHint)&&void 0!==n&&n.text||null!==(A=this.config.panel)&&void 0!==A&&null!==(A=A.sendButtonHint)&&void 0!==A&&A.text?'\n <div class="send-button-hint" style="color: '.concat((null===(o=this.config.sendButtonHint)||void 0===o?void 0:o.color)||(null===(i=this.config.panel)||void 0===i||null===(i=i.sendButtonHint)||void 0===i?void 0:i.color)||"#6B7280","; font-size: ").concat((null===(r=this.config.sendButtonHint)||void 0===r?void 0:r.fontSize)||(null===(a=this.config.panel)||void 0===a||null===(a=a.sendButtonHint)||void 0===a?void 0:a.fontSize)||"12px",'; text-align: center; margin-top: 4px;">\n ').concat((null===(s=this.config.sendButtonHint)||void 0===s?void 0:s.text)||(null===(c=this.config.panel)||void 0===c||null===(c=c.sendButtonHint)||void 0===c?void 0:c.text),"\n </div>\n "):"","\n </div>\n </div>")}generateCSS(){var t,e,n,A,o,i,r,a,s,c,l,d,p,u=this.config.messages,h=(this.config.panel,this.config.animation,this.config.sendButtonColor||(null===(t=this.config.panel)||void 0===t?void 0:t.sendButtonColor)||"#7C3AED"),g=this.config.sendButtonHoverColor||(null===(e=this.config.panel)||void 0===e?void 0:e.sendButtonHoverColor)||"#6D28D9",m=this.config.sendButtonTextColor||(null===(n=this.config.panel)||void 0===n?void 0:n.sendButtonTextColor)||"#FFFFFF",v=(this.config.inputPlaceholder||null===(A=this.config.panel)||void 0===A||A.inputPlaceholder,this.config.inputBorderColor||(null===(o=this.config.panel)||void 0===o?void 0:o.inputBorderColor)||"#E5E7EB"),f=this.config.inputFocusColor||(null===(i=this.config.panel)||void 0===i?void 0:i.inputFocusColor)||"#7C3AED",w=this.config.inputBackgroundColor||(null===(r=this.config.panel)||void 0===r?void 0:r.inputBackgroundColor)||"#FFFFFF",B=this.config.inputTextColor||(null===(a=this.config.panel)||void 0===a?void 0:a.inputTextColor)||"#1F2937",b=this.config.inputFontSize||(null===(s=this.config.panel)||void 0===s?void 0:s.inputFontSize)||"14px",y=this.config.inputBorderRadius||(null===(c=this.config.panel)||void 0===c?void 0:c.inputBorderRadius)||20,x=this.config.inputPadding||(null===(l=this.config.panel)||void 0===l?void 0:l.inputPadding)||"6px 14px",C=!1===this.config.useShadowDOM?" !important":"";return"\n .text-interface-top-bar {\n flex-shrink: 0".concat(C,";\n padding: 10px 12px 8px").concat(C,";\n border-bottom: 1px solid #E5E7EB").concat(C,";\n background: #FFFFFF").concat(C,";\n display: flex").concat(C,";\n align-items: center").concat(C,";\n }\n .text-interface-back-btn {\n display: inline-flex").concat(C,";\n align-items: center").concat(C,";\n gap: 6px").concat(C,";\n padding: 6px 10px").concat(C,";\n margin: 0").concat(C,";\n border: none").concat(C,";\n border-radius: 8px").concat(C,";\n background: transparent").concat(C,";\n color: #475569").concat(C,";\n font-size: 14px").concat(C,";\n font-weight: 600").concat(C,";\n cursor: pointer").concat(C,";\n font-family: inherit").concat(C,";\n }\n .text-interface-back-btn:hover {\n background: #f1f5f9").concat(C,";\n color: #334155").concat(C,";\n }\n .text-interface-back-icon {\n font-size: 16px").concat(C,";\n line-height: 1").concat(C,";\n }\n .text-interface-back-label {\n line-height: 1.2").concat(C,";\n }\n /* Messages container using new classes */\n #messagesContainer { \n flex: 1").concat(C,"; \n overflow-y: auto").concat(C,"; \n overflow-x: hidden").concat(C,"; \n padding: 20px").concat(C,"; \n background: #f8fafc").concat(C,"; \n display: flex").concat(C,"; \n flex-direction: column").concat(C,"; \n gap: 16px").concat(C,"; \n min-height: 0").concat(C,"; \n }\n .empty-state { \n flex: 1").concat(C,"; \n display: flex").concat(C,"; \n flex-direction: column").concat(C,"; \n align-items: center").concat(C,"; \n justify-content: center").concat(C,"; \n gap: 12px").concat(C,"; \n color: #64748b").concat(C,"; \n text-align: center").concat(C,"; \n padding: 20px").concat(C,"; \n }\n .empty-state-icon { font-size: 48px").concat(C,"; opacity: 0.3").concat(C,"; }\n .empty-state-title { font-size: 20px").concat(C,"; font-weight: 700").concat(C,"; color: #334155").concat(C,"; }\n .empty-state-text { font-size: 13px").concat(C,"; max-width: 280px").concat(C,"; }\n\n .text-interface { \n display: none").concat(C,"; \n flex: 1").concat(C,"; \n flex-direction: column").concat(C,"; \n min-height: 0").concat(C,"; \n overflow: hidden").concat(C,"; \n }\n .text-interface.active { display: flex").concat(C,"; }\n \n .message { \n display: flex").concat(C,"; \n gap: 8px").concat(C,"; \n padding: 4px 0").concat(C,"; \n max-width: 100%").concat(C,"; \n align-items: center").concat(C,"; \n }\n .message.edge-left { flex-direction: row").concat(C,"; }\n .message.edge-right { flex-direction: row-reverse").concat(C,"; }\n .message-bubble { \n padding: 12px").concat(C,"; \n border-radius: ").concat(u.borderRadius,"px").concat(C,"; \n max-width: 80%").concat(C,"; \n font-size: ").concat(u.fontSize,"; \n word-wrap: break-word").concat(C,"; \n text-align: ").concat("rtl"===this.config.direction?"right":"left").concat(C,"; \n direction: ").concat(this.config.direction||"ltr",";\n }\n .message.user .message-bubble { \n background: ").concat(u.userBackgroundColor).concat(C,"; \n color: ").concat(u.userTextColor||u.textColor).concat(C,"; \n }\n .message.agent .message-bubble { \n background: ").concat(u.agentBackgroundColor).concat(C,"; \n color: ").concat(u.agentTextColor||u.textColor).concat(C,"; \n }\n .message.user { \n align-self: ").concat("rtl"===this.config.direction?"flex-start":"flex-end").concat(C,"; \n }\n .message.agent { \n align-self: ").concat("rtl"===this.config.direction?"flex-end":"flex-start").concat(C,"; \n }\n .message .message-bubble { \n text-align: ").concat("rtl"===this.config.direction?"right":"left"," !important; \n }\n ").concat("rtl"===this.config.direction?"\n .message-bubble {\n text-align: right !important;\n }\n ":"","\n .message-avatar { \n width: 20px").concat(C,"; \n height: 20px").concat(C,"; \n display: flex").concat(C,"; \n align-items: center").concat(C,"; \n justify-content: center").concat(C,"; \n flex-shrink: 0").concat(C,"; \n color: inherit").concat(C,"; \n font-size: 18px").concat(C,"; \n line-height: 1").concat(C,"; \n background: transparent").concat(C,"; \n border: none").concat(C,"; \n }\n .message-avatar.user { background: transparent").concat(C,"; }\n .message-avatar.agent { background: transparent").concat(C,"; }\n \n .message.system {\n background: ").concat(u.systemBackgroundColor,";\n align-self: flex-start").concat(C,";\n }\n .message.error {\n background: ").concat(u.errorBackgroundColor,";\n align-self: flex-start").concat(C,";\n }\n \n .input-container {\n display: flex").concat(C,";\n gap: 8px").concat(C,";\n padding: 12px 16px").concat(C,";\n background: #FFFFFF").concat(C,";\n border-top: 1px solid #E5E7EB").concat(C,";\n align-items: center").concat(C,";\n flex-shrink: 0").concat(C,";\n flex-direction: ").concat("rtl"===this.config.direction?"row-reverse":"row").concat(C,";\n }\n \n .input-wrapper {\n position: relative").concat(C,";\n display: flex").concat(C,";\n align-items: center").concat(C,";\n }\n \n .message-input {\n width: 100%").concat(C,";\n min-height: 32px").concat(C,";\n max-height: 120px").concat(C,";\n padding: ").concat(x,";\n border: 1px solid ").concat(v,";\n border-radius: ").concat(y,"px;\n font-size: ").concat(b,";\n font-family: inherit").concat(C,";\n line-height: 1.3").concat(C,";\n resize: none").concat(C,";\n overflow-y: auto").concat(C,";\n background: ").concat(w,";\n color: ").concat(B,";\n vertical-align: top").concat(C,";\n margin: 0").concat(C,";\n display: block").concat(C,";\n white-space: pre-wrap").concat(C,";\n word-wrap: break-word").concat(C,";\n text-align: ").concat("rtl"===this.config.direction?"right":"left").concat(C,";\n direction: ").concat(this.config.direction||"ltr",";\n -webkit-appearance: none").concat(C,";\n appearance: none").concat(C,";\n box-sizing: border-box").concat(C,";\n }\n \n .message-input:focus {\n outline: none").concat(C,";\n border-color: ").concat(f,";\n background: ").concat("#FFFFFF"===w?"#FFFFFF":w).concat(C,";\n box-shadow: 0 0 0 3px ").concat(f,"33;\n }\n \n .message-input::placeholder {\n color: #9CA3AF").concat(C,";\n text-align: ").concat("rtl"===this.config.direction?"right":"left").concat(C,";\n }\n \n .send-button {\n width: 40px").concat(C,";\n height: 40px").concat(C,";\n border-radius: 50%").concat(C,";\n border: none").concat(C,";\n background: ").concat(h,";\n color: ").concat(m,";\n font-size: ").concat(this.config.sendButtonFontSize||(null===(d=this.config.panel)||void 0===d?void 0:d.sendButtonFontSize)||"18px",";\n font-weight: ").concat(this.config.sendButtonFontWeight||(null===(p=this.config.panel)||void 0===p?void 0:p.sendButtonFontWeight)||"500",";\n cursor: pointer").concat(C,";\n display: flex").concat(C,";\n align-items: center").concat(C,";\n justify-content: center").concat(C,";\n flex-shrink: 0").concat(C,";\n transition: all 0.2s ease").concat(C,";\n box-shadow: 0 4px 12px rgba(124, 60, 237, 0.3)").concat(C,";\n }\n \n .send-button:hover:not(:disabled) {\n background: ").concat(g,";\n transform: scale(1.05)").concat(C,";\n box-shadow: 0 6px 16px rgba(124, 60, 237, 0.4)").concat(C,";\n }\n \n .send-button-hint {\n width: 100%").concat(C,";\n text-align: center").concat(C,";\n margin-top: 4px").concat(C,";\n }\n \n .send-button:disabled {\n opacity: 0.5").concat(C,";\n cursor: not-allowed").concat(C,";\n }\n \n .typing-indicator {\n display: inline-flex").concat(C,";\n gap: 4px").concat(C,";\n align-items: center").concat(C,";\n }\n \n .typing-dot {\n width: 6px").concat(C,";\n height: 6px").concat(C,";\n border-radius: 50%").concat(C,";\n background: #64748b").concat(C,";\n animation: typingDot 1.4s ease-in-out infinite").concat(C,";\n }\n \n .typing-dot:nth-child(2) { animation-delay: 0.2s").concat(C,"; }\n .typing-dot:nth-child(3) { animation-delay: 0.4s").concat(C,"; }\n \n @keyframes typingDot {\n 0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }\n 30% { transform: translateY(-8px); opacity: 1; }\n }\n \n .error-message {\n padding: 12px").concat(C,";\n background: ").concat(u.errorBackgroundColor,";\n border-radius: ").concat(u.borderRadius,"px;\n color: #991B1B").concat(C,";\n font-size: ").concat(u.fontSize,";\n margin: 8px 0").concat(C,";\n }\n \n @media (max-width: 768px) {\n #messagesContainer {\n padding: 12px").concat(C,";\n gap: 12px").concat(C,";\n }\n \n .message-bubble {\n max-width: 85%").concat(C,";\n font-size: 14px").concat(C,";\n padding: 10px").concat(C,";\n }\n \n .text-input-container {\n padding: 10px").concat(C,";\n gap: 8px").concat(C,";\n }\n \n #text-chat-input {\n font-size: 16px !important; /* Prevents iOS zoom on focus */\n padding: 10px 14px").concat(C,";\n min-height: 44px").concat(C,";\n }\n \n #text-chat-send {\n min-width: 56px").concat(C,";\n min-height: 44px").concat(C,";\n width: 56px").concat(C,";\n height: 44px").concat(C,";\n }\n \n .empty-state-icon {\n font-size: 40px").concat(C,";\n }\n \n .empty-state-title {\n font-size: 18px").concat(C,";\n }\n \n .empty-state-text {\n font-size: 12px").concat(C,";\n }\n }\n \n @media (max-width: 480px) {\n #messagesContainer {\n padding: 10px").concat(C,";\n gap: 10px").concat(C,";\n }\n \n .message-bubble {\n max-width: 90%").concat(C,";\n font-size: 13px").concat(C,";\n padding: 8px").concat(C,";\n }\n \n .text-input-container {\n padding: 8px").concat(C,";\n }\n \n #text-chat-input {\n font-size: 16px !important;\n padding: 8px 12px").concat(C,";\n }\n }\n ")}setupEventHandlers(){var t=this.shadowRoot.getElementById("sendButton"),e=this.shadowRoot.getElementById("messageInput"),n=this.shadowRoot.getElementById("newChatBtn");if(t&&(t.onclick=()=>this.sendMessage()),n&&(n.onclick=()=>this.startNewChat()),this.updateInputAttributes(),e){e.style.height="32px",e.style.overflow="hidden";var A=()=>{e.style.height="auto";var t=Math.min(e.scrollHeight,120);e.style.height=t+"px",e.style.overflowY=t>=120?"auto":"hidden",t>=120&&setTimeout(()=>{e.scrollTop=e.scrollHeight},0)};e.addEventListener("input",A),e.addEventListener("keydown",t=>{"Enter"!==t.key||t.shiftKey?"Enter"===t.key&&t.shiftKey&&setTimeout(A,0):(t.preventDefault(),this.sendMessage())})}}startNewChat(){try{localStorage.removeItem("ttp_text_chat_conversation_id")}catch(t){}this.sdk&&(this.sdk.config.conversationId=null);var t=this.shadowRoot.getElementById("messagesContainer");t&&(t.innerHTML='\n <div class="empty-state">\n <div class="empty-state-icon">💬</div>\n <div class="empty-state-title">'.concat(this.t("hello"),'</div>\n <div class="empty-state-text">').concat(this.t("sendMessage"),"</div>\n </div>"));var e=this.shadowRoot.getElementById("messageInput");e&&e.focus()}updateInputAttributes(){var t=this.shadowRoot.getElementById("messageInput");if(t){var e,n=this.config.inputPlaceholder||(null===(e=this.config.panel)||void 0===e?void 0:e.inputPlaceholder)||this.t("typeMessage")||"Type your message...";t.placeholder=n,t.dir=this.config.direction||"ltr",t.style.textAlign="rtl"===this.config.direction?"right":"left"}}show(){var t=this.shadowRoot.getElementById("textInterface");t&&t.classList.add("active"),setTimeout(()=>{var t=this.shadowRoot.getElementById("messageInput");t&&t.focus()},50)}hide(){var t=this.shadowRoot.getElementById("textInterface");t&&t.classList.remove("active")}startChat(){var t=this;return Se(function*(){t.isActive=!0,t.updateSendButtonState()})()}sendMessage(){var t=this;return Se(function*(){var e=t.shadowRoot.getElementById("messageInput"),n=e.value.trim();if(n){t.isActive||(yield t.startChat()),t.addMessage("user",n),e.value="",e.style.height="32px",e.style.overflow="hidden";try{t.beginStreaming(),yield t.sdk.sendMessage(n)}catch(e){console.error("❌ Failed to send message:",e),e&&("DOMAIN_NOT_WHITELISTED"===e.message||e.message&&e.message.includes("Domain not whitelisted"))||t.showError(e),t.stopStreamingState()}}})()}updateSendButtonState(){var t=this.shadowRoot.getElementById("sendButton");t&&(t.disabled=!this.isActive)}addMessage(t,e){var n,A,o=this.shadowRoot.getElementById("messagesContainer");if(o){var i=o.querySelector(".empty-state");i&&i.remove();var r=document.createElement("div"),a="rtl"===this.config.direction?"user"===t?"edge-left":"edge-right":"user"===t?"edge-right":"edge-left";r.className="message ".concat(t," ").concat(a);var s=document.createElement("div");s.className="message-avatar ".concat(t);var c="user"===t?(null===(n=this.config.messages)||void 0===n?void 0:n.userAvatarIcon)||"👤":(null===(A=this.config.messages)||void 0===A?void 0:A.agentAvatarIcon)||"🤖";s.textContent=c;var l=document.createElement("div");l.className="message-bubble",l.textContent=e,r.appendChild(s),r.appendChild(l),o.appendChild(r),o.scrollTop=o.scrollHeight}}beginStreaming(){var t,e=this.shadowRoot.getElementById("messagesContainer");if(e){this.stopStreamingState();var n=document.createElement("div"),A="rtl"===this.config.direction?"edge-right":"edge-left";n.className="message agent ".concat(A),n.id="agent-streaming";var o=document.createElement("div");o.className="message-avatar agent",o.textContent=(null===(t=this.config.messages)||void 0===t?void 0:t.agentAvatarIcon)||"🤖";var i=document.createElement("div");i.className="message-bubble",i.innerHTML='<span class="typing-indicator"><span class="typing-dot"></span><span class="typing-dot"></span><span class="typing-dot"></span></span>',n.appendChild(o),n.appendChild(i),e.appendChild(n),this.streamingEl=i,this.hasStartedStreaming=!1,e.scrollTop=e.scrollHeight}}appendStreamingChunk(t){if(this.streamingEl){this.hasStartedStreaming||(this.streamingEl.textContent="",this.hasStartedStreaming=!0),this.streamingEl.textContent+=t;var e=this.shadowRoot.getElementById("messagesContainer");e&&(e.scrollTop=e.scrollHeight)}}finalizeStreaming(t){if(this.streamingEl){this.streamingEl.textContent=t||this.streamingEl.textContent;var e=this.shadowRoot.getElementById("agent-streaming");e&&(e.id=""),this.streamingEl=null}this.updateSendButtonState()}stopStreamingState(){var t=this.shadowRoot.getElementById("agent-streaming");t&&t.remove(),this.streamingEl=null,this.hasStartedStreaming=!1}showError(t){var e=this.shadowRoot.getElementById("messagesContainer");if(e){if(t&&("DOMAIN_NOT_WHITELISTED"===t.message||"string"==typeof t&&t.includes("DOMAIN_NOT_WHITELISTED")||t.message&&t.message.includes("Domain not whitelisted")||"string"==typeof t&&t.includes("Domain not whitelisted"))){var n,A=document.createElement("div");A.className="error-message",A.style.cssText="padding: 16px; margin: 12px; border-radius: 8px; background: "+((null===(n=this.config.messages)||void 0===n?void 0:n.errorBackgroundColor)||"#FEE2E2")+";";var o=document.createElement("div");o.style.cssText="font-weight: 600; font-size: 16px; margin-bottom: 8px; color: #991B1B;",o.textContent=this.t("domainNotValidated");var i=document.createElement("div");i.style.cssText="font-size: 14px; color: #991B1B; line-height: 1.5;",i.textContent=this.t("domainErrorMessage"),A.appendChild(o),A.appendChild(i),e.appendChild(A)}else{var r=document.createElement("div");r.className="error-message",r.textContent="string"==typeof t?t:(null==t?void 0:t.message)||t,e.appendChild(r)}e.scrollTop=e.scrollHeight}}setActive(t){this.isActive=t,this.updateSendButtonState()}}const Ue={en:{landingTitle:"How would you like to communicate?",landingSubtitle:"Choose your preferred method",voiceCall:"Voice Call",textChat:"Text Chat",clickToStartCall:"Click to Start Call",realTimeVoice:"Real-time voice conversation",startCall:"Start Call",connecting:"Connecting...",connectingSubtitle:"Please wait",awaitingBrowserMic:"Waiting for microphone…",awaitingBrowserMicDetail:"Allow access in your browser’s permission prompt.",listening:"Listening...",speakFreely:"Speak freely",liveTranscript:"Live Transcript",transcriptWillAppear:"Transcript will appear here during the call...",userTranscriptPrefix:"You: ",mute:"Mute",speaker:"Speaker",endCall:"End Call",hello:"Hello! How can I help?",sendMessage:"Send a message to get started",online:"Online",newChat:"New Chat",back:"Back",backToModeChoice:"Voice or text",close:"Close",error:"Error",typeMessage:"Type your message...",sendMessageAria:"Send message",domainNotValidated:"Domain not validated",domainErrorMessage:"This domain is not whitelisted. Please contact the administrator to whitelist your website URL."},he:{landingTitle:"איך תרצה לתקשר?",landingSubtitle:"בחר את השיטה המועדפת עליך",voiceCall:"שיחה קולית",textChat:"צ'אט טקסט",clickToStartCall:"לחץ להתחלת שיחה",realTimeVoice:"שיחה קולית בזמן אמת",startCall:"התחל שיחה",connecting:"מתחבר...",connectingSubtitle:"אנא המתן",awaitingBrowserMic:"ממתין למיקרופון…",awaitingBrowserMicDetail:"אשר גישה בחלון ההרשאות של הדפדפן.",listening:"מקשיב...",speakFreely:"דבר בחופשיות",liveTranscript:"תמלול בזמן אמת",transcriptWillAppear:"התמלול יופיע כאן במהלך השיחה...",userTranscriptPrefix:"אתה: ",mute:"השתק",speaker:"רמקול",endCall:"סיים שיחה",hello:"שלום! איך אפשר לעזור?",sendMessage:"שלח הודעה או עבור למצב קולי לשיחה בזמן אמת",online:"מקוון",newChat:"צ'אט חדש",back:"חזור",backToModeChoice:"קול או טקסט",close:"סגור",error:"שגיאה",typeMessage:"הקלד הודעה...",sendMessageAria:"שלח הודעה",domainNotValidated:"דומיין לא מאומת",domainErrorMessage:"דומיין זה לא ברשימת המורשים. אנא פנה למנהל המערכת כדי להוסיף את כתובת האתר שלך לרשימה."},ar:{landingTitle:"كيف تريد التواصل؟",landingSubtitle:"اختر الطريقة المفضلة لديك",voiceCall:"مكالمة صوتية",textChat:"دردشة نصية",clickToStartCall:"انقر لبدء المكالمة",realTimeVoice:"محادثة صوتية في الوقت الفعلي",startCall:"ابدأ المكالمة",connecting:"جارٍ الاتصال...",connectingSubtitle:"يرجى الانتظار",awaitingBrowserMic:"في انتظار الميكروفون…",awaitingBrowserMicDetail:"اسمح بالوصول في موجه أذونات المتصفح.",listening:"الاستماع...",speakFreely:"تكلم بحرية",liveTranscript:"نص مباشر",transcriptWillAppear:"سيظهر النص هنا أثناء المكالمة...",userTranscriptPrefix:"أنت: ",mute:"كتم الصوت",speaker:"مكبر الصوت",endCall:"إنهاء المكالمة",hello:"مرحبا! كيف يمكنني المساعدة؟",sendMessage:"أرسل رسالة للبدء",online:"متصل",newChat:"محادثة جديدة",back:"رجوع",backToModeChoice:"صوت أو نص",close:"إغلاق",error:"خطأ",typeMessage:"اكتب رسالة...",sendMessageAria:"إرسال رسالة",domainNotValidated:"النطاق غير معتمد",domainErrorMessage:"هذا النطاق غير مسموح به. يرجى الاتصال بالمسؤول لإضافة عنوان موقع الويب الخاص بك إلى القائمة."},ru:{landingTitle:"Как вы хотите общаться?",landingSubtitle:"Выберите предпочтительный способ",voiceCall:"Голосовой звонок",textChat:"Текстовый чат",clickToStartCall:"Нажмите, чтобы начать звонок",realTimeVoice:"Голосовой разговор в реальном времени",startCall:"Начать звонок",connecting:"Подключение...",connectingSubtitle:"Пожалуйста, подождите",awaitingBrowserMic:"Ожидание микрофона…",awaitingBrowserMicDetail:"Разрешите доступ в запросе браузера.",listening:"Слушаю...",speakFreely:"Говорите свободно",liveTranscript:"Живая транскрипция",transcriptWillAppear:"Транскрипция появится здесь во время звонка...",userTranscriptPrefix:"Вы: ",mute:"Отключить звук",speaker:"Динамик",endCall:"Завершить звонок",hello:"Привет! Как я могу помочь?",sendMessage:"Отправьте сообщение для начала",online:"В сети",newChat:"Новый чат",back:"Назад",backToModeChoice:"Голос или текст",close:"Закрыть",error:"Ошибка",typeMessage:"Введите сообщение...",sendMessageAria:"Отправить сообщение",domainNotValidated:"Домен не проверен",domainErrorMessage:"Этот домен не в белом списке. Пожалуйста, свяжитесь с администратором, чтобы добавить URL вашего веб-сайта в список."},es:{landingTitle:"¿Cómo te gustaría comunicarte?",landingSubtitle:"Elige tu método preferido",voiceCall:"Llamada de voz",textChat:"Chat de texto",clickToStartCall:"Haz clic para iniciar la llamada",realTimeVoice:"Conversación de voz en tiempo real",startCall:"Iniciar llamada",connecting:"Conectando...",connectingSubtitle:"Por favor espere",awaitingBrowserMic:"Esperando el micrófono…",awaitingBrowserMicDetail:"Permita el acceso en el cuadro de permisos del navegador.",listening:"Escuchando...",speakFreely:"Habla libremente",liveTranscript:"Transcripción en vivo",transcriptWillAppear:"La transcripción aparecerá aquí durante la llamada...",userTranscriptPrefix:"Tú: ",mute:"Silenciar",speaker:"Altavoz",endCall:"Terminar llamada",hello:"¡Hola! ¿Cómo puedo ayudarte?",sendMessage:"Envía un mensaje para comenzar",online:"En línea",newChat:"Nuevo chat",back:"Atrás",backToModeChoice:"Voz o texto",close:"Cerrar",error:"Error",typeMessage:"Escribe un mensaje...",sendMessageAria:"Enviar mensaje",domainNotValidated:"Dominio no validado",domainErrorMessage:"Este dominio no está en la lista blanca. Por favor, contacte al administrador para agregar la URL de su sitio web a la lista."},fr:{landingTitle:"Comment souhaitez-vous communiquer?",landingSubtitle:"Choisissez votre méthode préférée",voiceCall:"Appel vocal",textChat:"Chat texte",clickToStartCall:"Cliquez pour démarrer l'appel",realTimeVoice:"Conversation vocale en temps réel",startCall:"Démarrer l'appel",connecting:"Connexion...",connectingSubtitle:"Veuillez patienter",awaitingBrowserMic:"En attente du microphone…",awaitingBrowserMicDetail:"Autorisez l’accès dans la fenêtre d’autorisation du navigateur.",listening:"Écoute...",speakFreely:"Parlez librement",liveTranscript:"Transcripción en direct",transcriptWillAppear:"La transcription apparaîtra ici pendant l'appel...",userTranscriptPrefix:"Vous : ",mute:"Muet",speaker:"Haut-parleur",endCall:"Terminer l'appel",hello:"Bonjour! Comment puis-je vous aider?",sendMessage:"Envoyez un message pour commencer",online:"En ligne",newChat:"Nouveau chat",back:"Retour",backToModeChoice:"Voix ou texte",close:"Fermer",error:"Erreur",typeMessage:"Tapez votre message...",sendMessageAria:"Envoyer un message",domainNotValidated:"Domaine non validé",domainErrorMessage:"Ce domaine n'est pas sur la liste blanche. Veuillez contacter l'administrateur pour ajouter l'URL de votre site Web à la liste."},de:{landingTitle:"Wie möchten Sie kommunizieren?",landingSubtitle:"Wählen Sie Ihre bevorzugte Methode",voiceCall:"Sprachanruf",textChat:"Text-Chat",clickToStartCall:"Klicken Sie, um den Anruf zu starten",realTimeVoice:"Sprachanruf in Echtzeit",startCall:"Anruf starten",connecting:"Verbinden...",connectingSubtitle:"Bitte warten",awaitingBrowserMic:"Warte auf Mikrofon…",awaitingBrowserMicDetail:"Erlauben Sie den Zugriff in der Browser-Anfrage.",listening:"Hören...",speakFreely:"Sprechen Sie frei",liveTranscript:"Live-Transkription",transcriptWillAppear:"Die Transkription erscheint hier während des Anrufs...",userTranscriptPrefix:"Sie: ",mute:"Stumm",speaker:"Lautsprecher",endCall:"Anruf beenden",hello:"Hallo! Wie kann ich helfen?",sendMessage:"Senden Sie eine Nachricht zum Starten",online:"Online",newChat:"Neuer Chat",back:"Zurück",backToModeChoice:"Sprache oder Text",close:"Schließen",error:"Fehler",typeMessage:"Geben Sie eine Nachricht ein...",sendMessageAria:"Nachricht senden",domainNotValidated:"Domain nicht validiert",domainErrorMessage:"Diese Domain steht nicht auf der Whitelist. Bitte kontaktieren Sie den Administrator, um die URL Ihrer Website zur Liste hinzuzufügen."}};var Ee="ttp-gallery-handler-styles";function ke(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,A=null,o=[],i=0,r=null,a=!1,s=[],c=[],l=[],d=null,p=null,u=null,h=null,g=null;function m(){try{var e,n=null===(e=t.shadowRoot)||void 0===e?void 0:e.host;n&&(n.style.zIndex=g||"",g=null)}catch(t){}}function v(t){var e;0!==o.length&&(i=(t%o.length+o.length)%o.length,s.forEach((t,e)=>t.classList.toggle("ttp-gh-img-active",e===i)),c.forEach((t,e)=>t.classList.toggle("ttp-gh-thumb-active",e===i)),l.forEach((t,e)=>t.classList.toggle("ttp-gh-dot-active",e===i)),d&&(d.textContent=(null===(e=o[i])||void 0===e?void 0:e.caption)||""),p&&(p.textContent="".concat(i+1," / ").concat(o.length)))}function f(){o.length<2||(w(),r=setInterval(()=>v(i+1),4e3))}function w(){r&&(clearInterval(r),r=null)}function B(){w(),f()}function b(){if(!a&&n){a=!0,w(),n.classList.remove("ttp-gh-visible");var t=n;setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),t._escHandler&&document.removeEventListener("keydown",t._escHandler)},320),n=null,A=null,s=[],c=[],l=[],m()}}return{handleShowMedia:function(r){n&&(w(),n&&(n._escHandler&&document.removeEventListener("keydown",n._escHandler),n.parentNode&&n.parentNode.removeChild(n),n=null,A=null,s=[],c=[],l=[]),m()),a=!1,function(){if(!document.getElementById(Ee)){var t=document.createElement("style");t.id=Ee,t.textContent="\n/* ── Backdrop ── */\n.ttp-gh-backdrop {\n position: fixed;\n inset: 0;\n z-index: 2147483640;\n background: rgba(0, 0, 0, 0);\n backdrop-filter: blur(0px);\n -webkit-backdrop-filter: blur(0px);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n box-sizing: border-box;\n transition: background 0.3s ease, backdrop-filter 0.3s ease;\n pointer-events: none;\n}\n.ttp-gh-backdrop.ttp-gh-visible {\n background: rgba(0, 0, 0, 0.45);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n pointer-events: all;\n}\n\n/* ── Card ── */\n.ttp-gh-card {\n position: relative;\n width: 80vw;\n max-width: 680px;\n background: #fff;\n border-radius: 20px;\n overflow: hidden;\n box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.10);\n display: flex;\n flex-direction: column;\n opacity: 0;\n transform: scale(0.94) translateY(10px);\n transition: opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1),\n transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);\n max-height: calc(100vh - 32px);\n}\n.ttp-gh-backdrop.ttp-gh-visible .ttp-gh-card {\n opacity: 1;\n transform: scale(1) translateY(0);\n}\n\n/* ── Image area ── */\n.ttp-gh-img-wrap {\n position: relative;\n width: 100%;\n padding-top: 56.25%; /* 16:9 */\n background: #f0f0ee;\n overflow: hidden;\n flex-shrink: 0;\n}\n.ttp-gh-img {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n opacity: 0;\n transition: opacity 0.5s ease, transform 0.5s ease;\n transform: scale(1.03);\n z-index: 1;\n}\n.ttp-gh-img.ttp-gh-img-active {\n opacity: 1;\n transform: scale(1);\n}\n.ttp-gh-img-placeholder {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #f0f0ee;\n z-index: 0;\n}\n\n/* Gradient + caption */\n.ttp-gh-img-grad {\n position: absolute;\n bottom: 0; left: 0; right: 0;\n height: 50%;\n background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.42));\n pointer-events: none;\n z-index: 2;\n}\n.ttp-gh-caption {\n position: absolute;\n bottom: 12px; left: 16px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 13px;\n font-weight: 500;\n color: rgba(255,255,255,0.92);\n pointer-events: none;\n letter-spacing: 0.01em;\n z-index: 3;\n}\n\n/* Counter */\n.ttp-gh-counter {\n position: absolute;\n top: 12px; right: 12px;\n background: rgba(0,0,0,0.32);\n color: #fff;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 11px;\n font-weight: 500;\n padding: 3px 10px;\n border-radius: 20px;\n letter-spacing: 0.05em;\n pointer-events: none;\n z-index: 3;\n}\n\n/* Close button */\n.ttp-gh-close {\n position: absolute;\n top: 12px; left: 12px;\n width: 36px; height: 36px;\n padding: 0;\n background: rgba(0,0,0,0.55);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n border: none;\n border-radius: 50%;\n color: #fff;\n cursor: pointer;\n display: flex; align-items: center; justify-content: center;\n transition: background 0.15s;\n box-shadow: 0 2px 8px rgba(0,0,0,0.2);\n z-index: 4;\n}\n.ttp-gh-close:hover { background: rgba(0,0,0,0.7); }\n\n/* Prev / next arrows */\n.ttp-gh-nav {\n position: absolute;\n top: 50%; transform: translateY(-50%);\n left: 12px; right: 12px;\n display: flex; justify-content: space-between;\n pointer-events: none;\n z-index: 4;\n}\n.ttp-gh-arr {\n width: 42px; height: 42px;\n padding: 0;\n background: rgba(255,255,255,0.95);\n backdrop-filter: blur(6px);\n -webkit-backdrop-filter: blur(6px);\n border: none; border-radius: 50%;\n color: #222;\n cursor: pointer;\n display: flex; align-items: center; justify-content: center;\n pointer-events: all;\n transition: background 0.15s, transform 0.15s;\n box-shadow: 0 2px 10px rgba(0,0,0,0.18);\n}\n.ttp-gh-arr:hover { background: #fff; transform: scale(1.06); }\n.ttp-gh-arr:active { transform: scale(0.94); }\n\n/* ── Body ── */\n.ttp-gh-body {\n padding: 16px 20px 12px;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 12px;\n flex-shrink: 0;\n}\n.ttp-gh-room-name {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 17px;\n font-weight: 500;\n color: #1a1a1a;\n line-height: 1.2;\n}\n.ttp-gh-price-wrap { text-align: right; flex-shrink: 0; }\n.ttp-gh-price-lbl {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 10px;\n color: #aaa;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n}\n.ttp-gh-price {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 22px;\n font-weight: 500;\n color: #1a1a1a;\n line-height: 1.1;\n}\n\n/* ── Thumbnails ── */\n.ttp-gh-thumbs {\n display: flex;\n gap: 7px;\n padding: 0 20px 12px;\n overflow-x: auto;\n scrollbar-width: none;\n flex-shrink: 0;\n}\n.ttp-gh-thumbs::-webkit-scrollbar { display: none; }\n.ttp-gh-thumb {\n flex-shrink: 0;\n width: 58px; height: 40px;\n border-radius: 8px;\n overflow: hidden;\n cursor: pointer;\n border: 2px solid transparent;\n opacity: 0.42;\n transition: opacity 0.2s, border-color 0.2s, transform 0.15s;\n background: #e8e8e6;\n}\n.ttp-gh-thumb img {\n width: 100%; height: 100%; object-fit: cover; display: block;\n}\n.ttp-gh-thumb.ttp-gh-thumb-active {\n opacity: 1;\n border-color: #1a1a1a;\n}\n.ttp-gh-thumb:hover:not(.ttp-gh-thumb-active) {\n opacity: 0.72;\n transform: translateY(-1px);\n}\n\n/* ── Dots ── */\n.ttp-gh-dots {\n display: flex;\n gap: 5px;\n align-items: center;\n padding: 0 20px 4px;\n flex-shrink: 0;\n}\n.ttp-gh-dot {\n height: 2.5px;\n border-radius: 2px;\n background: #ddd;\n cursor: pointer;\n width: 16px;\n transition: all 0.25s ease;\n}\n.ttp-gh-dot.ttp-gh-dot-active {\n background: #1a1a1a;\n width: 28px;\n}\n\n/* ── Footer ── */\n.ttp-gh-footer {\n padding: 8px 20px 20px;\n display: flex;\n gap: 10px;\n flex-shrink: 0;\n}\n.ttp-gh-btn-book {\n flex: 1;\n padding: 13px 20px;\n background: #1a1a1a;\n color: #fff;\n border: none;\n border-radius: 12px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n letter-spacing: 0.02em;\n transition: background 0.15s, transform 0.1s;\n}\n.ttp-gh-btn-book:hover { background: #2d2d2d; }\n.ttp-gh-btn-book:active { transform: scale(0.98); }\n\n/* ── Mobile ── */\n@media (max-width: 600px) {\n .ttp-gh-backdrop { padding: 12px; align-items: center; }\n .ttp-gh-card {\n width: calc(100vw - 24px);\n max-width: none;\n max-height: calc(100vh - 24px);\n border-radius: 18px;\n }\n .ttp-gh-img-wrap { padding-top: 62%; }\n .ttp-gh-room-name { font-size: 15px; }\n .ttp-gh-price { font-size: 18px; }\n .ttp-gh-thumb { width: 48px; height: 34px; }\n .ttp-gh-btn-book { padding: 12px 16px; font-size: 13px; }\n}\n",document.head.appendChild(t)}}(),(n=document.createElement("div")).className="ttp-gh-backdrop",n.addEventListener("click",b),n.appendChild(function(t){var n;o=t.images||[],i=0,s=[],c=[],l=[],(A=document.createElement("div")).className="ttp-gh-card",A.addEventListener("click",t=>t.stopPropagation());var r=document.createElement("div");r.className="ttp-gh-img-wrap";var a=document.createElement("div");a.className="ttp-gh-img-placeholder",a.innerHTML='<span style="font-size:32px;color:#ccc;line-height:1;">🖼</span>',r.appendChild(a),o.forEach((t,e)=>{var n=document.createElement("img");n.className="ttp-gh-img"+(0===e?" ttp-gh-img-active":""),n.src=t.url,n.alt=t.caption||"",n.draggable=!1,n.onload=()=>{a.style.display="none"},r.appendChild(n),s.push(n)});var g=document.createElement("div");g.className="ttp-gh-img-grad",r.appendChild(g),(d=document.createElement("div")).className="ttp-gh-caption",d.textContent=(null===(n=o[0])||void 0===n?void 0:n.caption)||"",r.appendChild(d),(p=document.createElement("div")).className="ttp-gh-counter",p.textContent=o.length>1?"1 / ".concat(o.length):"",o.length<=1&&(p.style.display="none"),r.appendChild(p);var m=document.createElement("button");if(m.className="ttp-gh-close",m.setAttribute("aria-label","Close gallery"),m.innerHTML='<span style="display:block;position:relative;width:16px;height:16px;"><span style="position:absolute;top:50%;left:50%;width:16px;height:2px;background:#fff;border-radius:1px;transform:translate(-50%,-50%) rotate(45deg);"></span><span style="position:absolute;top:50%;left:50%;width:16px;height:2px;background:#fff;border-radius:1px;transform:translate(-50%,-50%) rotate(-45deg);"></span></span>',m.addEventListener("click",b),r.appendChild(m),o.length>1){var f=document.createElement("div");f.className="ttp-gh-nav";var w=document.createElement("button");w.className="ttp-gh-arr",w.setAttribute("aria-label","Previous"),w.innerHTML='<span style="display:block;width:12px;height:12px;border-left:3px solid #222;border-bottom:3px solid #222;transform:rotate(45deg);margin-left:4px;"></span>',w.addEventListener("click",()=>{v(i-1),B()});var y=document.createElement("button");y.className="ttp-gh-arr",y.setAttribute("aria-label","Next"),y.innerHTML='<span style="display:block;width:12px;height:12px;border-right:3px solid #222;border-top:3px solid #222;transform:rotate(45deg);margin-right:4px;"></span>',y.addEventListener("click",()=>{v(i+1),B()}),f.appendChild(w),f.appendChild(y),r.appendChild(f)}A.appendChild(r);var x=document.createElement("div");if(x.className="ttp-gh-body",(u=document.createElement("div")).className="ttp-gh-room-name",u.textContent=t.title||"",x.appendChild(u),t.price){var C=document.createElement("div");C.className="ttp-gh-price-wrap";var Q=document.createElement("div");Q.className="ttp-gh-price-lbl",Q.textContent=e.priceLabel||"",(h=document.createElement("div")).className="ttp-gh-price",h.textContent=t.price,C.appendChild(Q),C.appendChild(h),x.appendChild(C)}if(A.appendChild(x),o.length>1){var S=document.createElement("div");S.className="ttp-gh-thumbs",o.forEach((t,e)=>{var n=document.createElement("div");n.className="ttp-gh-thumb"+(0===e?" ttp-gh-thumb-active":"");var A=document.createElement("img");A.src=t.url,A.alt=t.caption||"",n.appendChild(A),n.addEventListener("click",()=>{v(e),B()}),S.appendChild(n),c.push(n)}),A.appendChild(S);var F=document.createElement("div");F.className="ttp-gh-dots",o.forEach((t,e)=>{var n=document.createElement("div");n.className="ttp-gh-dot"+(0===e?" ttp-gh-dot-active":""),n.addEventListener("click",()=>{v(e),B()}),F.appendChild(n),l.push(n)}),A.appendChild(F)}var U=e.buttonText;if(U){var E=document.createElement("div");E.className="ttp-gh-footer";var k=document.createElement("button");k.className="ttp-gh-btn-book",k.textContent=U,k.addEventListener("click",b),E.appendChild(k),A.appendChild(E)}return function(t){if(!(o.length<=1)){var e=0;t.addEventListener("touchstart",t=>{e=t.touches[0].clientX},{passive:!0}),t.addEventListener("touchend",t=>{var n=t.changedTouches[0].clientX-e;Math.abs(n)>45&&(v(i+(n>0?-1:1)),B())});var n=!1;t.addEventListener("mousedown",t=>{n=!0,e=t.clientX}),t.addEventListener("mouseup",t=>{if(n){n=!1;var A=t.clientX-e;Math.abs(A)>45&&(v(i+(A>0?-1:1)),B())}})}}(A),A}(r)),document.body.appendChild(n),requestAnimationFrame(()=>{requestAnimationFrame(()=>{n.classList.add("ttp-gh-visible"),f()})}),n._escHandler=t=>{"Escape"===t.key&&b()},document.addEventListener("keydown",n._escHandler),function(){try{var e,n=null===(e=t.shadowRoot)||void 0===e?void 0:e.host;n&&(g=n.style.zIndex||null,n.style.zIndex=String(2147483641))}catch(t){}}()},dismissGallery:b}}function Ie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function Te(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ie(Object(n),!0).forEach(function(e){He(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function He(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _e,De,Me,Pe=Object.freeze({SHOW_ITEMS:"show_items",CART_UPDATED:"cart_updated",SHOW_MEDIA:"show_media",DISMISS_MEDIA:"dismiss_media",PRODUCT_SELECTED:"product_selected",PRODUCT_DESELECTED:"product_deselected"});class Le{constructor(t){var e,n,A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.widget=t,this.flavorOpts=A,this.galleryHandler=ke(t,o);var i=(null===(e=t.config)||void 0===e||null===(e=e.colors)||void 0===e?void 0:e.primary)||(null===(n=t._rawConfig)||void 0===n||null===(n=n.colors)||void 0===n?void 0:n.primary)||"#2563eb";this.manager=this.createManager({shadowRoot:t.shadowRoot,primaryColor:i}),this._validateManager(),this.tools=this.buildTools(),this.messageHandlers=this._assembleMessageHandlers()}createManager(){throw new Error("BaseFlavor subclass must implement createManager()")}getManagerHideMethod(){return"hideProducts"}buildExtraMessageHandlers(){return{}}buildTools(){return[]}sendToVoiceSDK(t){try{var e,n=null===(e=this.widget.voiceInterface)||void 0===e||null===(e=e.sdk)||void 0===e?void 0:e.voiceSDK;null!=n&&n.sendMessage&&n.sendMessage(t)}catch(t){console.warn("[".concat(this.constructor.name,"] Could not send to VoiceSDK:"),t)}}stopPlayback(){try{var t,e=null===(t=this.widget.voiceInterface)||void 0===t||null===(t=t.sdk)||void 0===t?void 0:t.voiceSDK;null!=e&&e.stopAudioPlayback&&e.stopAudioPlayback()}catch(t){}}handleItemSelected(t){this.stopPlayback(),this.sendToVoiceSDK({t:Pe.PRODUCT_SELECTED,productId:t.id,productName:t.name,price:t.price,quantity:t.selectedAmount||t.selectedNights||1,sellBy:t.sellBy||"quantity"})}handleItemDeselected(t){this.sendToVoiceSDK({t:Pe.PRODUCT_DESELECTED,productId:t.id,productName:t.name})}hideManagerUI(){var t=this.getManagerHideMethod();this.manager&&"function"==typeof this.manager[t]&&this.manager[t]()}_validateManager(){var t=this.manager;if(t){var e=this.getManagerHideMethod(),n=["handleShowItems","handleCartUpdated",e];for(var A of n)"function"!=typeof t[A]&&console.error("[".concat(this.constructor.name,"] Manager is missing required method: ").concat(A,"(). ")+"All managers must implement: handleShowItems(), handleCartUpdated(), ".concat(e,"()."))}}_assembleMessageHandlers(){var t=t=>{this.galleryHandler.dismissGallery(),this.manager.handleShowItems(t)},e={[Pe.SHOW_ITEMS]:t,show_products:t,[Pe.CART_UPDATED]:t=>{this.manager.handleCartUpdated(t)},[Pe.SHOW_MEDIA]:t=>{this.hideManagerUI(),this.galleryHandler.handleShowMedia(t)},[Pe.DISMISS_MEDIA]:()=>{this.galleryHandler.dismissGallery()}},n=this.buildExtraMessageHandlers(),A=new Set(Object.values(Pe));for(var o of Object.keys(n))A.has(o)&&(console.warn("[".concat(this.constructor.name,'] buildExtraMessageHandlers() returned universal type "').concat(o,'" — ')+"this will be ignored. Universal handlers are managed by BaseFlavor."),delete n[o]);return Te(Te({},e),n)}hookCallEnd(){var t=this.widget.voiceInterface;if(t){var e=t.config.onCallEnd,n=this;t.config.onCallEnd=function(){n.hideManagerUI(),n.galleryHandler.dismissGallery(),e&&e()}}}destroy(){var t;null!==(t=this.manager)&&void 0!==t&&t.destroy&&this.manager.destroy(),this.galleryHandler.dismissGallery()}}class Re{showProducts(t,e,n){throw new Error("EcommercePresenter.showProducts() not implemented")}hideProducts(){throw new Error("EcommercePresenter.hideProducts() not implemented")}onProductAdded(t,e){throw new Error("EcommercePresenter.onProductAdded() not implemented")}updateCart(t){throw new Error("EcommercePresenter.updateCart() not implemented")}destroy(){throw new Error("EcommercePresenter.destroy() not implemented")}}function Ke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function Oe(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ke(Object(n),!0).forEach(function(e){Ve(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ve(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Ne{constructor(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.product=t,this.compact=e.compact||!1,this.primaryColor=e.primaryColor||"#7c3aed",this.onAdd=e.onAdd||(()=>{}),this.onAddDisabled=e.onAddDisabled||(()=>!1),this.onPickerOpen=e.onPickerOpen||(()=>{}),this.onPickerClose=e.onPickerClose||(()=>{}),this.hasVariants=e.hasVariants||(()=>!1),this.onVariantPick=e.onVariantPick||null,this.element=null;var n=t.sellBy||t.sell_by||"quantity";this.sellBy=n,this.step="weight"===n?.5:1,this.min="weight"===n?.5:1,this.unit="weight"===n?"kg":"";var A=t.cartQuantity||t.cart_quantity||0;this.inCart=A>0,this.amount=this.inCart?A:this.min}_generateStepperHTML(){var t="weight"===this.sellBy?"".concat(this.amount.toFixed(1)," ").concat(this.unit):"".concat(this.amount);return'\n <div class="ttp-stepper" data-sell-by="'.concat(this.sellBy,'">\n <button class="ttp-stepper-btn ttp-stepper-minus" type="button">−</button>\n <span class="ttp-stepper-value">').concat(t,'</span>\n <button class="ttp-stepper-btn ttp-stepper-plus" type="button">+</button>\n </div>\n ')}_updateStepperDisplay(t,e){"weight"===this.sellBy?t.textContent="".concat(this.amount.toFixed(1)," ").concat(this.unit):t.textContent="".concat(this.amount),e.disabled=this.amount<=this.min,e.classList.toggle("ttp-stepper-disabled",this.amount<=this.min)}render(){var t=document.createElement("div");t.className=this.compact?"ttp-product-compact":"ttp-product-card";var e=this.product,n="ILS"===e.currency?"₪":"$",A=this.hasVariants(e),o=A?"Choose":this.inCart?"Update":"Add",i=A?"ttp-add-btn ttp-choose-btn":this.inCart?"ttp-add-btn ttp-update-btn":"ttp-add-btn";this.compact?t.innerHTML='\n <div class="ttp-product-image-sm">\n <img src="'.concat(e.imageUrl,'" alt="').concat(e.name,'" onerror="this.style.display=\'none\'" />\n </div>\n <div class="ttp-product-info">\n <div class="ttp-product-name">\n ').concat(e.name,"\n ").concat(e.productPageUrl?'<a class="ttp-product-page-link" href="'.concat(e.productPageUrl,'" onclick="event.stopPropagation()">↗</a>'):"",'\n </div>\n <div class="ttp-product-meta">').concat(e.unit," · ").concat(e.brand,'</div>\n </div>\n <div class="ttp-product-action">\n <div class="ttp-product-price">').concat(n).concat(e.price.toFixed(2),"</div>\n ").concat(e.inStock?'<button class="'.concat(i,'">').concat(o,"</button>"):'<span class="ttp-out-of-stock">Out of stock</span>',"\n ").concat(this._generateStepperHTML(),"\n </div>\n "):t.innerHTML='\n <div class="ttp-product-image">\n <img src="'.concat(e.imageUrl,'" alt="').concat(e.name,'" onerror="this.style.display=\'none\'" />\n ').concat(e.inStock?"":'<div class="ttp-stock-badge">Out of stock</div>','\n </div>\n <div class="ttp-product-details">\n <div class="ttp-product-name">\n ').concat(e.name,"\n ").concat(e.productPageUrl?'<a class="ttp-product-page-link" href="'.concat(e.productPageUrl,'" onclick="event.stopPropagation()">↗</a>'):"",'\n </div>\n <div class="ttp-product-meta">').concat(e.unit,'</div>\n <div class="ttp-product-footer">\n <span class="ttp-product-price">').concat(n).concat(e.price.toFixed(2),"</span>\n ").concat(e.inStock?'<button class="'.concat(i,'">').concat(o,"</button>"):'<span class="ttp-out-of-stock">Out of stock</span>',"\n ").concat(this._generateStepperHTML(),"\n </div>\n </div>\n ");var r=t.querySelector(".ttp-add-btn");r&&r.addEventListener("click",e=>{if(e.stopPropagation(),!this.onAddDisabled())if(A&&this.onVariantPick)this.onVariantPick(t,this.product);else{r.textContent="✓",r.classList.add("ttp-added"),r.disabled=!0;var n=Oe(Oe({},this.product),{},{selectedAmount:this.amount,sellBy:this.sellBy});this.onAdd(t,n),this.inCart=!0,setTimeout(()=>{r.textContent="Update",r.classList.remove("ttp-added"),r.classList.add("ttp-update-btn"),r.disabled=!1},1500)}});var a=t.querySelector(".ttp-stepper-minus"),s=t.querySelector(".ttp-stepper-plus"),c=t.querySelector(".ttp-stepper-value");return a&&s&&c&&(a.addEventListener("click",t=>{t.stopPropagation(),this.amount>this.min&&(this.amount=Math.round(10*(this.amount-this.step))/10,this._updateStepperDisplay(c,a))}),s.addEventListener("click",t=>{t.stopPropagation(),this.amount=Math.round(10*(this.amount+this.step))/10,this._updateStepperDisplay(c,a)}),this._updateStepperDisplay(c,a)),this.element=t,t}}function je(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function Ge(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?je(Object(n),!0).forEach(function(e){ze(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):je(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function ze(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function We(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function qe(t){return!0===t.hasVariants&&(!!(Array.isArray(t.variants)&&t.variants.length>0)||Array.isArray(t.options)&&t.options.length>0)}function Xe(t){return Ye.apply(this,arguments)}function Ye(){var t;return t=function*(t){if(!t.productPageUrl)return null;try{var e=t.productPageUrl.split("/products/")[1];if(!e)return null;var n=yield fetch("/products/".concat(e,".js"));if(!n.ok)return null;var A=((yield n.json()).variants||[]).map(t=>{var e;return{id:"gid://shopify/ProductVariant/".concat(t.id),price:parseFloat(t.price)/100,available:t.available,imageUrl:(null===(e=t.featured_image)||void 0===e?void 0:e.src)||null,option1:t.option1||null,option2:t.option2||null,option3:t.option3||null}});return Ge(Ge({},t),{},{variants:A})}catch(t){return console.error("[TTP] Failed to fetch product variants:",t),null}},Ye=function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){We(i,A,o,r,a,"next",t)}function a(t){We(i,A,o,r,a,"throw",t)}r(void 0)})},Ye.apply(this,arguments)}function Je(t,e){return t.find(t=>e.every((e,n)=>t["option".concat(n+1)]===e))||null}function Ze(t,e,n){return[...new Set(t.map(t=>t["option".concat(e+1)]).filter(Boolean))].filter(A=>{var o=[...n];return o[e]=A,t.some(t=>o.every((e,n)=>!e||t["option".concat(n+1)]===e)&&t.available)})}function $e(t){return{USD:"$",ILS:"₪",EUR:"€",GBP:"£"}[t]||t}function tn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function en(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?tn(Object(n),!0).forEach(function(e){nn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function nn(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class An{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onProductAdd=t.onProductAdd||(()=>{}),this.onBack=t.onBack||(()=>{}),this.primaryColor=t.primaryColor||"#7c3aed",this.element=null,this.product=null,this.selectedValues=[]}render(t){return this.product=t,this.element=document.createElement("div"),this.element.className="ttp-var-picker",this.element.style.setProperty("--ttp-var-primary",this.primaryColor),t.variants?(this.selectedValues=new Array(t.options.length).fill(null),t.options.forEach((e,n)=>{var A=Ze(t.variants,n,this.selectedValues);A.length>0&&(this.selectedValues[n]=A[0])}),this.element.innerHTML=this._buildHTML(),this._attachHandlers(),this._updateAddButton(),this.element):(this.element.innerHTML='\n <div class="ttp-var-header">\n <button class="ttp-var-back-btn" id="ttpVarBack">←</button>\n <span class="ttp-var-title">'.concat(t.name,'</span>\n </div>\n <div class="ttp-var-body" style="align-items:center;justify-content:center;display:flex;flex-direction:column;gap:10px;">\n <div class="ttp-var-spinner"></div>\n <div style="font-size:12px;color:#64748b;">Loading options...</div>\n </div>\n '),this.element.querySelector("#ttpVarBack").addEventListener("click",()=>{this.destroy(),this.onBack()}),Xe(t).then(t=>{if(!t||!t.variants)return this.destroy(),void this.onBack();this.product=t,this.selectedValues=new Array(t.options.length).fill(null),t.options.forEach((e,n)=>{var A=Ze(t.variants,n,this.selectedValues);A.length>0&&(this.selectedValues[n]=A[0])}),this.element.innerHTML=this._buildHTML(),this._attachHandlers(),this._updateAddButton()}),this.element)}destroy(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.product=null}_buildHTML(){var t=this.product,e=$e(t.currency),n=Je(t.variants,this.selectedValues),A=n?n.price:t.price,o=(null==n?void 0:n.imageUrl)||t.imageUrl||"",i=t.productPageUrl&&""!==t.productPageUrl.trim();return'\n <div class="ttp-var-header">\n <button class="ttp-var-back-btn" id="ttpVarBack">←</button>\n <span class="ttp-var-title">'.concat(t.name,"</span>\n ").concat(i?'<a class="ttp-var-page-link" href="'.concat(t.productPageUrl,'">View page ↗</a>'):"",'\n </div>\n\n <div class="ttp-var-body">\n <div class="ttp-var-preview">\n <div class="ttp-var-preview-img" id="ttpVarPreviewImg">\n ').concat(o?'<img src="'.concat(o,'" alt="').concat(t.name,'" onerror="this.style.display=\'none\'"/>'):"",'\n </div>\n <div class="ttp-var-preview-info">\n ').concat(t.brand?'<div class="ttp-var-preview-brand">'.concat(t.brand,"</div>"):"",'\n <div class="ttp-var-preview-name">').concat(t.name,'</div>\n <div class="ttp-var-preview-price" id="ttpVarPreviewPrice">').concat(e).concat(A.toFixed(2),'</div>\n <div class="ttp-var-preview-selected" id="ttpVarPreviewSel">Select options</div>\n </div>\n </div>\n\n <div class="ttp-var-options" id="ttpVarOptions">\n ').concat(this._renderOptions(),'\n </div>\n </div>\n\n <div class="ttp-var-footer">\n <button class="ttp-var-add-btn" id="ttpVarAddBtn" disabled>\n Add to Cart — ').concat(e).concat(A.toFixed(2),"\n </button>\n </div>\n ")}_renderOptions(){return this.product.options.map((t,e)=>{var n=Ze(this.product.variants,e,this.selectedValues);return"color"===t.name.toLowerCase()||"colour"===t.name.toLowerCase()?'\n <div class="ttp-var-section">\n <div class="ttp-var-section-label">'.concat(t.name,'</div>\n <div class="ttp-var-swatches">\n ').concat(t.values.map(t=>{var A=!n.includes(t),o=this.selectedValues[e]===t;return'<div\n class="ttp-var-swatch'.concat(o?" selected":"").concat(A?" oos":"",'"\n data-value="').concat(t,'"\n data-opt-idx="').concat(e,'"\n style="background:').concat(this._colorNameToHex(t),';"\n title="').concat(t).concat(A?" (unavailable)":"",'"\n ></div>')}).join(""),"\n </div>\n </div>"):'\n <div class="ttp-var-section">\n <div class="ttp-var-section-label">'.concat(t.name,'</div>\n <div class="ttp-var-pills">\n ').concat(t.values.map(t=>{var A=!n.includes(t),o=this.selectedValues[e]===t;return'<button\n class="ttp-var-pill'.concat(o?" selected":"").concat(A?" oos":"",'"\n data-value="').concat(t,'"\n data-opt-idx="').concat(e,'"\n ').concat(A?"disabled":"","\n >").concat(t,"</button>")}).join(""),"\n </div>\n </div>")}).join("")}_attachHandlers(){this.element.querySelector("#ttpVarBack").addEventListener("click",()=>{this.destroy(),this.onBack()}),this.element.querySelector("#ttpVarAddBtn").addEventListener("click",()=>{this._handleAdd()}),this._attachOptionHandlers()}_attachOptionHandlers(){this.element.querySelectorAll(".ttp-var-swatch:not(.oos)").forEach(t=>{t.addEventListener("click",()=>this._selectOption(parseInt(t.dataset.optIdx),t.dataset.value))}),this.element.querySelectorAll(".ttp-var-pill:not(.oos)").forEach(t=>{t.addEventListener("click",()=>this._selectOption(parseInt(t.dataset.optIdx),t.dataset.value))})}_selectOption(t,e){this.selectedValues[t]=e,this.element.querySelector("#ttpVarOptions").innerHTML=this._renderOptions(),this._attachOptionHandlers(),this._updateAddButton(),this._updatePreview()}_updateAddButton(){var t,e=$e(this.product.currency),n=Je(this.product.variants,this.selectedValues),A=this.element.querySelector("#ttpVarAddBtn");if(!this.selectedValues.every(t=>null!==t))return A.textContent="Select all options",void(A.disabled=!0);if(!n||!n.available)return A.textContent="Unavailable",void(A.disabled=!0);var o=null!==(t=n.price)&&void 0!==t?t:this.product.price;A.textContent="Add to Cart — ".concat(e).concat(o.toFixed(2)),A.disabled=!1}_updatePreview(){var t=$e(this.product.currency),e=Je(this.product.variants,this.selectedValues),n=(null==e?void 0:e.imageUrl)||this.product.imageUrl||"",A=this.element.querySelector("#ttpVarPreviewImg");A&&n&&(A.innerHTML='<img src="'.concat(n,'" alt="').concat(this.product.name,'"\n onerror="this.style.display=\'none\'"/>'));var o=this.element.querySelector("#ttpVarPreviewPrice");o&&e&&(o.textContent="".concat(t).concat(e.price.toFixed(2)));var i=this.element.querySelector("#ttpVarPreviewSel");if(i){var r=this.selectedValues.filter(t=>null!==t);i.textContent=r.length>0?r.join(" · "):"Select options"}}_handleAdd(){var t=Je(this.product.variants,this.selectedValues);if(t&&t.available){var e=this.element.querySelector("#ttpVarAddBtn");e.textContent="✓ Added!",e.disabled=!0;var n=en(en({},this.product),{},{id:t.id,price:t.price,selectedOptions:this.selectedValues,selectedAmount:1,sellBy:"quantity"});this.onProductAdd(this.element,n),setTimeout(()=>{this.destroy(),this.onBack()},800)}}_colorNameToHex(t){return{black:"#1e293b",white:"#f8fafc",red:"#ef4444",blue:"#3b82f6",green:"#22c55e",yellow:"#eab308",orange:"#f97316",purple:"#a855f7",pink:"#ec4899",grey:"#94a3b8",gray:"#94a3b8",navy:"#1e3a5f",brown:"#92400e",beige:"#d4b483",cream:"#fef9c3"}[t.toLowerCase()]||"#94a3b8"}}class on{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.primaryColor=t.primaryColor||"#7c3aed",this.onProductAdd=t.onProductAdd||(()=>{}),this.onAddDisabled=t.onAddDisabled||(()=>!1),this.onClose=t.onClose||(()=>{}),this.element=null}show(t,e,n){this.hide();var A=document.createElement("div");A.className="picker-relative";var o=document.createElement("div");o.className="ttp-product-picker",o.setAttribute("data-layout",n);var i=document.createElement("div");i.className="ttp-picker-header",i.innerHTML='\n <span class="ttp-picker-title">'.concat(e,'</span>\n <button class="ttp-picker-close">✕</button>\n '),i.querySelector(".ttp-picker-close").addEventListener("click",()=>{this.hide(),this.onClose()}),o.appendChild(i);var r=document.createElement("div");r.className="cards"===n?"ttp-products-horizontal":"ttp-products-vertical";var a=this.primaryColor,s=this.onProductAdd,c=this.onAddDisabled;return t.forEach(t=>{var e=new Ne(t,{compact:"list"===n,primaryColor:a,onAdd:(t,e)=>s(t,e),onAddDisabled:()=>c(),hasVariants:qe,onVariantPick:(t,e)=>{var n=t.closest(".picker-relative");if(n){var A=n.querySelector(".ttp-product-picker");A&&A.style.setProperty("display","none","important");var o=n.querySelector(".ttp-var-picker");o&&o.remove();var i=new An({primaryColor:a||"#7c3aed",onProductAdd:(t,e)=>{s(t,e)},onBack:()=>{n.classList.remove("ttp-var-picker-active"),A&&A.style.removeProperty("display")}});n.classList.add("ttp-var-picker-active"),n.appendChild(i.render(e))}}});r.appendChild(e.render())}),o.appendChild(r),A.appendChild(o),this.element=A,A}hide(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null}}class rn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onUndo=t.onUndo||(()=>{}),this.onHide=t.onHide||(()=>{}),this.element=null,this.dismissTimer=null}show(t){this.hide(!0);var e=document.createElement("div");return e.className="ttp-cart-toast",e.innerHTML='\n <div class="ttp-toast-icon">✓</div>\n <div class="ttp-toast-content">\n <div class="ttp-toast-title">Added to cart!</div>\n <div class="ttp-toast-product">'.concat(t.name,'</div>\n </div>\n <button class="ttp-toast-undo">Undo</button>\n '),e.querySelector(".ttp-toast-undo").addEventListener("click",()=>{this.onUndo(t),this.hide()}),this.element=e,this.dismissTimer=setTimeout(()=>this.hide(),3e3),e}hide(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.dismissTimer&&(clearTimeout(this.dismissTimer),this.dismissTimer=null),this.element&&this.element.parentNode){this.element.classList.add("ttp-toast-hiding");var e=this.element;this.element=null;var n=!t;setTimeout(()=>{e&&e.parentNode&&e.parentNode.removeChild(e),n&&this.onHide()},300)}}}class an{constructor(){this.element=null,this.itemCount=0,this.total=0,this.currency="$",this.cartUrl="/cart"}render(){var t=document.createElement("div");return t.className="ttp-cart-summary ttp-cart-empty",t.style.display="none",t.innerHTML='\n <div class="ttp-cart-info">\n <span class="ttp-cart-icon" data-ttp-fly-target>🛒</span>\n <span class="ttp-cart-count">0 items</span>\n <span class="ttp-cart-separator">·</span>\n <span class="ttp-cart-total">'.concat(this.currency,'0.00</span>\n </div>\n <a class="ttp-cart-view" href="').concat(this.cartUrl,'" target="_top">View Cart ›</a>\n '),this.element=t,t}update(t,e,n){this.itemCount=t,this.total=e,n&&(this.currency=n),this.element&&(this.element.style.setProperty("display",t>0?"flex":"none","important"),this.element.classList.toggle("ttp-cart-empty",0===t),this.element.querySelector(".ttp-cart-count").textContent="".concat(t," item").concat(1!==t?"s":""),this.element.querySelector(".ttp-cart-total").textContent="".concat(this.currency).concat(e.toFixed(2)))}}class sn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.getCartTarget=t.getCartTarget||(()=>null),this.onCartBump=t.onCartBump||(()=>{}),this.onRipple=t.onRipple||(()=>{}),this.animatingId=null,this.trailParticles=[],this.canvas=null,this.rafId=null,this._canvasInitialized=!1}get isAnimating(){return null!==this.animatingId}_ensureCanvas(){if(!this._canvasInitialized){this._canvasInitialized=!0,this.canvas=document.createElement("canvas"),this.canvas.id="ttp-fly-to-cart-canvas",this.canvas.style.cssText="\n position: fixed; top: 0; left: 0;\n width: 100%; height: 100%;\n pointer-events: none; z-index: 2147483646;\n ",document.body.appendChild(this.canvas);var t=this.canvas.getContext("2d"),e=()=>{this.canvas.width=window.innerWidth,this.canvas.height=window.innerHeight};e(),window.addEventListener("resize",e);var n=()=>{if(this.canvas&&t){for(var e of(t.clearRect(0,0,this.canvas.width,this.canvas.height),this.trailParticles=this.trailParticles.filter(t=>t.life>0),this.trailParticles))e.life-=.025,e.x+=e.vx,e.y+=e.vy,e.vx*=.96,e.vy*=.96,e.r*=.97,t.beginPath(),t.arc(e.x,e.y,e.r,0,2*Math.PI),t.fillStyle="rgba(".concat(e.color,", ").concat(.6*e.life,")"),t.fill();this.rafId=requestAnimationFrame(n)}};this.rafId=requestAnimationFrame(n)}}_emitTrailAt(t,e,n){for(var A=0;A<3;A++){var o=Math.random()*Math.PI*2,i=.5+2*Math.random(),r=3*(1-n);this.trailParticles.push({x:t+20*(Math.random()-.5)*r,y:e+10*(Math.random()-.5),vx:Math.cos(o)*i*r,vy:Math.sin(o)*i*.5,r:2+4*Math.random()*(1-n),life:.6+.4*Math.random(),color:Math.random()>.5?"139, 92, 246":"236, 72, 153"})}}_emitImpactBurst(t,e){for(var n=0;n<16;n++){var A=n/16*Math.PI*2,o=2+4*Math.random();this.trailParticles.push({x:t,y:e,vx:Math.cos(A)*o,vy:Math.sin(A)*o,r:2+3*Math.random(),life:.8+.2*Math.random(),color:n%3==0?"250, 204, 21":n%3==1?"74, 222, 128":"139, 92, 246"})}}triggerFly(t,e,n){var A,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(null===this.animatingId){var i=this.getCartTarget();if(t&&i){var r=t.getBoundingClientRect(),a=()=>{var t=this.getCartTarget();if(!t)return{x:window.innerWidth-60,y:window.innerHeight-60};var e=t.getBoundingClientRect(),n=e.left+e.width/2,A=e.top+e.height/2;return"undefined"==typeof window||!window.Shopify||(A<r.top+r.height/2||0===e.width&&0===e.height)&&(n=window.innerWidth-60,A=window.innerHeight-60),{x:n,y:A}};this.animatingId=null!==(A=null==e?void 0:e.id)&&void 0!==A?A:"fly";var s=e=>{var A=document.createElement("div");A.style.cssText="\n position: fixed;\n z-index: 2147483647;\n left: ".concat(r.left,"px;\n top: ").concat(r.top,"px;\n width: ").concat(r.width,"px;\n height: ").concat(r.height,"px;\n pointer-events: none;\n perspective: 600px;\n "),e.style.cssText="\n width: 100%;\n height: 100%;\n border-radius: 12px;\n overflow: hidden;\n background: #fff;\n box-shadow: 0 8px 32px rgba(0,0,0,0.4);\n transform-origin: center top;\n transform: rotateX(0deg) scaleX(1) scaleY(1);\n object-fit: cover;\n transition: none;\n ",A.appendChild(e),document.body.appendChild(A),t.style.opacity="0",t.style.transition="opacity 0.08s ease";var o=r.left,i=r.top,s=r.width,c=r.height,l=o+s/2,d=i+c/2,p=performance.now(),u=t=>{var o=t-p,i=Math.min(o/1e3,1),r=i*i*i,h=i*i,{x:g,y:m}=a(),v=l+(g-l)*h,f=d+(m-d)*r,w=Math.max(1-.92*h,.08),B=s*w,b=c*w;A.style.left="".concat(v-B/2,"px"),A.style.top="".concat(f-b/2,"px"),A.style.width="".concat(B,"px"),A.style.height="".concat(b,"px");var y=55*h,x=1-.5*h,C=12*h,Q=8*Math.sin(i*Math.PI*3)*h;e.style.transform="\n rotateX(".concat(y,"deg)\n rotateY(").concat(C,"deg)\n rotateZ(").concat(Q,"deg)\n scaleX(").concat(x,")\n "),e.style.opacity="".concat(i<.7?1:1-(i-.7)/.3);var S=.4*(1-h);if(A.style.boxShadow="\n 0 ".concat(12*(1-h),"px ").concat(32*(1-h),"px rgba(0,0,0,").concat(S,"),\n 0 0 ").concat(20*h,"px rgba(139,92,246,").concat(.4*h,")\n "),i<.9&&this._emitTrailAt(v,f+.3*b,i),i<1)requestAnimationFrame(u);else{A.remove(),this.animatingId=null,this.onCartBump(),this.onRipple();var F=a();this._emitImpactBurst(F.x,F.y),n&&n()}};this._ensureCanvas(),requestAnimationFrame(u)};if(!0===o.preferClone){var c=t.cloneNode(!0);c.querySelectorAll("button").forEach(t=>{t.style.pointerEvents="none",t.style.cursor="default"}),s(c)}else Y()(t,{useCORS:!0,allowTaint:!1,backgroundColor:"#ffffff",scale:1,logging:!1}).then(t=>{var e=document.createElement("img");e.src=t.toDataURL("image/png"),e.alt="",s(e)}).catch(()=>{var e=t.cloneNode(!0);e.querySelectorAll("button").forEach(t=>{t.style.pointerEvents="none",t.style.cursor="default"}),s(e)})}else n&&n()}}destroy(){this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this._canvasInitialized=!1,this.trailParticles=[],this.animatingId=null}}function cn(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class ln extends Re{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.shadowRoot=t.shadowRoot,this.onProductAdd=t.onProductAdd||(()=>{}),this.onProductUndo=t.onProductUndo||(()=>{}),this.flyToCart=new sn({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>this._triggerCartBump(),onRipple:()=>this._triggerRipple()}),this.productPicker=new on({primaryColor:t.primaryColor||"#7c3aed",onProductAdd:(t,e)=>this._handleProductAddWithFly(t,e),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>this._handlePickerClose()}),this.cartToast=new rn({onUndo:t=>this.onProductUndo(t),onHide:()=>this._restoreWaveform()}),this.cartSummary=new an,this.container=document.createElement("div"),this.container.id="ttpEcommerceArea",this.container.className="ttp-ecommerce-area";var e=document.createElement("div");e.id="ttpDesktopFlyTarget",e.className="ttp-desktop-fly-target",e.setAttribute("aria-hidden","true"),this.container.appendChild(e),this.voiceActiveState=null,this.isAttached=!1,this._cartBump=!1,this._ripple=!1,this._toastActive=!1,this._activatedByPresenter=!1}_widgetDomRoot(){return this.shadowRoot&&this.shadowRoot!==document?this.shadowRoot:document.getElementById("ttp-widget-container")}_queryId(t){var e=this._widgetDomRoot();return e?e.querySelector("#".concat(CSS.escape(t))):null}_querySelector(t){var e=this._widgetDomRoot();return e?e.querySelector(t):null}_getCartTarget(){var t=this.voiceActiveState||this._queryId("voiceActiveState");if(t){var e=t.querySelector(".ttp-cart-icon");if(e){var n=e.getBoundingClientRect();if(n.width>0&&n.height>0)return e}}var A=document.getElementById("ttpEcommerceArea")||this.container;return(null==A?void 0:A.querySelector("#ttpDesktopFlyTarget"))||null}_handleProductAddWithFly(t,e){var n;this.flyToCart.isAnimating||(null===(n=this.productPicker.element)||void 0===n||n.classList.add("ttp-products-animating"),this.flyToCart.triggerFly(t,e,()=>{var t;null===(t=this.productPicker.element)||void 0===t||t.classList.remove("ttp-products-animating"),this.onProductAdd(e)},{preferClone:!1}))}_triggerCartBump(){this._cartBump=!0,this._updateCartBumpStyles(),setTimeout(()=>{this._cartBump=!1,this._updateCartBumpStyles()},450)}_triggerRipple(){this._ripple=!0,this._updateRippleStyles(),setTimeout(()=>{this._ripple=!1,this._updateRippleStyles()},600)}_updateCartBumpStyles(){if(this.cartSummary.element){var t=this.cartSummary.element.querySelector(".ttp-cart-info");t&&(t.style.transform="none",t.style.transition="")}}_updateRippleStyles(){if(this.cartSummary.element&&this._ripple){var t=this.cartSummary.element.querySelector(".ttp-fly-ripple");t&&t.remove();var e=document.createElement("div");e.className="ttp-fly-ripple",this.cartSummary.element.style.position="relative",this.cartSummary.element.appendChild(e),setTimeout(()=>e.remove(),600)}}showProducts(t,e,n){this._ensureReady(),this._ensureActiveStateVisible(),this._switchToCompactMode(),this._setContainerMode("products"),this.productPicker.hide();var A=n||(t.length<=4?"cards":"list"),o=this.productPicker.show(t,e,A);this.container.insertBefore(o,this.container.firstChild),this._expandPanelToFit(t.length,A)}hideProducts(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.productPicker.hide(),t.shrinkToToastHeight||this._toastActive?this._setPanelHeightForToast():this._shrinkPanel(),this._restoreFullVoiceMode(),this._setContainerMode("summary"),t.shrinkToToastHeight||this._toastActive||this._restoreIdleStateIfNeeded()}onProductAdded(t,e){this._ensureReady(),this.cartSummary.update(e.itemCount,e.total,e.currency),this._toastActive=!0,this.hideProducts({shrinkToToastHeight:!0});var n=this.cartToast.show(t,"added"),A=this._querySelector(".ttp-controls");A?A.parentNode.insertBefore(n,A):this.voiceActiveState&&this.voiceActiveState.appendChild(n)}_setPanelHeightForToast(){var t=()=>{var t=this._queryId("text-chat-panel");if(t){var e=Math.min(ln.TOAST_HEIGHT_PX,Math.floor(.92*window.innerHeight));t.classList.add("ttp-panel-expanded"),t.style.setProperty("height","".concat(e,"px"),"important")}};t(),requestAnimationFrame(()=>requestAnimationFrame(t))}_shrinkPanelForToast(){this._toastActive=!1;var t=this._queryId("text-chat-panel");t&&(t.classList.remove("ttp-panel-expanded"),t.style.removeProperty("height"))}_restoreWaveform(){this._shrinkPanelForToast()}updateCart(t){this._ensureReady(),this.cartSummary.update(t.itemCount,t.total,t.currency)}destroy(){var t;this.flyToCart&&this.flyToCart.destroy(),this.productPicker.hide(),this.cartToast.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-products-visible"),null!==(t=this.cartSummary.element)&&void 0!==t&&t.parentNode&&this.cartSummary.element.parentNode.removeChild(this.cartSummary.element),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.isAttached=!1}_ensureReady(){this.isAttached||(this._injectStyles(),this._attachToDOM())}_injectStyles(){var t='\n\n/* ═══════════════════════════════════════\n ECOMMERCE AREA\n ═══════════════════════════════════════ */\n\n\n/*\n * When products are visible, expand the panel dynamically.\n * Actual height is set via inline style by EcommerceManager._expandPanelToFit().\n * When the class is removed, the panel returns to its CSS-defined default.\n */\n#text-chat-panel.ttp-panel-expanded {\n transition: height 0.25s ease;\n}\n\n/*\n * Layout overrides ONLY when ecommerce/hotels overlay is active.\n * Scoped under .ttp-products-visible / .ttp-rooms-visible so the\n * normal voice CSS takes effect when products/rooms are hidden.\n *\n * voiceActiveState is a flex column: [voice-controls] [ecommerce] [conversation].\n * Ecommerce area fills the middle and scrolls; conversation panel stays at bottom.\n */\n#voiceActiveState.ttp-products-visible,\n#voiceActiveState.ttp-rooms-visible {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow: hidden !important;\n}\n\n.ttp-products-visible > .desktop-voice-section,\n.ttp-rooms-visible > .desktop-voice-section {\n flex-shrink: 1 !important;\n}\n\n/* Conversation + input always stick to bottom; ecommerce area above grows to fill. */\n.ttp-products-visible > .desktop-conversation-panel,\n.ttp-rooms-visible > .desktop-conversation-panel {\n flex: 0 0 auto !important;\n margin-top: auto !important;\n display: flex !important;\n flex-direction: column !important;\n}\n\n.ttp-products-visible .desktop-conversation-panel .live-transcript-collapsed,\n.ttp-rooms-visible .desktop-conversation-panel .live-transcript-collapsed {\n flex: 0 0 auto !important;\n min-height: 40px !important;\n overflow: hidden !important;\n}\n\n.ttp-products-visible .desktop-conversation-panel .voice-text-input-area,\n.ttp-rooms-visible .desktop-conversation-panel .voice-text-input-area {\n margin-top: auto !important;\n padding: 3px 16px !important;\n}\n\n.ttp-products-visible .desktop-conversation-panel .voice-input-hint,\n.ttp-rooms-visible .desktop-conversation-panel .voice-input-hint {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-voice-section {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .compact-voice-section {\n display: flex !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-conversation-panel {\n flex: 0 0 auto !important;\n}\n\n#voiceActiveState.ttp-products-visible .conversation-history {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .live-transcript-collapsed {\n flex: 0 0 auto !important;\n}\n\n.voice-text-input-area {\n flex-shrink: 0 !important;\n}\n\n.ttp-products-visible .conversation-history,\n.ttp-rooms-visible .conversation-history {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow-y: auto !important;\n}\n\n.ttp-ecommerce-area {\n display: flex !important;\n flex-direction: column !important;\n width: 100%;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n position: relative !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT PICKER\n ═══════════════════════════════════════ */\n\n.ttp-product-picker {\n background: rgba(255,255,255,0.04);\n border-radius: 14px;\n border: 1px solid rgba(255,255,255,0.08);\n box-shadow: none;\n margin: 8px 10px;\n overflow-x: hidden !important;\n overflow-y: auto !important;\n animation: ttpSlideUp 0.25s ease;\n display: flex !important;\n flex-direction: column;\n flex: 1;\n min-height: 0 !important;\n}\n\n@keyframes ttpSlideUp {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n.ttp-picker-header {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 10px 14px;\n border-bottom: 1px solid rgba(255,255,255,0.06);\n flex-shrink: 0;\n}\n\n.ttp-picker-title {\n font-size: 12px;\n font-weight: 600;\n color: rgba(255,255,255,0.5);\n}\n\n.ttp-picker-close {\n background: none;\n border: none;\n cursor: pointer;\n color: rgba(255,255,255,0.4);\n font-size: 14px;\n padding: 2px 6px;\n border-radius: 4px;\n}\n.ttp-picker-close:hover {\n background: rgba(255,255,255,0.08);\n color: rgba(255,255,255,0.7);\n}\n\n/* Horizontal card layout */\n.ttp-products-horizontal {\n display: flex !important;\n align-items: flex-start;\n flex-shrink: 0;\n gap: 10px;\n padding: 12px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: thin;\n}\n.ttp-products-horizontal::-webkit-scrollbar { height: 4px; }\n.ttp-products-horizontal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }\n.ttp-products-horizontal::-webkit-scrollbar-track { background: transparent; }\n\n/* Vertical list layout */\n.ttp-products-vertical {\n padding: 8px 12px;\n overflow-y: auto !important;\n display: flex !important;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n min-height: 0 !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT CARD (horizontal)\n ═══════════════════════════════════════ */\n\n.ttp-product-card {\n width: 170px !important;\n flex-shrink: 0 !important;\n background: rgba(255,255,255,0.04);\n border-radius: 12px;\n border: 1px solid rgba(255,255,255,0.08);\n overflow: hidden;\n transition: border-color 0.15s;\n}\n.ttp-product-card:hover { border-color: rgba(109,86,245,0.5); }\n\n.ttp-product-image {\n height: 110px !important;\n background: rgba(0,0,0,0.2);\n display: flex !important;\n align-items: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n}\n.ttp-product-image img {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n object-fit: contain !important;\n display: block !important;\n}\n\n.ttp-stock-badge {\n position: absolute;\n top: 6px; right: 6px;\n background: rgba(239,68,68,0.15);\n color: #ef4444;\n font-size: 9px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n}\n\n.ttp-product-details {\n padding: 10px 12px 14px;\n}\n\n.ttp-product-name {\n font-size: 13px;\n font-weight: 600;\n color: #e8e4f0;\n line-height: 1.3;\n min-height: 30px;\n}\n\n.ttp-product-page-link {\n display: inline-flex;\n align-items: center;\n margin-left: 5px;\n font-size: 10px;\n color: #a78bfa;\n text-decoration: none;\n opacity: 0.7;\n vertical-align: middle;\n}\n.ttp-product-page-link:hover { opacity: 1; text-decoration: underline; }\n\n.ttp-product-meta {\n font-size: 10px;\n color: rgba(255,255,255,0.35);\n margin-top: 2px;\n}\n\n.ttp-product-footer {\n display: flex !important;\n align-items: center;\n justify-content: space-between;\n margin-top: 6px;\n}\n\n.ttp-product-price {\n font-size: 14px;\n font-weight: 700;\n color: #e8e4f0;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT COMPACT (list view)\n ═══════════════════════════════════════ */\n\n.ttp-product-compact {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n background: rgba(255,255,255,0.04);\n border-radius: 10px;\n border: 1px solid rgba(255,255,255,0.08);\n transition: border-color 0.15s;\n}\n.ttp-product-compact:hover { border-color: rgba(109,86,245,0.5); }\n\n.ttp-product-image-sm {\n width: 72px !important; height: 72px !important;\n border-radius: 10px;\n background: rgba(0,0,0,0.2);\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n}\n.ttp-product-image-sm img {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n object-fit: contain !important;\n display: block !important;\n}\n\n.ttp-product-compact .ttp-product-info {\n flex: 1;\n min-width: 0;\n}\n.ttp-product-compact .ttp-product-name {\n min-height: auto;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: #e8e4f0;\n}\n.ttp-product-compact .ttp-product-action {\n text-align: right;\n flex-shrink: 0 !important;\n}\n.ttp-product-compact .ttp-product-price {\n font-size: 13px;\n}\n\n.ttp-out-of-stock {\n font-size: 10px;\n color: #f87171;\n font-weight: 500;\n}\n\n/* ═══════════════════════════════════════\n ADD BUTTON\n ═══════════════════════════════════════ */\n\n.ttp-add-btn {\n padding: 6px 14px;\n border-radius: 8px;\n border: 1.5px solid rgba(109,86,245,0.6);\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n background: transparent;\n color: #a78bfa;\n transition: all 0.15s;\n}\n.ttp-add-btn:hover { background: rgba(109,86,245,0.15); border-color: #a78bfa; }\n.ttp-add-btn:active { transform: scale(0.95); }\n.ttp-add-btn.ttp-added { background: rgba(109,86,245,0.6) !important; border-color: #7c3aed !important; color: #fff !important; }\n.ttp-add-btn:disabled { cursor: default; opacity: 0.5; }\n.ttp-add-btn.ttp-update-btn { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.5); color: #fbbf24; }\n.ttp-add-btn.ttp-update-btn:hover { background: rgba(245,158,11,0.25); border-color: #fbbf24; }\n\n.ttp-products-animating .ttp-add-btn {\n opacity: 0.4;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n/* ═══════════════════════════════════════\n CART TOAST\n ═══════════════════════════════════════ */\n\n/* Toast replaces waveform in desktop voice section */\n.ttp-cart-toast {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n margin: 8px 12px;\n background: rgba(16,185,129,0.1);\n border-radius: 12px;\n border: 1px solid rgba(16,185,129,0.2);\n animation: ttpToastIn 0.25s ease;\n flex-shrink: 0;\n box-shadow: none;\n}\n\n@keyframes ttpToastIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n.ttp-cart-toast.ttp-toast-hiding {\n animation: ttpSlideDown 0.3s ease forwards;\n}\n\n@keyframes ttpSlideDown {\n to { opacity: 0; transform: translateY(-8px); height: 0; padding: 0; margin: 0; overflow: hidden; }\n}\n\n.ttp-toast-icon {\n width: 24px !important; height: 24px !important;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex !important;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: 700;\n flex-shrink: 0;\n}\n\n.ttp-toast-content { flex: 1; min-width: 0; }\n.ttp-toast-title { font-size: 12px; font-weight: 600; color: #34d399; }\n.ttp-toast-product {\n font-size: 11px;\n color: rgba(52,211,153,0.7);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-toast-undo {\n background: none;\n border: 1px solid rgba(52,211,153,0.3);\n border-radius: 6px;\n padding: 3px 8px;\n font-size: 10px;\n color: #34d399;\n cursor: pointer;\n font-weight: 600;\n flex-shrink: 0;\n}\n.ttp-toast-undo:hover { background: rgba(52,211,153,0.1); }\n\n/* Fly-to-cart desktop target (when cart summary is hidden) */\n.ttp-desktop-fly-target {\n position: absolute;\n bottom: 12px;\n right: 80px;\n width: 24px;\n height: 24px;\n pointer-events: none;\n}\n\n/* Fly-to-cart ripple effect */\n.ttp-fly-ripple {\n position: absolute;\n left: 10px;\n top: 50%;\n width: 30px;\n height: 30px;\n margin-top: -15px;\n border-radius: 50%;\n border: 2px solid rgba(74,222,128,0.7);\n animation: ttp-ripple-expand 0.6s ease-out forwards;\n pointer-events: none;\n}\n\n@keyframes ttp-ripple-expand {\n 0% { transform: scale(0.5); opacity: 0.8; }\n 100% { transform: scale(3); opacity: 0; }\n}\n\n/* ═══════════════════════════════════════\n CART SUMMARY BAR\n ═══════════════════════════════════════ */\n\n.ttp-cart-summary {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 8px 14px;\n margin: 4px 12px 0;\n margin-right: 20px;\n margin-top: auto !important;\n flex-shrink: 0 !important;\n background: rgba(255,255,255,0.04);\n border-radius: 12px;\n border: 1px solid rgba(255,255,255,0.08);\n}\n\n/* Hide cart when empty — overrides display:flex !important */\n.ttp-cart-summary.ttp-cart-empty {\n display: none !important;\n}\n\n/* Desktop: cart below input (fallback when input area not found) */\n.ttp-cart-summary-bottom {\n margin-top: 0 !important;\n margin: 8px 12px 12px !important;\n flex-shrink: 0 !important;\n}\n\n/* Desktop: cart inside input area — unified section (like mobile) */\n.ttp-cart-summary-inline {\n margin: 0 !important;\n padding: 0 !important;\n padding-top: 8px !important;\n flex-shrink: 0 !important;\n background: transparent !important;\n border: none !important;\n border-top: 1px solid rgba(255, 255, 255, 0.06) !important;\n border-radius: 0 !important;\n width: 100% !important;\n flex-basis: 100% !important;\n}\n\n.ttp-cart-info {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.ttp-cart-icon { font-size: 14px; }\n.ttp-cart-count { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.6); }\n.ttp-cart-separator { font-size: 12px; color: rgba(255,255,255,0.25); }\n.ttp-cart-total { font-size: 13px; font-weight: 700; color: #e8e4f0; }\n.ttp-cart-view {\n font-size: 12px;\n font-weight: 600;\n color: #a78bfa;\n text-decoration: none;\n cursor: pointer;\n white-space: nowrap;\n}\n.ttp-cart-view:hover {\n color: #c4b5fd;\n text-decoration: underline;\n}\n\n/* ═══════════════════════════════════════\n QUANTITY/WEIGHT STEPPER\n ═══════════════════════════════════════ */\n\n.ttp-stepper {\n display: flex !important;\n align-items: center;\n gap: 2px;\n margin: 4px 0;\n}\n\n.ttp-stepper-btn {\n width: 24px !important;\n height: 24px !important;\n border-radius: 6px;\n border: 1px solid rgba(255,255,255,0.15);\n background: rgba(255,255,255,0.06);\n color: rgba(255,255,255,0.6);\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n display: flex !important;\n align-items: center;\n justify-content: center;\n padding: 0;\n line-height: 1;\n transition: all 0.15s;\n flex-shrink: 0;\n}\n\n.ttp-stepper-btn:hover:not(:disabled) {\n background: rgba(255,255,255,0.12);\n border-color: rgba(255,255,255,0.25);\n}\n\n.ttp-stepper-btn:active:not(:disabled) {\n transform: scale(0.9);\n}\n\n.ttp-stepper-btn:disabled,\n.ttp-stepper-disabled {\n opacity: 0.35;\n cursor: default;\n}\n\n.ttp-stepper-value {\n font-size: 12px;\n font-weight: 600;\n color: #e8e4f0;\n min-width: 36px;\n text-align: center;\n user-select: none;\n}\n\n.ttp-product-compact .ttp-stepper {\n justify-content: flex-end;\n}\n\n.ttp-product-compact .ttp-product-action {\n display: flex !important;\n flex-direction: column;\n align-items: flex-end;\n gap: 2px;\n}\n\n.ttp-product-card .ttp-stepper {\n justify-content: center;\n margin: 4px 0;\n}\n\n.ttp-product-card .ttp-product-footer {\n display: flex !important;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n/* ═══════════════════════════════════════\n VARIATION DESKTOP PICKER\n ═══════════════════════════════════════ */\n\n.picker-relative {\n position: relative !important;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n display: flex !important;\n flex-direction: column !important;\n overflow: hidden;\n}\n\n/* When variant picker is shown, center it horizontally and vertically */\n.picker-relative.ttp-var-picker-active {\n justify-content: center !important;\n align-items: center !important;\n}\n\n.ttp-var-picker {\n background: rgba(255,255,255,0.04);\n border-radius: 14px;\n border: 1px solid rgba(255,255,255,0.08);\n display: flex !important;\n flex-direction: column;\n animation: ttpVarFadeIn 0.2s ease;\n overflow: hidden;\n width: 100%;\n flex-shrink: 0 !important;\n}\n\n@keyframes ttpVarFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.ttp-var-header {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n border-bottom: 1px solid rgba(255,255,255,0.06);\n flex-shrink: 0;\n}\n\n.ttp-var-back-btn {\n background: none;\n border: none;\n cursor: pointer;\n color: rgba(255,255,255,0.5);\n font-size: 16px;\n padding: 0;\n display: flex;\n align-items: center;\n line-height: 1;\n font-family: inherit;\n}\n.ttp-var-back-btn:hover { color: #e8e4f0; }\n\n.ttp-var-title {\n font-size: 13px;\n font-weight: 700;\n color: #e8e4f0;\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-var-page-link {\n font-size: 11px;\n color: #a78bfa;\n text-decoration: none;\n font-weight: 500;\n white-space: nowrap;\n flex-shrink: 0;\n}\n.ttp-var-page-link:hover { text-decoration: underline; }\n\n.ttp-var-body {\n flex: 1;\n overflow-y: auto;\n padding: 12px 14px;\n display: flex !important;\n flex-direction: column;\n gap: 14px;\n}\n\n.ttp-var-preview {\n display: flex !important;\n gap: 12px;\n align-items: flex-start;\n}\n\n.ttp-var-preview-img {\n width: 72px !important;\n height: 72px !important;\n border-radius: 12px;\n background: rgba(0,0,0,0.2);\n border: 1px solid rgba(255,255,255,0.08);\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n transition: all 0.2s ease;\n}\n\n.ttp-var-preview-img img {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n object-fit: contain !important;\n display: block !important;\n padding: 6px;\n}\n\n.ttp-var-preview-info { flex: 1; min-width: 0; }\n\n.ttp-var-preview-brand {\n font-size: 10px;\n color: rgba(255,255,255,0.4);\n font-weight: 500;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n\n.ttp-var-preview-name {\n font-size: 14px;\n font-weight: 700;\n color: #e8e4f0;\n margin: 2px 0 4px;\n line-height: 1.2;\n}\n\n.ttp-var-preview-price {\n font-size: 18px;\n font-weight: 700;\n color: #7c3aed;\n}\n\n.ttp-var-preview-selected {\n font-size: 11px;\n color: rgba(255,255,255,0.4);\n margin-top: 3px;\n}\n\n.ttp-var-section { display: flex !important; flex-direction: column; gap: 8px; }\n\n.ttp-var-section-label {\n font-size: 11px;\n font-weight: 700;\n color: rgba(255,255,255,0.5);\n text-transform: uppercase;\n letter-spacing: 0.4px;\n}\n\n.ttp-var-swatches { display: flex !important; flex-wrap: wrap; gap: 8px; }\n\n.ttp-var-swatch {\n display: block !important;\n width: 28px !important;\n height: 28px !important;\n border-radius: 50%;\n cursor: pointer;\n border: 3px solid transparent;\n transition: all 0.15s;\n position: relative;\n flex-shrink: 0;\n}\n.ttp-var-swatch:hover { transform: scale(1.1); }\n.ttp-var-swatch.selected {\n border-color: #7c3aed;\n box-shadow: 0 0 0 2px #fff, 0 0 0 4px #7c3aed;\n}\n.ttp-var-swatch.oos {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.ttp-var-pills { display: flex !important; flex-wrap: wrap; gap: 6px; }\n\n.ttp-var-pill {\n padding: 5px 12px;\n border-radius: 8px;\n border: 1.5px solid rgba(255,255,255,0.15);\n background: rgba(255,255,255,0.04);\n font-size: 12px;\n font-weight: 600;\n color: rgba(255,255,255,0.6);\n cursor: pointer;\n transition: all 0.15s;\n font-family: inherit;\n}\n.ttp-var-pill:hover:not(:disabled) { border-color: #7c3aed; color: #a78bfa; }\n.ttp-var-pill.selected { border-color: #7c3aed; background: #7c3aed; color: #fff; }\n.ttp-var-pill.oos { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }\n\n.ttp-var-footer {\n padding: 10px 14px 12px;\n border-top: 1px solid rgba(255,255,255,0.06);\n flex-shrink: 0;\n}\n\n.ttp-var-add-btn {\n width: 100%;\n padding: 10px;\n background: linear-gradient(135deg, #7c3aed, #6d28d9);\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n box-shadow: 0 3px 10px rgba(124,58,237,0.3);\n transition: all 0.15s;\n}\n.ttp-var-add-btn:hover:not(:disabled) { transform: scale(0.99); }\n.ttp-var-add-btn:disabled {\n background: rgba(255,255,255,0.1);\n box-shadow: none;\n cursor: not-allowed;\n color: rgba(255,255,255,0.3);\n}\n\n.ttp-var-spinner {\n width: 24px;\n height: 24px;\n border: 3px solid rgba(255,255,255,0.1);\n border-top-color: #7c3aed;\n border-radius: 50%;\n animation: ttpVarSpin 0.7s linear infinite;\n}\n@keyframes ttpVarSpin {\n to { transform: rotate(360deg); }\n}\n\n/* Amber "Choose" button for variant products */\n.ttp-add-btn.ttp-choose-btn {\n background: linear-gradient(135deg, #f59e0b, #d97706);\n box-shadow: 0 2px 8px rgba(245,158,11,0.3);\n color: #fff;\n}\n\n ',e=this.shadowRoot;if(e){if(e===document){if(document.getElementById("ttp-ecommerce-presenter-styles"))return;var n=document.createElement("style");return n.id="ttp-ecommerce-presenter-styles",n.textContent=t+"\n#ttp-widget-container #voiceActiveState.ttp-products-visible .picker-relative,\n#ttp-widget-container #voiceActiveState.ttp-products-visible .ttp-ecommerce-area {\n min-height: 160px !important;\n}\n#ttp-widget-container #voiceActiveState.ttp-products-visible .ttp-product-picker {\n min-height: 140px !important;\n}\n",void document.head.appendChild(n)}var A=e.querySelector("style");if(A)A.textContent+="\n"+t;else{var o=document.createElement("style");o.textContent=t,e.appendChild(o)}}}_attachToDOM(){if(!this.isAttached&&this.shadowRoot)if(this.voiceActiveState=this._queryId("voiceActiveState"),this.voiceActiveState)if(this.voiceActiveState.contains(this.container))this.isAttached=!0;else{var t=this.voiceActiveState.querySelector(".desktop-voice-section"),e=this.voiceActiveState.querySelector(".compact-voice-section")||t;e&&e.nextSibling?this.voiceActiveState.insertBefore(this.container,e.nextSibling):this.voiceActiveState.appendChild(this.container);var n=this.voiceActiveState.querySelector(".voice-text-input-area");if(n){var A=this.cartSummary.render();A.classList.add("ttp-cart-summary-inline"),n.appendChild(A)}else{var o=this.cartSummary.render();o.classList.add("ttp-cart-summary-bottom"),this.voiceActiveState.appendChild(o)}this.isAttached=!0}else console.warn("[DesktopPresenter] #voiceActiveState not found — will retry on next message")}_setContainerMode(t){if("products"===t?(this.container.style.flex="1 1 0",this.container.style.minHeight="0",this.container.style.overflowY="auto",this.voiceActiveState&&this.voiceActiveState.classList.add("ttp-products-visible")):(this.container.style.flex="1 1 0",this.container.style.minHeight="0",this.container.style.overflowY="",this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-products-visible")),this.cartSummary.element){var e="products"===t||"summary"===t&&this.cartSummary.itemCount>0;this.cartSummary.element.classList.toggle("ttp-cart-empty",!e)}}_expandPanelToFit(t,e){if(this._widgetDomRoot()){var n=this._queryId("text-chat-panel");if(n){n.classList.add("ttp-panel-expanded");var A=this._queryId("voiceActiveState");requestAnimationFrame(()=>{var o,i=null==A?void 0:A.querySelector(".compact-voice-section"),r=null===(o=this.container)||void 0===o?void 0:o.querySelector(".ttp-product-picker"),a=null==A?void 0:A.querySelector(".desktop-conversation-panel"),s=null==A?void 0:A.querySelector(".voice-text-input-area"),c=0;i&&(c+=i.offsetHeight);var l=r?r.scrollHeight+18:0;if("list"===e){var d=Math.min(t,ln.MIN_VISIBLE_LIST_ITEMS),p=ln.PICKER_HEADER_HEIGHT+ln.PICKER_PADDING+d*ln.LIST_ITEM_HEIGHT+(d-1)*ln.LIST_GAP;c+=Math.max(l,p)}else c+=l;a&&(c+=Math.min(a.offsetHeight,100)),s&&(c+=s.offsetHeight),c+=60;var u=Math.min(800,Math.floor(.9*window.innerHeight)),h=Math.min(Math.max(c,380),u);n.style.setProperty("height","".concat(h,"px"),"important")})}}}_shrinkPanel(){if(this._widgetDomRoot()){var t=this._queryId("text-chat-panel");t&&(t.classList.remove("ttp-panel-expanded"),t.style.removeProperty("height"))}}_switchToCompactMode(){if(this._widgetDomRoot()){var t=this._queryId("desktopVoiceSection"),e=this._queryId("compactVoiceSection");t&&(t.style.display="none"),e&&(e.style.display="flex")}}_restoreFullVoiceMode(){if(this._widgetDomRoot()){var t=this._queryId("desktopVoiceSection"),e=this._queryId("compactVoiceSection");t&&e&&(t.style.display="",e.style.display="none")}}_ensureActiveStateVisible(){if(this._widgetDomRoot()){var t=this._queryId("text-chat-panel");t&&!t.classList.contains("open")&&t.classList.add("open");var e=this._queryId("landingScreen");e&&e.classList.remove("active");var n=this._queryId("textInterface");n&&n.classList.remove("active");var A=this._queryId("voiceInterface");A&&!A.classList.contains("active")&&A.classList.add("active");var o=this._queryId("voiceActiveState");if(o&&("none"===o.style.display||"none"===getComputedStyle(o).display)){var i=this._queryId("voiceIdleState");i&&(i.style.display="none"),o.style.display="flex",this._activatedByPresenter=!0}}}_restoreIdleStateIfNeeded(){if(this._activatedByPresenter&&this._widgetDomRoot()){var t=this._queryId("voiceActiveState"),e=this._queryId("voiceIdleState");t&&(t.style.display="none"),e&&(e.style.display="flex"),this._activatedByPresenter=!1}}_handlePickerClose(){this.hideProducts()}}function dn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function pn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?dn(Object(n),!0).forEach(function(e){un(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function un(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}cn(ln,"TOAST_HEIGHT_PX",510),cn(ln,"LIST_ITEM_HEIGHT",90),cn(ln,"LIST_GAP",6),cn(ln,"PICKER_HEADER_HEIGHT",44),cn(ln,"PICKER_PADDING",20),cn(ln,"MIN_VISIBLE_LIST_ITEMS",4);class hn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onProductAdd=t.onProductAdd||(()=>{}),this.onClose=t.onClose||(()=>{}),this.primaryColor=t.primaryColor||"#3b82f6",this.container=null,this.product=null,this.selectedValues=[]}show(t){if(this.hide(),this.product=t,!t.variants)return this._injectStyles(),this._buildLoadingDOM(),this._positionAboveMobileBar(),document.body.appendChild(this.container),void Xe(t).then(t=>{t&&t.variants?(this.hide(!0),this.show(t)):this.hide()});this.selectedValues=new Array(t.options.length).fill(null),t.options.forEach((e,n)=>{var A=Ze(t.variants,n,this.selectedValues);A.length>0&&(this.selectedValues[n]=A[0])}),this._injectStyles(),this._buildDOM(),this._positionAboveMobileBar(),document.body.appendChild(this.container)}hide(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.container&&this.container.parentNode){this.container.classList.add("ttp-varpicker--hiding");var e=this.container,n=this.onClose;setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e),t||n()},280)}this.container=null,this.product=null}destroy(){this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null;var t=document.getElementById("ttp-varpicker-styles");t&&t.remove()}_buildLoadingDOM(){this.container=document.createElement("div"),this.container.className="ttp-varpicker",this.container.style.setProperty("--ttp-vp-primary",this.primaryColor),this.container.innerHTML='\n <div class="ttp-vp-backdrop"></div>\n <div class="ttp-vp-card" style="align-items:center;justify-content:center;min-height:120px;">\n <div style="display:flex;flex-direction:column;align-items:center;gap:10px;padding:24px;">\n <div class="ttp-vp-spinner"></div>\n <div style="font-size:12px;color:#64748b;font-weight:500;">Loading options...</div>\n </div>\n </div>\n ',this.container.querySelector(".ttp-vp-backdrop").addEventListener("click",()=>{this.hide()})}_buildDOM(){var t=this.product,e=$e(t.currency),n=Je(t.variants,this.selectedValues),A=n?n.price:t.price;this.container=document.createElement("div"),this.container.className="ttp-varpicker",this.container.style.setProperty("--ttp-vp-primary",this.primaryColor),this.container.innerHTML='\n <div class="ttp-vp-backdrop"></div>\n <div class="ttp-vp-card" id="ttpVpCard">\n\n \x3c!-- Collapsed: product summary (left panel) --\x3e\n <div class="ttp-vp-left" id="ttpVpLeft">\n <div class="ttp-vp-img" id="ttpVpImg">'.concat(t.imageUrl?'<img src="'.concat(t.imageUrl,'" alt="').concat(t.name,'" onerror="this.style.display=\'none\'"/>'):"",'</div>\n <div class="ttp-vp-product-name">').concat(t.name,'</div>\n <div class="ttp-vp-product-price" id="ttpVpPrice">').concat(e).concat(A.toFixed(2),'</div>\n </div>\n\n \x3c!-- Options panel (right panel) --\x3e\n <div class="ttp-vp-right" id="ttpVpRight">\n <div class="ttp-vp-right-header">\n <span class="ttp-vp-right-title">Choose Options</span>\n <button class="ttp-vp-close-btn" id="ttpVpClose">✕</button>\n </div>\n <div class="ttp-vp-options" id="ttpVpOptions">\n ').concat(this._renderOptions(),'\n </div>\n <button class="ttp-vp-add-btn" id="ttpVpAddBtn">\n Add to Cart — ').concat(e).concat(A.toFixed(2),"\n </button>\n </div>\n </div>\n "),this.container.querySelector("#ttpVpClose").addEventListener("click",()=>{this.hide()}),this.container.querySelector("#ttpVpAddBtn").addEventListener("click",()=>{this._handleAdd()}),this._attachOptionHandlers(),this._updateAddButton()}_renderOptions(){return this.product.options.map((t,e)=>{var n=Ze(this.product.variants,e,this.selectedValues);return"color"===t.name.toLowerCase()||"colour"===t.name.toLowerCase()?'\n <div class="ttp-vp-section">\n <div class="ttp-vp-label">'.concat(t.name,'</div>\n <div class="ttp-vp-swatches" data-opt-idx="').concat(e,'">\n ').concat(t.values.map(t=>{var A=!n.includes(t),o=this.selectedValues[e]===t;return'<div\n class="ttp-vp-swatch'.concat(o?" selected":"").concat(A?" oos":"",'"\n data-value="').concat(t,'"\n data-opt-idx="').concat(e,'"\n style="background:').concat(this._colorNameToHex(t),';"\n title="').concat(t).concat(A?" (unavailable)":"",'"\n ></div>')}).join(""),"\n </div>\n </div>"):'\n <div class="ttp-vp-section">\n <div class="ttp-vp-label">'.concat(t.name,'</div>\n <div class="ttp-vp-pills" data-opt-idx="').concat(e,'">\n ').concat(t.values.map(t=>{var A=!n.includes(t),o=this.selectedValues[e]===t;return'<button\n class="ttp-vp-pill'.concat(o?" selected":"").concat(A?" oos":"",'"\n data-value="').concat(t,'"\n data-opt-idx="').concat(e,'"\n ').concat(A?"disabled":"","\n >").concat(t,"</button>")}).join(""),"\n </div>\n </div>")}).join("")}_attachOptionHandlers(){this.container.querySelectorAll(".ttp-vp-swatch:not(.oos)").forEach(t=>{t.addEventListener("click",()=>this._selectOption(parseInt(t.dataset.optIdx),t.dataset.value))}),this.container.querySelectorAll(".ttp-vp-pill:not(.oos)").forEach(t=>{t.addEventListener("click",()=>this._selectOption(parseInt(t.dataset.optIdx),t.dataset.value))})}_selectOption(t,e){this.selectedValues[t]=e,this.container.querySelector("#ttpVpOptions").innerHTML=this._renderOptions(),this._attachOptionHandlers(),this._updateAddButton(),this._updateImage()}_updateAddButton(){var t,e=$e(this.product.currency),n=Je(this.product.variants,this.selectedValues),A=this.container.querySelector("#ttpVpAddBtn");if(!this.selectedValues.every(t=>null!==t))return A.textContent="Select all options",void(A.disabled=!0);if(!n||!n.available)return A.textContent="Unavailable",void(A.disabled=!0);var o=null!==(t=n.price)&&void 0!==t?t:this.product.price;A.textContent="Add to Cart — ".concat(e).concat(o.toFixed(2)),A.disabled=!1;var i=this.container.querySelector("#ttpVpPrice");i&&(i.textContent="".concat(e).concat(o.toFixed(2)))}_updateImage(){var t=Je(this.product.variants,this.selectedValues),e=(null==t?void 0:t.imageUrl)||this.product.imageUrl,n=this.container.querySelector("#ttpVpImg");n&&e&&(n.innerHTML='<img src="'.concat(e,'" alt="').concat(this.product.name,'"\n onerror="this.style.display=\'none\'"/>'))}_handleAdd(){var t=Je(this.product.variants,this.selectedValues);if(t&&t.available){var e=this.container.querySelector("#ttpVpAddBtn");e.textContent="✓ Added!",e.disabled=!0;var n=pn(pn({},this.product),{},{id:t.id,price:t.price,selectedOptions:this.selectedValues,selectedAmount:1,sellBy:"quantity"});this.onProductAdd(this.container,n),setTimeout(()=>this.hide(),800)}}_positionAboveMobileBar(){}_colorNameToHex(t){return{black:"#1e293b",white:"#f8fafc",red:"#ef4444",blue:"#3b82f6",green:"#22c55e",yellow:"#eab308",orange:"#f97316",purple:"#a855f7",pink:"#ec4899",grey:"#94a3b8",gray:"#94a3b8",navy:"#1e3a5f",brown:"#92400e",beige:"#d4b483",cream:"#fef9c3"}[t.toLowerCase()]||"#94a3b8"}_injectStyles(){if(!document.getElementById("ttp-varpicker-styles")){var t=document.createElement("style");t.id="ttp-varpicker-styles",t.textContent="\n\n.ttp-varpicker {\n position: fixed !important;\n inset: 0;\n z-index: 2147483647 !important;\n display: flex !important;\n align-items: center;\n justify-content: center;\n font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n animation: ttpVpIn 0.3s cubic-bezier(0.23,1,0.32,1);\n padding: 16px;\n}\n\n.ttp-varpicker--hiding {\n animation: ttpVpOut 0.28s ease forwards;\n pointer-events: none;\n}\n\n@keyframes ttpVpIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@keyframes ttpVpOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n.ttp-vp-backdrop {\n position: absolute;\n inset: 0;\n background: #0a0a0a;\n backdrop-filter: blur(20px);\n -webkit-backdrop-filter: blur(20px);\n}\n\n.ttp-vp-card {\n position: relative !important;\n z-index: 1 !important;\n width: 310px;\n background: #fff;\n border-radius: 20px;\n overflow: hidden;\n box-shadow: 0 16px 56px rgba(0,0,0,0.22);\n display: flex !important;\n flex-direction: row;\n animation: ttpVpCardIn 0.35s cubic-bezier(0.23,1,0.32,1);\n}\n\n@keyframes ttpVpCardIn {\n from { transform: translateY(20px) scale(0.96); opacity: 0; }\n to { transform: translateY(0) scale(1); opacity: 1; }\n}\n\n/* Left panel — product image + name + price */\n.ttp-vp-left {\n width: 110px;\n flex-shrink: 0;\n background: linear-gradient(160deg, #f0f4ff, #dde6f8);\n display: flex !important;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding: 14px 8px;\n border-right: 1px solid #f1f5f9;\n}\n\n.ttp-vp-img {\n width: 72px !important; height: 72px !important;\n border-radius: 14px;\n background: #fff;\n border: 1px solid #e5e7eb;\n display: flex !important; align-items: center; justify-content: center;\n overflow: hidden;\n transition: all 0.2s ease;\n}\n\n.ttp-vp-img img {\n width: 100%; height: 100%;\n object-fit: contain;\n padding: 6px;\n}\n\n.ttp-vp-product-name {\n font-size: 11px;\n font-weight: 700;\n color: #1e293b;\n text-align: center;\n line-height: 1.25;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n\n.ttp-vp-product-price {\n font-size: 14px;\n font-weight: 700;\n color: var(--ttp-vp-primary, #3b82f6);\n}\n\n/* Right panel — options */\n.ttp-vp-right {\n flex: 1;\n display: flex !important;\n flex-direction: column;\n padding: 12px 12px 10px;\n gap: 8px;\n min-width: 0;\n}\n\n.ttp-vp-right-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 2px;\n}\n\n.ttp-vp-right-title {\n font-size: 11px;\n font-weight: 700;\n color: #1e293b;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n}\n\n.ttp-vp-close-btn {\n background: none;\n border: none;\n cursor: pointer;\n color: #94a3b8;\n font-size: 13px;\n padding: 2px 4px;\n border-radius: 4px;\n line-height: 1;\n}\n.ttp-vp-close-btn:hover { background: #f1f5f9; color: #475569; }\n\n.ttp-vp-options {\n flex: 1;\n display: flex !important;\n flex-direction: column;\n gap: 10px;\n overflow-y: auto;\n}\n\n.ttp-vp-section { display: flex !important; flex-direction: column; gap: 5px; }\n\n.ttp-vp-label {\n font-size: 9px;\n font-weight: 700;\n color: #94a3b8;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n/* Color swatches */\n.ttp-vp-swatches { display: flex !important; flex-wrap: wrap; gap: 6px; }\n\n.ttp-vp-swatch {\n display: block !important;\n width: 22px !important; height: 22px !important;\n border-radius: 50%;\n cursor: pointer;\n border: 2.5px solid transparent;\n transition: all 0.15s;\n flex-shrink: 0;\n position: relative;\n}\n.ttp-vp-swatch:hover { transform: scale(1.12); }\n.ttp-vp-swatch.selected {\n border-color: var(--ttp-vp-primary, #3b82f6);\n box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ttp-vp-primary, #3b82f6);\n}\n.ttp-vp-swatch.oos { opacity: 0.3; cursor: not-allowed; }\n\n/* Size pills */\n.ttp-vp-pills { display: flex !important; flex-wrap: wrap; gap: 4px; }\n\n.ttp-vp-pill {\n padding: 3px 9px;\n border-radius: 6px;\n border: 1.5px solid #e2e8f0;\n background: #fff;\n font-size: 10px;\n font-weight: 600;\n color: #475569;\n cursor: pointer;\n transition: all 0.15s;\n font-family: inherit;\n line-height: 1.4;\n}\n.ttp-vp-pill:hover:not(:disabled) { border-color: var(--ttp-vp-primary, #3b82f6); color: var(--ttp-vp-primary, #3b82f6); }\n.ttp-vp-pill.selected { border-color: var(--ttp-vp-primary, #3b82f6); background: var(--ttp-vp-primary, #3b82f6); color: #fff; }\n.ttp-vp-pill.oos { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }\n\n/* Add button */\n.ttp-vp-add-btn {\n width: 100%;\n padding: 9px;\n background: linear-gradient(135deg, var(--ttp-vp-primary, #3b82f6), #2563eb);\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 11px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n box-shadow: 0 3px 10px rgba(59,130,246,0.3);\n transition: all 0.15s;\n flex-shrink: 0;\n}\n.ttp-vp-add-btn:hover:not(:disabled) { transform: scale(0.98); }\n.ttp-vp-add-btn:disabled { background: #cbd5e1; box-shadow: none; cursor: not-allowed; }\n\n.ttp-vp-spinner {\n width: 24px; height: 24px;\n border: 3px solid #e2e8f0;\n border-top-color: var(--ttp-vp-primary, #3b82f6);\n border-radius: 50%;\n animation: ttpVpSpin 0.7s linear infinite;\n}\n@keyframes ttpVpSpin {\n to { transform: rotate(360deg); }\n}\n\n ",document.head.appendChild(t)}}}function gn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function mn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?gn(Object(n),!0).forEach(function(e){vn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function vn(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class fn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onProductAdd=t.onProductAdd||(()=>{}),this.onAddDisabled=t.onAddDisabled||(()=>!1),this.onClose=t.onClose||(()=>{}),this.primaryColor=t.primaryColor||"#3b82f6",this.products=[],this.current=0,this.amounts=[],this.sellByModes=[],this.container=null,this.wheel=null,this.dotsEl=null,this.currentPicker=null,this.anglePerCard=42,this.radius=240,this.dragging=!1,this.startX=0,this.swiped=!1,this.dragThreshold=40,this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._boundMouseMove=this._onMouseMove.bind(this),this._boundMouseUp=this._onMouseUp.bind(this)}show(t,e){this.hide(),t&&0!==t.length&&(this._normalizeProducts(t),this.current=0,this._injectStyles(),this._buildDOM(e),this._buildCards(),this._buildDots(),this._setupDragEvents(),this._updateWheel(),document.body.appendChild(this.container),this._positionAboveMobileBar())}hide(){if(this.currentPicker&&(this.currentPicker.hide(),this.currentPicker=null),this._removeEventListeners(),this.container&&this.container.parentNode){this.container.classList.add("ttp-carousel--hiding");var t=this.container;setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},280)}this.container=null,this.wheel=null,this.dotsEl=null}destroy(){this.currentPicker&&(this.currentPicker.destroy(),this.currentPicker=null),this._removeEventListeners(),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null;var t=document.getElementById("ttpCarouselToast");t&&t.remove();var e=document.getElementById("ttp-mobile-carousel-styles");e&&e.remove()}showToast(t,e){var n=document.getElementById("ttpCarouselToast");n&&n.remove();var A=document.createElement("div");A.id="ttpCarouselToast",A.className="ttp-carousel-toast";var o=e?'<div class="ttp-carousel-toast__cart">'.concat(e.itemCount," item").concat(1!==e.itemCount?"s":""," · ").concat(e.currency).concat(e.total.toFixed(2),"</div>"):"";A.innerHTML='\n <div class="ttp-carousel-toast__icon">✓</div>\n <div class="ttp-carousel-toast__text">\n <strong>'.concat(t,"</strong> added to cart\n ").concat(o,"\n </div>\n "),A.style.setProperty("--ttp-carousel-primary",this.primaryColor),document.body.appendChild(A);var i=document.getElementById("mobile-voice-call-bar-container"),r=document.getElementById("ttpMobileCartSummary");A.style.bottom=r?"".concat(parseInt(r.style.bottom)+r.offsetHeight+8,"px"):i?"".concat(i.offsetHeight+12,"px"):"100px",setTimeout(()=>{A.classList.add("ttp-carousel-toast--hiding"),setTimeout(()=>A.remove(),300)},3e3)}_normalizeProducts(t){this.products=t.map(t=>mn(mn({},t),{},{imageUrl:t.imageUrl||t.image_url||"",inStock:void 0!==t.inStock?t.inStock:void 0===t.in_stock||t.in_stock,sellBy:t.sellBy||t.sell_by||"quantity",cartQuantity:t.cartQuantity||t.cart_quantity||0,brand:t.brand||"",unit:t.unit||"",currency:t.currency||"USD"})),this.amounts=this.products.map(t=>{var e="weight"===t.sellBy?.5:1;return t.cartQuantity>0?t.cartQuantity:e}),this.sellByModes=this.products.map(t=>t.sellBy)}_buildDOM(t){this.container=document.createElement("div"),this.container.className="ttp-mobile-carousel",this.container.id="ttpMobileCarousel",this.container.style.setProperty("--ttp-carousel-primary",this.primaryColor),this.container.style.setProperty("--ttp-carousel-primary-light",this._hexToRgba(this.primaryColor,.12)),this.container.style.setProperty("--ttp-carousel-primary-dark",this._darkenHex(this.primaryColor,30)),this.container.style.setProperty("--ttp-carousel-primary-shadow",this._hexToRgba(this.primaryColor,.3));var e=document.createElement("div");e.className="ttp-carousel-header",e.innerHTML='\n <span class="ttp-carousel-title">'.concat(t||"Products",'</span>\n <button class="ttp-carousel-close" aria-label="Close">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">\n <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>\n </svg>\n </button>\n '),e.querySelector(".ttp-carousel-close").addEventListener("click",()=>{this.hide(),this.onClose()});var n=document.createElement("div");n.className="ttp-carousel-area",this.wheel=document.createElement("div"),this.wheel.className="ttp-carousel-wheel",n.appendChild(this.wheel),this.dotsEl=document.createElement("div"),this.dotsEl.className="ttp-carousel-dots",this.container.appendChild(e),this.container.appendChild(n),this.container.appendChild(this.dotsEl)}_buildCards(){this.products.forEach((t,e)=>{var n=document.createElement("div");n.className="ttp-carousel-card"+(t.inStock?"":" ttp-carousel-card--oos"),n.dataset.index=e;var A="ILS"===t.currency?"₪":"$",o="weight"===this.sellByModes[e]?"".concat(this.amounts[e].toFixed(1)," kg"):"".concat(this.amounts[e]),i=t.cartQuantity>0,r=qe(t);n.innerHTML='\n <div class="ttp-carousel-card__image">\n <img src="'.concat(t.imageUrl,'" alt="').concat(t.name,'" onerror="this.style.display=\'none\'" />\n ').concat(t.inStock?"":'<div class="ttp-carousel-card__badge">Out of Stock</div>','\n </div>\n <div class="ttp-carousel-card__info">\n ').concat(t.brand?'<div class="ttp-carousel-card__brand">'.concat(t.brand,"</div>"):"",'\n <div class="ttp-carousel-card__name">').concat(t.name,"</div>\n ").concat(t.unit?'<div class="ttp-carousel-card__unit">'.concat(t.unit,"</div>"):"",'\n <div class="ttp-carousel-card__price">').concat(A).concat(t.price.toFixed(2),'</div>\n </div>\n <div class="ttp-carousel-card__actions">\n <div class="ttp-carousel-card__stepper">\n <button class="ttp-carousel-card__qty-btn ttp-carousel-minus" data-idx="').concat(e,'" ').concat(t.inStock?"":"disabled",'>−</button>\n <span class="ttp-carousel-card__qty-val" id="ttpCQty').concat(e,'">').concat(o,'</span>\n <button class="ttp-carousel-card__qty-btn ttp-carousel-plus" data-idx="').concat(e,'" ').concat(t.inStock?"":"disabled",'>+</button>\n </div>\n <button class="ttp-carousel-card__add-btn').concat(r?" ttp-carousel-card__add-btn--choose":"").concat(i?" ttp-carousel-card__add-btn--update":"",'" data-idx="').concat(e,'" ').concat(t.inStock?"":"disabled",">\n ").concat(t.inStock?r?"Choose Options":i?"Update":"Add to Cart":"Unavailable","\n </button>\n </div>\n "),n.style.transform="rotateY(".concat(e*this.anglePerCard,"deg) translateZ(").concat(this.radius,"px)"),this.wheel.appendChild(n)}),this._setupCardHandlers()}_setupCardHandlers(){var t=this.container.querySelector(".ttp-carousel-area");if(t){var e=null;t.addEventListener("touchstart",t=>{e={x:t.touches[0].clientX,y:t.touches[0].clientY}},{passive:!0}),t.addEventListener("touchend",t=>{if(e&&!this.swiped){var n=t.changedTouches[0],A=Math.abs(n.clientX-e.x),o=Math.abs(n.clientY-e.y);e=null,A>15||o>15||(t.preventDefault(),this._handleTapAt(n.clientX,n.clientY))}else e=null}),t.addEventListener("click",t=>{var e=t.target,n=e.closest(".ttp-carousel-card");if(n&&parseInt(n.dataset.index)===this.current){var A=e.closest(".ttp-carousel-minus"),o=e.closest(".ttp-carousel-plus"),i=e.closest(".ttp-carousel-card__add-btn");A&&!A.disabled?(t.stopPropagation(),this._handleMinus()):o&&!o.disabled?(t.stopPropagation(),this._handlePlus()):i&&!i.disabled&&(t.stopPropagation(),this._handleAdd())}})}}_handleTapAt(t,e){var n=this.wheel.querySelectorAll(".ttp-carousel-card")[this.current];if(n){var A=n.querySelector(".ttp-carousel-minus"),o=n.querySelector(".ttp-carousel-plus"),i=n.querySelector(".ttp-carousel-card__add-btn");!this._hitTest(t,e,A)||null!=A&&A.disabled?!this._hitTest(t,e,o)||null!=o&&o.disabled?!this._hitTest(t,e,i)||null!=i&&i.disabled||this._handleAdd():this._handlePlus():this._handleMinus()}}_hitTest(t,e,n){if(!n)return!1;var A=n.getBoundingClientRect();return t>=A.left&&t<=A.right&&e>=A.top&&e<=A.bottom}_handleMinus(){var t=this.current,e=this.sellByModes[t],n="weight"===e?.5:1,A="weight"===e?.5:1;this.amounts[t]>n&&(this.amounts[t]=Math.round(10*(this.amounts[t]-A))/10,this._refreshStepper(t))}_handlePlus(){var t=this.current,e="weight"===this.sellByModes[t]?.5:1;this.amounts[t]=Math.round(10*(this.amounts[t]+e))/10,this._refreshStepper(t)}_handleAdd(){var t=this.current,e=this.products[t];if(e.inStock&&!this.onAddDisabled()){if(qe(e)){var n=new hn({primaryColor:this.primaryColor,onProductAdd:(t,e)=>{this.onProductAdd(t,e),setTimeout(()=>this.hide(),800)},onClose:()=>{this.currentPicker=null,this.container&&this.container.classList.remove("ttp-carousel--picker-open")}});return this.currentPicker=n,this.container&&this.container.classList.add("ttp-carousel--picker-open"),void n.show(e)}var A=this.wheel.querySelectorAll(".ttp-carousel-card")[t],o=null==A?void 0:A.querySelector(".ttp-carousel-card__add-btn");o&&(o.textContent="✓ Added!",o.classList.add("ttp-carousel-card__add-btn--added"),o.disabled=!0);var i=mn(mn({},e),{},{selectedAmount:this.amounts[t],sellBy:this.sellByModes[t]});this.onProductAdd(A,i),setTimeout(()=>this.hide(),800)}}_refreshStepper(t){var e=this.sellByModes[t],n="weight"===e?.5:1,A=this.container.querySelector("#ttpCQty".concat(t)),o=this.container.querySelector('.ttp-carousel-minus[data-idx="'.concat(t,'"]'));A&&(A.textContent="weight"===e?"".concat(this.amounts[t].toFixed(1)," kg"):"".concat(this.amounts[t])),o&&(o.disabled=this.amounts[t]<=n)}_buildDots(){this.products.length<=1||this.products.forEach((t,e)=>{var n=document.createElement("div");n.className="ttp-carousel-dot",n.addEventListener("click",()=>this.goTo(e)),this.dotsEl.appendChild(n)})}_updateWheel(){var t=-this.current*this.anglePerCard;this.wheel.style.transform="translateZ(-".concat(this.radius,"px) rotateY(").concat(t,"deg)"),this.wheel.querySelectorAll(".ttp-carousel-card").forEach((e,n)=>{for(var A=n*this.anglePerCard+t;A>180;)A-=360;for(;A<-180;)A+=360;Math.abs(A)>90?(e.style.visibility="hidden",e.style.opacity="0"):(e.style.visibility="visible",e.style.opacity=this.products[n].inStock?"1":"0.7")}),this.dotsEl.querySelectorAll(".ttp-carousel-dot").forEach((t,e)=>t.classList.toggle("ttp-carousel-dot--active",e===this.current))}goTo(t){this.current=Math.max(0,Math.min(this.products.length-1,t)),this._updateWheel()}_setupDragEvents(){var t=this.container.querySelector(".ttp-carousel-area");t&&(t.addEventListener("touchstart",t=>{this.dragging=!0,this.startX=t.touches[0].clientX,this.swiped=!1},{passive:!0}),t.addEventListener("mousedown",t=>{this.dragging=!0,this.startX=t.clientX,this.swiped=!1}),document.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),document.addEventListener("touchend",this._boundTouchEnd),document.addEventListener("mousemove",this._boundMouseMove),document.addEventListener("mouseup",this._boundMouseUp))}_onTouchMove(t){if(this.dragging){var e=t.touches[0].clientX-this.startX;Math.abs(e)>this.dragThreshold&&(this.goTo(this.current+(e>0?-1:1)),this.startX=t.touches[0].clientX,this.swiped=!0)}}_onTouchEnd(){this.dragging=!1,this.swiped&&setTimeout(()=>{this.swiped=!1},400)}_onMouseMove(t){if(this.dragging){var e=t.clientX-this.startX;Math.abs(e)>this.dragThreshold&&(this.goTo(this.current+(e>0?-1:1)),this.startX=t.clientX,this.swiped=!0)}}_onMouseUp(){this.dragging=!1,this.swiped&&setTimeout(()=>{this.swiped=!1},400)}_removeEventListeners(){document.removeEventListener("touchmove",this._boundTouchMove),document.removeEventListener("touchend",this._boundTouchEnd),document.removeEventListener("mousemove",this._boundMouseMove),document.removeEventListener("mouseup",this._boundMouseUp)}_positionAboveMobileBar(){requestAnimationFrame(()=>{if(this.container){var t=document.getElementById("mobile-voice-call-bar-container");if(t){var e=t.getBoundingClientRect();this.container.style.bottom="".concat(window.innerHeight-e.top+8+50,"px")}}})}_hexToRgba(t,e){var n=parseInt(t.slice(1,3),16),A=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16);return"rgba(".concat(n,", ").concat(A,", ").concat(o,", ").concat(e,")")}_darkenHex(t,e){var n=Math.max(0,parseInt(t.slice(1,3),16)-e),A=Math.max(0,parseInt(t.slice(3,5),16)-e),o=Math.max(0,parseInt(t.slice(5,7),16)-e);return"#".concat(n.toString(16).padStart(2,"0")).concat(A.toString(16).padStart(2,"0")).concat(o.toString(16).padStart(2,"0"))}_injectStyles(){if(!document.getElementById("ttp-mobile-carousel-styles")){var t=document.createElement("style");t.id="ttp-mobile-carousel-styles",t.textContent=this._generateCSS(),document.head.appendChild(t)}}_generateCSS(){return"\n/* ═══════════════════════════════════════\n MOBILE PRODUCT CAROUSEL\n ═══════════════════════════════════════ */\n\n.ttp-mobile-carousel {\n position: fixed !important;\n bottom: 180px;\n left: 0 !important;\n right: 0 !important;\n top: 0 !important;\n z-index: 2147483646 !important;\n font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;\n animation: ttpCarouselIn 0.35s cubic-bezier(0.23, 1, 0.32, 1);\n -webkit-tap-highlight-color: transparent;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n padding-bottom: 16px;\n}\n\n.ttp-mobile-carousel > .ttp-carousel-header,\n.ttp-mobile-carousel > .ttp-carousel-area,\n.ttp-mobile-carousel > .ttp-carousel-dots {\n position: relative;\n z-index: 1;\n}\n\n.ttp-mobile-carousel::after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 420px;\n background: rgba(0, 0, 0, 0.2);\n backdrop-filter: blur(4px);\n -webkit-backdrop-filter: blur(4px);\n border-radius: 24px 24px 0 0;\n pointer-events: none;\n z-index: 0;\n}\n\n.ttp-mobile-carousel.ttp-carousel--hiding {\n animation: ttpCarouselOut 0.28s ease forwards;\n pointer-events: none;\n}\n\n/* Hide carousel when variation picker is open so products are not visible behind it */\n.ttp-mobile-carousel.ttp-carousel--picker-open {\n visibility: hidden !important;\n opacity: 0 !important;\n pointer-events: none !important;\n}\n\n@keyframes ttpCarouselIn {\n from { opacity: 0; transform: translateY(30px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes ttpCarouselOut {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(30px); }\n}\n\n/* ── Header ── */\n\n.ttp-carousel-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 24px 8px;\n flex-shrink: 0;\n}\n\n.ttp-carousel-title {\n font-size: 13px;\n font-weight: 600;\n color: #fff;\n text-shadow: 0 1px 4px rgba(0,0,0,0.4);\n}\n\n.ttp-carousel-close {\n width: 32px;\n height: 32px;\n border: none;\n border-radius: 0;\n background: none;\n color: #fff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: auto;\n padding: 0;\n opacity: 0.85;\n}\n.ttp-carousel-close:active {\n opacity: 1;\n}\n\n/* ── 3D Carousel Area ── */\n\n.ttp-carousel-area {\n position: relative;\n height: 300px;\n flex-shrink: 0;\n perspective: 800px;\n perspective-origin: 50% 55%;\n cursor: grab;\n user-select: none;\n -webkit-user-select: none;\n}\n.ttp-carousel-area:active {\n cursor: grabbing;\n}\n\n.ttp-carousel-wheel {\n position: absolute;\n width: 100%;\n height: 100%;\n transform-style: preserve-3d;\n transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);\n}\n\n/* ── Card ── */\n\n.ttp-carousel-card {\n position: absolute;\n width: 150px;\n height: 285px;\n left: 50%;\n top: 50%;\n margin-left: -75px;\n margin-top: -142px;\n background: #fff;\n border-radius: 18px;\n overflow: hidden;\n box-shadow: 0 8px 32px rgba(0,0,0,0.14);\n transform-style: preserve-3d;\n transition: visibility 0.3s, opacity 0.3s;\n display: flex;\n flex-direction: column;\n}\n\n.ttp-carousel-card--oos {\n opacity: 0.7;\n}\n\n/* Card Image */\n.ttp-carousel-card__image {\n width: 100%;\n height: 100px;\n background: linear-gradient(145deg, #f0f4ff, #e8ecf8);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n position: relative;\n overflow: hidden;\n}\n\n.ttp-carousel-card__image img {\n max-width: 80%;\n max-height: 80%;\n object-fit: contain;\n}\n\n.ttp-carousel-card__badge {\n position: absolute;\n top: 6px;\n right: 6px;\n background: #ef4444;\n color: #fff;\n font-size: 8px;\n font-weight: 700;\n padding: 2px 6px;\n border-radius: 4px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n\n/* Card Info */\n.ttp-carousel-card__info {\n padding: 8px 10px 4px;\n flex-shrink: 0;\n}\n\n.ttp-carousel-card__brand {\n font-size: 9px;\n font-weight: 500;\n color: #94a3b8;\n margin-bottom: 1px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n\n.ttp-carousel-card__name {\n font-size: 12px;\n font-weight: 600;\n color: #1e1b4b;\n line-height: 1.25;\n margin-bottom: 1px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n\n.ttp-carousel-card__unit {\n font-size: 9px;\n color: #64748b;\n margin-bottom: 3px;\n}\n\n.ttp-carousel-card__price {\n font-size: 16px;\n font-weight: 700;\n color: var(--ttp-carousel-primary, #3b82f6);\n}\n\n/* Card Actions */\n.ttp-carousel-card__actions {\n padding: 6px 10px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-top: auto;\n}\n\n/* Stepper */\n.ttp-carousel-card__stepper {\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--ttp-carousel-primary-light, rgba(59,130,246,0.12));\n border-radius: 10px;\n padding: 3px;\n}\n\n.ttp-carousel-card__qty-btn {\n width: 30px;\n height: 30px;\n border: none;\n background: transparent;\n color: var(--ttp-carousel-primary, #3b82f6);\n font-size: 17px;\n font-weight: 600;\n cursor: pointer;\n border-radius: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.15s;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 10;\n touch-action: manipulation;\n}\n.ttp-carousel-card__qty-btn:active:not(:disabled) {\n background: var(--ttp-carousel-primary-light, rgba(59,130,246,0.12));\n}\n.ttp-carousel-card__qty-btn:disabled {\n opacity: 0.3;\n cursor: default;\n}\n\n.ttp-carousel-card__qty-val {\n min-width: 40px;\n text-align: center;\n font-size: 14px;\n font-weight: 600;\n color: #1e1b4b;\n user-select: none;\n}\n\n/* Add Button */\n.ttp-carousel-card__add-btn {\n width: 100%;\n padding: 9px 12px;\n background: linear-gradient(135deg, var(--ttp-carousel-primary, #3b82f6), var(--ttp-carousel-primary-dark, #2563eb));\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n box-shadow: 0 4px 12px var(--ttp-carousel-primary-shadow, rgba(59,130,246,0.3));\n transition: transform 0.15s, box-shadow 0.15s;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 10;\n touch-action: manipulation;\n}\n.ttp-carousel-card__add-btn:active:not(:disabled) {\n transform: scale(0.97);\n}\n.ttp-carousel-card__add-btn:disabled {\n background: #94a3b8;\n cursor: default;\n box-shadow: none;\n}\n\n.ttp-carousel-card__add-btn--added {\n background: linear-gradient(135deg, #10b981, #059669) !important;\n box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;\n}\n\n.ttp-carousel-card__add-btn--update {\n background: linear-gradient(135deg, #f59e0b, #d97706);\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);\n}\n\n.ttp-carousel-card__add-btn--choose {\n background: linear-gradient(135deg, #f59e0b, #d97706);\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);\n}\n\n.ttp-products-animating .ttp-carousel-card__add-btn {\n opacity: 0.4;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n/* ── Dots ── */\n\n.ttp-carousel-dots {\n display: flex;\n justify-content: center;\n gap: 8px;\n padding: 8px 0 0;\n flex-shrink: 0;\n}\n\n.ttp-carousel-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: rgba(255,255,255,0.35);\n cursor: pointer;\n transition: all 0.3s;\n -webkit-tap-highlight-color: transparent;\n}\n\n.ttp-carousel-dot--active {\n width: 24px;\n border-radius: 4px;\n background: #fff;\n}\n\n/* ── Toast ── */\n\n.ttp-carousel-toast {\n position: fixed;\n left: 16px;\n right: 16px;\n bottom: 100px;\n z-index: 100001;\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n background: #fff;\n border-radius: 14px;\n box-shadow: 0 8px 32px rgba(0,0,0,0.15);\n animation: ttpCarouselToastIn 0.3s ease;\n pointer-events: auto;\n}\n\n.ttp-carousel-toast--hiding {\n animation: ttpCarouselOut 0.3s ease forwards;\n}\n\n@keyframes ttpCarouselToastIn {\n from { opacity: 0; transform: translateY(12px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n.ttp-carousel-toast__icon {\n width: 28px;\n height: 28px;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n font-weight: 700;\n flex-shrink: 0;\n}\n\n.ttp-carousel-toast__text {\n font-size: 13px;\n color: #1e293b;\n line-height: 1.3;\n}\n.ttp-carousel-toast__text strong {\n font-weight: 600;\n}\n.ttp-carousel-toast__cart {\n font-size: 11px;\n color: #64748b;\n margin-top: 2px;\n font-weight: 500;\n}\n"}}class wn extends Re{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.primaryColor=t.primaryColor||"#3b82f6",this.onProductAdd=t.onProductAdd||(()=>{}),this.carousel=null,this.flyToCart=new sn({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>this._triggerCartBump(),onRipple:()=>{}})}_getCartTarget(){var t=document.getElementById("mobile-voice-call-bar-container");if(!t)return null;var e=t.querySelector("[data-ttp-fly-target]");if(e){var n=e.getBoundingClientRect();if(n.width>0&&n.height>0)return e}var A=t.querySelector("#ttpFlyToCartTarget");if(A){var o=A.getBoundingClientRect();if(o.width>0&&o.height>0)return A}return null}_triggerCartBump(){}showProducts(t,e,n){this.carousel||(this.carousel=new fn({primaryColor:this.primaryColor,onProductAdd:(t,e)=>this._handleProductAddWithFly(t,e),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>{}})),this.carousel.show(t,e)}_handleProductAddWithFly(t,e){var n;this.flyToCart.isAnimating||(null===(n=this.carousel)||void 0===n||null===(n=n.container)||void 0===n||n.classList.add("ttp-products-animating"),this.flyToCart.triggerFly(t,e,()=>{var t;null===(t=this.carousel)||void 0===t||null===(t=t.container)||void 0===t||t.classList.remove("ttp-products-animating"),this.onProductAdd(e)},{preferClone:!1}))}hideProducts(){this.carousel&&this.carousel.hide()}onProductAdded(t,e){this.carousel&&this.carousel.container&&this.carousel.showToast(t.name,e),this._updateMobileCartRow(e)}updateCart(t){this._updateMobileCartRow(t)}destroy(){this.flyToCart&&this.flyToCart.destroy(),this.carousel&&(this.carousel.destroy(),this.carousel=null)}_updateMobileCartRow(t){var{itemCount:e,total:n,currency:A}=t,o=document.getElementById("mobileCartRow"),i=document.getElementById("mobileCartText");if(o&&i)if(e<=0)o.style.display="none";else{var r="".concat(e," item").concat(1!==e?"s":"");i.textContent="".concat(r," · ").concat(A).concat(n.toFixed(2)),o.style.display="flex"}}}class Bn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.shadowRoot=t.shadowRoot,this.primaryColor=t.primaryColor||"#3b82f6",this.onProductSelected=t.onProductSelected||(()=>{}),this.onProductDeselected=t.onProductDeselected||(()=>{}),this.cartItemCount=0,this.cartTotal=0,this.currencySymbol="$",this._presenter=null}get presenter(){return this._presenter||(this._presenter=this._createPresenter()),this._presenter}_createPresenter(){return this._isMobileCall()?new wn({primaryColor:this.primaryColor,onProductAdd:t=>this._handleProductAdd(t)}):new ln({shadowRoot:this.shadowRoot,primaryColor:this.primaryColor,onProductAdd:t=>this._handleProductAdd(t),onProductUndo:t=>this.onProductDeselected(t)})}_isMobileCall(){return!!document.getElementById("mobile-voice-call-bar-container")}_resolveCurrency(t){return"ILS"===t?"₪":"$"}_buildCartInfo(){return{itemCount:this.cartItemCount,total:this.cartTotal,currency:this.currencySymbol}}handleShowItems(t){return this.handleShowProducts(t)}handleShowProducts(t){var{products:e,title:n,layout:A}=t;e&&0!==e.length?(this.currencySymbol=this._resolveCurrency(e[0].currency),this.presenter.showProducts(e,n,A)):console.warn("[EcommerceManager] show_products with no products")}handleCartUpdated(t){var{product:e,action:n,cartTotal:A,cartItemCount:o}=t;if(void 0!==A&&void 0!==o){var i=this._resolveCurrency(t.currency||("₪"===this.currencySymbol?"ILS":"USD"));this.cartItemCount=o,this.cartTotal=A,this.currencySymbol=i,this.presenter.updateCart(this._buildCartInfo())}"added"===n&&e&&this.presenter.onProductAdded(e,this._buildCartInfo())}handleMessage(t){var e=t.t||t.type;"show_products"===e?this.handleShowProducts(t):"cart_updated"===e&&this.handleCartUpdated(t)}_handleProductAdd(t){var e=t.price||0,n=t.selectedAmount||1,A=this._resolveCurrency(t.currency);this.cartItemCount+=1,this.cartTotal+=e*n,this.currencySymbol=A,this.presenter.onProductAdded(t,this._buildCartInfo()),this.onProductSelected(t)}hideProducts(){this.presenter.hideProducts()}destroy(){this._presenter&&(this._presenter.destroy(),this._presenter=null)}}function bn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function yn(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xn(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function Cn(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){xn(i,A,o,r,a,"next",t)}function a(t){xn(i,A,o,r,a,"throw",t)}r(void 0)})}}class Qn extends Le{createManager(t){var{shadowRoot:e,primaryColor:n}=t;return new Bn({shadowRoot:e,primaryColor:n,onProductSelected:t=>this._handleProductSelected(t),onProductDeselected:t=>this.handleItemDeselected(t)})}getManagerHideMethod(){return"hideProducts"}buildTools(){var t,e,n,A=(null===(t=this.widget._rawConfig)||void 0===t?void 0:t.cart)||{},o=[];return A.addToCartFn&&o.push({name:"addToCart",handler:(e=Cn(function*(t){try{var e=yield A.addToCartFn(t.productId,t.quantity||1);return function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?bn(Object(n),!0).forEach(function(e){yn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({success:!0,productName:t.productName},e)}catch(t){return{success:!1,error:t.message}}}),function(t){return e.apply(this,arguments)})}),A.getCartFn&&o.push({name:"getCart",handler:(n=Cn(function*(){try{return yield A.getCartFn()}catch(t){return{items:[],total:0,count:0,error:t.message}}}),function(){return n.apply(this,arguments)})}),o}buildExtraMessageHandlers(){return{add_to_store_cart:t=>this._handleAddToStoreCart(t),get_store_cart:()=>this._handleGetStoreCart()}}_handleProductSelected(t){var e=t.selectedAmount||1;this.stopPlayback(),this.sendToVoiceSDK({t:"product_selected",productId:t.id,productName:t.name,price:t.price,quantity:e,sellBy:t.sellBy||"quantity"})}_handleGetStoreCart(){var t=this;return Cn(function*(){try{var e=yield fetch("/cart.js",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)return console.error("[EcommerceFlavor] Failed to fetch /cart.js:",e.status),void t.sendToVoiceSDK({t:"cart_state_result",success:!1,error:"Failed to fetch cart: HTTP ".concat(e.status)});var n=yield e.json();t.sendToVoiceSDK({t:"cart_state_result",success:!0,items:(n.items||[]).map(t=>({title:t.title,variant_title:t.variant_title,quantity:t.quantity,price:t.price,line_price:t.line_price,image:t.image,variant_id:t.variant_id,product_id:t.product_id})),item_count:n.item_count,total_price:n.total_price,currency:n.currency}),console.log("[EcommerceFlavor] Cart state sent: ".concat(n.item_count," items, ").concat(n.currency," ").concat((n.total_price/100).toFixed(2)))}catch(e){console.error("[EcommerceFlavor] Error fetching cart:",e),t.sendToVoiceSDK({t:"cart_state_result",success:!1,error:e.message||"Failed to fetch cart"})}})()}_handleAddToStoreCart(t){var e=this;return Cn(function*(){var{variantId:n,quantity:A}=t,o="";try{var i,r=yield fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:parseInt(n),quantity:A||1}]})});if(!r.ok){var a=yield r.text();return console.error("[EcommerceFlavor] /cart/add.js failed:",r.status,a),void e.sendToVoiceSDK({t:"cart_add_result",success:!1,error:"Cart add failed: HTTP ".concat(r.status),productName:o||String(n),quantity:A||1})}var s=yield r.json();(null===(i=s.items)||void 0===i?void 0:i.length)>0&&(o=s.items[0].title||"");var c=yield fetch("/cart.js"),l=yield c.json(),d=!1;try{d=e._refreshCartCount(l.item_count)}catch(t){console.warn("[EcommerceFlavor] Cart count refresh failed (non-critical):",t)}e.manager.handleCartUpdated({action:"added",product:{name:o,id:n},cartTotal:l.total_price/100,cartItemCount:l.item_count,currency:l.currency}),e.sendToVoiceSDK({t:"cart_add_result",success:!0,cartRefreshed:d,productName:o,quantity:A||1,cartTotal:l.total_price,cartItemCount:l.item_count,currency:l.currency}),console.log("[EcommerceFlavor] Cart add result sent: ".concat(o,", refreshed=").concat(d,", ").concat(l.item_count," items"))}catch(t){console.error("[EcommerceFlavor] Error in handleAddToStoreCart:",t),e.sendToVoiceSDK({t:"cart_add_result",success:!1,error:t.message||"Failed to add to cart",productName:o||String(n),quantity:A||1})}})()}_refreshCartCount(t){var e=!1;return[".cart-count",".cart-count-bubble","[data-cart-count]",".js-cart-count",".cart-item-count","#CartCount",".site-header__cart-count",".cart-count-tag"].forEach(n=>{document.querySelectorAll(n).forEach(n=>{n.textContent=t,e=!0})}),e}_exposeTestAPI(){var t,e=this;window.__TTP_ECOMMERCE__={handleMessage:t=>e.manager.handleMessage(t),showProducts:(t=Cn(function*(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,A=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"test",o=window.__TTP_MOCK_API__||"https://backend.talktopc.com";try{var i=yield fetch("".concat(o,"/api/partner/mock-store/products/search?q=").concat(encodeURIComponent(t),"&limit=").concat(n,"&sessionId=").concat(encodeURIComponent(A))),r=yield i.json();e.manager.handleShowProducts({t:"show_products",products:r.products,title:"".concat(r.totalCount,' results for "').concat(t,'"'),layout:r.products.length<=4?"cards":"list"})}catch(t){console.error("[EcommerceFlavor] showProducts failed:",t)}}),function(e){return t.apply(this,arguments)}),getCart:()=>({total:e.manager.cartTotal,count:e.manager.cartItemCount}),clearCart:()=>{e.manager.cartItemCount=0,e.manager.cartTotal=0,e.manager.presenter.updateCart({itemCount:0,total:0,currency:e.manager.currencySymbol})}}}destroy(){delete window.__TTP_ECOMMERCE__,super.destroy()}}function Sn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function Fn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Sn(Object(n),!0).forEach(function(e){Un(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Un(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class En{constructor(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.room=t,this.compact=e.compact||!1,this.primaryColor=e.primaryColor||"#2563eb",this.onBook=e.onBook||(()=>{}),this.element=null,this.nights=t.nights||1}render(){var t=document.createElement("div");t.className=this.compact?"ttp-product-compact":"ttp-product-card";var e=this.room,n="ILS"===e.currency?"₪":"EUR"===e.currency?"€":"$";if(this.compact)t.innerHTML='\n <div class="ttp-product-image-sm">\n <img src="'.concat(e.imageUrl,'" alt="').concat(e.name,'" onerror="this.style.display=\'none\'" />\n </div>\n <div class="ttp-product-info">\n <div class="ttp-product-name">').concat(e.name,'</div>\n <div class="ttp-product-meta">').concat(e.subtitle||"",'</div>\n </div>\n <div class="ttp-product-action">\n <div class="ttp-product-price">').concat(n).concat(e.pricePerNight,'<span class="ttp-room-per-night">/night</span></div>\n ').concat(!1!==e.available?'<button class="ttp-add-btn">Book</button>':'<span class="ttp-out-of-stock">Unavailable</span>','\n <div class="ttp-stepper" data-sell-by="nights">\n <button class="ttp-stepper-btn ttp-stepper-minus" type="button">−</button>\n <span class="ttp-stepper-value">').concat(this.nights," night").concat(1!==this.nights?"s":"",'</span>\n <button class="ttp-stepper-btn ttp-stepper-plus" type="button">+</button>\n </div>\n </div>\n ');else{var A=(e.pricePerNight*this.nights).toFixed(0),o=e.amenities||[],i=o.slice(0,3),r=o.length-3,a=i.length>0?'<div class="ttp-room-amenities">'.concat(i.map(t=>'<span class="ttp-amenity-tag">'.concat(t,"</span>")).join("")).concat(r>0?'<span class="ttp-amenity-tag ttp-amenity-more">+'.concat(r,"</span>"):"","</div>"):"";t.innerHTML='\n <div class="ttp-product-image">\n <img src="'.concat(e.imageUrl,'" alt="').concat(e.name,'" onerror="this.style.display=\'none\'" />\n ').concat(!1===e.available?'<div class="ttp-stock-badge">Unavailable</div>':"","\n ").concat(a,'\n </div>\n <div class="ttp-product-details">\n <div class="ttp-product-name">').concat(e.name,'</div>\n <div class="ttp-product-meta">').concat(n).concat(e.pricePerNight,'/night</div>\n <div class="ttp-product-footer">\n <div class="ttp-stepper" data-sell-by="nights">\n <button class="ttp-stepper-btn ttp-stepper-minus" type="button">−</button>\n <span class="ttp-stepper-value">').concat(this.nights,'n</span>\n <button class="ttp-stepper-btn ttp-stepper-plus" type="button">+</button>\n </div>\n ').concat(!1!==e.available?'<button class="ttp-add-btn">Book · '.concat(n).concat(A,"</button>"):'<span class="ttp-out-of-stock">Unavailable</span>',"\n </div>\n </div>\n ")}return this._bindEvents(t,n),this.element=t,t}_bindEvents(t,e){var n=t.querySelector(".ttp-stepper-minus"),A=t.querySelector(".ttp-stepper-plus"),o=t.querySelector(".ttp-stepper-value"),i=t.querySelector(".ttp-add-btn");n&&A&&o&&(n.addEventListener("click",t=>{t.stopPropagation(),this.nights>1&&(this.nights--,this._updateDisplay(o,n,i,e))}),A.addEventListener("click",t=>{t.stopPropagation(),this.nights<30&&(this.nights++,this._updateDisplay(o,n,i,e))}),n.disabled=this.nights<=1,n.classList.toggle("ttp-stepper-disabled",this.nights<=1)),i&&i.addEventListener("click",e=>{e.stopPropagation(),i.textContent="✓ Booked!",i.classList.add("ttp-added"),i.disabled=!0,this.onBook(t,Fn(Fn({},this.room),{},{selectedNights:this.nights}))})}_updateDisplay(t,e,n,A){if(t.textContent=this.compact?"".concat(this.nights," night").concat(1!==this.nights?"s":""):"".concat(this.nights,"n"),e.disabled=this.nights<=1,e.classList.toggle("ttp-stepper-disabled",this.nights<=1),n&&!n.disabled){var o=(this.room.pricePerNight*this.nights).toFixed(0);n.textContent="Book · ".concat(A).concat(o)}}}class kn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.primaryColor=t.primaryColor||"#2563eb",this.onRoomBook=t.onRoomBook||(()=>{}),this.onClose=t.onClose||(()=>{}),this.element=null,this._cards=[],this._resizeObserver=null}show(t,e){if(this.hide(),!t||0===t.length)return null;var n=document.createElement("div");n.className="picker-relative";var A=document.createElement("div");A.className="ttp-product-picker";var o=document.createElement("div");o.className="ttp-picker-header",o.innerHTML='\n <span class="ttp-picker-title">'.concat(e||"Available Rooms",'</span>\n <button class="ttp-picker-close" aria-label="Close">×</button>\n '),o.querySelector(".ttp-picker-close").addEventListener("click",()=>{this.hide(),this.onClose()}),A.appendChild(o);var i=document.createElement("div");return i.className="ttp-products-horizontal",this._cards=[],t.forEach(t=>{var e=new En(t,{compact:!1,primaryColor:this.primaryColor,onBook:(t,e)=>this.onRoomBook(t,e)});i.appendChild(e.render()),this._cards.push(e)}),A.appendChild(i),n.appendChild(A),this.element=n,t.length>0&&(this._resizeObserver=new ResizeObserver(e=>{for(var n of e){var A=n.target.clientWidth;A>0&&(this._layoutCards(i,A,t.length),this._resizeObserver.disconnect(),this._resizeObserver=null)}}),this._resizeObserver.observe(i)),n}_layoutCards(t,e,n){var A=t.querySelectorAll(".ttp-product-card");if(A.length){var o,i=getComputedStyle(t),r=parseFloat(i.paddingLeft)||12,a=parseFloat(i.paddingRight)||12,s=parseFloat(i.gap)||10,c=e-r-a;o=1===n?c:2===n?Math.floor((c-s)/2):Math.floor((c-s-28)/2),o=Math.max(o,120),A.forEach(t=>{t.style.setProperty("width","".concat(o,"px"),"important")})}}hide(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this._cards=[]}destroy(){this.hide()}}class In{constructor(){this.element=null,this.booking=null}render(){var t=document.createElement("div");return t.className="ttp-booking-summary ttp-booking-empty",t.style.display="none",t.innerHTML='\n <div class="ttp-booking-info">\n <span class="ttp-booking-icon">🏨</span>\n <span class="ttp-booking-room">No booking</span>\n <span class="ttp-booking-sep">·</span>\n <span class="ttp-booking-stay"></span>\n <span class="ttp-booking-sep">·</span>\n <span class="ttp-booking-total"></span>\n </div>\n ',this.element=t,t}update(t){if(this.booking=t,this.element){if(!t||!t.roomName)return this.element.style.setProperty("display","none","important"),void this.element.classList.add("ttp-booking-empty");this.element.style.setProperty("display","flex","important"),this.element.classList.remove("ttp-booking-empty");var e="ILS"===t.currency?"₪":"EUR"===t.currency?"€":"$",n=t.nights||1,A=t.guests||1,o=t.totalPrice||t.pricePerNight*n;this.element.querySelector(".ttp-booking-room").textContent=t.roomName,this.element.querySelector(".ttp-booking-stay").textContent="".concat(n," night").concat(1!==n?"s":""," · ").concat(A," guest").concat(1!==A?"s":""),this.element.querySelector(".ttp-booking-total").textContent="".concat(e).concat(o.toFixed(0))}}hide(){this.element&&(this.element.style.setProperty("display","none","important"),this.element.classList.add("ttp-booking-empty")),this.booking=null}static generateCSS(){return"\n/* ═══════════════════════════════════════\n BOOKING SUMMARY\n ═══════════════════════════════════════ */\n\n.ttp-booking-summary {\n display: flex;\n align-items: center;\n padding: 10px 14px;\n background: rgba(109,86,245,0.08);\n border: 1px solid rgba(109,86,245,0.15);\n border-radius: 10px;\n margin: 6px 8px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.ttp-booking-info {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: rgba(255,255,255,0.7);\n font-weight: 500;\n flex-wrap: wrap;\n}\n\n.ttp-booking-icon {\n font-size: 14px;\n flex-shrink: 0;\n}\n\n.ttp-booking-room {\n font-weight: 600;\n color: #e8e4f0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 120px;\n}\n\n.ttp-booking-sep {\n color: rgba(255,255,255,0.2);\n}\n\n.ttp-booking-stay {\n white-space: nowrap;\n color: rgba(255,255,255,0.5);\n}\n\n.ttp-booking-total {\n font-weight: 700;\n color: #a78bfa;\n}\n\n.ttp-booking-empty {\n display: none !important;\n}\n"}}class Tn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.shadowRoot=t.shadowRoot,this.primaryColor=t.primaryColor||"#2563eb",this.onRoomBook=t.onRoomBook||(()=>{}),this.picker=new kn({primaryColor:this.primaryColor,onRoomBook:(t,e)=>this._handleRoomBook(t,e),onClose:()=>this._handlePickerClose()}),this.bookingSummary=new In,this.flyToCart=new sn({getCartTarget:()=>this._getFlyTarget(),onCartBump:()=>{},onRipple:()=>{}}),this.container=document.createElement("div"),this.container.id="ttpHotelsArea",this.container.className="ttp-hotels-area",this._toastEl=null,this._toastTimer=null,this.voiceActiveState=null,this.isAttached=!1,this._activatedByPresenter=!1}_getFlyTarget(){if(this.bookingSummary.element){var t=this.bookingSummary.element.getBoundingClientRect();if(t.width>0&&t.height>0)return this.bookingSummary.element}return this.container}_handleRoomBook(t,e){var n;this.flyToCart.isAnimating||(null===(n=this.picker.element)||void 0===n||n.classList.add("ttp-products-animating"),this.flyToCart.triggerFly(t,e,()=>{var t;null===(t=this.picker.element)||void 0===t||t.classList.remove("ttp-products-animating"),this.onRoomBook(e),this._showBookedToast(e)},{preferClone:!1}))}_showBookedToast(t){var e;this._dismissToast(!0),this.picker.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this._setContainerMode("summary");var n=document.createElement("div");n.className="ttp-cart-toast",n.innerHTML='\n <div class="ttp-toast-icon">✓</div>\n <div class="ttp-toast-content">\n <div class="ttp-toast-title">Room booked!</div>\n <div class="ttp-toast-product">'.concat(t.name,"</div>\n </div>\n ");var A=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".ttp-controls");A?A.parentNode.insertBefore(n,A):this.voiceActiveState&&this.voiceActiveState.appendChild(n),this._toastEl=n,this._toastTimer=setTimeout(()=>this._dismissToast(),3e3)}_dismissToast(){var t;if(this._toastTimer&&(clearTimeout(this._toastTimer),this._toastTimer=null),null!==(t=this._toastEl)&&void 0!==t&&t.parentNode){this._toastEl.classList.add("ttp-toast-hiding");var e=this._toastEl;this._toastEl=null,setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},300)}}showRooms(t,e){this._ensureReady(),this._ensureActiveStateVisible(),this._switchToCompactMode(),this._setContainerMode("rooms"),this.picker.hide();var n=this.picker.show(t,e);n&&this.container.insertBefore(n,this.container.firstChild),this._expandPanelToFit(t.length)}hideRooms(){this.picker.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this._setContainerMode("summary"),this._restoreIdleStateIfNeeded()}updateBooking(t){this._ensureReady(),t&&this.bookingSummary.update(t)}destroy(){var t,e;this.flyToCart&&this.flyToCart.destroy(),this._dismissToast(!0),this.picker.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-rooms-visible"),null!==(t=this.bookingSummary.element)&&void 0!==t&&t.parentNode&&this.bookingSummary.element.parentNode.removeChild(this.bookingSummary.element),null!==(e=this.container)&&void 0!==e&&e.parentNode&&this.container.parentNode.removeChild(this.container),this.isAttached=!1}_ensureReady(){this.isAttached||(this._injectStyles(),this._attachToDOM())}_injectStyles(){if(this.shadowRoot&&!this.shadowRoot.querySelector("[data-ttp-hotels]")){var t=document.createElement("style");t.setAttribute("data-ttp-hotels",""),t.textContent='\n\n/* ═══════════════════════════════════════\n ECOMMERCE AREA\n ═══════════════════════════════════════ */\n\n\n/*\n * When products are visible, expand the panel dynamically.\n * Actual height is set via inline style by EcommerceManager._expandPanelToFit().\n * When the class is removed, the panel returns to its CSS-defined default.\n */\n#text-chat-panel.ttp-panel-expanded {\n transition: height 0.25s ease;\n}\n\n/*\n * Layout overrides ONLY when ecommerce/hotels overlay is active.\n * Scoped under .ttp-products-visible / .ttp-rooms-visible so the\n * normal voice CSS takes effect when products/rooms are hidden.\n *\n * voiceActiveState is a flex column: [voice-controls] [ecommerce] [conversation].\n * Ecommerce area fills the middle and scrolls; conversation panel stays at bottom.\n */\n#voiceActiveState.ttp-products-visible,\n#voiceActiveState.ttp-rooms-visible {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow: hidden !important;\n}\n\n.ttp-products-visible > .desktop-voice-section,\n.ttp-rooms-visible > .desktop-voice-section {\n flex-shrink: 1 !important;\n}\n\n/* Conversation + input always stick to bottom; ecommerce area above grows to fill. */\n.ttp-products-visible > .desktop-conversation-panel,\n.ttp-rooms-visible > .desktop-conversation-panel {\n flex: 0 0 auto !important;\n margin-top: auto !important;\n display: flex !important;\n flex-direction: column !important;\n}\n\n.ttp-products-visible .desktop-conversation-panel .live-transcript-collapsed,\n.ttp-rooms-visible .desktop-conversation-panel .live-transcript-collapsed {\n flex: 0 0 auto !important;\n min-height: 40px !important;\n overflow: hidden !important;\n}\n\n.ttp-products-visible .desktop-conversation-panel .voice-text-input-area,\n.ttp-rooms-visible .desktop-conversation-panel .voice-text-input-area {\n margin-top: auto !important;\n padding: 3px 16px !important;\n}\n\n.ttp-products-visible .desktop-conversation-panel .voice-input-hint,\n.ttp-rooms-visible .desktop-conversation-panel .voice-input-hint {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-voice-section {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .compact-voice-section {\n display: flex !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-conversation-panel {\n flex: 0 0 auto !important;\n}\n\n#voiceActiveState.ttp-products-visible .conversation-history {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .live-transcript-collapsed {\n flex: 0 0 auto !important;\n}\n\n.voice-text-input-area {\n flex-shrink: 0 !important;\n}\n\n.ttp-products-visible .conversation-history,\n.ttp-rooms-visible .conversation-history {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow-y: auto !important;\n}\n\n.ttp-ecommerce-area {\n display: flex !important;\n flex-direction: column !important;\n width: 100%;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n position: relative !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT PICKER\n ═══════════════════════════════════════ */\n\n.ttp-product-picker {\n background: rgba(255,255,255,0.04);\n border-radius: 14px;\n border: 1px solid rgba(255,255,255,0.08);\n box-shadow: none;\n margin: 8px 10px;\n overflow-x: hidden !important;\n overflow-y: auto !important;\n animation: ttpSlideUp 0.25s ease;\n display: flex !important;\n flex-direction: column;\n flex: 1;\n min-height: 0 !important;\n}\n\n@keyframes ttpSlideUp {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n.ttp-picker-header {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 10px 14px;\n border-bottom: 1px solid rgba(255,255,255,0.06);\n flex-shrink: 0;\n}\n\n.ttp-picker-title {\n font-size: 12px;\n font-weight: 600;\n color: rgba(255,255,255,0.5);\n}\n\n.ttp-picker-close {\n background: none;\n border: none;\n cursor: pointer;\n color: rgba(255,255,255,0.4);\n font-size: 14px;\n padding: 2px 6px;\n border-radius: 4px;\n}\n.ttp-picker-close:hover {\n background: rgba(255,255,255,0.08);\n color: rgba(255,255,255,0.7);\n}\n\n/* Horizontal card layout */\n.ttp-products-horizontal {\n display: flex !important;\n align-items: flex-start;\n flex-shrink: 0;\n gap: 10px;\n padding: 12px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: thin;\n}\n.ttp-products-horizontal::-webkit-scrollbar { height: 4px; }\n.ttp-products-horizontal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }\n.ttp-products-horizontal::-webkit-scrollbar-track { background: transparent; }\n\n/* Vertical list layout */\n.ttp-products-vertical {\n padding: 8px 12px;\n overflow-y: auto !important;\n display: flex !important;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n min-height: 0 !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT CARD (horizontal)\n ═══════════════════════════════════════ */\n\n.ttp-product-card {\n width: 170px !important;\n flex-shrink: 0 !important;\n background: rgba(255,255,255,0.04);\n border-radius: 12px;\n border: 1px solid rgba(255,255,255,0.08);\n overflow: hidden;\n transition: border-color 0.15s;\n}\n.ttp-product-card:hover { border-color: rgba(109,86,245,0.5); }\n\n.ttp-product-image {\n height: 110px !important;\n background: rgba(0,0,0,0.2);\n display: flex !important;\n align-items: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n}\n.ttp-product-image img {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n object-fit: contain !important;\n display: block !important;\n}\n\n.ttp-stock-badge {\n position: absolute;\n top: 6px; right: 6px;\n background: rgba(239,68,68,0.15);\n color: #ef4444;\n font-size: 9px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n}\n\n.ttp-product-details {\n padding: 10px 12px 14px;\n}\n\n.ttp-product-name {\n font-size: 13px;\n font-weight: 600;\n color: #e8e4f0;\n line-height: 1.3;\n min-height: 30px;\n}\n\n.ttp-product-page-link {\n display: inline-flex;\n align-items: center;\n margin-left: 5px;\n font-size: 10px;\n color: #a78bfa;\n text-decoration: none;\n opacity: 0.7;\n vertical-align: middle;\n}\n.ttp-product-page-link:hover { opacity: 1; text-decoration: underline; }\n\n.ttp-product-meta {\n font-size: 10px;\n color: rgba(255,255,255,0.35);\n margin-top: 2px;\n}\n\n.ttp-product-footer {\n display: flex !important;\n align-items: center;\n justify-content: space-between;\n margin-top: 6px;\n}\n\n.ttp-product-price {\n font-size: 14px;\n font-weight: 700;\n color: #e8e4f0;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT COMPACT (list view)\n ═══════════════════════════════════════ */\n\n.ttp-product-compact {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n background: rgba(255,255,255,0.04);\n border-radius: 10px;\n border: 1px solid rgba(255,255,255,0.08);\n transition: border-color 0.15s;\n}\n.ttp-product-compact:hover { border-color: rgba(109,86,245,0.5); }\n\n.ttp-product-image-sm {\n width: 72px !important; height: 72px !important;\n border-radius: 10px;\n background: rgba(0,0,0,0.2);\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n}\n.ttp-product-image-sm img {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n object-fit: contain !important;\n display: block !important;\n}\n\n.ttp-product-compact .ttp-product-info {\n flex: 1;\n min-width: 0;\n}\n.ttp-product-compact .ttp-product-name {\n min-height: auto;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: #e8e4f0;\n}\n.ttp-product-compact .ttp-product-action {\n text-align: right;\n flex-shrink: 0 !important;\n}\n.ttp-product-compact .ttp-product-price {\n font-size: 13px;\n}\n\n.ttp-out-of-stock {\n font-size: 10px;\n color: #f87171;\n font-weight: 500;\n}\n\n/* ═══════════════════════════════════════\n ADD BUTTON\n ═══════════════════════════════════════ */\n\n.ttp-add-btn {\n padding: 6px 14px;\n border-radius: 8px;\n border: 1.5px solid rgba(109,86,245,0.6);\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n background: transparent;\n color: #a78bfa;\n transition: all 0.15s;\n}\n.ttp-add-btn:hover { background: rgba(109,86,245,0.15); border-color: #a78bfa; }\n.ttp-add-btn:active { transform: scale(0.95); }\n.ttp-add-btn.ttp-added { background: rgba(109,86,245,0.6) !important; border-color: #7c3aed !important; color: #fff !important; }\n.ttp-add-btn:disabled { cursor: default; opacity: 0.5; }\n.ttp-add-btn.ttp-update-btn { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.5); color: #fbbf24; }\n.ttp-add-btn.ttp-update-btn:hover { background: rgba(245,158,11,0.25); border-color: #fbbf24; }\n\n.ttp-products-animating .ttp-add-btn {\n opacity: 0.4;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n/* ═══════════════════════════════════════\n CART TOAST\n ═══════════════════════════════════════ */\n\n/* Toast replaces waveform in desktop voice section */\n.ttp-cart-toast {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n margin: 8px 12px;\n background: rgba(16,185,129,0.1);\n border-radius: 12px;\n border: 1px solid rgba(16,185,129,0.2);\n animation: ttpToastIn 0.25s ease;\n flex-shrink: 0;\n box-shadow: none;\n}\n\n@keyframes ttpToastIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n.ttp-cart-toast.ttp-toast-hiding {\n animation: ttpSlideDown 0.3s ease forwards;\n}\n\n@keyframes ttpSlideDown {\n to { opacity: 0; transform: translateY(-8px); height: 0; padding: 0; margin: 0; overflow: hidden; }\n}\n\n.ttp-toast-icon {\n width: 24px !important; height: 24px !important;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex !important;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: 700;\n flex-shrink: 0;\n}\n\n.ttp-toast-content { flex: 1; min-width: 0; }\n.ttp-toast-title { font-size: 12px; font-weight: 600; color: #34d399; }\n.ttp-toast-product {\n font-size: 11px;\n color: rgba(52,211,153,0.7);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-toast-undo {\n background: none;\n border: 1px solid rgba(52,211,153,0.3);\n border-radius: 6px;\n padding: 3px 8px;\n font-size: 10px;\n color: #34d399;\n cursor: pointer;\n font-weight: 600;\n flex-shrink: 0;\n}\n.ttp-toast-undo:hover { background: rgba(52,211,153,0.1); }\n\n/* Fly-to-cart desktop target (when cart summary is hidden) */\n.ttp-desktop-fly-target {\n position: absolute;\n bottom: 12px;\n right: 80px;\n width: 24px;\n height: 24px;\n pointer-events: none;\n}\n\n/* Fly-to-cart ripple effect */\n.ttp-fly-ripple {\n position: absolute;\n left: 10px;\n top: 50%;\n width: 30px;\n height: 30px;\n margin-top: -15px;\n border-radius: 50%;\n border: 2px solid rgba(74,222,128,0.7);\n animation: ttp-ripple-expand 0.6s ease-out forwards;\n pointer-events: none;\n}\n\n@keyframes ttp-ripple-expand {\n 0% { transform: scale(0.5); opacity: 0.8; }\n 100% { transform: scale(3); opacity: 0; }\n}\n\n/* ═══════════════════════════════════════\n CART SUMMARY BAR\n ═══════════════════════════════════════ */\n\n.ttp-cart-summary {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 8px 14px;\n margin: 4px 12px 0;\n margin-right: 20px;\n margin-top: auto !important;\n flex-shrink: 0 !important;\n background: rgba(255,255,255,0.04);\n border-radius: 12px;\n border: 1px solid rgba(255,255,255,0.08);\n}\n\n/* Hide cart when empty — overrides display:flex !important */\n.ttp-cart-summary.ttp-cart-empty {\n display: none !important;\n}\n\n/* Desktop: cart below input (fallback when input area not found) */\n.ttp-cart-summary-bottom {\n margin-top: 0 !important;\n margin: 8px 12px 12px !important;\n flex-shrink: 0 !important;\n}\n\n/* Desktop: cart inside input area — unified section (like mobile) */\n.ttp-cart-summary-inline {\n margin: 0 !important;\n padding: 0 !important;\n padding-top: 8px !important;\n flex-shrink: 0 !important;\n background: transparent !important;\n border: none !important;\n border-top: 1px solid rgba(255, 255, 255, 0.06) !important;\n border-radius: 0 !important;\n width: 100% !important;\n flex-basis: 100% !important;\n}\n\n.ttp-cart-info {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.ttp-cart-icon { font-size: 14px; }\n.ttp-cart-count { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.6); }\n.ttp-cart-separator { font-size: 12px; color: rgba(255,255,255,0.25); }\n.ttp-cart-total { font-size: 13px; font-weight: 700; color: #e8e4f0; }\n.ttp-cart-view {\n font-size: 12px;\n font-weight: 600;\n color: #a78bfa;\n text-decoration: none;\n cursor: pointer;\n white-space: nowrap;\n}\n.ttp-cart-view:hover {\n color: #c4b5fd;\n text-decoration: underline;\n}\n\n/* ═══════════════════════════════════════\n QUANTITY/WEIGHT STEPPER\n ═══════════════════════════════════════ */\n\n.ttp-stepper {\n display: flex !important;\n align-items: center;\n gap: 2px;\n margin: 4px 0;\n}\n\n.ttp-stepper-btn {\n width: 24px !important;\n height: 24px !important;\n border-radius: 6px;\n border: 1px solid rgba(255,255,255,0.15);\n background: rgba(255,255,255,0.06);\n color: rgba(255,255,255,0.6);\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n display: flex !important;\n align-items: center;\n justify-content: center;\n padding: 0;\n line-height: 1;\n transition: all 0.15s;\n flex-shrink: 0;\n}\n\n.ttp-stepper-btn:hover:not(:disabled) {\n background: rgba(255,255,255,0.12);\n border-color: rgba(255,255,255,0.25);\n}\n\n.ttp-stepper-btn:active:not(:disabled) {\n transform: scale(0.9);\n}\n\n.ttp-stepper-btn:disabled,\n.ttp-stepper-disabled {\n opacity: 0.35;\n cursor: default;\n}\n\n.ttp-stepper-value {\n font-size: 12px;\n font-weight: 600;\n color: #e8e4f0;\n min-width: 36px;\n text-align: center;\n user-select: none;\n}\n\n.ttp-product-compact .ttp-stepper {\n justify-content: flex-end;\n}\n\n.ttp-product-compact .ttp-product-action {\n display: flex !important;\n flex-direction: column;\n align-items: flex-end;\n gap: 2px;\n}\n\n.ttp-product-card .ttp-stepper {\n justify-content: center;\n margin: 4px 0;\n}\n\n.ttp-product-card .ttp-product-footer {\n display: flex !important;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n/* ═══════════════════════════════════════\n VARIATION DESKTOP PICKER\n ═══════════════════════════════════════ */\n\n.picker-relative {\n position: relative !important;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n display: flex !important;\n flex-direction: column !important;\n overflow: hidden;\n}\n\n/* When variant picker is shown, center it horizontally and vertically */\n.picker-relative.ttp-var-picker-active {\n justify-content: center !important;\n align-items: center !important;\n}\n\n.ttp-var-picker {\n background: rgba(255,255,255,0.04);\n border-radius: 14px;\n border: 1px solid rgba(255,255,255,0.08);\n display: flex !important;\n flex-direction: column;\n animation: ttpVarFadeIn 0.2s ease;\n overflow: hidden;\n width: 100%;\n flex-shrink: 0 !important;\n}\n\n@keyframes ttpVarFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.ttp-var-header {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n border-bottom: 1px solid rgba(255,255,255,0.06);\n flex-shrink: 0;\n}\n\n.ttp-var-back-btn {\n background: none;\n border: none;\n cursor: pointer;\n color: rgba(255,255,255,0.5);\n font-size: 16px;\n padding: 0;\n display: flex;\n align-items: center;\n line-height: 1;\n font-family: inherit;\n}\n.ttp-var-back-btn:hover { color: #e8e4f0; }\n\n.ttp-var-title {\n font-size: 13px;\n font-weight: 700;\n color: #e8e4f0;\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-var-page-link {\n font-size: 11px;\n color: #a78bfa;\n text-decoration: none;\n font-weight: 500;\n white-space: nowrap;\n flex-shrink: 0;\n}\n.ttp-var-page-link:hover { text-decoration: underline; }\n\n.ttp-var-body {\n flex: 1;\n overflow-y: auto;\n padding: 12px 14px;\n display: flex !important;\n flex-direction: column;\n gap: 14px;\n}\n\n.ttp-var-preview {\n display: flex !important;\n gap: 12px;\n align-items: flex-start;\n}\n\n.ttp-var-preview-img {\n width: 72px !important;\n height: 72px !important;\n border-radius: 12px;\n background: rgba(0,0,0,0.2);\n border: 1px solid rgba(255,255,255,0.08);\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n transition: all 0.2s ease;\n}\n\n.ttp-var-preview-img img {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n object-fit: contain !important;\n display: block !important;\n padding: 6px;\n}\n\n.ttp-var-preview-info { flex: 1; min-width: 0; }\n\n.ttp-var-preview-brand {\n font-size: 10px;\n color: rgba(255,255,255,0.4);\n font-weight: 500;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n\n.ttp-var-preview-name {\n font-size: 14px;\n font-weight: 700;\n color: #e8e4f0;\n margin: 2px 0 4px;\n line-height: 1.2;\n}\n\n.ttp-var-preview-price {\n font-size: 18px;\n font-weight: 700;\n color: #7c3aed;\n}\n\n.ttp-var-preview-selected {\n font-size: 11px;\n color: rgba(255,255,255,0.4);\n margin-top: 3px;\n}\n\n.ttp-var-section { display: flex !important; flex-direction: column; gap: 8px; }\n\n.ttp-var-section-label {\n font-size: 11px;\n font-weight: 700;\n color: rgba(255,255,255,0.5);\n text-transform: uppercase;\n letter-spacing: 0.4px;\n}\n\n.ttp-var-swatches { display: flex !important; flex-wrap: wrap; gap: 8px; }\n\n.ttp-var-swatch {\n display: block !important;\n width: 28px !important;\n height: 28px !important;\n border-radius: 50%;\n cursor: pointer;\n border: 3px solid transparent;\n transition: all 0.15s;\n position: relative;\n flex-shrink: 0;\n}\n.ttp-var-swatch:hover { transform: scale(1.1); }\n.ttp-var-swatch.selected {\n border-color: #7c3aed;\n box-shadow: 0 0 0 2px #fff, 0 0 0 4px #7c3aed;\n}\n.ttp-var-swatch.oos {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.ttp-var-pills { display: flex !important; flex-wrap: wrap; gap: 6px; }\n\n.ttp-var-pill {\n padding: 5px 12px;\n border-radius: 8px;\n border: 1.5px solid rgba(255,255,255,0.15);\n background: rgba(255,255,255,0.04);\n font-size: 12px;\n font-weight: 600;\n color: rgba(255,255,255,0.6);\n cursor: pointer;\n transition: all 0.15s;\n font-family: inherit;\n}\n.ttp-var-pill:hover:not(:disabled) { border-color: #7c3aed; color: #a78bfa; }\n.ttp-var-pill.selected { border-color: #7c3aed; background: #7c3aed; color: #fff; }\n.ttp-var-pill.oos { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }\n\n.ttp-var-footer {\n padding: 10px 14px 12px;\n border-top: 1px solid rgba(255,255,255,0.06);\n flex-shrink: 0;\n}\n\n.ttp-var-add-btn {\n width: 100%;\n padding: 10px;\n background: linear-gradient(135deg, #7c3aed, #6d28d9);\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n box-shadow: 0 3px 10px rgba(124,58,237,0.3);\n transition: all 0.15s;\n}\n.ttp-var-add-btn:hover:not(:disabled) { transform: scale(0.99); }\n.ttp-var-add-btn:disabled {\n background: rgba(255,255,255,0.1);\n box-shadow: none;\n cursor: not-allowed;\n color: rgba(255,255,255,0.3);\n}\n\n.ttp-var-spinner {\n width: 24px;\n height: 24px;\n border: 3px solid rgba(255,255,255,0.1);\n border-top-color: #7c3aed;\n border-radius: 50%;\n animation: ttpVarSpin 0.7s linear infinite;\n}\n@keyframes ttpVarSpin {\n to { transform: rotate(360deg); }\n}\n\n/* Amber "Choose" button for variant products */\n.ttp-add-btn.ttp-choose-btn {\n background: linear-gradient(135deg, #f59e0b, #d97706);\n box-shadow: 0 2px 8px rgba(245,158,11,0.3);\n color: #fff;\n}\n\n \n\n/* ═══════════════════════════════════════\n HOTELS-SPECIFIC OVERRIDES\n ═══════════════════════════════════════ */\n\n/* Hotels area mirrors ecommerce area */\n.ttp-hotels-area {\n display: flex !important;\n flex-direction: column !important;\n width: 100%;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n position: relative !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n/* Scroll snap for horizontal room cards */\n.ttp-hotels-area .ttp-products-horizontal {\n scroll-snap-type: x proximity;\n scroll-behavior: smooth;\n}\n.ttp-hotels-area .ttp-product-card {\n scroll-snap-align: start;\n}\n\n/* Room-specific layout classes */\n#voiceActiveState.ttp-rooms-visible .desktop-voice-section {\n display: none !important;\n}\n#voiceActiveState.ttp-rooms-visible .compact-voice-section {\n display: flex !important;\n}\n#voiceActiveState.ttp-rooms-visible .desktop-conversation-panel {\n flex: 0 0 auto !important;\n}\n#voiceActiveState.ttp-rooms-visible .conversation-history {\n display: none !important;\n}\n#voiceActiveState.ttp-rooms-visible .live-transcript-collapsed {\n flex: 0 0 auto !important;\n}\n\n/* Amenity tags overlaid on room image */\n.ttp-room-amenities {\n position: absolute;\n bottom: 6px;\n left: 6px;\n right: 6px;\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n}\n\n.ttp-amenity-tag {\n font-size: 9px;\n font-weight: 600;\n padding: 2px 7px;\n border-radius: 4px;\n background: rgba(0,0,0,0.55);\n color: rgba(255,255,255,0.85);\n backdrop-filter: blur(4px);\n -webkit-backdrop-filter: blur(4px);\n}\n\n.ttp-amenity-more {\n color: rgba(255,255,255,0.5);\n}\n\n/* Per-night price styling */\n.ttp-room-per-night {\n font-size: 10px;\n color: rgba(255,255,255,0.35);\n font-weight: 400;\n}\n\n/* Booking summary bar */\n.ttp-booking-summary-inline {\n margin: 0 !important;\n padding: 0 !important;\n padding-top: 8px !important;\n flex-shrink: 0 !important;\n background: transparent !important;\n border: none !important;\n border-top: 1px solid rgba(255,255,255,0.06) !important;\n border-radius: 0 !important;\n width: 100% !important;\n flex-basis: 100% !important;\n}\n\n.ttp-booking-summary {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 8px 14px;\n flex-shrink: 0 !important;\n}\n\n.ttp-booking-summary.ttp-booking-empty {\n display: none !important;\n}\n\n.ttp-booking-info {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: rgba(255,255,255,0.6);\n}\n\n.ttp-booking-total {\n font-size: 13px;\n font-weight: 700;\n color: #e8e4f0;\n}\n\n ',this.shadowRoot.appendChild(t)}}_attachToDOM(){if(!this.isAttached&&this.shadowRoot)if(this.voiceActiveState=this.shadowRoot.getElementById("voiceActiveState"),this.voiceActiveState)if(this.shadowRoot.getElementById("ttpHotelsArea"))this.isAttached=!0;else{var t=this.voiceActiveState.querySelector(".compact-voice-section"),e=this.voiceActiveState.querySelector(".desktop-voice-section"),n=t||e;null!=n&&n.nextSibling?this.voiceActiveState.insertBefore(this.container,n.nextSibling):this.voiceActiveState.appendChild(this.container);var A=this.voiceActiveState.querySelector(".voice-text-input-area");if(A){var o=this.bookingSummary.render();o.classList.add("ttp-booking-summary-inline"),A.appendChild(o)}this.isAttached=!0}else console.warn("[HotelsDesktopPresenter] #voiceActiveState not found")}_setContainerMode(t){"rooms"===t?(this.container.style.flex="1 1 0",this.container.style.minHeight="0",this.container.style.overflowY="auto",this.voiceActiveState&&this.voiceActiveState.classList.add("ttp-rooms-visible")):(this.container.style.flex="0 0 auto",this.container.style.minHeight="",this.container.style.overflowY="",this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-rooms-visible"))}_expandPanelToFit(t){if(this.shadowRoot){var e=this.shadowRoot.getElementById("text-chat-panel");e&&(e.classList.add("ttp-panel-expanded"),requestAnimationFrame(()=>{var t,n,A,o,i=null===(t=this.voiceActiveState)||void 0===t?void 0:t.querySelector(".compact-voice-section"),r=null===(n=this.container)||void 0===n?void 0:n.querySelector(".ttp-product-picker"),a=null===(A=this.voiceActiveState)||void 0===A?void 0:A.querySelector(".desktop-conversation-panel"),s=null===(o=this.voiceActiveState)||void 0===o?void 0:o.querySelector(".voice-text-input-area"),c=0;i&&(c+=i.offsetHeight),r&&(c+=r.scrollHeight+18),a&&(c+=Math.min(a.offsetHeight,100)),s&&(c+=s.offsetHeight),c+=60;var l=Math.min(800,Math.floor(.9*window.innerHeight)),d=Math.min(Math.max(c,380),l);e.style.height="".concat(d,"px")}))}}_shrinkPanel(){if(this.shadowRoot){var t=this.shadowRoot.getElementById("text-chat-panel");t&&(t.classList.remove("ttp-panel-expanded"),t.style.height="")}}_switchToCompactMode(){if(this.shadowRoot){var t=this.shadowRoot.getElementById("desktopVoiceSection"),e=this.shadowRoot.getElementById("compactVoiceSection");t&&(t.style.display="none"),e&&(e.style.display="flex")}}_restoreFullVoiceMode(){if(this.shadowRoot){var t=this.shadowRoot.getElementById("desktopVoiceSection"),e=this.shadowRoot.getElementById("compactVoiceSection");t&&e&&(t.style.display="",e.style.display="none")}}_ensureActiveStateVisible(){if(this.shadowRoot){var t=this.shadowRoot.getElementById("text-chat-panel");t&&!t.classList.contains("open")&&t.classList.add("open");var e=this.shadowRoot.getElementById("landingScreen");e&&e.classList.remove("active");var n=this.shadowRoot.getElementById("textInterface");n&&n.classList.remove("active");var A=this.shadowRoot.getElementById("voiceInterface");A&&!A.classList.contains("active")&&A.classList.add("active");var o=this.shadowRoot.getElementById("voiceActiveState");if(o&&("none"===o.style.display||"none"===getComputedStyle(o).display)){var i=this.shadowRoot.getElementById("voiceIdleState");i&&(i.style.display="none"),o.style.display="flex",this._activatedByPresenter=!0}}}_restoreIdleStateIfNeeded(){if(this._activatedByPresenter&&this.shadowRoot){var t=this.shadowRoot.getElementById("voiceActiveState"),e=this.shadowRoot.getElementById("voiceIdleState");t&&(t.style.display="none"),e&&(e.style.display="flex"),this._activatedByPresenter=!1}}_handlePickerClose(){this.hideRooms()}}function Hn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function _n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Hn(Object(n),!0).forEach(function(e){Dn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Dn(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Mn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onRoomBook=t.onRoomBook||(()=>{}),this.onClose=t.onClose||(()=>{}),this.primaryColor=t.primaryColor||"#2563eb",this.rooms=[],this.current=0,this.nights=[],this.container=null,this.wheel=null,this.dotsEl=null,this.anglePerCard=42,this.radius=240,this.dragging=!1,this.startX=0,this.swiped=!1,this.dragThreshold=40,this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._boundMouseMove=this._onMouseMove.bind(this),this._boundMouseUp=this._onMouseUp.bind(this)}show(t,e){this.hide(),t&&0!==t.length&&(this._normalizeRooms(t),this.current=0,this._injectStyles(),this._buildDOM(e),this._buildCards(),this._buildDots(),this._setupDragEvents(),this._updateWheel(),document.body.appendChild(this.container),this._positionAboveMobileBar())}hide(){var t;if(this._removeEventListeners(),null!==(t=this.container)&&void 0!==t&&t.parentNode){this.container.classList.add("ttp-carousel--hiding");var e=this.container;setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},280)}this.container=null,this.wheel=null,this.dotsEl=null}destroy(){var t;this._removeEventListeners(),null!==(t=this.container)&&void 0!==t&&t.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null;var e=document.getElementById("ttpHotelCarouselToast");e&&e.remove();var n=document.getElementById("ttp-hotel-carousel-styles");n&&n.remove()}showToast(t){var e=document.getElementById("ttpHotelCarouselToast");e&&e.remove();var n=document.createElement("div");n.id="ttpHotelCarouselToast",n.className="ttp-carousel-toast",n.innerHTML='\n <div class="ttp-carousel-toast__icon">✓</div>\n <div class="ttp-carousel-toast__text">\n <strong>'.concat(t,"</strong> booked!\n </div>\n "),document.body.appendChild(n);var A=document.getElementById("mobile-voice-call-bar-container");n.style.bottom=A?"".concat(A.offsetHeight+12,"px"):"100px",setTimeout(()=>{n.classList.add("ttp-carousel-toast--hiding"),setTimeout(()=>n.remove(),300)},3e3)}_normalizeRooms(t){this.rooms=t.map(t=>_n(_n({},t),{},{imageUrl:t.imageUrl||t.image_url||"",available:void 0===t.available||t.available,pricePerNight:t.pricePerNight||t.price_per_night||t.price||0,currency:t.currency||"USD",name:t.name||t.roomName||"Room"})),this.nights=this.rooms.map(t=>t.nights||1)}_buildDOM(t){this.container=document.createElement("div"),this.container.className="ttp-mobile-carousel",this.container.id="ttpHotelMobileCarousel",this.container.style.setProperty("--ttp-carousel-primary",this.primaryColor),this.container.style.setProperty("--ttp-carousel-primary-light",this._hexToRgba(this.primaryColor,.12)),this.container.style.setProperty("--ttp-carousel-primary-dark",this._darkenHex(this.primaryColor,30)),this.container.style.setProperty("--ttp-carousel-primary-shadow",this._hexToRgba(this.primaryColor,.3));var e=document.createElement("div");e.className="ttp-carousel-header",e.innerHTML='\n <span class="ttp-carousel-title">'.concat(t||"Available Rooms",'</span>\n <button class="ttp-carousel-close" aria-label="Close">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">\n <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>\n </svg>\n </button>\n '),e.querySelector(".ttp-carousel-close").addEventListener("click",()=>{this.hide(),this.onClose()});var n=document.createElement("div");n.className="ttp-carousel-area",this.wheel=document.createElement("div"),this.wheel.className="ttp-carousel-wheel",n.appendChild(this.wheel),this.dotsEl=document.createElement("div"),this.dotsEl.className="ttp-carousel-dots",this.container.appendChild(e),this.container.appendChild(n),this.container.appendChild(this.dotsEl)}_buildCards(){this.rooms.forEach((t,e)=>{var n=document.createElement("div");n.className="ttp-carousel-card"+(t.available?"":" ttp-carousel-card--oos"),n.dataset.index=e;var A="ILS"===t.currency?"₪":"EUR"===t.currency?"€":"$",o=(t.pricePerNight*this.nights[e]).toFixed(0);n.innerHTML='\n <div class="ttp-carousel-card__image">\n <img src="'.concat(t.imageUrl,'" alt="').concat(t.name,'" onerror="this.style.display=\'none\'" />\n ').concat(t.available?"":'<div class="ttp-carousel-card__badge">Unavailable</div>','\n </div>\n <div class="ttp-carousel-card__info">\n <div class="ttp-carousel-card__name">').concat(t.name,"</div>\n ").concat(t.subtitle?'<div class="ttp-carousel-card__unit">'.concat(t.subtitle,"</div>"):"",'\n <div class="ttp-carousel-card__price">').concat(A).concat(t.pricePerNight,'<span style="font-size:10px;color:#94a3b8;font-weight:400">/night</span></div>\n </div>\n <div class="ttp-carousel-card__actions">\n <div class="ttp-carousel-card__stepper">\n <button class="ttp-carousel-card__qty-btn ttp-carousel-minus" data-idx="').concat(e,'" ').concat(!t.available||this.nights[e]<=1?"disabled":"",'>−</button>\n <span class="ttp-carousel-card__qty-val" id="ttpHNights').concat(e,'">').concat(this.nights[e]," night").concat(1!==this.nights[e]?"s":"",'</span>\n <button class="ttp-carousel-card__qty-btn ttp-carousel-plus" data-idx="').concat(e,'" ').concat(t.available?"":"disabled",'>+</button>\n </div>\n <button class="ttp-carousel-card__add-btn" data-idx="').concat(e,'" ').concat(t.available?"":"disabled",">\n ").concat(t.available?"Book Now · ".concat(A).concat(o):"Unavailable","\n </button>\n </div>\n "),n.style.transform="rotateY(".concat(e*this.anglePerCard,"deg) translateZ(").concat(this.radius,"px)"),this.wheel.appendChild(n)}),this._setupCardHandlers()}_setupCardHandlers(){var t=this.container.querySelector(".ttp-carousel-area");if(t){var e=null;t.addEventListener("touchstart",t=>{e={x:t.touches[0].clientX,y:t.touches[0].clientY}},{passive:!0}),t.addEventListener("touchend",t=>{if(e&&!this.swiped){var n=t.changedTouches[0];Math.hypot(n.clientX-e.x,n.clientY-e.y)<15&&this._handleTapAt(n.clientX,n.clientY),e=null}else e=null}),t.addEventListener("click",t=>{var e=t.target.closest(".ttp-carousel-minus"),n=t.target.closest(".ttp-carousel-plus"),A=t.target.closest(".ttp-carousel-card__add-btn");e&&!e.disabled?(t.stopPropagation(),this._handleMinus()):n&&!n.disabled?(t.stopPropagation(),this._handlePlus()):A&&!A.disabled&&(t.stopPropagation(),this._handleBook())})}}_handleTapAt(t,e){var n=this.wheel.querySelectorAll(".ttp-carousel-card")[this.current];if(n){var A=n.querySelector(".ttp-carousel-minus"),o=n.querySelector(".ttp-carousel-plus"),i=n.querySelector(".ttp-carousel-card__add-btn");!this._hitTest(t,e,A)||null!=A&&A.disabled?!this._hitTest(t,e,o)||null!=o&&o.disabled?!this._hitTest(t,e,i)||null!=i&&i.disabled||this._handleBook():this._handlePlus():this._handleMinus()}}_hitTest(t,e,n){if(!n)return!1;var A=n.getBoundingClientRect();return t>=A.left&&t<=A.right&&e>=A.top&&e<=A.bottom}_handleMinus(){var t=this.current;this.nights[t]>1&&(this.nights[t]--,this._refreshStepper(t))}_handlePlus(){var t=this.current;this.nights[t]<30&&(this.nights[t]++,this._refreshStepper(t))}_handleBook(){var t=this.current,e=this.rooms[t];if(e.available){var n=this.wheel.querySelectorAll(".ttp-carousel-card")[t],A=null==n?void 0:n.querySelector(".ttp-carousel-card__add-btn");A&&(A.textContent="✓ Booked!",A.classList.add("ttp-carousel-card__add-btn--added"),A.disabled=!0);var o=_n(_n({},e),{},{selectedNights:this.nights[t]});this.onRoomBook(n,o),setTimeout(()=>this.hide(),800)}}_refreshStepper(t){var e=this.container.querySelector("#ttpHNights".concat(t)),n=this.container.querySelector('.ttp-carousel-minus[data-idx="'.concat(t,'"]')),A=this.container.querySelector('.ttp-carousel-card__add-btn[data-idx="'.concat(t,'"]'));if(e&&(e.textContent="".concat(this.nights[t]," night").concat(1!==this.nights[t]?"s":"")),n&&(n.disabled=this.nights[t]<=1),A&&!A.classList.contains("ttp-carousel-card__add-btn--added")){var o=this.rooms[t],i="ILS"===o.currency?"₪":"EUR"===o.currency?"€":"$",r=(o.pricePerNight*this.nights[t]).toFixed(0);A.textContent="Book Now · ".concat(i).concat(r)}}_buildDots(){this.rooms.length<=1||this.rooms.forEach((t,e)=>{var n=document.createElement("div");n.className="ttp-carousel-dot",n.addEventListener("click",()=>this.goTo(e)),this.dotsEl.appendChild(n)})}_updateWheel(){var t=-this.current*this.anglePerCard;this.wheel.style.transform="translateZ(-".concat(this.radius,"px) rotateY(").concat(t,"deg)"),this.wheel.querySelectorAll(".ttp-carousel-card").forEach((e,n)=>{for(var A=n*this.anglePerCard+t;A>180;)A-=360;for(;A<-180;)A+=360;Math.abs(A)>90?(e.style.visibility="hidden",e.style.opacity="0"):(e.style.visibility="visible",e.style.opacity=this.rooms[n].available?"1":"0.7")}),this.dotsEl.querySelectorAll(".ttp-carousel-dot").forEach((t,e)=>t.classList.toggle("ttp-carousel-dot--active",e===this.current))}goTo(t){this.current=Math.max(0,Math.min(this.rooms.length-1,t)),this._updateWheel()}_setupDragEvents(){var t=this.container.querySelector(".ttp-carousel-area");t&&(t.addEventListener("touchstart",t=>{this.dragging=!0,this.startX=t.touches[0].clientX,this.swiped=!1},{passive:!0}),t.addEventListener("mousedown",t=>{this.dragging=!0,this.startX=t.clientX,this.swiped=!1}),document.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),document.addEventListener("touchend",this._boundTouchEnd),document.addEventListener("mousemove",this._boundMouseMove),document.addEventListener("mouseup",this._boundMouseUp))}_onTouchMove(t){if(this.dragging){var e=t.touches[0].clientX-this.startX;Math.abs(e)>this.dragThreshold&&(this.goTo(this.current+(e>0?-1:1)),this.startX=t.touches[0].clientX,this.swiped=!0)}}_onTouchEnd(){this.dragging=!1,this.swiped&&setTimeout(()=>{this.swiped=!1},400)}_onMouseMove(t){if(this.dragging){var e=t.clientX-this.startX;Math.abs(e)>this.dragThreshold&&(this.goTo(this.current+(e>0?-1:1)),this.startX=t.clientX,this.swiped=!0)}}_onMouseUp(){this.dragging=!1,this.swiped&&setTimeout(()=>{this.swiped=!1},400)}_removeEventListeners(){document.removeEventListener("touchmove",this._boundTouchMove),document.removeEventListener("touchend",this._boundTouchEnd),document.removeEventListener("mousemove",this._boundMouseMove),document.removeEventListener("mouseup",this._boundMouseUp)}_positionAboveMobileBar(){requestAnimationFrame(()=>{if(this.container){var t=document.getElementById("mobile-voice-call-bar-container");if(t){var e=t.getBoundingClientRect();this.container.style.bottom="".concat(window.innerHeight-e.top+58,"px")}}})}_hexToRgba(t,e){var n=parseInt(t.slice(1,3),16),A=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16);return"rgba(".concat(n,", ").concat(A,", ").concat(o,", ").concat(e,")")}_darkenHex(t,e){var n=Math.max(0,parseInt(t.slice(1,3),16)-e),A=Math.max(0,parseInt(t.slice(3,5),16)-e),o=Math.max(0,parseInt(t.slice(5,7),16)-e);return"#".concat(n.toString(16).padStart(2,"0")).concat(A.toString(16).padStart(2,"0")).concat(o.toString(16).padStart(2,"0"))}_injectStyles(){if(!document.getElementById("ttp-hotel-carousel-styles")){var t=document.createElement("style");t.id="ttp-hotel-carousel-styles",t.textContent=this._generateCSS(),document.head.appendChild(t)}}_generateCSS(){return"\n/* ═══════════════════════════════════════\n HOTEL MOBILE CAROUSEL (reuses ecommerce carousel classes)\n ═══════════════════════════════════════ */\n\n.ttp-mobile-carousel {\n position: fixed !important;\n bottom: 180px;\n left: 0 !important;\n right: 0 !important;\n top: 0 !important;\n z-index: 2147483646 !important;\n font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;\n animation: ttpCarouselIn 0.35s cubic-bezier(0.23, 1, 0.32, 1);\n -webkit-tap-highlight-color: transparent;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n padding-bottom: 16px;\n}\n\n.ttp-mobile-carousel > .ttp-carousel-header,\n.ttp-mobile-carousel > .ttp-carousel-area,\n.ttp-mobile-carousel > .ttp-carousel-dots {\n position: relative;\n z-index: 1;\n}\n\n.ttp-mobile-carousel::after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 420px;\n background: rgba(0, 0, 0, 0.2);\n backdrop-filter: blur(4px);\n -webkit-backdrop-filter: blur(4px);\n border-radius: 24px 24px 0 0;\n pointer-events: none;\n z-index: 0;\n}\n\n.ttp-mobile-carousel.ttp-carousel--hiding {\n animation: ttpCarouselOut 0.28s ease forwards;\n pointer-events: none;\n}\n\n@keyframes ttpCarouselIn {\n from { opacity: 0; transform: translateY(30px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes ttpCarouselOut {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(30px); }\n}\n\n.ttp-carousel-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 24px 8px;\n flex-shrink: 0;\n}\n\n.ttp-carousel-title {\n font-size: 13px;\n font-weight: 600;\n color: #fff;\n text-shadow: 0 1px 4px rgba(0,0,0,0.4);\n}\n\n.ttp-carousel-close {\n width: 32px;\n height: 32px;\n border: none;\n border-radius: 0;\n background: none;\n color: #fff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n opacity: 0.85;\n}\n.ttp-carousel-close:active { opacity: 1; }\n\n.ttp-carousel-area {\n position: relative;\n height: 300px;\n flex-shrink: 0;\n perspective: 800px;\n perspective-origin: 50% 55%;\n cursor: grab;\n user-select: none;\n -webkit-user-select: none;\n}\n.ttp-carousel-area:active { cursor: grabbing; }\n\n.ttp-carousel-wheel {\n position: absolute;\n width: 100%;\n height: 100%;\n transform-style: preserve-3d;\n transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);\n}\n\n.ttp-carousel-card {\n position: absolute;\n width: 150px;\n height: 285px;\n left: 50%;\n top: 50%;\n margin-left: -75px;\n margin-top: -142px;\n background: #fff;\n border-radius: 18px;\n overflow: hidden;\n box-shadow: 0 8px 32px rgba(0,0,0,0.14);\n transform-style: preserve-3d;\n transition: visibility 0.3s, opacity 0.3s;\n display: flex;\n flex-direction: column;\n}\n\n.ttp-carousel-card--oos { opacity: 0.7; }\n\n.ttp-carousel-card__image {\n width: 100%;\n height: 100px;\n background: linear-gradient(145deg, #f0f4ff, #e8ecf8);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n position: relative;\n overflow: hidden;\n}\n.ttp-carousel-card__image img {\n max-width: 80%;\n max-height: 80%;\n object-fit: contain;\n}\n\n.ttp-carousel-card__badge {\n position: absolute;\n top: 6px; right: 6px;\n background: #ef4444;\n color: #fff;\n font-size: 8px;\n font-weight: 700;\n padding: 2px 6px;\n border-radius: 4px;\n text-transform: uppercase;\n}\n\n.ttp-carousel-card__info {\n padding: 8px 10px 4px;\n flex-shrink: 0;\n}\n\n.ttp-carousel-card__name {\n font-size: 12px;\n font-weight: 600;\n color: #1e1b4b;\n line-height: 1.25;\n margin-bottom: 1px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n\n.ttp-carousel-card__unit {\n font-size: 9px;\n color: #64748b;\n margin-bottom: 3px;\n}\n\n.ttp-carousel-card__price {\n font-size: 16px;\n font-weight: 700;\n color: var(--ttp-carousel-primary, #2563eb);\n}\n\n.ttp-carousel-card__actions {\n padding: 6px 10px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-top: auto;\n}\n\n.ttp-carousel-card__stepper {\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--ttp-carousel-primary-light, rgba(37,99,235,0.12));\n border-radius: 10px;\n padding: 3px;\n}\n\n.ttp-carousel-card__qty-btn {\n width: 30px;\n height: 30px;\n border: none;\n background: transparent;\n color: var(--ttp-carousel-primary, #2563eb);\n font-size: 17px;\n font-weight: 600;\n cursor: pointer;\n border-radius: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 10;\n touch-action: manipulation;\n}\n.ttp-carousel-card__qty-btn:active:not(:disabled) {\n background: var(--ttp-carousel-primary-light);\n}\n.ttp-carousel-card__qty-btn:disabled { opacity: 0.3; cursor: default; }\n\n.ttp-carousel-card__qty-val {\n min-width: 40px;\n text-align: center;\n font-size: 14px;\n font-weight: 600;\n color: #1e1b4b;\n user-select: none;\n}\n\n.ttp-carousel-card__add-btn {\n width: 100%;\n padding: 9px 12px;\n background: linear-gradient(135deg, var(--ttp-carousel-primary, #2563eb), var(--ttp-carousel-primary-dark, #1d4ed8));\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n box-shadow: 0 4px 12px var(--ttp-carousel-primary-shadow, rgba(37,99,235,0.3));\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 10;\n touch-action: manipulation;\n}\n.ttp-carousel-card__add-btn:active:not(:disabled) { transform: scale(0.97); }\n.ttp-carousel-card__add-btn:disabled { background: #94a3b8; cursor: default; box-shadow: none; }\n.ttp-carousel-card__add-btn--added {\n background: linear-gradient(135deg, #10b981, #059669) !important;\n box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;\n}\n\n.ttp-carousel-dots {\n display: flex;\n justify-content: center;\n gap: 8px;\n padding: 8px 0 0;\n flex-shrink: 0;\n}\n\n.ttp-carousel-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: rgba(255,255,255,0.35);\n cursor: pointer;\n transition: all 0.3s;\n}\n\n.ttp-carousel-dot--active {\n width: 24px;\n border-radius: 4px;\n background: #fff;\n}\n\n.ttp-carousel-toast {\n position: fixed;\n left: 16px;\n right: 16px;\n bottom: 100px;\n z-index: 100001;\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n background: #fff;\n border-radius: 14px;\n box-shadow: 0 8px 32px rgba(0,0,0,0.15);\n animation: ttpCarouselToastIn 0.3s ease;\n}\n\n.ttp-carousel-toast--hiding {\n animation: ttpCarouselOut 0.3s ease forwards;\n}\n\n@keyframes ttpCarouselToastIn {\n from { opacity: 0; transform: translateY(12px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n.ttp-carousel-toast__icon {\n width: 28px;\n height: 28px;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n font-weight: 700;\n flex-shrink: 0;\n}\n\n.ttp-carousel-toast__text {\n font-size: 13px;\n color: #1e293b;\n line-height: 1.3;\n}\n.ttp-carousel-toast__text strong { font-weight: 600; }\n"}}class Pn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.primaryColor=t.primaryColor||"#2563eb",this.onRoomBook=t.onRoomBook||(()=>{}),this.carousel=null}showRooms(t,e){this.carousel||(this.carousel=new Mn({primaryColor:this.primaryColor,onRoomBook:(t,e)=>{this.onRoomBook(e)},onClose:()=>{}})),this.carousel.show(t,e)}hideRooms(){this.carousel&&this.carousel.hide()}onRoomBooked(t){var e;null!==(e=this.carousel)&&void 0!==e&&e.container&&this.carousel.showToast(t.name||t.roomName||"Room")}updateBooking(t){}destroy(){this.carousel&&(this.carousel.destroy(),this.carousel=null)}}class Ln{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.shadowRoot=t.shadowRoot,this.primaryColor=t.primaryColor||"#2563eb",this.onRoomSelected=t.onRoomSelected||(()=>{}),this.onExtraSelected=t.onExtraSelected||(()=>{}),this._presenter=null}get presenter(){return this._presenter||(this._presenter=this._createPresenter()),this._presenter}_createPresenter(){return this._isMobileCall()?new Pn({primaryColor:this.primaryColor,onRoomBook:t=>this._handleRoomBook(t)}):new Tn({shadowRoot:this.shadowRoot,primaryColor:this.primaryColor,onRoomBook:t=>this._handleRoomBook(t)})}_isMobileCall(){return!!document.getElementById("mobile-voice-call-bar-container")}handleShowItems(t){var e=t.items||t.products||[];if(e.length){var n=e.map(Rn);this.presenter.showRooms(n,t.title)}else console.warn("[HotelsManager] show_items with no items")}handleCartUpdated(t){var{product:e,action:n,cartTotal:A,cartItemCount:o}=t;void 0!==A&&void 0!==o&&this.presenter.updateBooking({roomName:(null==e?void 0:e.name)||(null==e?void 0:e.productName)||"",totalPrice:A,nights:o,currency:t.currency})}handleBookingUpdated(t){var e=t.booking||t;this.presenter.updateBooking(e)}handleShowExtras(t){var e=t.items||t.extras||[];if(e.length){var n=e.map(Kn);this.presenter.showRooms(n,t.title||"Extras")}}hideRooms(){this.presenter.hideRooms()}_handleRoomBook(t){this.onRoomSelected(t)}destroy(){this._presenter&&(this._presenter.destroy(),this._presenter=null)}}function Rn(t){return{id:t.roomId||t.id,name:t.roomName||t.name,imageUrl:t.imageUrl||t.image_url||"",subtitle:(e=t,A=[],e.beds&&A.push("".concat(e.beds," bed").concat(e.beds>1?"s":"")),null!==(n=e.amenities)&&void 0!==n&&n.length&&A.push(e.amenities.slice(0,3).join(", ")),A.join(" · ")),pricePerNight:t.pricePerNight||t.price_per_night||t.price||0,currency:t.currency||"USD",available:void 0===t.available||t.available,nights:1};var e,n,A}function Kn(t){return{id:t.extraId||t.id,name:t.name,imageUrl:t.imageUrl||t.image_url||"",subtitle:t.description||"",pricePerNight:t.price||t.pricePerNight||0,currency:t.currency||"USD",available:!0,nights:1}}class On extends Le{constructor(t,e){super(t,e,{buttonText:"Book this room",priceLabel:"per night"})}createManager(t){var{shadowRoot:e,primaryColor:n}=t;return new Ln({shadowRoot:e,primaryColor:n,onRoomSelected:t=>this.handleItemSelected(t)})}getManagerHideMethod(){return"hideRooms"}}class Vn{constructor(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.item=t,this.primaryColor=e.primaryColor||"#2563eb",this.onSelect=e.onSelect||(()=>{}),this.element=this._render()}_render(){var t=document.createElement("div");t.className="ttp-product-card",t.dataset.itemId=this.item.id;var e="ILS"===this.item.currency?"₪":"$",n=(this.item.allergens||[]).map(t=>'<span class="ttp-allergen-tag">'.concat(t,"</span>")).join(""),A=(this.item.tags||[]).filter(t=>["vegetarian","vegan","gluten-free","healthy"].includes(t)).map(t=>'<span class="ttp-dietary-tag">'.concat(t,"</span>")).join(""),o=A||n?'<div class="ttp-product-tags">'.concat(A).concat(n,"</div>"):"";t.innerHTML='\n <div class="ttp-product-image">\n <img src="'.concat(this.item.imageUrl||"",'" alt="').concat(this.item.name,'" loading="lazy"\n onerror="this.style.display=\'none\'" />\n ').concat(this.item.available?"":'<div class="ttp-stock-badge">Unavailable</div>','\n </div>\n <div class="ttp-product-details">\n <div class="ttp-product-name">').concat(this.item.name,'</div>\n <div class="ttp-product-meta">').concat(this.item.category||"","</div>\n ").concat(o,'\n <div class="ttp-product-footer">\n <span class="ttp-product-price">').concat(e).concat((this.item.price||0).toFixed(2),"</span>\n ").concat(this.item.available?'<button class="ttp-add-btn">Add</button>':'<span class="ttp-out-of-stock">Unavailable</span>',"\n </div>\n </div>\n ");var i=t.querySelector(".ttp-add-btn");return i&&this.item.available&&(i.style.background=this.primaryColor,i.addEventListener("click",t=>{t.stopPropagation(),i.textContent="✓",i.classList.add("ttp-added"),i.disabled=!0,this.onSelect(this.item),setTimeout(()=>{i.textContent="Add",i.classList.remove("ttp-added"),i.disabled=!1},1500)})),t}}class Nn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.primaryColor=t.primaryColor||"#2563eb",this.onItemSelect=t.onItemSelect||(()=>{}),this.onAddDisabled=t.onAddDisabled||(()=>!1),this.onClose=t.onClose||(()=>{}),this.element=null,this._cards=[]}show(t,e){if(this.hide(),!t||0===t.length)return null;var n=document.createElement("div");n.className="picker-relative";var A=document.createElement("div");A.className="ttp-product-picker";var o=document.createElement("div");o.className="ttp-picker-header",o.innerHTML='\n <span class="ttp-picker-title">'.concat(e||"Menu",'</span>\n <button class="ttp-picker-close" aria-label="Close">×</button>\n '),o.querySelector(".ttp-picker-close").addEventListener("click",()=>{this.hide(),this.onClose()}),A.appendChild(o);var i=document.createElement("div");return i.className="ttp-products-horizontal",this._cards=[],t.forEach(t=>{var e=new Vn(t,{primaryColor:this.primaryColor,onSelect:t=>{this.onAddDisabled()||this.onItemSelect(e.element,t)}});i.appendChild(e.element),this._cards.push(e)}),A.appendChild(i),n.appendChild(A),this.element=n,n}hide(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this._cards=[]}destroy(){this.hide()}}class jn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.shadowRoot=t.shadowRoot,this.primaryColor=t.primaryColor||"#2563eb",this.onItemSelect=t.onItemSelect||(()=>{}),this.flyToCart=new sn({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>this._triggerCartBump(),onRipple:()=>this._triggerRipple()}),this.picker=new Nn({primaryColor:this.primaryColor,onItemSelect:(t,e)=>this._handleItemSelectWithFly(t,e),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>this._handlePickerClose()}),this.cartToast=new rn({onUndo:()=>{},onHide:()=>this._restoreWaveform()}),this.cartSummary=new an,this.container=document.createElement("div"),this.container.id="ttpRestaurantArea",this.container.className="ttp-restaurant-area";var e=document.createElement("div");e.id="ttpDesktopFlyTarget",e.className="ttp-desktop-fly-target",e.setAttribute("aria-hidden","true"),this.container.appendChild(e),this.voiceActiveState=null,this.isAttached=!1,this._cartBump=!1,this._ripple=!1,this._toastActive=!1,this._activatedByPresenter=!1}_getCartTarget(){var t,e,n=this.voiceActiveState||(null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("voiceActiveState"));if(n){var A=n.querySelector(".ttp-cart-icon");if(A){var o=A.getBoundingClientRect();if(o.width>0&&o.height>0)return A}}var i=(null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("ttpRestaurantArea"))||this.container;return(null==i?void 0:i.querySelector("#ttpDesktopFlyTarget"))||null}_handleItemSelectWithFly(t,e){var n;this.flyToCart.isAnimating||(null===(n=this.picker.element)||void 0===n||n.classList.add("ttp-products-animating"),this.flyToCart.triggerFly(t,e,()=>{var t;null===(t=this.picker.element)||void 0===t||t.classList.remove("ttp-products-animating"),this._showAddedToast(e),this.onItemSelect(e)},{preferClone:!1}))}_showAddedToast(t){var e,n;this._toastActive=!0,this.hideMenuItems({shrinkToToastHeight:!0});var A=this.cartToast.show(t,"added"),o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".ttp-call-hero");o&&o.style.setProperty("display","none","important");var i=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector(".ttp-controls");i?i.parentNode.insertBefore(A,i):this.voiceActiveState&&this.voiceActiveState.appendChild(A)}_triggerCartBump(){this._cartBump=!0,setTimeout(()=>{this._cartBump=!1},450)}_triggerRipple(){if(this.cartSummary.element){var t=this.cartSummary.element.querySelector(".ttp-fly-ripple");t&&t.remove();var e=document.createElement("div");e.className="ttp-fly-ripple",this.cartSummary.element.style.position="relative",this.cartSummary.element.appendChild(e),setTimeout(()=>e.remove(),600)}}showMenuItems(t,e){this._ensureReady(),this._ensureActiveStateVisible(),this._switchToCompactMode(),this._setContainerMode("menu"),this.picker.hide();var n=this.picker.show(t,e);n&&this.container.insertBefore(n,this.container.firstChild),this._expandPanelToFit(t.length)}hideMenuItems(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.picker.hide(),t.shrinkToToastHeight||this._toastActive?this._setPanelHeightForToast():this._shrinkPanel(),this._restoreFullVoiceMode(),this._setContainerMode("summary"),t.shrinkToToastHeight||this._toastActive||this._restoreIdleStateIfNeeded()}_setPanelHeightForToast(){var t=()=>{var t,e=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("text-chat-panel");if(e){var n=Math.min(jn.TOAST_HEIGHT_PX,Math.floor(.92*window.innerHeight));e.classList.add("ttp-panel-expanded"),e.style.setProperty("height","".concat(n,"px"),"important")}};t(),requestAnimationFrame(()=>requestAnimationFrame(t))}_restoreWaveform(){var t,e,n=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".ttp-call-hero");n&&n.style.removeProperty("display"),this._toastActive=!1;var A=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("text-chat-panel");A&&(A.classList.remove("ttp-panel-expanded"),A.style.removeProperty("height"))}updateOrder(t){if(this._ensureReady(),t){var e,n,A,o,i=null!==(e=null!==(n=t.orderItemCount)&&void 0!==n?n:t.itemCount)&&void 0!==e?e:0,r=null!==(A=null!==(o=t.orderTotal)&&void 0!==o?o:t.total)&&void 0!==A?A:0;this.cartSummary.update(i,r,"$")}}onItemAdded(t,e){e&&this.cartSummary.update(e.itemCount,e.total,e.currency)}destroy(){var t,e;this.flyToCart&&this.flyToCart.destroy(),this.picker.hide(),this.cartToast.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-menu-visible"),null!==(t=this.cartSummary.element)&&void 0!==t&&t.parentNode&&this.cartSummary.element.parentNode.removeChild(this.cartSummary.element),null!==(e=this.container)&&void 0!==e&&e.parentNode&&this.container.parentNode.removeChild(this.container),this.isAttached=!1}_ensureReady(){this.isAttached||(this._injectStyles(),this._attachToDOM())}_injectStyles(){if(this.shadowRoot&&!this.shadowRoot.querySelector("[data-ttp-restaurant]")){var t=document.createElement("style");t.setAttribute("data-ttp-restaurant",""),t.textContent='\n\n/* ═══════════════════════════════════════\n ECOMMERCE AREA\n ═══════════════════════════════════════ */\n\n\n/*\n * When products are visible, expand the panel dynamically.\n * Actual height is set via inline style by EcommerceManager._expandPanelToFit().\n * When the class is removed, the panel returns to its CSS-defined default.\n */\n#text-chat-panel.ttp-panel-expanded {\n transition: height 0.25s ease;\n}\n\n/*\n * Layout overrides ONLY when ecommerce/hotels overlay is active.\n * Scoped under .ttp-products-visible / .ttp-rooms-visible so the\n * normal voice CSS takes effect when products/rooms are hidden.\n *\n * voiceActiveState is a flex column: [voice-controls] [ecommerce] [conversation].\n * Ecommerce area fills the middle and scrolls; conversation panel stays at bottom.\n */\n#voiceActiveState.ttp-products-visible,\n#voiceActiveState.ttp-rooms-visible {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow: hidden !important;\n}\n\n.ttp-products-visible > .desktop-voice-section,\n.ttp-rooms-visible > .desktop-voice-section {\n flex-shrink: 1 !important;\n}\n\n/* Conversation + input always stick to bottom; ecommerce area above grows to fill. */\n.ttp-products-visible > .desktop-conversation-panel,\n.ttp-rooms-visible > .desktop-conversation-panel {\n flex: 0 0 auto !important;\n margin-top: auto !important;\n display: flex !important;\n flex-direction: column !important;\n}\n\n.ttp-products-visible .desktop-conversation-panel .live-transcript-collapsed,\n.ttp-rooms-visible .desktop-conversation-panel .live-transcript-collapsed {\n flex: 0 0 auto !important;\n min-height: 40px !important;\n overflow: hidden !important;\n}\n\n.ttp-products-visible .desktop-conversation-panel .voice-text-input-area,\n.ttp-rooms-visible .desktop-conversation-panel .voice-text-input-area {\n margin-top: auto !important;\n padding: 3px 16px !important;\n}\n\n.ttp-products-visible .desktop-conversation-panel .voice-input-hint,\n.ttp-rooms-visible .desktop-conversation-panel .voice-input-hint {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-voice-section {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .compact-voice-section {\n display: flex !important;\n}\n\n#voiceActiveState.ttp-products-visible .desktop-conversation-panel {\n flex: 0 0 auto !important;\n}\n\n#voiceActiveState.ttp-products-visible .conversation-history {\n display: none !important;\n}\n\n#voiceActiveState.ttp-products-visible .live-transcript-collapsed {\n flex: 0 0 auto !important;\n}\n\n.voice-text-input-area {\n flex-shrink: 0 !important;\n}\n\n.ttp-products-visible .conversation-history,\n.ttp-rooms-visible .conversation-history {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n overflow-y: auto !important;\n}\n\n.ttp-ecommerce-area {\n display: flex !important;\n flex-direction: column !important;\n width: 100%;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n position: relative !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT PICKER\n ═══════════════════════════════════════ */\n\n.ttp-product-picker {\n background: rgba(255,255,255,0.04);\n border-radius: 14px;\n border: 1px solid rgba(255,255,255,0.08);\n box-shadow: none;\n margin: 8px 10px;\n overflow-x: hidden !important;\n overflow-y: auto !important;\n animation: ttpSlideUp 0.25s ease;\n display: flex !important;\n flex-direction: column;\n flex: 1;\n min-height: 0 !important;\n}\n\n@keyframes ttpSlideUp {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n.ttp-picker-header {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 10px 14px;\n border-bottom: 1px solid rgba(255,255,255,0.06);\n flex-shrink: 0;\n}\n\n.ttp-picker-title {\n font-size: 12px;\n font-weight: 600;\n color: rgba(255,255,255,0.5);\n}\n\n.ttp-picker-close {\n background: none;\n border: none;\n cursor: pointer;\n color: rgba(255,255,255,0.4);\n font-size: 14px;\n padding: 2px 6px;\n border-radius: 4px;\n}\n.ttp-picker-close:hover {\n background: rgba(255,255,255,0.08);\n color: rgba(255,255,255,0.7);\n}\n\n/* Horizontal card layout */\n.ttp-products-horizontal {\n display: flex !important;\n align-items: flex-start;\n flex-shrink: 0;\n gap: 10px;\n padding: 12px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: thin;\n}\n.ttp-products-horizontal::-webkit-scrollbar { height: 4px; }\n.ttp-products-horizontal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }\n.ttp-products-horizontal::-webkit-scrollbar-track { background: transparent; }\n\n/* Vertical list layout */\n.ttp-products-vertical {\n padding: 8px 12px;\n overflow-y: auto !important;\n display: flex !important;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n min-height: 0 !important;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT CARD (horizontal)\n ═══════════════════════════════════════ */\n\n.ttp-product-card {\n width: 170px !important;\n flex-shrink: 0 !important;\n background: rgba(255,255,255,0.04);\n border-radius: 12px;\n border: 1px solid rgba(255,255,255,0.08);\n overflow: hidden;\n transition: border-color 0.15s;\n}\n.ttp-product-card:hover { border-color: rgba(109,86,245,0.5); }\n\n.ttp-product-image {\n height: 110px !important;\n background: rgba(0,0,0,0.2);\n display: flex !important;\n align-items: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n}\n.ttp-product-image img {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n object-fit: contain !important;\n display: block !important;\n}\n\n.ttp-stock-badge {\n position: absolute;\n top: 6px; right: 6px;\n background: rgba(239,68,68,0.15);\n color: #ef4444;\n font-size: 9px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n}\n\n.ttp-product-details {\n padding: 10px 12px 14px;\n}\n\n.ttp-product-name {\n font-size: 13px;\n font-weight: 600;\n color: #e8e4f0;\n line-height: 1.3;\n min-height: 30px;\n}\n\n.ttp-product-page-link {\n display: inline-flex;\n align-items: center;\n margin-left: 5px;\n font-size: 10px;\n color: #a78bfa;\n text-decoration: none;\n opacity: 0.7;\n vertical-align: middle;\n}\n.ttp-product-page-link:hover { opacity: 1; text-decoration: underline; }\n\n.ttp-product-meta {\n font-size: 10px;\n color: rgba(255,255,255,0.35);\n margin-top: 2px;\n}\n\n.ttp-product-footer {\n display: flex !important;\n align-items: center;\n justify-content: space-between;\n margin-top: 6px;\n}\n\n.ttp-product-price {\n font-size: 14px;\n font-weight: 700;\n color: #e8e4f0;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT COMPACT (list view)\n ═══════════════════════════════════════ */\n\n.ttp-product-compact {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n background: rgba(255,255,255,0.04);\n border-radius: 10px;\n border: 1px solid rgba(255,255,255,0.08);\n transition: border-color 0.15s;\n}\n.ttp-product-compact:hover { border-color: rgba(109,86,245,0.5); }\n\n.ttp-product-image-sm {\n width: 72px !important; height: 72px !important;\n border-radius: 10px;\n background: rgba(0,0,0,0.2);\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n}\n.ttp-product-image-sm img {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n object-fit: contain !important;\n display: block !important;\n}\n\n.ttp-product-compact .ttp-product-info {\n flex: 1;\n min-width: 0;\n}\n.ttp-product-compact .ttp-product-name {\n min-height: auto;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: #e8e4f0;\n}\n.ttp-product-compact .ttp-product-action {\n text-align: right;\n flex-shrink: 0 !important;\n}\n.ttp-product-compact .ttp-product-price {\n font-size: 13px;\n}\n\n.ttp-out-of-stock {\n font-size: 10px;\n color: #f87171;\n font-weight: 500;\n}\n\n/* ═══════════════════════════════════════\n ADD BUTTON\n ═══════════════════════════════════════ */\n\n.ttp-add-btn {\n padding: 6px 14px;\n border-radius: 8px;\n border: 1.5px solid rgba(109,86,245,0.6);\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n background: transparent;\n color: #a78bfa;\n transition: all 0.15s;\n}\n.ttp-add-btn:hover { background: rgba(109,86,245,0.15); border-color: #a78bfa; }\n.ttp-add-btn:active { transform: scale(0.95); }\n.ttp-add-btn.ttp-added { background: rgba(109,86,245,0.6) !important; border-color: #7c3aed !important; color: #fff !important; }\n.ttp-add-btn:disabled { cursor: default; opacity: 0.5; }\n.ttp-add-btn.ttp-update-btn { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.5); color: #fbbf24; }\n.ttp-add-btn.ttp-update-btn:hover { background: rgba(245,158,11,0.25); border-color: #fbbf24; }\n\n.ttp-products-animating .ttp-add-btn {\n opacity: 0.4;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n/* ═══════════════════════════════════════\n CART TOAST\n ═══════════════════════════════════════ */\n\n/* Toast replaces waveform in desktop voice section */\n.ttp-cart-toast {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n margin: 8px 12px;\n background: rgba(16,185,129,0.1);\n border-radius: 12px;\n border: 1px solid rgba(16,185,129,0.2);\n animation: ttpToastIn 0.25s ease;\n flex-shrink: 0;\n box-shadow: none;\n}\n\n@keyframes ttpToastIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n.ttp-cart-toast.ttp-toast-hiding {\n animation: ttpSlideDown 0.3s ease forwards;\n}\n\n@keyframes ttpSlideDown {\n to { opacity: 0; transform: translateY(-8px); height: 0; padding: 0; margin: 0; overflow: hidden; }\n}\n\n.ttp-toast-icon {\n width: 24px !important; height: 24px !important;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex !important;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: 700;\n flex-shrink: 0;\n}\n\n.ttp-toast-content { flex: 1; min-width: 0; }\n.ttp-toast-title { font-size: 12px; font-weight: 600; color: #34d399; }\n.ttp-toast-product {\n font-size: 11px;\n color: rgba(52,211,153,0.7);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-toast-undo {\n background: none;\n border: 1px solid rgba(52,211,153,0.3);\n border-radius: 6px;\n padding: 3px 8px;\n font-size: 10px;\n color: #34d399;\n cursor: pointer;\n font-weight: 600;\n flex-shrink: 0;\n}\n.ttp-toast-undo:hover { background: rgba(52,211,153,0.1); }\n\n/* Fly-to-cart desktop target (when cart summary is hidden) */\n.ttp-desktop-fly-target {\n position: absolute;\n bottom: 12px;\n right: 80px;\n width: 24px;\n height: 24px;\n pointer-events: none;\n}\n\n/* Fly-to-cart ripple effect */\n.ttp-fly-ripple {\n position: absolute;\n left: 10px;\n top: 50%;\n width: 30px;\n height: 30px;\n margin-top: -15px;\n border-radius: 50%;\n border: 2px solid rgba(74,222,128,0.7);\n animation: ttp-ripple-expand 0.6s ease-out forwards;\n pointer-events: none;\n}\n\n@keyframes ttp-ripple-expand {\n 0% { transform: scale(0.5); opacity: 0.8; }\n 100% { transform: scale(3); opacity: 0; }\n}\n\n/* ═══════════════════════════════════════\n CART SUMMARY BAR\n ═══════════════════════════════════════ */\n\n.ttp-cart-summary {\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 8px 14px;\n margin: 4px 12px 0;\n margin-right: 20px;\n margin-top: auto !important;\n flex-shrink: 0 !important;\n background: rgba(255,255,255,0.04);\n border-radius: 12px;\n border: 1px solid rgba(255,255,255,0.08);\n}\n\n/* Hide cart when empty — overrides display:flex !important */\n.ttp-cart-summary.ttp-cart-empty {\n display: none !important;\n}\n\n/* Desktop: cart below input (fallback when input area not found) */\n.ttp-cart-summary-bottom {\n margin-top: 0 !important;\n margin: 8px 12px 12px !important;\n flex-shrink: 0 !important;\n}\n\n/* Desktop: cart inside input area — unified section (like mobile) */\n.ttp-cart-summary-inline {\n margin: 0 !important;\n padding: 0 !important;\n padding-top: 8px !important;\n flex-shrink: 0 !important;\n background: transparent !important;\n border: none !important;\n border-top: 1px solid rgba(255, 255, 255, 0.06) !important;\n border-radius: 0 !important;\n width: 100% !important;\n flex-basis: 100% !important;\n}\n\n.ttp-cart-info {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.ttp-cart-icon { font-size: 14px; }\n.ttp-cart-count { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.6); }\n.ttp-cart-separator { font-size: 12px; color: rgba(255,255,255,0.25); }\n.ttp-cart-total { font-size: 13px; font-weight: 700; color: #e8e4f0; }\n.ttp-cart-view {\n font-size: 12px;\n font-weight: 600;\n color: #a78bfa;\n text-decoration: none;\n cursor: pointer;\n white-space: nowrap;\n}\n.ttp-cart-view:hover {\n color: #c4b5fd;\n text-decoration: underline;\n}\n\n/* ═══════════════════════════════════════\n QUANTITY/WEIGHT STEPPER\n ═══════════════════════════════════════ */\n\n.ttp-stepper {\n display: flex !important;\n align-items: center;\n gap: 2px;\n margin: 4px 0;\n}\n\n.ttp-stepper-btn {\n width: 24px !important;\n height: 24px !important;\n border-radius: 6px;\n border: 1px solid rgba(255,255,255,0.15);\n background: rgba(255,255,255,0.06);\n color: rgba(255,255,255,0.6);\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n display: flex !important;\n align-items: center;\n justify-content: center;\n padding: 0;\n line-height: 1;\n transition: all 0.15s;\n flex-shrink: 0;\n}\n\n.ttp-stepper-btn:hover:not(:disabled) {\n background: rgba(255,255,255,0.12);\n border-color: rgba(255,255,255,0.25);\n}\n\n.ttp-stepper-btn:active:not(:disabled) {\n transform: scale(0.9);\n}\n\n.ttp-stepper-btn:disabled,\n.ttp-stepper-disabled {\n opacity: 0.35;\n cursor: default;\n}\n\n.ttp-stepper-value {\n font-size: 12px;\n font-weight: 600;\n color: #e8e4f0;\n min-width: 36px;\n text-align: center;\n user-select: none;\n}\n\n.ttp-product-compact .ttp-stepper {\n justify-content: flex-end;\n}\n\n.ttp-product-compact .ttp-product-action {\n display: flex !important;\n flex-direction: column;\n align-items: flex-end;\n gap: 2px;\n}\n\n.ttp-product-card .ttp-stepper {\n justify-content: center;\n margin: 4px 0;\n}\n\n.ttp-product-card .ttp-product-footer {\n display: flex !important;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n/* ═══════════════════════════════════════\n VARIATION DESKTOP PICKER\n ═══════════════════════════════════════ */\n\n.picker-relative {\n position: relative !important;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n display: flex !important;\n flex-direction: column !important;\n overflow: hidden;\n}\n\n/* When variant picker is shown, center it horizontally and vertically */\n.picker-relative.ttp-var-picker-active {\n justify-content: center !important;\n align-items: center !important;\n}\n\n.ttp-var-picker {\n background: rgba(255,255,255,0.04);\n border-radius: 14px;\n border: 1px solid rgba(255,255,255,0.08);\n display: flex !important;\n flex-direction: column;\n animation: ttpVarFadeIn 0.2s ease;\n overflow: hidden;\n width: 100%;\n flex-shrink: 0 !important;\n}\n\n@keyframes ttpVarFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.ttp-var-header {\n display: flex !important;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n border-bottom: 1px solid rgba(255,255,255,0.06);\n flex-shrink: 0;\n}\n\n.ttp-var-back-btn {\n background: none;\n border: none;\n cursor: pointer;\n color: rgba(255,255,255,0.5);\n font-size: 16px;\n padding: 0;\n display: flex;\n align-items: center;\n line-height: 1;\n font-family: inherit;\n}\n.ttp-var-back-btn:hover { color: #e8e4f0; }\n\n.ttp-var-title {\n font-size: 13px;\n font-weight: 700;\n color: #e8e4f0;\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-var-page-link {\n font-size: 11px;\n color: #a78bfa;\n text-decoration: none;\n font-weight: 500;\n white-space: nowrap;\n flex-shrink: 0;\n}\n.ttp-var-page-link:hover { text-decoration: underline; }\n\n.ttp-var-body {\n flex: 1;\n overflow-y: auto;\n padding: 12px 14px;\n display: flex !important;\n flex-direction: column;\n gap: 14px;\n}\n\n.ttp-var-preview {\n display: flex !important;\n gap: 12px;\n align-items: flex-start;\n}\n\n.ttp-var-preview-img {\n width: 72px !important;\n height: 72px !important;\n border-radius: 12px;\n background: rgba(0,0,0,0.2);\n border: 1px solid rgba(255,255,255,0.08);\n display: flex !important;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n transition: all 0.2s ease;\n}\n\n.ttp-var-preview-img img {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n object-fit: contain !important;\n display: block !important;\n padding: 6px;\n}\n\n.ttp-var-preview-info { flex: 1; min-width: 0; }\n\n.ttp-var-preview-brand {\n font-size: 10px;\n color: rgba(255,255,255,0.4);\n font-weight: 500;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n\n.ttp-var-preview-name {\n font-size: 14px;\n font-weight: 700;\n color: #e8e4f0;\n margin: 2px 0 4px;\n line-height: 1.2;\n}\n\n.ttp-var-preview-price {\n font-size: 18px;\n font-weight: 700;\n color: #7c3aed;\n}\n\n.ttp-var-preview-selected {\n font-size: 11px;\n color: rgba(255,255,255,0.4);\n margin-top: 3px;\n}\n\n.ttp-var-section { display: flex !important; flex-direction: column; gap: 8px; }\n\n.ttp-var-section-label {\n font-size: 11px;\n font-weight: 700;\n color: rgba(255,255,255,0.5);\n text-transform: uppercase;\n letter-spacing: 0.4px;\n}\n\n.ttp-var-swatches { display: flex !important; flex-wrap: wrap; gap: 8px; }\n\n.ttp-var-swatch {\n display: block !important;\n width: 28px !important;\n height: 28px !important;\n border-radius: 50%;\n cursor: pointer;\n border: 3px solid transparent;\n transition: all 0.15s;\n position: relative;\n flex-shrink: 0;\n}\n.ttp-var-swatch:hover { transform: scale(1.1); }\n.ttp-var-swatch.selected {\n border-color: #7c3aed;\n box-shadow: 0 0 0 2px #fff, 0 0 0 4px #7c3aed;\n}\n.ttp-var-swatch.oos {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.ttp-var-pills { display: flex !important; flex-wrap: wrap; gap: 6px; }\n\n.ttp-var-pill {\n padding: 5px 12px;\n border-radius: 8px;\n border: 1.5px solid rgba(255,255,255,0.15);\n background: rgba(255,255,255,0.04);\n font-size: 12px;\n font-weight: 600;\n color: rgba(255,255,255,0.6);\n cursor: pointer;\n transition: all 0.15s;\n font-family: inherit;\n}\n.ttp-var-pill:hover:not(:disabled) { border-color: #7c3aed; color: #a78bfa; }\n.ttp-var-pill.selected { border-color: #7c3aed; background: #7c3aed; color: #fff; }\n.ttp-var-pill.oos { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }\n\n.ttp-var-footer {\n padding: 10px 14px 12px;\n border-top: 1px solid rgba(255,255,255,0.06);\n flex-shrink: 0;\n}\n\n.ttp-var-add-btn {\n width: 100%;\n padding: 10px;\n background: linear-gradient(135deg, #7c3aed, #6d28d9);\n color: #fff;\n border: none;\n border-radius: 10px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n box-shadow: 0 3px 10px rgba(124,58,237,0.3);\n transition: all 0.15s;\n}\n.ttp-var-add-btn:hover:not(:disabled) { transform: scale(0.99); }\n.ttp-var-add-btn:disabled {\n background: rgba(255,255,255,0.1);\n box-shadow: none;\n cursor: not-allowed;\n color: rgba(255,255,255,0.3);\n}\n\n.ttp-var-spinner {\n width: 24px;\n height: 24px;\n border: 3px solid rgba(255,255,255,0.1);\n border-top-color: #7c3aed;\n border-radius: 50%;\n animation: ttpVarSpin 0.7s linear infinite;\n}\n@keyframes ttpVarSpin {\n to { transform: rotate(360deg); }\n}\n\n/* Amber "Choose" button for variant products */\n.ttp-add-btn.ttp-choose-btn {\n background: linear-gradient(135deg, #f59e0b, #d97706);\n box-shadow: 0 2px 8px rgba(245,158,11,0.3);\n color: #fff;\n}\n\n \n\n/* ═══════════════════════════════════════\n RESTAURANT-SPECIFIC OVERRIDES\n ═══════════════════════════════════════ */\n\n.ttp-restaurant-area {\n display: flex !important;\n flex-direction: column !important;\n width: 100%;\n flex: 1 1 0 !important;\n min-height: 0 !important;\n position: relative !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n#voiceActiveState.ttp-menu-visible .desktop-voice-section {\n display: none !important;\n}\n#voiceActiveState.ttp-menu-visible .compact-voice-section {\n display: flex !important;\n}\n#voiceActiveState.ttp-menu-visible .desktop-conversation-panel {\n flex: 0 0 auto !important;\n}\n#voiceActiveState.ttp-menu-visible .conversation-history {\n display: none !important;\n}\n#voiceActiveState.ttp-menu-visible .live-transcript-collapsed {\n flex: 0 0 auto !important;\n}\n\n.ttp-product-tags {\n margin-top: 3px;\n line-height: 1.6;\n}\n\n.ttp-allergen-tag {\n display: inline-block;\n font-size: 9px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n background: rgba(251,191,36,0.12);\n color: #fbbf24;\n margin-right: 3px;\n margin-bottom: 2px;\n}\n\n.ttp-dietary-tag {\n display: inline-block;\n font-size: 9px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n background: rgba(52,211,153,0.12);\n color: #34d399;\n margin-right: 3px;\n margin-bottom: 2px;\n}\n\n.ttp-order-summary-inline {\n margin: 0 !important;\n margin-top: 10px !important;\n}\n',this.shadowRoot.appendChild(t)}}_attachToDOM(){if(!this.isAttached&&this.shadowRoot)if(this.voiceActiveState=this.shadowRoot.getElementById("voiceActiveState"),this.voiceActiveState)if(this.shadowRoot.getElementById("ttpRestaurantArea"))this.isAttached=!0;else{var t=this.voiceActiveState.querySelector(".compact-voice-section"),e=this.voiceActiveState.querySelector(".desktop-voice-section"),n=t||e;null!=n&&n.nextSibling?this.voiceActiveState.insertBefore(this.container,n.nextSibling):this.voiceActiveState.appendChild(this.container);var A=this.voiceActiveState.querySelector(".voice-text-input-area");if(A){var o=this.cartSummary.render();o.classList.add("ttp-cart-summary-inline"),A.appendChild(o)}else{var i=this.cartSummary.render();i.classList.add("ttp-cart-summary-bottom"),this.voiceActiveState.appendChild(i)}this.isAttached=!0}else console.warn("[RestaurantDesktopPresenter] #voiceActiveState not found")}_setContainerMode(t){"menu"===t?(this.container.style.flex="1 1 0",this.container.style.minHeight="0",this.container.style.overflowY="auto",this.voiceActiveState&&this.voiceActiveState.classList.add("ttp-menu-visible")):(this.container.style.flex="1 1 0",this.container.style.minHeight="0",this.container.style.overflowY="",this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-menu-visible"))}_expandPanelToFit(t){if(this.shadowRoot){var e=this.shadowRoot.getElementById("text-chat-panel");if(e){e.classList.add("ttp-panel-expanded");var n=this.shadowRoot.getElementById("voiceActiveState");requestAnimationFrame(()=>{var t,A=null==n?void 0:n.querySelector(".compact-voice-section"),o=null===(t=this.container)||void 0===t?void 0:t.querySelector(".ttp-product-picker"),i=null==n?void 0:n.querySelector(".desktop-conversation-panel"),r=null==n?void 0:n.querySelector(".voice-text-input-area"),a=0;A&&(a+=A.offsetHeight),o&&(a+=o.scrollHeight+18),i&&(a+=Math.min(i.offsetHeight,100)),r&&(a+=r.offsetHeight),a+=60;var s=Math.min(800,Math.floor(.9*window.innerHeight)),c=Math.min(Math.max(a,380),s);e.style.height="".concat(c,"px")})}}}_shrinkPanel(){if(this.shadowRoot){var t=this.shadowRoot.getElementById("text-chat-panel");t&&(t.classList.remove("ttp-panel-expanded"),t.style.height="")}}_switchToCompactMode(){if(this.shadowRoot){var t=this.shadowRoot.getElementById("desktopVoiceSection"),e=this.shadowRoot.getElementById("compactVoiceSection");t&&(t.style.display="none"),e&&(e.style.display="flex")}}_restoreFullVoiceMode(){if(this.shadowRoot){var t=this.shadowRoot.getElementById("desktopVoiceSection"),e=this.shadowRoot.getElementById("compactVoiceSection");t&&e&&(t.style.display="",e.style.display="none")}}_ensureActiveStateVisible(){if(this.shadowRoot){var t=this.shadowRoot.getElementById("text-chat-panel");t&&!t.classList.contains("open")&&t.classList.add("open");var e=this.shadowRoot.getElementById("landingScreen");e&&e.classList.remove("active");var n=this.shadowRoot.getElementById("textInterface");n&&n.classList.remove("active");var A=this.shadowRoot.getElementById("voiceInterface");A&&!A.classList.contains("active")&&A.classList.add("active");var o=this.shadowRoot.getElementById("voiceActiveState");if(o&&("none"===o.style.display||"none"===getComputedStyle(o).display)){var i=this.shadowRoot.getElementById("voiceIdleState");i&&(i.style.display="none"),o.style.display="flex",this._activatedByPresenter=!0}}}_restoreIdleStateIfNeeded(){if(this._activatedByPresenter&&this.shadowRoot){var t=this.shadowRoot.getElementById("voiceActiveState"),e=this.shadowRoot.getElementById("voiceIdleState");t&&(t.style.display="none"),e&&(e.style.display="flex"),this._activatedByPresenter=!1}}_handlePickerClose(){this.hideMenuItems()}}function Gn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function zn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Gn(Object(n),!0).forEach(function(e){Wn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Wn(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}_e=jn,Me=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(De="TOAST_HEIGHT_PX"),(De="symbol"==typeof Me?Me:Me+"")in _e?Object.defineProperty(_e,De,{value:510,enumerable:!0,configurable:!0,writable:!0}):_e[De]=510;class qn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.primaryColor=t.primaryColor||"#2563eb",this.onItemSelect=t.onItemSelect||(()=>{}),this.carousel=null,this.flyToCart=new sn({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>{},onRipple:()=>{}})}_getCartTarget(){var t=document.getElementById("mobile-voice-call-bar-container");if(!t)return null;var e=t.querySelector("[data-ttp-fly-target]");if(e){var n=e.getBoundingClientRect();if(n.width>0&&n.height>0)return e}var A=t.querySelector("#ttpFlyToCartTarget");if(A){var o=A.getBoundingClientRect();if(o.width>0&&o.height>0)return A}return null}_handleAddWithFly(t,e){var n;this.flyToCart.isAnimating||(null===(n=this.carousel)||void 0===n||null===(n=n.container)||void 0===n||n.classList.add("ttp-products-animating"),this.flyToCart.triggerFly(t,e,()=>{var t;null===(t=this.carousel)||void 0===t||null===(t=t.container)||void 0===t||t.classList.remove("ttp-products-animating"),this.onItemSelect(e)},{preferClone:!1}))}showMenuItems(t,e){this.carousel||(this.carousel=new fn({primaryColor:this.primaryColor,onProductAdd:(t,e)=>this._handleAddWithFly(t,e),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>{}}));var n=t.map(t=>zn(zn({},t),{},{inStock:!1!==t.available,brand:t.category||"",unit:"",sellBy:"quantity",cartQuantity:t.orderQuantity||0}));this.carousel.show(n,e)}hideMenuItems(){this.carousel&&this.carousel.hide()}onItemAdded(t,e){this.carousel&&this.carousel.container&&this.carousel.showToast(t.name||t.itemName||"Item",e),e&&this._updateMobileCartRow(e.itemCount,e.total,e.currency)}updateOrder(t){var e,n,A,o,i=null!==(e=null!==(n=t.orderItemCount)&&void 0!==n?n:t.itemCount)&&void 0!==e?e:0,r=null!==(A=null!==(o=t.orderTotal)&&void 0!==o?o:t.total)&&void 0!==A?A:0;this._updateMobileCartRow(i,r,"$")}_updateMobileCartRow(t,e,n){var A=document.getElementById("mobileCartRow"),o=document.getElementById("mobileCartText");if(A&&o)if(t<=0)A.style.display="none";else{var i="".concat(t," item").concat(1!==t?"s":"");o.textContent="".concat(i," · ").concat(n).concat(e.toFixed(2)),A.style.display="flex"}}destroy(){this.flyToCart&&this.flyToCart.destroy(),this.carousel&&(this.carousel.destroy(),this.carousel=null)}}class Xn{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.shadowRoot=t.shadowRoot,this.primaryColor=t.primaryColor||"#2563eb",this.onItemSelected=t.onItemSelected||(()=>{}),this.cartItemCount=0,this.cartTotal=0,this.currencySymbol="$",this._presenter=null}get presenter(){return this._presenter||(this._presenter=this._createPresenter()),this._presenter}_createPresenter(){return this._isMobileCall()?new qn({primaryColor:this.primaryColor,onItemSelect:t=>this._handleItemSelect(t)}):new jn({shadowRoot:this.shadowRoot,primaryColor:this.primaryColor,onItemSelect:t=>this._handleItemSelect(t)})}_isMobileCall(){return!!document.getElementById("mobile-voice-call-bar-container")}handleShowItems(t){var e=t.items||[];if(e.length){var n=e.map(Yn);this.presenter.showMenuItems(n,t.title)}else console.warn("[RestaurantManager] show_items with no items")}handleCartUpdated(t){var e,n,{product:A,action:o,cartTotal:i,cartItemCount:r}=t;void 0!==i&&void 0!==r&&(this.cartItemCount=r,this.cartTotal=i,this.currencySymbol=this._resolveCurrency(t.currency),this.presenter.updateOrder({orderItemCount:r,orderTotal:i})),"added"===o&&A&&(null===(e=(n=this.presenter).onItemAdded)||void 0===e||e.call(n,A))}_resolveCurrency(t){return t?"ILS"===t?"₪":"$":this.currencySymbol||"$"}hideMenuItems(){this.presenter.hideMenuItems()}_buildCartInfo(){return{itemCount:this.cartItemCount,total:this.cartTotal,currency:this.currencySymbol}}_handleItemSelect(t){var e=t.price||0,n=t.selectedAmount||1;this.currencySymbol=this._resolveCurrency(t.currency),this.cartItemCount+=1,this.cartTotal+=e*n,this.presenter.onItemAdded(t,this._buildCartInfo()),this.onItemSelected(t)}destroy(){this._presenter&&(this._presenter.destroy(),this._presenter=null)}}function Yn(t){return{id:t.itemId||t.id,name:t.name||t.itemName||"",category:t.category||"",price:t.price||0,currency:t.currency||"USD",imageUrl:t.imageUrl||t.image_url||"",available:void 0===t.available||t.available,tags:t.tags||[],allergens:t.allergens||[],description:t.description||"",orderQuantity:t.orderQuantity||t.order_quantity||0}}class Jn extends Le{createManager(t){var{shadowRoot:e,primaryColor:n}=t;return new Xn({shadowRoot:e,primaryColor:n,onItemSelected:t=>this.handleItemSelected(t)})}getManagerHideMethod(){return"hideMenuItems"}}class Zn extends Le{createManager(t){var{shadowRoot:e,primaryColor:n}=t;return new Xn({shadowRoot:e,primaryColor:n,onItemSelected:t=>this.handleItemSelected(t)})}getManagerHideMethod(){return"hideMenuItems"}}var $n={ecommerce:function(t){var e=new Qn(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return e._exposeTestAPI(),e},hotels:function(t){return new On(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},restaurants:function(t){return new Jn(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},tours:function(t){return new Zn(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}},tA={resturants:"restaurants"},eA=["agentName"];function nA(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function AA(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){nA(i,A,o,r,a,"next",t)}function a(t){nA(i,A,o,r,a,"throw",t)}r(void 0)})}}function oA(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function iA(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?oA(Object(n),!0).forEach(function(e){rA(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oA(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function rA(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aA(t){return null!=t&&""!==String(t).trim()}function sA(t){return!(!t||"#"!==t.charAt(0))&&(299*parseInt(t.substr(1,2),16)+587*parseInt(t.substr(3,2),16)+114*parseInt(t.substr(5,2),16))/1e3>160}function cA(t,e,n,A){var o=e.primaryBtnGradient1||e.primaryBtnGradient2||e.startCallButtonColor||"#6d56f5",i=t?"#7C3AED":o;if(!A||!function(t){var e=null==t?void 0:t.voice;if(!e||"object"!=typeof e)return!1;var n=t=>Object.prototype.hasOwnProperty.call(e,t)&&aA(e[t]);return n("primaryBtnGradient1")||n("primaryBtnGradient2")||n("startCallButtonColor")}(n))return i;var r=e.primaryBtnGradient1||e.primaryBtnGradient2||e.startCallButtonColor;if(!aA(r))return i;var a=String(r).trim();if(a.startsWith("#")){if(4===a.length){var s=a[1],c=a[2],l=a[3];return"#".concat(s).concat(s).concat(c).concat(c).concat(l).concat(l)}if(7===a.length)return a}var d=a.match(/#[0-9a-fA-F]{6}/i);return d?d[0]:i}class lA{constructor(){var t,e,n,A,o,i,r,a,s,c,l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._rawConfig=l,this.config=this.mergeWithDefaults(l),l.signedUrl&&!l.websocketUrl&&console.warn("⚠️ TTPChatWidget: signedUrl is deprecated — use websocketUrl for custom backend URLs, or just provide agentId + appId"),this.sdk=new Vt(this.config),this.isOpen=!1,this.isActive=!1,this.translations=Ue,this.currentView="voice",this.isStartingCall=!1,this.shadowRoot=null,this.container=null,this._pendingClientTools=null,this.config.useShadowDOM?(this.createShadowHost(),this.container=this.shadowRoot):(this.createRegularContainer(),this.container=this.regularContainer,this.shadowRoot=document);var d=(null===(t=this.config.behavior)||void 0===t?void 0:t.mode)||"unified",p="unified"===d||"voice-only"===d,u=cA(sA((null===(e=this.config.panel)||void 0===e?void 0:e.backgroundColor)||"#16161e"),this.config.voice,this._rawConfig,p),h=iA(iA(iA({},this.config),this.config.voice),{},{agentName:this.config.agentName,_talkToPcLinkColor:u,inputPlaceholder:(null===(n=this.config.text)||void 0===n?void 0:n.inputPlaceholder)||this.config.inputPlaceholder||"Type your message...",sendButtonColor:(null===(A=this.config.text)||void 0===A?void 0:A.sendButtonColor)||this.config.sendButtonColor||"#7C3AED",language:(null===(o=this.config.voice)||void 0===o?void 0:o.language)||this.config.language||"en",websocketUrl:this.config.websocketUrl,agentSettingsOverride:this.config.agentSettingsOverride,visualAssistant:this.config.visualAssistant,flavor:this.config.flavor||null,translations:this.translations,shadowRoot:this.shadowRoot,textSDK:this.sdk,inputFormat:this.config.inputFormat,outputContainer:(null===(i=this.config.voice)||void 0===i?void 0:i.outputContainer)||"raw",outputEncoding:(null===(r=this.config.voice)||void 0===r?void 0:r.outputEncoding)||"pcm",outputSampleRate:(null===(a=this.config.voice)||void 0===a?void 0:a.outputSampleRate)||44100,outputChannels:(null===(s=this.config.voice)||void 0===s?void 0:s.outputChannels)||1,outputBitDepth:(null===(c=this.config.voice)||void 0===c?void 0:c.outputBitDepth)||16,onConversationStart:this.config.onConversationStart,onConversationEnd:this.config.onConversationEnd,onBargeIn:this.config.onBargeIn,onAudioStartPlaying:this.config.onAudioStartPlaying,onAudioStoppedPlaying:this.config.onAudioStoppedPlaying,onSubtitleDisplay:this.config.onSubtitleDisplay,onVoiceCallButtonClick:this.config.onVoiceCallButtonClick,onCallEnd:()=>{var t;if(this._isDomainErrorVisible())console.log("🚫 Domain error is displayed - NOT returning to home from onCallEnd");else if("unified"===((null===(t=this.config.behavior)||void 0===t?void 0:t.mode)||"unified")){if(window.innerWidth<=768){var e,n,A=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("text-chat-panel");A&&(A.classList.remove("open"),this.isOpen=!1);var o=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector(".ttp-mobile-fab");o&&(o.style.display="")}this.showLanding()}},onShowVoice:()=>{this.showVoice()},onShowLanding:()=>{this.showLanding()},onErrorToast:(t,e)=>{this.showErrorToast(t,e)},onMobileError:t=>{this.showMobileLandingError(t)}});this.voiceInterface=new Ce(h);var g=iA(iA(iA({},this.config),this.config.text),{},{translations:this.translations,shadowRoot:this.shadowRoot});if(this.textInterface=new Fe(g,this.sdk),this.createWidget(),this.setupEventHandlers(),this.config.behavior.startOpen||this.config.behavior.autoOpen)if(window.innerWidth<=768){var m,v,f=null===(m=this.shadowRoot)||void 0===m?void 0:m.querySelector(".ttp-mobile-fab"),w=null===(v=this.shadowRoot)||void 0===v?void 0:v.getElementById("ttpMobileLanding");f&&w&&(f.style.display="none",w.classList.add("active"),this.isMobileLandingOpen=!0)}else{var B,b=null===(B=this.shadowRoot)||void 0===B?void 0:B.getElementById("text-chat-panel");b&&(this.isOpen=!0,b.classList.add("open"))}this.checkAndHandleResume(),this._flavor=null,this._flavorObj=l.flavor&&"object"==typeof l.flavor?l.flavor:null,this._flavorObj&&this._flavorObj.type?this._initFlavor(this._flavorObj.type):this._flavorObj&&!this._flavorObj.type&&console.error('[TTPChatWidget] flavor object is set but missing required "type" field. Widget will run in vanilla mode.')}checkAndHandleResume(){var t=this.voiceInterface.checkAndHandleResume();if(t){if(console.log("🔄 [WIDGET] Auto-resuming call from page navigation"),console.log(" From:",t.fromPage,"→ To:",t.toPage),window.innerWidth<=768){var e,n,A=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("ttpMobileLanding"),o=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector(".ttp-mobile-fab");A&&(A.classList.remove("active"),this.isMobileLandingOpen=!1),o&&(o.style.display="none")}this.open(),this.showVoice(),this.currentView="voice",setTimeout(()=>{this.startVoiceCall().then(()=>{console.log("✅ [WIDGET] Auto-resumed call successfully")}).catch(t=>{var e;console.error("❌ [WIDGET] Failed to auto-resume call:",t),"unified"===((null===(e=this.config.behavior)||void 0===e?void 0:e.mode)||"unified")&&this.showLanding()})},100)}}_initFlavor(t){var e,n=function(t){if(null==t||"string"!=typeof t)return null;var e=tA[t.trim().toLowerCase()]||t.trim().toLowerCase();return $n[e]||null}(t);if(n)if("ecommerce"!==t||null!==(e=this._flavorObj)&&void 0!==e&&e.partnerId){if(this._flavor=n(this,this._flavorObj||{}),this._flavor.tools&&this._flavor.tools.forEach(t=>{this.registerToolHandler(t.name,t.handler)}),this._flavor.messageHandlers){var A,o=null===(A=this.voiceInterface)||void 0===A?void 0:A.sdk;if(o){o.onUnsupportedAction=null;var i=this._flavor,r=o.connect.bind(o);o.connect=AA(function*(){yield r(),this.voiceSDK&&(this.voiceSDK.on("message",t=>{var e=t.t||t.type;i.messageHandlers[e]&&i.messageHandlers[e](t)}),this.voiceSDK.on("stopPlaying",()=>{i.messageHandlers.dismiss_media&&i.messageHandlers.dismiss_media()}),this.voiceSDK.on("bargeIn",()=>{i.messageHandlers.dismiss_media&&i.messageHandlers.dismiss_media()}),console.log('[TTPChatWidget] Flavor "'.concat(t,'" message listeners attached')))})}}this._flavor.hookCallEnd&&this._flavor.hookCallEnd()}else console.error('[TTPChatWidget] flavor "ecommerce" requires partnerId (e.g. { type: "ecommerce", partnerId: "shopify", shopifyDomain: "..." }). Widget will run in vanilla mode.');else console.error('[TTPChatWidget] Unknown flavor: "'.concat(t,'". Available flavors: ecommerce. Widget will run in vanilla mode.'))}getEffectiveTextDirection(){var t;return"rtl"===(null===(t=this.config)||void 0===t?void 0:t.direction)?"rtl":"ltr"}open(){var t;if(!this.isOpen){var e=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("text-chat-panel");e&&(this.isOpen=!0,e.classList.add("open"))}}mergeWithDefaults(t){var e,n,A,o,i,r,a,s,c,l,d,p,u,h,g,m,v,f,w,B,b,y,x,C,Q,S,F,U,E,k,I,T,H,_,D,M,P,L,R,K,O,V,N,j,G,z,W,q,X,Y,J,Z,$,tt,et,nt,At,ot,it,rt,at,st,ct,lt,dt,pt,ut,ht,gt,mt,vt,ft,wt,Bt,bt,yt,xt,Ct,Qt,St,Ft,Ut,Et,kt,It,Tt,Ht,_t,Dt,Mt,Pt,Lt,Rt,Kt,Ot,Vt,Nt,jt,Gt,zt,Wt,qt,Xt,Yt,Jt,Zt,$t,te,ee=t.position||"bottom-right";if("string"==typeof ee){var ne=ee.split("-");ee={vertical:ne[0]||"bottom",horizontal:ne[1]||"right",offset:t.positionOffset||{x:20,y:20}}}var Ae=t.primaryColor||(null===(e=t.button)||void 0===e?void 0:e.primaryColor)||(null===(n=t.button)||void 0===n?void 0:n.backgroundColor)||"#FFFFFF",oe={};t.landing&&Object.keys(t.landing).forEach(e=>{var n=t.landing[e];null!=n&&""!==n&&(oe[e]=n)});var ie,re,ae,se,ce,le,de,pe,ue,he,ge,me,ve,fe,we,Be,be,ye,xe,Ce,Qe,Se,Fe,Ue,Ee,ke,Ie,Te,He,_e,De,Me,Pe,Le,Re,Ke,Oe={};return t.header&&Object.keys(t.header).forEach(e=>{var n=t.header[e];null!=n&&""!==n&&(Oe[e]=n)}),iA(iA({agentId:t.agentId,appId:t.appId,websocketUrl:t.websocketUrl||t.signedUrl,agentSettingsOverride:t.agentSettingsOverride,demo:!1!==t.demo,direction:(()=>{if("rtl"===t.direction||"ltr"===t.direction)return t.direction;var e=String(t.language||"en").toLowerCase().split(/[-_]/)[0];return"he"===e||"ar"===e?"rtl":"ltr"})(),language:t.language||"en"},aA(t.agentName)?{agentName:String(t.agentName).trim()}:{}),{},{icon:iA(iA({type:(null===(A=t.icon)||void 0===A?void 0:A.type)||"custom",emoji:(null===(o=t.icon)||void 0===o?void 0:o.emoji)||"🎤",text:(null===(i=t.icon)||void 0===i?void 0:i.text)||"AI",size:(null===(r=t.icon)||void 0===r?void 0:r.size)||"medium",backgroundColor:(null===(a=t.icon)||void 0===a?void 0:a.backgroundColor)||"#FFFFFF"},t.icon),{},{customImage:(Ke=null===(Re=t.icon)||void 0===Re?void 0:Re.customImage,null==Ke||""===String(Ke).trim()?null:String(Ke).trim())}),position:iA({vertical:ee.vertical||"bottom",horizontal:ee.horizontal||"right",offset:ee.offset||{x:20,y:20}},"object"==typeof t.position?t.position:{}),button:iA({size:(null===(s=t.button)||void 0===s?void 0:s.size)||"medium",shape:(null===(c=t.button)||void 0===c?void 0:c.shape)||"circle",backgroundColor:(null===(l=t.button)||void 0===l?void 0:l.backgroundColor)||(null===(d=t.icon)||void 0===d?void 0:d.backgroundColor)||"#FFFFFF",hoverColor:(null===(p=t.button)||void 0===p?void 0:p.hoverColor)||"#D3D3D3",shadow:!1!==(null===(u=t.button)||void 0===u?void 0:u.shadow),shadowColor:(null===(h=t.button)||void 0===h?void 0:h.shadowColor)||"rgba(0,0,0,0.15)",primaryColor:(null===(g=t.button)||void 0===g?void 0:g.backgroundColor)||(null===(m=t.icon)||void 0===m?void 0:m.backgroundColor)||"#FFFFFF"},t.button),panel:iA({width:(null===(v=t.panel)||void 0===v?void 0:v.width)||360,height:(null===(f=t.panel)||void 0===f?void 0:f.height)||500,borderRadius:(null===(w=t.panel)||void 0===w?void 0:w.borderRadius)||24,backgroundColor:(null===(B=t.panel)||void 0===B?void 0:B.backgroundColor)||"#FFFFFF",backdropFilter:(null===(b=t.panel)||void 0===b?void 0:b.backdropFilter)||null,border:(null===(y=t.panel)||void 0===y?void 0:y.border)||"1px solid #E5E7EB"},t.panel),voice:(Le=iA(iA({micButtonColor:(null===(ie=t.voice)||void 0===ie?void 0:ie.micButtonColor)||(null===(re=t.panel)||void 0===re?void 0:re.micButtonColor)||Ae,micButtonActiveColor:(null===(ae=t.voice)||void 0===ae?void 0:ae.micButtonActiveColor)||(null===(se=t.panel)||void 0===se?void 0:se.micButtonActiveColor)||"#EF4444",micButtonHint:iA(iA({text:(null===(ce=t.voice)||void 0===ce||null===(ce=ce.micButtonHint)||void 0===ce?void 0:ce.text)||(null===(le=t.panel)||void 0===le||null===(le=le.micButtonHint)||void 0===le?void 0:le.text)||"Click the button to start voice conversation",color:(null===(de=t.voice)||void 0===de||null===(de=de.micButtonHint)||void 0===de?void 0:de.color)||(null===(pe=t.panel)||void 0===pe||null===(pe=pe.micButtonHint)||void 0===pe?void 0:pe.color)||"#6B7280",fontSize:(null===(ue=t.voice)||void 0===ue||null===(ue=ue.micButtonHint)||void 0===ue?void 0:ue.fontSize)||(null===(he=t.panel)||void 0===he||null===(he=he.micButtonHint)||void 0===he?void 0:he.fontSize)||"12px"},null===(ge=t.voice)||void 0===ge?void 0:ge.micButtonHint),null===(me=t.panel)||void 0===me?void 0:me.micButtonHint),avatarBackgroundColor:(null===(ve=t.voice)||void 0===ve?void 0:ve.avatarBackgroundColor)||"#667eea",avatarActiveBackgroundColor:(null===(fe=t.voice)||void 0===fe?void 0:fe.avatarActiveBackgroundColor)||"#667eea",statusTitleColor:(null===(we=t.voice)||void 0===we?void 0:we.statusTitleColor)||"#1e293b",statusSubtitleColor:(null===(Be=t.voice)||void 0===Be?void 0:Be.statusSubtitleColor)||"#64748b",statusDotColor:(null===(be=t.voice)||void 0===be?void 0:be.statusDotColor)||"#10b981",statusText:(null===(ye=t.voice)||void 0===ye?void 0:ye.statusText)||null,startCallButtonColor:(null===(xe=t.voice)||void 0===xe?void 0:xe.startCallButtonColor)||"#667eea",startCallButtonTextColor:(null===(Ce=t.voice)||void 0===Ce?void 0:Ce.startCallButtonTextColor)||"#FFFFFF",startCallTitle:(null===(Qe=t.voice)||void 0===Qe?void 0:Qe.startCallTitle)||null,startCallSubtitle:(null===(Se=t.voice)||void 0===Se?void 0:Se.startCallSubtitle)||null,startCallButtonText:(null===(Fe=t.voice)||void 0===Fe?void 0:Fe.startCallButtonText)||null,transcriptBackgroundColor:(null===(Ue=t.voice)||void 0===Ue?void 0:Ue.transcriptBackgroundColor)||"#FFFFFF",transcriptTextColor:(null===(Ee=t.voice)||void 0===Ee?void 0:Ee.transcriptTextColor)||"#1e293b",transcriptLabelColor:(null===(ke=t.voice)||void 0===ke?void 0:ke.transcriptLabelColor)||"#94a3b8",userTranscriptPrefix:null!==(Ie=null===(Te=t.voice)||void 0===Te?void 0:Te.userTranscriptPrefix)&&void 0!==Ie?Ie:null,controlButtonColor:(null===(He=t.voice)||void 0===He?void 0:He.controlButtonColor)||"#FFFFFF",controlButtonSecondaryColor:(null===(_e=t.voice)||void 0===_e?void 0:_e.controlButtonSecondaryColor)||"#64748b",endCallButtonColor:(null===(De=t.voice)||void 0===De?void 0:De.endCallButtonColor)||"#ef4444",language:(null===(Me=t.voice)||void 0===Me?void 0:Me.language)||t.language||"en"},t.voice),aA(t.headerAvatarImageUrl)&&!aA(null===(Pe=t.voice)||void 0===Pe?void 0:Pe.headerAvatarImageUrl)?{headerAvatarImageUrl:String(t.headerAvatarImageUrl).trim()}:{}),delete Le.agentName,Le),text:iA({sendButtonColor:(null===(x=t.text)||void 0===x?void 0:x.sendButtonColor)||(null===(C=t.panel)||void 0===C?void 0:C.sendButtonColor)||"#7C3AED",sendButtonHoverColor:(null===(Q=t.text)||void 0===Q?void 0:Q.sendButtonHoverColor)||(null===(S=t.panel)||void 0===S?void 0:S.sendButtonHoverColor)||"#6D28D9",sendButtonActiveColor:(null===(F=t.text)||void 0===F?void 0:F.sendButtonActiveColor)||(null===(U=t.panel)||void 0===U?void 0:U.sendButtonActiveColor)||"#6D28D9",sendButtonText:(null===(E=t.text)||void 0===E?void 0:E.sendButtonText)||(null===(k=t.panel)||void 0===k?void 0:k.sendButtonText)||"➤",sendButtonTextColor:(null===(I=t.text)||void 0===I?void 0:I.sendButtonTextColor)||(null===(T=t.panel)||void 0===T?void 0:T.sendButtonTextColor)||"#FFFFFF",sendButtonFontSize:(null===(H=t.text)||void 0===H?void 0:H.sendButtonFontSize)||(null===(_=t.panel)||void 0===_?void 0:_.sendButtonFontSize)||"18px",sendButtonFontWeight:(null===(D=t.text)||void 0===D?void 0:D.sendButtonFontWeight)||(null===(M=t.panel)||void 0===M?void 0:M.sendButtonFontWeight)||"500",sendButtonHint:iA(iA({text:(null===(P=t.text)||void 0===P||null===(P=P.sendButtonHint)||void 0===P?void 0:P.text)||(null===(L=t.panel)||void 0===L||null===(L=L.sendButtonHint)||void 0===L?void 0:L.text)||"",color:(null===(R=t.text)||void 0===R||null===(R=R.sendButtonHint)||void 0===R?void 0:R.color)||(null===(K=t.panel)||void 0===K||null===(K=K.sendButtonHint)||void 0===K?void 0:K.color)||"#6B7280",fontSize:(null===(O=t.text)||void 0===O||null===(O=O.sendButtonHint)||void 0===O?void 0:O.fontSize)||(null===(V=t.panel)||void 0===V||null===(V=V.sendButtonHint)||void 0===V?void 0:V.fontSize)||"12px"},null===(N=t.text)||void 0===N?void 0:N.sendButtonHint),null===(j=t.panel)||void 0===j?void 0:j.sendButtonHint),inputPlaceholder:(null===(G=t.text)||void 0===G?void 0:G.inputPlaceholder)||(null===(z=t.panel)||void 0===z?void 0:z.inputPlaceholder)||"Type your message...",inputBorderColor:(null===(W=t.text)||void 0===W?void 0:W.inputBorderColor)||(null===(q=t.panel)||void 0===q?void 0:q.inputBorderColor)||"#E5E7EB",inputFocusColor:(null===(X=t.text)||void 0===X?void 0:X.inputFocusColor)||(null===(Y=t.panel)||void 0===Y?void 0:Y.inputFocusColor)||"#7C3AED",inputBackgroundColor:(null===(J=t.text)||void 0===J?void 0:J.inputBackgroundColor)||(null===(Z=t.panel)||void 0===Z?void 0:Z.inputBackgroundColor)||"#FFFFFF",inputTextColor:(null===($=t.text)||void 0===$?void 0:$.inputTextColor)||(null===(tt=t.panel)||void 0===tt?void 0:tt.inputTextColor)||"#1F2937",inputFontSize:(null===(et=t.text)||void 0===et?void 0:et.inputFontSize)||(null===(nt=t.panel)||void 0===nt?void 0:nt.inputFontSize)||"14px",inputBorderRadius:(null===(At=t.text)||void 0===At?void 0:At.inputBorderRadius)||(null===(ot=t.panel)||void 0===ot?void 0:ot.inputBorderRadius)||20,inputPadding:(null===(it=t.text)||void 0===it?void 0:it.inputPadding)||(null===(rt=t.panel)||void 0===rt?void 0:rt.inputPadding)||"6px 14px"},t.text),whatsapp:t.whatsapp?{number:(t.whatsapp.number||"").replace(/[^0-9]/g,""),text:t.whatsapp.text||""}:null,landing:(()=>{var e={};return t.landing&&Object.keys(t.landing).forEach(n=>{var A=t.landing[n];(null!=A&&""!==A||!1===A)&&(e[n]=A)}),iA({backgroundColor:e.backgroundColor||"linear-gradient(180deg, #f8fafc 0%, #e0e7ff 100%)",logo:e.logo||"🤖",title:e.title||null,titleColor:e.titleColor||"#1e293b",modeCardBackgroundColor:e.modeCardBackgroundColor||"#FFFFFF",modeCardBorderColor:e.modeCardBorderColor||"#E2E8F0",modeCardHoverBorderColor:e.modeCardHoverBorderColor||"#7C3AED",modeCardIconBackgroundColor:e.modeCardIconBackgroundColor||"#7C3AED",modeCardTitleColor:e.modeCardTitleColor||"#111827",voiceCardIcon:e.voiceCardIcon||"🎤",textCardIcon:e.textCardIcon||"💬",voiceCardTitle:e.voiceCardTitle||null,textCardTitle:e.textCardTitle||null,callButtonText:e.callButtonText||null,chatButtonText:e.chatButtonText||null,statusText:e.statusText||null},e)})(),header:(()=>{var e={};return t.header&&Object.keys(t.header).forEach(n=>{var A=t.header[n];n.startsWith("onlineIndicator")?null!=A&&(e[n]=A):null!=A&&""!==A&&(e[n]=A)}),iA({title:e.title||"Chat Assistant",showTitle:!1!==e.showTitle,backgroundColor:e.backgroundColor||"#7C3AED",textColor:e.textColor||"#FFFFFF",showCloseButton:!1!==e.showCloseButton},e)})(),footer:iA({show:!1!==(null===(at=t.footer)||void 0===at?void 0:at.show),backgroundColor:(null===(st=t.footer)||void 0===st?void 0:st.backgroundColor)||"#f9fafb",textColor:(null===(ct=t.footer)||void 0===ct?void 0:ct.textColor)||"#9ca3af",hoverColor:(null===(lt=t.footer)||void 0===lt?void 0:lt.hoverColor)||"#7C3AED"},t.footer),tooltips:iA({newChat:(null===(dt=t.tooltips)||void 0===dt?void 0:dt.newChat)||null,back:(null===(pt=t.tooltips)||void 0===pt?void 0:pt.back)||null,close:(null===(ut=t.tooltips)||void 0===ut?void 0:ut.close)||null,mute:(null===(ht=t.tooltips)||void 0===ht?void 0:ht.mute)||null,speaker:(null===(gt=t.tooltips)||void 0===gt?void 0:gt.speaker)||null,endCall:(null===(mt=t.tooltips)||void 0===mt?void 0:mt.endCall)||null},t.tooltips),messages:iA({userBackgroundColor:(null===(vt=t.messages)||void 0===vt?void 0:vt.userBackgroundColor)||"#E5E7EB",agentBackgroundColor:(null===(ft=t.messages)||void 0===ft?void 0:ft.agentBackgroundColor)||"#F3F4F6",systemBackgroundColor:(null===(wt=t.messages)||void 0===wt?void 0:wt.systemBackgroundColor)||"#DCFCE7",errorBackgroundColor:(null===(Bt=t.messages)||void 0===Bt?void 0:Bt.errorBackgroundColor)||"#FEE2E2",textColor:(null===(bt=t.messages)||void 0===bt?void 0:bt.textColor)||"#1F2937",userTextColor:(null===(yt=t.messages)||void 0===yt?void 0:yt.userTextColor)||(null===(xt=t.messages)||void 0===xt?void 0:xt.textColor)||"#1F2937",agentTextColor:(null===(Ct=t.messages)||void 0===Ct?void 0:Ct.agentTextColor)||(null===(Qt=t.messages)||void 0===Qt?void 0:Qt.textColor)||"#1F2937",userAvatarIcon:(null===(St=t.messages)||void 0===St?void 0:St.userAvatarIcon)||"👤",agentAvatarIcon:(null===(Ft=t.messages)||void 0===Ft?void 0:Ft.agentAvatarIcon)||"🤖",fontSize:(null===(Ut=t.messages)||void 0===Ut?void 0:Ut.fontSize)||"14px",borderRadius:(null===(Et=t.messages)||void 0===Et?void 0:Et.borderRadius)||16},t.messages),animation:iA({enableHover:!1!==(null===(kt=t.animation)||void 0===kt?void 0:kt.enableHover),enablePulse:!1!==(null===(It=t.animation)||void 0===It?void 0:It.enablePulse),enableSlide:!1!==(null===(Tt=t.animation)||void 0===Tt?void 0:Tt.enableSlide),duration:(null===(Ht=t.animation)||void 0===Ht?void 0:Ht.duration)||.3},t.animation),promptAnimation:iA({enabled:!0===(null===(_t=t.promptAnimation)||void 0===_t?void 0:_t.enabled),text:(null===(Dt=t.promptAnimation)||void 0===Dt?void 0:Dt.text)||"Try me!",backgroundColor:(null===(Mt=t.promptAnimation)||void 0===Mt?void 0:Mt.backgroundColor)||"linear-gradient(135deg, #7c3aed, #4f46e5)",textColor:(null===(Pt=t.promptAnimation)||void 0===Pt?void 0:Pt.textColor)||"#ffffff",animationType:(null===(Lt=t.promptAnimation)||void 0===Lt?void 0:Lt.animationType)||"bounce",showShimmer:!1!==(null===(Rt=t.promptAnimation)||void 0===Rt?void 0:Rt.showShimmer),showPulseRings:!1!==(null===(Kt=t.promptAnimation)||void 0===Kt?void 0:Kt.showPulseRings),hideAfterClick:!1!==(null===(Ot=t.promptAnimation)||void 0===Ot?void 0:Ot.hideAfterClick),hideAfterSeconds:void 0!==(null===(Vt=t.promptAnimation)||void 0===Vt?void 0:Vt.hideAfterSeconds)?t.promptAnimation.hideAfterSeconds:null,position:(null===(Nt=t.promptAnimation)||void 0===Nt?void 0:Nt.position)||"top"},t.promptAnimation),behavior:iA({autoOpen:(null===(jt=t.behavior)||void 0===jt?void 0:jt.autoOpen)||!1,startOpen:(null===(Gt=t.behavior)||void 0===Gt?void 0:Gt.startOpen)||!1,hidden:(null===(zt=t.behavior)||void 0===zt?void 0:zt.hidden)||!1,autoConnect:(null===(Wt=t.behavior)||void 0===Wt?void 0:Wt.autoConnect)||!1,showWelcomeMessage:!1!==(null===(qt=t.behavior)||void 0===qt?void 0:qt.showWelcomeMessage),welcomeMessage:(null===(Xt=t.behavior)||void 0===Xt?void 0:Xt.welcomeMessage)||"Hello! How can I help you today?",enableVoiceMode:void 0===(null===(Yt=t.behavior)||void 0===Yt?void 0:Yt.enableVoiceMode)||t.behavior.enableVoiceMode,mode:(null===(Jt=t.behavior)||void 0===Jt?void 0:Jt.mode)||"unified"},t.behavior),accessibility:iA({ariaLabel:(null===(Zt=t.accessibility)||void 0===Zt?void 0:Zt.ariaLabel)||"Chat Assistant",ariaDescription:(null===($t=t.accessibility)||void 0===$t?void 0:$t.ariaDescription)||"Click to open chat assistant",keyboardNavigation:!1!==(null===(te=t.accessibility)||void 0===te?void 0:te.keyboardNavigation)},t.accessibility),customStyles:t.customStyles||"",useShadowDOM:!1!==t.useShadowDOM,variables:t.variables||{},forceConversationId:t.forceConversationId,visualAssistant:t.visualAssistant,flavor:t.flavor&&"object"==typeof t.flavor?t.flavor:null,onConversationStart:t.onConversationStart,onConversationEnd:t.onConversationEnd,onBargeIn:t.onBargeIn,onAudioStartPlaying:t.onAudioStartPlaying,onAudioStoppedPlaying:t.onAudioStoppedPlaying,onSubtitleDisplay:t.onSubtitleDisplay,onVoiceCallButtonClick:t.onVoiceCallButtonClick,primaryColor:Ae},"string"==typeof t.position?{positionString:t.position}:{})}setupEventHandlers(){this.sdk.on("domainError",t=>{this.textInterface.showError(t),this.textInterface.stopStreamingState()}),this.sdk.on("error",t=>{t&&("DOMAIN_NOT_WHITELISTED"===t.message||t.message&&t.message.includes("Domain not whitelisted"))||(this.textInterface.showError(t.message||t),this.textInterface.stopStreamingState())}),this.sdk.on("chunk",t=>{this.textInterface.appendStreamingChunk(t)}),this.sdk.on("done",t=>{var{text:e}=t;this.textInterface.finalizeStreaming(e)})}createShadowHost(){var t=document.getElementById("ttp-widget-shadow-host");t&&t.remove();var e=document.createElement("div");e.id="ttp-widget-shadow-host",e.style.cssText="position: fixed; z-index: 10000; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; overflow: visible;",e.setAttribute("dir",this.getEffectiveTextDirection()),this.shadowRoot=e.attachShadow({mode:"open"}),document.body.appendChild(e)}createRegularContainer(){var t=document.getElementById("ttp-widget-container");t&&t.remove();var e=document.createElement("div");e.id="ttp-widget-container",e.style.cssText="position: fixed; z-index: 10000; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; overflow: visible;",e.setAttribute("dir",this.getEffectiveTextDirection()),document.body.appendChild(e),this.regularContainer=e}createWidget(){this.container||(this.config.useShadowDOM?(this.createShadowHost(),this.container=this.shadowRoot):(this.createRegularContainer(),this.container=this.regularContainer,this.shadowRoot=document));var t,e=!1===this.config.useShadowDOM?" !important":"";t=this.config.useShadowDOM?"\n :host {\n all: initial".concat(e,";\n display: block").concat(e,";\n pointer-events: none").concat(e,";\n }\n img {\n max-width: none !important;\n }\n #text-chat-button img {\n width: 22px !important;\n height: 22px !important;\n }\n #text-chat-button {\n pointer-events: auto").concat(e,";\n }\n #text-chat-panel {\n pointer-events: auto").concat(e,";\n }\n .ttp-mobile-fab {\n pointer-events: auto").concat(e,";\n }\n #ttpMobileLanding {\n pointer-events: auto").concat(e,";\n }\n "):"\n /* Reset only problematic inherited styles, not all styles */\n #text-chat-button,\n #text-chat-panel,\n #text-chat-panel * {\n box-sizing: border-box".concat(e,';\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif').concat(e,";\n }\n \n /* Theme often sets img { max-width: 100% } which squashes widget art.\n Do NOT set width/height: auto on all #text-chat-panel img — that uses\n !important and overrides ecommerce card images (.ttp-product-image img\n needs width/height 100% + object-fit), which shows as empty/blank tiles. */\n #text-chat-panel img {\n max-width: none").concat(e,";\n }\n \n #text-chat-button img {\n max-width: none").concat(e,";\n width: 22px !important;\n height: 22px !important;\n }\n \n /* Ensure button and panel can receive clicks */\n #text-chat-button,\n #text-chat-panel,\n .ttp-mobile-fab,\n #ttpMobileLanding {\n pointer-events: auto").concat(e,";\n }\n \n /* Reset any inherited text styles that might break layout */\n #text-chat-panel {\n text-align: left").concat(e,";\n line-height: normal").concat(e,";\n letter-spacing: normal").concat(e,";\n word-spacing: normal").concat(e,";\n text-transform: none").concat(e,";\n text-indent: 0").concat(e,";\n text-shadow: none").concat(e,";\n white-space: normal").concat(e,";\n }\n \n /* Flex layout for shell only — do NOT force display on .voice-interface /\n .text-interface: #text-chat-panel + class beats component rules and keeps\n both visible (breaks Shopify / useShadowDOM: false). */\n #text-chat-panel .widget-shell,\n #text-chat-panel .panel-inner,\n #text-chat-panel .widget-container,\n #text-chat-panel .widget-header {\n display: flex").concat(e,";\n }\n \n #text-chat-panel .widget-shell,\n #text-chat-panel .panel-inner,\n #text-chat-panel .widget-container {\n flex-direction: column").concat(e,";\n }\n \n /* Ensure proper stacking */\n #text-chat-button {\n z-index: 10001 !important;\n }\n \n #text-chat-panel {\n z-index: 10000 !important;\n }\n ");var n=this.generateWidgetHTML();if(this.config.useShadowDOM){var A="\n <style>".concat(t,"</style>\n ").concat(n,"\n ");this.shadowRoot.innerHTML=A}else this.injectStylesIntoHead(t),this.container.innerHTML=n;if(this.setupWidgetEvents(),window.innerWidth>768){var o,i=(null===(o=this.config.behavior)||void 0===o?void 0:o.mode)||"unified";("unified"===i||"voice-only"===i)&&"text"!==this.currentView&&this.showVoice()}var r=this.shadowRoot.getElementById("text-chat-panel");if(r)if(this.config.behavior.startOpen||this.config.behavior.autoOpen)if(window.innerWidth<=768){var a,s,c=null===(a=this.shadowRoot)||void 0===a?void 0:a.querySelector(".ttp-mobile-fab"),l=null===(s=this.shadowRoot)||void 0===s?void 0:s.getElementById("ttpMobileLanding");c&&l&&(c.style.display="none",l.classList.add("active"),this.isMobileLandingOpen=!0),this.hidePrompt()}else this.isOpen=!0,r.classList.add("open"),this.hidePrompt();else this.showPrompt();else setTimeout(()=>{this.showPrompt()},100);setTimeout(()=>{this.isOpen?this.hidePrompt():this.showPrompt()},200)}injectStylesIntoHead(t){var e,n,A=document.getElementById("ttp-widget-styles");A&&A.remove();var o={small:50,medium:60,large:70,xl:80}[null===(e=this.config.button)||void 0===e?void 0:e.size]||60,i={small:20,medium:28,large:36,xl:44}[null===(n=this.config.icon)||void 0===n?void 0:n.size]||28,r=this.generatePositionStyles(),a=this.generateCSS(r,o,i),s=document.createElement("style");s.id="ttp-widget-styles",s.textContent=t+"\n"+a,this.config.customStyles&&(s.textContent+="\n"+this.config.customStyles),document.head.appendChild(s)}generateWidgetHTML(){this.config.position;var t,e=this.config.button,n=this.config.icon,A=(this.config.panel,this.config.header),o=(this.config.animation,{small:50,medium:60,large:70,xl:80}[e.size]||60),i={small:20,medium:28,large:36,xl:44}[n.size]||28,r=this.generatePositionStyles(),a=(null===(t=this.config.behavior)||void 0===t?void 0:t.mode)||"unified",s="unified"===a||"voice-only"===a,c="unified"===a||"text-only"===a,l=t=>{var e=this.config.language||"en";return(this.translations[e]||this.translations.en)[t]||t},d=this.config.useShadowDOM?"\n <style>\n ".concat(this.generateCSS(r,o,i),"\n ").concat(this.config.customStyles,"\n </style>\n "):"",p=this.config.promptAnimation||{},u=!0===p.enabled,h=u?this.generatePromptBubbleHTML(p,o):"";console.log("📝 generateWidgetHTML - promptAnimation:",{hasConfig:!!this.config.promptAnimation,promptConfig:p,enabled:p.enabled,isPromptEnabled:u,willGenerateHTML:!!h});var g=null!=A.pillTitle&&""!==String(A.pillTitle).trim()?String(A.pillTitle).trim():A.title||"Assistant",m=null!=A.mobileLabel&&""!==String(A.mobileLabel).trim()?String(A.mobileLabel).trim():g,v=null!=this.config.agentName&&""!==String(this.config.agentName).trim()?String(this.config.agentName).trim():A.title||"Chat Assistant",f=null!=n.customImage&&""!==String(n.customImage).trim()?String(n.customImage).trim():null,w=f?'<img class="ttp-launcher-logo" src="'.concat(f,'" alt="" />'):'<div class="ttp-pill-waveform" aria-hidden="true">'.concat('<span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span>',"</div>"),B=f?"ttp-pill-icon":"ttp-pill-icon ttp-pill-icon--wave";return"\n ".concat(d,"\n \n ").concat(this.config.behavior.hidden?"":'\n <div id="text-chat-button-container">\n '.concat(h,"\n ").concat(u&&!1!==p.showPulseRings?this.generatePulseRingsHTML(p):"",'\n \x3c!-- Desktop pill launcher (hidden on mobile) --\x3e\n <button type="button" id="text-chat-button" aria-label="Open chat with ').concat(g,'">\n <div class="').concat(B,'">\n ').concat(w,'\n </div>\n <div class="ttp-pill-text">\n <span class="ttp-pill-title">').concat(g,'</span>\n <span class="ttp-pill-status">\n <span class="ttp-launcher-dot"></span>\n ').concat(void 0!==A.onlineIndicatorText&&null!==A.onlineIndicatorText?A.onlineIndicatorText:l("online"),'\n </span>\n </div>\n </button>\n \x3c!-- Mobile FAB (hidden on desktop) --\x3e\n <button class="ttp-mobile-fab" aria-label="').concat(this.config.accessibility.ariaLabel,'">\n <div class="ttp-mobile-fab__icon-wrap">\n <div class="ttp-mobile-fab__waveform">\n <span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span>\n </div>\n </div>\n <div class="ttp-mobile-fab__label-wrap">\n <span class="ttp-mobile-fab__label">').concat(m,'</span>\n <span class="ttp-mobile-fab__status">\n <span class="ttp-mobile-fab__dot"></span>\n ').concat(void 0!==A.onlineIndicatorText&&null!==A.onlineIndicatorText?A.onlineIndicatorText:l("online"),"\n </span>\n </div>\n </button>\n </div>\n "),"\n\n ").concat(this.config.behavior.hidden?"":'\n <div id="ttpMobileLanding" class="ttp-mobile-landing">\n <div class="ttp-mobile-landing__header">\n <div class="ttp-mobile-landing__avatar">\n <div class="ttp-mobile-landing__waveform">\n <span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span>\n </div>\n </div>\n <div class="ttp-mobile-landing__info">\n <div class="ttp-mobile-landing__name">'.concat(v,'</div>\n <div class="ttp-mobile-landing__status">\n <span class="ttp-mobile-landing__dot"></span>\n ').concat(this.config.landing.statusText||l("online")+" • "+(this.config.landing.subtitle||"Ready to help"),'\n </div>\n </div>\n <button class="ttp-mobile-landing__close" aria-label="Close">\n <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>\n </svg>\n </button>\n </div>\n <div class="ttp-mobile-landing__error" id="ttpMobileLandingError" style="display:none;">\n <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">\n <circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>\n </svg>\n <span class="ttp-mobile-landing__error-text"></span>\n </div>\n <div class="ttp-mobile-landing__actions">\n ').concat(s?'\n <button class="ttp-mobile-landing__btn ttp-mobile-landing__btn--call" id="ttpMobileCallBtn">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z"/>\n </svg>\n '.concat(this.config.landing.callButtonText||this.config.landing.voiceCardTitle||l("voiceCall"),"\n </button>\n "):"","\n ").concat(c?'\n <button class="ttp-mobile-landing__btn ttp-mobile-landing__btn--text" id="ttpMobileChatBtn">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>\n </svg>\n '.concat(this.config.landing.chatButtonText||this.config.landing.textCardTitle||l("textChat"),"\n </button>\n "):"","\n </div>\n ").concat(!1!==this.config.footer.show?'\n <div class="ttp-mobile-landing__footer">\n <div class="ttp-mobile-landing__powered">\n <svg viewBox="0 0 24 24" fill="currentColor" width="10" height="10">\n <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>\n </svg>\n Powered by <a href="https://talktopc.com" target="_blank" rel="noopener">TalkToPC</a>\n </div>\n </div>\n ':"","\n </div>\n "),'\n \n <div id="text-chat-panel">\n <div class="widget-shell">\n <div class="panel-inner widget-container" style="direction: ').concat(this.config.direction,';">\n\n ').concat(s?this.voiceInterface.generateHTML():"","\n ").concat(c?this.textInterface.generateHTML():"","\n ").concat(this.generateFooterHTML(),"\n </div>\n </div>\n </div>\n ")}generateFooterHTML(){if(!this.config.footer.show)return"";var t=encodeURIComponent(window.location.hostname||"widget"),e="https://talktopc.com?ref=widget&source=".concat(t);return'\n <div class="widget-footer ttp-footer">\n <span>Powered by <a href="'.concat(e,'" target="_blank" rel="noopener noreferrer"><b>TalkToPC</b></a></span>\n </div>\n ')}generatePositionStyles(){var t=this.config.position,e=t.offset||{x:20,y:20},n="";return"top"===t.vertical?n+="top: ".concat(e.y,"px;"):"bottom"===t.vertical?n+="bottom: ".concat(e.y,"px;"):"center"===t.vertical&&(n+="top: 50%; transform: translateY(-50%);"),"left"===t.horizontal?n+="left: ".concat(e.x,"px;"):"right"===t.horizontal?n+="right: ".concat(e.x,"px;"):"center"===t.horizontal&&(n+="left: 50%; transform: translateX(-50%);"),n}generateIconHTML(t){var e=this.config.icon;switch(e.type){case"custom":return null!=e.customImage&&""!==String(e.customImage).trim()?'<img src="'.concat(e.customImage,'" alt="Chat Assistant" style="width: ').concat(t,"px; height: ").concat(t,'px; object-fit: contain;" />'):'<div class="ttp-pill-waveform" aria-hidden="true"><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="bar"></span></div>';case"emoji":return'<span style="font-size: '.concat(t,'px; line-height: 1;">').concat(e.emoji,"</span>");case"text":return'<span style="font-size: '.concat(Math.floor(.6*t),'px; font-weight: bold; color: white;">').concat(e.text,"</span>");case"microphone":default:return'<svg viewBox="0 0 24 24" style="width: '.concat(t,"px; height: ").concat(t,'px; fill: white;">\n <path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/>\n <path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/>\n </svg>');case"chat":return'<svg viewBox="0 0 24 24" style="width: '.concat(t,"px; height: ").concat(t,'px; fill: white;">\n <path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"/>\n </svg>')}}generatePromptBubbleHTML(t,e){var n="#7c3aed";if(t.backgroundColor&&t.backgroundColor.includes("gradient")){var A=t.backgroundColor.match(/#[0-9a-fA-F]{6}/);A&&(n=A[0])}else n=t.backgroundColor;var o="none"===t.animationType?"":"animation-".concat(t.animationType),i=t.showShimmer?'<div class="prompt-bubble-shimmer"></div>':"";return'\n <div class="prompt-bubble '.concat(t.position," ").concat(o,'" \n id="prompt-bubble"\n role="tooltip"\n style="--prompt-bubble-bg-color: ').concat(n,';">\n <div class="prompt-bubble-content" \n style="background: ').concat(t.backgroundColor,"; color: ").concat(t.textColor,';">\n ').concat(i,'\n <span style="position: relative; z-index: 1;">').concat(t.text,'</span>\n </div>\n <div class="prompt-bubble-arrow"></div>\n </div>\n ')}generatePulseRingsHTML(t){var e="#7c3aed";if(t.backgroundColor&&t.backgroundColor.includes("gradient")){var n=t.backgroundColor.match(/#[0-9a-fA-F]{6}/);n&&(e=n[0])}else e=t.backgroundColor;return'\n <div class="prompt-pulse-rings" id="prompt-pulse-rings">\n <div class="prompt-pulse-ring" style="background-color: '.concat(e,'33;"></div>\n <div class="prompt-pulse-ring" style="background-color: ').concat(e,'1a;"></div>\n </div>\n ')}generateCSS(t,e,n){this.config.button,this.config.icon;var A,o,i,r,a,s=this.config.panel,c=this.config.header,l=(this.config.messages,this.config.animation),d=(null===(A=this.config.behavior)||void 0===A?void 0:A.mode)||"unified",p="unified"===d||"voice-only"===d,u="unified"===d||"text-only"===d,h=!1===this.config.useShadowDOM?" !important":"",g=this.config.voice||{},m=g.pillGradient||"linear-gradient(135deg, #581c87, #312e81, #1e1b4b)",v=g.pillTextColor||"#ffffff",f=g.pillDotColor||"#4ade80",w=s.backgroundColor||"#16161e",B=sA(w),b=B?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.35)",y=cA(B,g,this._rawConfig,p),x=B?"rgba(0,0,0,0.08)":"rgba(255,255,255,0.06)",C=g.heroGradient1||"#2a2550",Q=g.heroGradient2||"#1a1a2e",S="linear-gradient(160deg, ".concat(C," 0%, ").concat(Q," 100%)"),F='#voiceInterface.active #voiceIdleState:not([style*="display: none"]):not([style*="display:none"])',U='#voiceInterface.active #voiceActiveState:not([style*="display: none"]):not([style*="display:none"])';return'\n /* Inline style display overrides - ensures JS show/hide works with !important CSS */\n #text-chat-panel [style*="display: none"],\n #text-chat-panel [style*="display:none"],\n #text-chat-button-container [style*="display: none"],\n #text-chat-button-container [style*="display:none"],\n #ttpMobileLanding[style*="display: none"],\n #ttpMobileLanding[style*="display:none"] {\n display: none !important;\n }\n #text-chat-panel [style*="display: flex"],\n #text-chat-panel [style*="display:flex"],\n #text-chat-button-container [style*="display: flex"],\n #text-chat-button-container [style*="display:flex"] {\n display: flex !important;\n }\n #text-chat-panel [style*="display: block"],\n #text-chat-panel [style*="display:block"] {\n display: block !important;\n }\n\n /* MOBILE FIRST - Default styles for all devices */\n #text-chat-widget {\n position: fixed !important;\n z-index: 10000'.concat(h,';\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif').concat(h,";\n /* Mobile defaults */\n right: 10px").concat(h,";\n bottom: 10px").concat(h,";\n left: auto").concat(h,";\n top: auto").concat(h,";\n }\n \n /* Desktop positioning (only on larger screens) */\n @media (min-width: 769px) {\n #text-chat-widget {\n ").concat(t,"\n right: ").concat("right"===this.config.position.horizontal?"20px":"auto").concat(h,";\n left: ").concat("left"===this.config.position.horizontal?"20px":"auto").concat(h,";\n bottom: ").concat("bottom"===this.config.position.vertical?"20px":"auto").concat(h,";\n top: ").concat("top"===this.config.position.vertical?"20px":"auto").concat(h,";\n }\n }\n \n /* Mobile override (force mobile positioning) */\n @media (max-width: 768px) {\n #text-chat-widget {\n right: 10px !important;\n bottom: 10px !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n }\n }\n \n @media (max-width: 480px) {\n #text-chat-widget {\n right: 8px !important;\n bottom: 8px !important;\n left: auto !important;\n top: auto !important;\n }\n }\n \n /* ── Desktop Pill Launcher ── */\n #text-chat-button {\n position: relative").concat(h,";\n display: flex").concat(h,";\n align-items: center").concat(h,";\n gap: 8px").concat(h,";\n padding-block: 10px").concat(h,";\n padding-inline-start: 6px").concat(h,";\n padding-inline-end: 12px").concat(h,";\n z-index: 1").concat(h,";\n background: ").concat(m,";\n border: 1px solid rgba(139,92,246,0.15)").concat(h,";\n border-radius: 999px").concat(h,";\n box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.15)").concat(h,";\n cursor: pointer").concat(h,";\n transition: box-shadow 0.25s, transform 0.2s, padding 0.3s, gap 0.3s").concat(h,";\n font-family: inherit").concat(h,";\n color: ").concat(v,";\n overflow: hidden").concat(h,";\n box-sizing: border-box").concat(h,";\n flex-shrink: 0").concat(h,";\n }\n #text-chat-button:hover {\n transform: translateY(-1px)").concat(h,";\n box-shadow: 0 10px 40px rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.2)").concat(h,";\n }\n #text-chat-button.open {\n gap: 0px").concat(h,";\n padding: 9px").concat(h,";\n width: auto").concat(h,";\n min-width: 0").concat(h,";\n max-width: none").concat(h,";\n }\n\n @media (min-width: 769px) {\n #text-chat-button {\n width: 158px").concat(h,";\n min-width: 158px").concat(h,";\n max-width: 158px").concat(h,";\n }\n }\n\n .ttp-pill-icon {\n width: 36px").concat(h,"; height: 36px").concat(h,"; border-radius: 50%").concat(h,";\n background: #ffffff").concat(h,";\n display: flex").concat(h,"; align-items: center").concat(h,"; justify-content: center").concat(h,";\n flex-shrink: 0").concat(h,";\n }\n .ttp-launcher-logo {\n width: 22px").concat(h,"; height: 22px").concat(h,"; border-radius: 50%").concat(h,";\n object-fit: cover").concat(h,";\n }\n\n /* Default pill launcher: same animated waveform as mobile FAB / landing */\n .ttp-pill-icon--wave {\n background: rgba(255, 255, 255, 0.15)").concat(h,";\n }\n .ttp-pill-waveform {\n display: flex").concat(h,";\n align-items: center").concat(h,";\n gap: 2px").concat(h,";\n height: 16px").concat(h,";\n }\n .ttp-pill-waveform .bar {\n width: 2px").concat(h,";\n background: #fff").concat(h,";\n border-radius: 1px").concat(h,";\n animation: ttpWaveAnimation 0.8s ease-in-out infinite").concat(h,";\n }\n .ttp-pill-waveform .bar:nth-child(1) { height: 5px").concat(h,"; animation-delay: 0s").concat(h,"; }\n .ttp-pill-waveform .bar:nth-child(2) { height: 10px").concat(h,"; animation-delay: 0.1s").concat(h,"; }\n .ttp-pill-waveform .bar:nth-child(3) { height: 16px").concat(h,"; animation-delay: 0.2s").concat(h,"; }\n .ttp-pill-waveform .bar:nth-child(4) { height: 8px").concat(h,"; animation-delay: 0.3s").concat(h,"; }\n .ttp-pill-waveform .bar:nth-child(5) { height: 12px").concat(h,"; animation-delay: 0.4s").concat(h,"; }\n\n .ttp-pill-text {\n display: flex").concat(h,"; flex-direction: column").concat(h,"; gap: 2px").concat(h,";\n max-width: 82px").concat(h,";\n opacity: 1").concat(h,";\n overflow: hidden").concat(h,";\n white-space: nowrap").concat(h,";\n transition: max-width 0.3s, opacity 0.2s").concat(h,";\n }\n #text-chat-button.open .ttp-pill-text {\n max-width: 0").concat(h,";\n opacity: 0").concat(h,";\n }\n .ttp-pill-title {\n font-size: 13px").concat(h,"; font-weight: 600").concat(h,"; color: ").concat(v,";\n line-height: 1.25").concat(h,";\n overflow: hidden").concat(h,";\n text-overflow: ellipsis").concat(h,";\n }\n .ttp-pill-status {\n display: flex").concat(h,"; align-items: center").concat(h,"; gap: 4px").concat(h,";\n font-size: 11px").concat(h,"; color: ").concat(v,"8c;\n line-height: 1.25").concat(h,";\n }\n\n /* Online dot (inside pill status) */\n .ttp-launcher-dot {\n width: 7px").concat(h,"; height: 7px").concat(h,"; border-radius: 50%").concat(h,";\n background: ").concat(f,";\n flex-shrink: 0").concat(h,";\n animation: ttp-dot-pulse 2s ease-in-out infinite").concat(h,";\n }\n @keyframes ttp-dot-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }\n \n @media (max-width: 768px) {\n #text-chat-widget {\n right: 10px !important;\n bottom: 10px !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n }\n \n #text-chat-button-container {\n width: auto !important;\n height: auto !important;\n }\n \n #text-chat-panel {\n position: fixed !important;\n left: 10px !important;\n right: 10px !important;\n bottom: 92px !important; /* 56px button + 20px gap + 16px footer */\n top: 60px !important; /* Add top spacing */\n width: auto !important;\n max-width: none !important;\n height: auto !important; /* Change from max-height to auto */\n max-height: none !important; /* Remove max-height */\n transform: none !important;\n margin: 0 !important;\n }\n \n #text-chat-panel .widget-header {\n padding: 10px 14px").concat(h,";\n min-height: 56px").concat(h,";\n }\n \n #text-chat-panel .header-title {\n font-size: 15px").concat(h,";\n }\n \n #text-chat-panel .header-icon {\n width: 40px").concat(h,";\n height: 40px").concat(h,";\n min-width: 40px").concat(h,";\n min-height: 40px").concat(h,";\n }\n \n #text-chat-input {\n font-size: 16px !important; /* Prevents iOS zoom on focus */\n padding: 12px 16px !important;\n min-height: 48px !important;\n }\n \n #text-chat-send {\n min-width: 48px !important;\n min-height: 48px !important;\n width: 48px !important;\n height: 48px !important;\n }\n \n }\n \n @media (max-width: 480px) {\n #text-chat-widget {\n right: 8px !important;\n bottom: 8px !important;\n left: auto !important;\n top: auto !important;\n }\n \n #text-chat-button-container {\n width: auto !important;\n height: auto !important;\n }\n \n #text-chat-panel {\n left: 8px !important;\n right: 8px !important;\n bottom: 86px !important; /* 54px button + 20px gap + 12px footer */\n top: 50px !important; /* Add top spacing for very small screens */\n height: auto !important;\n max-height: none !important;\n }\n \n #text-chat-panel .widget-header {\n padding: 8px 12px").concat(h,";\n min-height: 52px").concat(h,";\n }\n \n #text-chat-panel .header-title {\n font-size: 14px").concat(h,";\n }\n \n }\n \n ").concat(l.enableHover?"\n #text-chat-button:hover {\n transform: translateY(-1px);\n }\n ":"","\n \n /* Prompt Animation Keyframes */\n @keyframes widget-shimmer {\n 0% { transform: translateX(-100%); }\n 100% { transform: translateX(200%); }\n }\n \n @keyframes widget-ripple {\n 0% { transform: scale(1); opacity: 0.6; }\n 100% { transform: scale(2.5); opacity: 0; }\n }\n \n @keyframes widget-float {\n 0%, 100% { transform: translateX(-50%) translateY(0); }\n 50% { transform: translateX(-50%) translateY(-8px); }\n }\n \n @keyframes widget-bounce {\n 0%, 100% { transform: translateX(-50%) translateY(0); }\n 50% { transform: translateX(-50%) translateY(-10px); }\n }\n \n @keyframes widget-pulse-ring {\n 0% { transform: scale(1); opacity: 0.4; }\n 100% { transform: scale(1.8); opacity: 0; }\n }\n \n /* Prompt Bubble Container */\n #text-chat-button-container {\n position: fixed").concat(h,";\n ").concat("bottom"===this.config.position.vertical?"bottom: ".concat((null===(o=this.config.position.offset)||void 0===o?void 0:o.y)||20,"px;"):"top: ".concat((null===(i=this.config.position.offset)||void 0===i?void 0:i.y)||20,"px;"),"\n ").concat("right"===this.config.position.horizontal?"right: ".concat((null===(r=this.config.position.offset)||void 0===r?void 0:r.x)||20,"px;"):"left: ".concat((null===(a=this.config.position.offset)||void 0===a?void 0:a.x)||20,"px;"),"\n width: auto").concat(h,";\n height: auto").concat(h,";\n z-index: 10001").concat(h,";\n display: flex").concat(h,";\n align-items: center").concat(h,";\n justify-content: center").concat(h,";\n }\n \n @media (max-width: 768px) {\n #text-chat-button-container {\n right: 10px !important;\n bottom: 10px !important;\n left: auto !important;\n top: auto !important;\n }\n }\n \n @media (max-width: 480px) {\n #text-chat-button-container {\n right: 8px !important;\n bottom: 8px !important;\n left: auto !important;\n top: auto !important;\n }\n }\n \n /* Prompt Bubble Styles */\n .prompt-bubble {\n position: absolute").concat(h,";\n z-index: 10002").concat(h,";\n pointer-events: none").concat(h,";\n white-space: nowrap").concat(h,";\n }\n \n .prompt-bubble.top {\n bottom: calc(100% + 18px)").concat(h,";\n left: 50%").concat(h,";\n transform: translateX(-50%)").concat(h,";\n }\n \n .prompt-bubble.left {\n right: calc(100% + 12px)").concat(h,";\n top: 50%").concat(h,";\n transform: translateY(-50%)").concat(h,";\n }\n \n .prompt-bubble.right {\n left: calc(100% + 12px)").concat(h,";\n top: 50%").concat(h,";\n transform: translateY(-50%)").concat(h,";\n }\n \n /* Ensure animations preserve horizontal centering for top position */\n .prompt-bubble.top.animation-bounce {\n animation: widget-bounce 1s ease-in-out infinite").concat(h,";\n transform: translateX(-50%)").concat(h,"; /* Keep centering */\n }\n \n .prompt-bubble.top.animation-float {\n animation: widget-float 2s ease-in-out infinite").concat(h,";\n transform: translateX(-50%)").concat(h,"; /* Keep centering */\n }\n \n .prompt-bubble.top.animation-pulse {\n animation: pulse 2s ease-in-out infinite").concat(h,";\n transform: translateX(-50%)").concat(h,"; /* Keep centering */\n }\n \n .prompt-bubble-content {\n position: relative").concat(h,";\n padding: 8px 16px").concat(h,";\n border-radius: 20px").concat(h,";\n font-weight: 500").concat(h,";\n font-size: 14px").concat(h,";\n box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3)").concat(h,";\n overflow: hidden").concat(h,";\n }\n \n .prompt-bubble-shimmer {\n position: absolute").concat(h,";\n inset: 0").concat(h,";\n background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent)").concat(h,";\n animation: widget-shimmer 2s infinite").concat(h,";\n }\n \n .prompt-bubble.animation-bounce {\n animation: widget-bounce 1s ease-in-out infinite").concat(h,";\n }\n \n .prompt-bubble.animation-pulse {\n animation: pulse 2s ease-in-out infinite").concat(h,";\n }\n \n .prompt-bubble.animation-float {\n animation: widget-float 2s ease-in-out infinite").concat(h,";\n }\n \n /* Ensure top-positioned bubbles maintain horizontal centering during animations */\n .prompt-bubble.top.animation-bounce,\n .prompt-bubble.top.animation-float,\n .prompt-bubble.top.animation-pulse {\n /* Animation keyframes already include translateX(-50%) for centering */\n }\n \n /* Prompt Bubble Arrow */\n .prompt-bubble-arrow {\n position: absolute").concat(h,";\n width: 0").concat(h,";\n height: 0").concat(h,";\n border: 8px solid transparent").concat(h,";\n }\n \n .prompt-bubble.top .prompt-bubble-arrow {\n top: 100%").concat(h,";\n left: 50%").concat(h,";\n transform: translateX(-50%)").concat(h,";\n border-top-color: var(--prompt-bubble-bg-color, #7c3aed)").concat(h,";\n border-bottom: none").concat(h,";\n margin-left: 0").concat(h,";\n }\n \n .prompt-bubble.left .prompt-bubble-arrow {\n left: 100%").concat(h,";\n top: 50%").concat(h,";\n transform: translateY(-50%)").concat(h,";\n border-left-color: var(--prompt-bubble-bg-color, #7c3aed)").concat(h,";\n border-right: none").concat(h,";\n }\n \n .prompt-bubble.right .prompt-bubble-arrow {\n right: 100%").concat(h,";\n top: 50%").concat(h,";\n transform: translateY(-50%)").concat(h,";\n border-right-color: var(--prompt-bubble-bg-color, #7c3aed)").concat(h,";\n border-left: none").concat(h,";\n }\n \n /* Pulse Rings */\n .prompt-pulse-rings {\n position: absolute").concat(h,";\n inset: 0").concat(h,";\n border-radius: 50%").concat(h,";\n pointer-events: none").concat(h,";\n }\n \n .prompt-pulse-ring {\n position: absolute").concat(h,";\n inset: 0").concat(h,";\n border-radius: 50%").concat(h,";\n animation: widget-pulse-ring 2s ease-out infinite").concat(h,";\n }\n \n .prompt-pulse-ring:nth-child(2) {\n animation-delay: 0.5s").concat(h,";\n }\n \n /* Mobile adjustments for prompt bubble */\n @media (max-width: 768px) {\n .prompt-bubble-content {\n font-size: 12px").concat(h,";\n padding: 6px 12px").concat(h,";\n }\n \n .prompt-bubble.top {\n bottom: calc(100% + 14px)").concat(h,";\n }\n \n .prompt-bubble.left,\n .prompt-bubble.right {\n display: none").concat(h,"; /* Hide side prompts on mobile */\n }\n }\n \n #text-chat-panel {\n display: none").concat(h,";\n position: fixed").concat(h,";\n bottom: calc(54px + 24px)").concat(h,"; /* launcher pill + gap */\n ").concat("right"===this.config.position.horizontal?"right: 20px;":"left: 20px;","\n width: 340px").concat(h,";\n max-width: calc(100vw - 40px)").concat(h,";\n height: auto").concat(h,";\n max-height: calc(100vh - 100px)").concat(h,";\n background: ").concat(w,";\n border-radius: 20px").concat(h,";\n border: ").concat(s.border||"1px solid rgba(255,255,255,0.08)",";\n flex-direction: column").concat(h,";\n overflow: hidden").concat(h,";\n box-shadow: 0 24px 60px rgba(0,0,0,0.6)").concat(h,";\n transform-origin: bottom right").concat(h,";\n opacity: 0").concat(h,";\n pointer-events: none").concat(h,";\n box-sizing: border-box").concat(h,";\n }\n \n #text-chat-panel.open {\n display: flex").concat(h,";\n opacity: 1").concat(h,";\n pointer-events: auto").concat(h,";\n }\n\n /* Shell for panel inner */\n .widget-shell { width: 100%").concat(h,"; padding: 0").concat(h,"; border-radius: 20px").concat(h,"; background: transparent").concat(h,"; overflow: hidden").concat(h,"; display: flex").concat(h,"; flex-direction: column").concat(h,"; box-sizing: border-box").concat(h,"; flex: 1").concat(h,"; min-height: 0").concat(h,"; }\n .panel-inner { width: 100%").concat(h,"; background: ").concat(w,"; border-radius: 20px").concat(h,"; border: none").concat(h,"; overflow: hidden").concat(h,"; display:flex").concat(h,"; flex-direction: column").concat(h,"; padding: 0").concat(h,"; box-sizing: border-box").concat(h,"; max-width: 100%").concat(h,"; flex: 1").concat(h,"; min-height: 0").concat(h,"; }\n\n #text-chat-panel .widget-container {\n width: 100%").concat(h,"; background: ").concat(w,"; overflow: visible").concat(h,"; display: flex").concat(h,"; flex-direction: column").concat(h,"; border-radius: 20px").concat(h,"; flex: 1").concat(h,"; min-height: 0").concat(h,";\n }\n\n /* Voice idle: one gradient for voice UI + footer (Powered by), not a flat strip under buttons */\n #text-chat-panel.open:has(").concat(F,") {\n background: linear-gradient(160deg, ").concat(C," 0%, ").concat(Q," 100%)").concat(h,";\n }\n #text-chat-panel .widget-container:has(").concat(F,") {\n background: linear-gradient(160deg, ").concat(C," 0%, ").concat(Q," 100%)").concat(h,";\n }\n\n /* Voice active call: same hero gradient as idle + mobile minimized bar */\n #text-chat-panel.open:has(").concat(U,") {\n background: ").concat(S).concat(h,";\n }\n #text-chat-panel .widget-container:has(").concat(U,") {\n background: ").concat(S).concat(h,";\n }\n #text-chat-panel.open:has(").concat(U,") .widget-shell {\n background: ").concat(S).concat(h,";\n }\n #text-chat-panel.open:has(").concat(U,") .panel-inner {\n background: ").concat(S).concat(h,";\n }\n #text-chat-panel.open:has(").concat(U,") .ttp-footer {\n background: ").concat(S).concat(h,";\n }\n \n /* Ensure content areas can scroll when height is constrained */\n #text-chat-panel .widget-container > .voice-interface,\n #text-chat-panel .widget-container > .text-interface {\n flex: 1").concat(h,";\n overflow-y: auto").concat(h,";\n overflow-x: visible").concat(h,"; /* Change from hidden to visible */\n }\n \n /* Header is removed in new design - hero serves as header */\n #text-chat-panel .widget-header { display: none").concat(h,"; }\n\n ").concat(p?this.voiceInterface.generateCSS():"","\n ").concat(u?this.textInterface.generateCSS():"","\n \n /* Footer Branding */\n .ttp-footer {\n padding: 6px 18px 10px").concat(h,";\n border-top: 1px solid ").concat(x,";\n display: flex").concat(h,";\n justify-content: center").concat(h,";\n flex-shrink: 0").concat(h,";\n box-sizing: border-box").concat(h,";\n background: transparent").concat(h,";\n }\n .ttp-footer span { font-size: 10px").concat(h,"; color: ").concat(b,"; }\n .ttp-footer a { color: ").concat(y,"; text-decoration: none").concat(h,"; font-weight: 600").concat(h,"; }\n .ttp-footer a:hover { opacity: 0.85").concat(h,"; }\n .ttp-footer a b { font-weight: 700").concat(h,"; }\n \n #text-chat-send-hint {\n text-align: center").concat(h,";\n line-height: 1.4").concat(h,";\n }\n \n .agent-thinking {\n font-style: italic").concat(h,";\n color: #6B7280").concat(h,";\n }\n\n /* ========================================\n MOBILE PILL BUTTON & LANDING OVERLAY\n Hidden on desktop, shown on mobile only\n ======================================== */\n .ttp-mobile-fab {\n display: none").concat(h,";\n }\n\n .ttp-mobile-landing {\n display: none").concat(h,";\n }\n\n @keyframes ttpWaveAnimation {\n 0%, 100% { transform: scaleY(0.4); }\n 50% { transform: scaleY(1); }\n }\n\n @keyframes ttpPulseAnimation {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n\n @media (max-width: 768px) {\n /* Hide desktop pill button on mobile */\n #text-chat-button {\n display: none !important;\n }\n\n /* Re-flow the container for pill shape */\n #text-chat-button-container {\n width: auto !important;\n height: auto !important;\n min-width: 0 !important;\n min-height: 0 !important;\n max-width: none !important;\n max-height: none !important;\n }\n\n /* Show mobile pill button */\n .ttp-mobile-fab {\n display: flex").concat(h,";\n align-items: center").concat(h,";\n gap: 10px").concat(h,";\n padding: 10px 16px 10px 12px").concat(h,";\n background: ").concat(m,";\n border: none").concat(h,";\n border-radius: 24px").concat(h,";\n cursor: pointer").concat(h,";\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3)").concat(h,";\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1)").concat(h,";\n z-index: 1").concat(h,";\n font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif").concat(h,";\n touch-action: manipulation").concat(h,";\n -webkit-tap-highlight-color: transparent").concat(h,";\n }\n\n .ttp-mobile-fab:hover {\n transform: translateY(-3px)").concat(h,";\n box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4)").concat(h,";\n }\n\n .ttp-mobile-fab__icon-wrap {\n width: 36px").concat(h,";\n height: 36px").concat(h,";\n border-radius: 50%").concat(h,";\n background: rgba(255, 255, 255, 0.15)").concat(h,";\n display: flex").concat(h,";\n align-items: center").concat(h,";\n justify-content: center").concat(h,";\n flex-shrink: 0").concat(h,";\n }\n\n .ttp-mobile-fab__waveform {\n display: flex").concat(h,";\n align-items: center").concat(h,";\n gap: 2px").concat(h,";\n height: 16px").concat(h,";\n }\n\n .ttp-mobile-fab__waveform .bar {\n width: 2px").concat(h,";\n background: #fff").concat(h,";\n border-radius: 1px").concat(h,";\n animation: ttpWaveAnimation 0.8s ease-in-out infinite").concat(h,";\n }\n\n .ttp-mobile-fab__waveform .bar:nth-child(1) { height: 5px").concat(h,"; animation-delay: 0s").concat(h,"; }\n .ttp-mobile-fab__waveform .bar:nth-child(2) { height: 10px").concat(h,"; animation-delay: 0.1s").concat(h,"; }\n .ttp-mobile-fab__waveform .bar:nth-child(3) { height: 16px").concat(h,"; animation-delay: 0.2s").concat(h,"; }\n .ttp-mobile-fab__waveform .bar:nth-child(4) { height: 8px").concat(h,"; animation-delay: 0.3s").concat(h,"; }\n .ttp-mobile-fab__waveform .bar:nth-child(5) { height: 12px").concat(h,"; animation-delay: 0.4s").concat(h,"; }\n\n .ttp-mobile-fab__label-wrap {\n display: flex").concat(h,";\n flex-direction: column").concat(h,";\n align-items: flex-start").concat(h,";\n gap: 1px").concat(h,";\n }\n\n .ttp-mobile-fab__label {\n color: ").concat(v,";\n font-size: 14px").concat(h,";\n font-weight: 600").concat(h,";\n line-height: 1.2").concat(h,";\n }\n\n .ttp-mobile-fab__status {\n display: flex").concat(h,";\n align-items: center").concat(h,";\n gap: 4px").concat(h,";\n font-size: 11px").concat(h,";\n color: ").concat(v,"b3;\n line-height: 1.2").concat(h,";\n }\n\n .ttp-mobile-fab__dot {\n width: 6px").concat(h,";\n height: 6px").concat(h,";\n background: ").concat(f,";\n border-radius: 50%").concat(h,";\n box-shadow: 0 0 6px ").concat(f,"99;\n }\n\n /* ---- Mobile Landing Overlay ---- */\n .ttp-mobile-landing.active {\n display: block").concat(h,";\n position: fixed").concat(h,";\n bottom: 16px").concat(h,";\n left: 12px").concat(h,";\n right: 12px").concat(h,";\n background: ").concat(m,";\n border-radius: 20px").concat(h,";\n overflow: hidden").concat(h,";\n box-shadow:\n 0 10px 40px rgba(0, 0, 0, 0.3),\n 0 0 0 1px rgba(255, 255, 255, 0.1) inset").concat(h,";\n z-index: 10002").concat(h,";\n font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif").concat(h,";\n }\n\n .ttp-mobile-landing::before {\n content: ''").concat(h,";\n position: absolute").concat(h,";\n top: 0").concat(h,";\n left: 0").concat(h,";\n right: 0").concat(h,";\n height: 1px").concat(h,";\n background: linear-gradient(90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.3) 50%,\n transparent 100%);\n }\n\n .ttp-mobile-landing__header {\n padding: 14px 16px").concat(h,";\n display: flex").concat(h,";\n align-items: center").concat(h,";\n gap: 12px").concat(h,";\n }\n\n .ttp-mobile-landing__avatar {\n width: 44px").concat(h,";\n height: 44px").concat(h,";\n border-radius: 12px").concat(h,";\n background: rgba(255, 255, 255, 0.15)").concat(h,";\n display: flex").concat(h,";\n align-items: center").concat(h,";\n justify-content: center").concat(h,";\n flex-shrink: 0").concat(h,";\n }\n\n .ttp-mobile-landing__waveform {\n display: flex").concat(h,";\n align-items: center").concat(h,";\n gap: 3px").concat(h,";\n height: 20px").concat(h,";\n }\n\n .ttp-mobile-landing__waveform .bar {\n width: 3px").concat(h,";\n background: rgba(255, 255, 255, 0.9)").concat(h,";\n border-radius: 2px").concat(h,";\n animation: ttpWaveAnimation 0.8s ease-in-out infinite").concat(h,";\n }\n\n .ttp-mobile-landing__waveform .bar:nth-child(1) { height: 6px").concat(h,"; animation-delay: 0s").concat(h,"; }\n .ttp-mobile-landing__waveform .bar:nth-child(2) { height: 12px").concat(h,"; animation-delay: 0.1s").concat(h,"; }\n .ttp-mobile-landing__waveform .bar:nth-child(3) { height: 20px").concat(h,"; animation-delay: 0.2s").concat(h,"; }\n .ttp-mobile-landing__waveform .bar:nth-child(4) { height: 10px").concat(h,"; animation-delay: 0.3s").concat(h,"; }\n .ttp-mobile-landing__waveform .bar:nth-child(5) { height: 16px").concat(h,"; animation-delay: 0.4s").concat(h,"; }\n\n .ttp-mobile-landing__info {\n flex: 1").concat(h,";\n min-width: 0").concat(h,";\n }\n\n .ttp-mobile-landing__name {\n color: #fff").concat(h,";\n font-size: 15px").concat(h,";\n font-weight: 600").concat(h,";\n margin-bottom: 2px").concat(h,";\n }\n\n .ttp-mobile-landing__status {\n color: rgba(255, 255, 255, 0.7)").concat(h,";\n font-size: 12px").concat(h,";\n display: flex").concat(h,";\n align-items: center").concat(h,";\n gap: 5px").concat(h,";\n }\n\n .ttp-mobile-landing__dot {\n width: 6px").concat(h,";\n height: 6px").concat(h,";\n background: ").concat(c.onlineIndicatorDotColor||"#10b981",";\n border-radius: 50%").concat(h,";\n animation: ttpPulseAnimation 2s ease-in-out infinite").concat(h,";\n }\n\n .ttp-mobile-landing__close {\n width: 32px").concat(h,";\n height: 32px").concat(h,";\n border-radius: 10px").concat(h,";\n background: rgba(255, 255, 255, 0.1)").concat(h,";\n border: none").concat(h,";\n color: rgba(255, 255, 255, 0.7)").concat(h,";\n display: flex").concat(h,";\n align-items: center").concat(h,";\n justify-content: center").concat(h,";\n cursor: pointer").concat(h,";\n transition: all 0.2s").concat(h,";\n flex-shrink: 0").concat(h,";\n }\n\n .ttp-mobile-landing__close:hover {\n background: rgba(255, 255, 255, 0.2)").concat(h,";\n color: #fff").concat(h,";\n }\n\n .ttp-mobile-landing__error {\n margin: 0 14px 10px").concat(h,";\n padding: 10px 12px").concat(h,";\n background: #fef2f2").concat(h,";\n border: 1px solid #fecaca").concat(h,";\n border-radius: 10px").concat(h,";\n display: flex").concat(h,";\n align-items: flex-start").concat(h,";\n gap: 8px").concat(h,";\n color: #b91c1c").concat(h,";\n font-size: 13px").concat(h,";\n line-height: 1.4").concat(h,";\n }\n .ttp-mobile-landing__error svg {\n flex-shrink: 0").concat(h,";\n margin-top: 1px").concat(h,";\n stroke: #dc2626").concat(h,";\n }\n\n .ttp-mobile-landing__actions {\n padding: 0 14px 14px").concat(h,";\n display: flex").concat(h,";\n gap: 10px").concat(h,";\n }\n\n .ttp-mobile-landing__btn {\n flex: 1").concat(h,";\n padding: 14px").concat(h,";\n border-radius: 12px").concat(h,";\n border: none").concat(h,";\n cursor: pointer").concat(h,";\n font-family: inherit").concat(h,";\n font-size: 14px").concat(h,";\n font-weight: 600").concat(h,";\n display: flex").concat(h,";\n align-items: center").concat(h,";\n justify-content: center").concat(h,";\n gap: 10px").concat(h,";\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1)").concat(h,";\n touch-action: manipulation").concat(h,";\n -webkit-tap-highlight-color: transparent").concat(h,";\n }\n\n .ttp-mobile-landing__btn svg {\n width: 20px").concat(h,";\n height: 20px").concat(h,";\n flex-shrink: 0").concat(h,";\n }\n\n .ttp-mobile-landing__btn--call {\n background: #fff").concat(h,";\n color: ").concat(c.backgroundColor||"#7C3AED",";\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15)").concat(h,";\n }\n\n .ttp-mobile-landing__btn--call:hover {\n transform: translateY(-2px)").concat(h,";\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2)").concat(h,";\n }\n\n .ttp-mobile-landing__btn--text {\n background: rgba(255, 255, 255, 0.15)").concat(h,";\n color: #fff").concat(h,";\n border: 1px solid rgba(255, 255, 255, 0.1)").concat(h,";\n }\n\n .ttp-mobile-landing__btn--text:hover {\n background: rgba(255, 255, 255, 0.2)").concat(h,";\n border-color: rgba(255, 255, 255, 0.2)").concat(h,";\n }\n\n .ttp-mobile-landing__footer {\n padding: 10px 16px").concat(h,";\n display: flex").concat(h,";\n justify-content: center").concat(h,";\n border-top: 1px solid rgba(255, 255, 255, 0.08)").concat(h,";\n }\n\n .ttp-mobile-landing__powered {\n color: rgba(255, 255, 255, 0.4)").concat(h,";\n font-size: 11px").concat(h,";\n display: flex").concat(h,";\n align-items: center").concat(h,";\n gap: 4px").concat(h,";\n }\n\n .ttp-mobile-landing__powered svg {\n width: 10px").concat(h,";\n height: 10px").concat(h,";\n color: #f59e0b").concat(h,";\n }\n\n .ttp-mobile-landing__powered a {\n color: ").concat(y).concat(h,";\n text-decoration: none").concat(h,";\n }\n\n .ttp-mobile-landing__powered a:hover {\n opacity: 0.88").concat(h,";\n }\n }\n ")}setupWidgetEvents(){var t;if(this.shadowRoot){this.setupPromptAnimation();var e=this.shadowRoot.getElementById("text-chat-button");e&&(e.onclick=t=>{t.stopPropagation(),this.config.promptAnimation.hideAfterClick&&this.hidePrompt(),this.togglePanel()});var n=this.shadowRoot.getElementById("closeBtn");n&&(n.onclick=()=>{this._doTogglePanel()});var A=this.shadowRoot.getElementById("ttpCloseIdle");A&&(A.onclick=()=>this._doTogglePanel());var o=this.shadowRoot.getElementById("ttpCloseActive");o&&(o.onclick=()=>this._doTogglePanel());var i=this.shadowRoot.getElementById("startTextBtn");i&&(i.onclick=()=>this.showText());var r=this.shadowRoot.getElementById("textUnifiedBackBtn");r&&(r.onclick=()=>{var t;"unified"===((null===(t=this.config.behavior)||void 0===t?void 0:t.mode)||"unified")&&(this.showLanding(),this._openMobileCallTextLanding())});var a=this.config.useShadowDOM?this.shadowRoot:document.getElementById("ttp-widget-container"),s=null==a?void 0:a.querySelector("#ttp-wave");s&&0===s.children.length&&[7,14,22,18,26,18,22,14,7].forEach((t,e)=>{var n=document.createElement("div");n.className="ttp-wave-bar",n.style.height=t+"px",n.style.animationDelay=.07*e+"s",s.appendChild(n)});var c=(null===(t=this.config.behavior)||void 0===t?void 0:t.mode)||"unified",l="unified"===c,d="unified"===c||"voice-only"===c,p="unified"===c||"text-only"===c,u=this.shadowRoot.getElementById("backBtn"),h=this.shadowRoot.getElementById("textInterface"),g=this.shadowRoot.getElementById("voiceInterface"),m=this.shadowRoot.getElementById("newChatBtn");u&&(u.onclick=()=>{var t,e,n;if(null!==(t=this.voiceInterface)&&void 0!==t&&t.isShowingDomainError)return console.log("🔙 Back button clicked - clearing domain error and returning to voice hero"),this.voiceInterface.isShowingDomainError=!1,null!==(n=this.voiceInterface)&&void 0!==n&&n.resetConnectingState&&this.voiceInterface.resetConnectingState(),this.showLanding(),void this._openMobileCallTextLanding();null!==(e=this.voiceInterface)&&void 0!==e&&e.isActive?this.showBackButtonWarning():window.innerWidth<=768?(this.showLanding(),this._openMobileCallTextLanding()):this.showLanding()}),l?"text"===this.currentView?(h&&h.classList.add("active"),g&&g.classList.remove("active"),u&&u.classList.add("visible"),m&&(m.style.display="")):(this.currentView="voice",h&&h.classList.remove("active"),g&&g.classList.add("active"),u&&u.classList.remove("visible"),m&&(m.style.display="none")):"voice-only"===c?(g&&g.classList.add("active"),h&&h.classList.remove("active")):"text-only"===c&&(h&&h.classList.add("active"),g&&g.classList.remove("active")),d&&(console.log("⚙️ Setting up voice interface event handlers"),this.voiceInterface.setupEventHandlers()),p&&(console.log("⚙️ Setting up text interface event handlers"),this.textInterface.setupEventHandlers()),m&&(m.onclick=()=>this.textInterface.startNewChat(),l&&"text"!==this.currentView&&(m.style.display="none")),this.setupMobileWidgetEvents(),this.config.accessibility.keyboardNavigation&&this.setupKeyboardNavigation()}}startNewChat(){this.textInterface.startNewChat()}showLanding(){if(this.shadowRoot&&!this._isDomainErrorVisible()&&"unified"===(this.config.behavior.mode||"unified")){var t=this.shadowRoot.getElementById("textInterface"),e=this.shadowRoot.getElementById("voiceInterface"),n=this.shadowRoot.getElementById("backBtn"),A=this.shadowRoot.getElementById("newChatBtn");this.currentView="voice",t&&t.classList.remove("active"),e&&e.classList.add("active"),n&&n.classList.remove("visible"),A&&(A.style.display="none")}}showText(){if(this.shadowRoot){this.currentView="text";var t=this.shadowRoot.getElementById("voiceInterface"),e=this.shadowRoot.getElementById("backBtn"),n=this.shadowRoot.getElementById("newChatBtn");t&&t.classList.remove("active"),this.textInterface.show();var A=this.config.behavior.mode||"unified";e&&"unified"===A&&e.classList.add("visible"),n&&(n.style.display="")}}_isDomainErrorVisible(){var t,e,n;if(null!==(t=this.voiceInterface)&&void 0!==t&&t.isShowingDomainError)return!0;var A=null===(e=this.voiceInterface)||void 0===e||null===(e=e.shadowRoot)||void 0===e?void 0:e.getElementById("voiceIdleState");return A&&"true"===(null===(n=A.dataset)||void 0===n?void 0:n.domainError)}showVoice(){if(this.shadowRoot){this.currentView="voice";var t=this.shadowRoot.getElementById("textInterface"),e=this.shadowRoot.getElementById("voiceInterface"),n=this.shadowRoot.getElementById("backBtn"),A=this.shadowRoot.getElementById("newChatBtn");t&&t.classList.remove("active"),e&&e.classList.add("active");var o=this.config.behavior.mode||"unified";n&&"unified"===o&&n.classList.remove("visible"),A&&(A.style.display="none")}}_openMobileCallTextLanding(){if(this.shadowRoot&&!(window.innerWidth>768)){var t=this.shadowRoot.querySelector(".ttp-mobile-fab"),e=this.shadowRoot.getElementById("ttpMobileLanding");t&&e&&queueMicrotask(()=>{if(this.shadowRoot&&!(window.innerWidth>768)){var t=this.shadowRoot.getElementById("text-chat-panel");t&&(t.classList.remove("open"),this.isOpen=!1),this.config.promptAnimation.hideAfterClick&&this.hidePrompt();var e=this.shadowRoot.getElementById("ttpMobileLandingError");e&&(e.style.display="none");var n=this.shadowRoot.querySelector(".ttp-mobile-fab"),A=this.shadowRoot.getElementById("ttpMobileLanding");n&&A&&(n.style.display="none",A.classList.add("active"),this.isMobileLandingOpen=!0)}})}}setupMobileWidgetEvents(){if(this.shadowRoot){var t=this.shadowRoot.querySelector(".ttp-mobile-fab"),e=this.shadowRoot.getElementById("ttpMobileLanding");if(t&&e){var n=()=>{e.classList.remove("active"),t.style.display="",this.isMobileLandingOpen=!1};t.onclick=()=>this._openMobileCallTextLanding();var A=e.querySelector(".ttp-mobile-landing__close");A&&(A.onclick=n);var o=this.shadowRoot.getElementById("ttpMobileCallBtn");o&&(o.onclick=()=>{n();var e=this.shadowRoot.getElementById("text-chat-panel");e&&(e.classList.add("open"),this.isOpen=!0),t.style.display="none",this.showVoice(),queueMicrotask(()=>{this.startVoiceCall().catch(t=>{console.error("[TTPChatWidget] Mobile landing voice start failed:",t)})})});var i=this.shadowRoot.getElementById("ttpMobileChatBtn");i&&(i.onclick=()=>{n();var e=this.shadowRoot.getElementById("text-chat-panel");e&&(e.classList.add("open"),this.isOpen=!0),t.style.display="none",this.showText()}),document.addEventListener("click",A=>{if(this.isMobileLandingOpen){var o=A.composedPath();o.includes(e)||o.includes(t)||n()}}),document.addEventListener("keydown",t=>{"Escape"===t.key&&this.isMobileLandingOpen&&n()})}}}setupKeyboardNavigation(){document.addEventListener("keydown",t=>{"Escape"===t.key&&this.isOpen&&this.togglePanel()})}setupPromptAnimation(){var t=this;if(this.shadowRoot){var e=this.config.promptAnimation||{},n=!0===e.enabled;if(console.log("🎨 setupPromptAnimation called:",{hasPromptConfig:!!this.config.promptAnimation,promptConfig:e,enabled:e.enabled,isPromptEnabled:n,isOpen:this.isOpen}),!n)return console.log("❌ Prompt disabled, hiding"),void this.hidePrompt();if(this.isOpen?this.hidePrompt():this.showPrompt(),!this.isOpen&&null!==e.hideAfterSeconds&&e.hideAfterSeconds>0&&(this.promptAutoHideTimer=setTimeout(()=>{this.hidePrompt()},1e3*e.hideAfterSeconds)),this.voiceInterface&&this.voiceInterface.sdk){var A=this.config.onConversationStart;this.config.onConversationStart=function(){var e=t.shadowRoot.getElementById("prompt-pulse-rings");e&&(e.style.display="none"),A&&A(...arguments)},this.voiceInterface.sdk.voiceSDK&&this.voiceInterface.sdk.voiceSDK.on("recordingStarted",()=>{var t=this.shadowRoot.getElementById("prompt-pulse-rings");t&&(t.style.display="none")})}}}hidePrompt(){if(this.shadowRoot){this.promptAutoHideTimer&&(clearTimeout(this.promptAutoHideTimer),this.promptAutoHideTimer=null);var t=this.shadowRoot.getElementById("prompt-bubble");t||this.shadowRoot===document||(t=document.getElementById("prompt-bubble")),t&&(t.style.display="none",t.style.visibility="hidden");var e=this.shadowRoot.getElementById("prompt-pulse-rings");e||this.shadowRoot===document||(e=document.getElementById("prompt-pulse-rings")),e&&(e.style.display="none",e.style.visibility="hidden")}}showPrompt(){if(this.shadowRoot){var t=this.config.promptAnimation||{},e=!1!==t.enabled;if(console.log("👁️ showPrompt called:",{hasPromptConfig:!!this.config.promptAnimation,promptConfig:t,enabled:t.enabled,isPromptEnabled:e,shadowRoot:!!this.shadowRoot}),e){var n=()=>{var e=this.shadowRoot.getElementById("prompt-bubble");if(e||this.shadowRoot===document||(e=document.getElementById("prompt-bubble")),e?(e.style.display="block",e.style.visibility="visible",e.style.opacity="1",console.log("✅ Prompt bubble shown:",e)):console.warn("⚠️ Prompt bubble not found in shadowRoot or document"),!1!==t.showPulseRings){var n=this.shadowRoot.getElementById("prompt-pulse-rings");n||this.shadowRoot===document||(n=document.getElementById("prompt-pulse-rings")),n&&(n.style.display="block",n.style.visibility="visible",n.style.opacity="1")}};n();var A=this.shadowRoot.getElementById("prompt-bubble"),o=!1!==t.showPulseRings?this.shadowRoot.getElementById("prompt-pulse-rings"):null;A&&(!1===t.showPulseRings||o)||(setTimeout(()=>{n()},100),setTimeout(()=>{n()},500)),null!==t.hideAfterSeconds&&t.hideAfterSeconds>0&&(this.promptAutoHideTimer&&clearTimeout(this.promptAutoHideTimer),this.promptAutoHideTimer=setTimeout(()=>{this.hidePrompt()},1e3*t.hideAfterSeconds))}else console.log("❌ Prompt not enabled, skipping show")}}togglePanel(){this.shadowRoot&&this._doTogglePanel()}_doTogglePanel(){if(this.shadowRoot){this.isOpen=!this.isOpen;var t=this.shadowRoot.getElementById("text-chat-panel");t&&t.classList.toggle("open");var e=this.shadowRoot.getElementById("text-chat-button");if(e&&e.classList.toggle("open",this.isOpen),this.isOpen)this.hidePrompt(),setTimeout(()=>{var t=this.shadowRoot.getElementById("messageInput");t&&t.focus()},100);else{if(window.innerWidth<=768){var n=this.shadowRoot.querySelector(".ttp-mobile-fab");n&&(n.style.display="")}this.showPrompt(),setTimeout(()=>{var t,e=this.shadowRoot.getElementById("prompt-bubble");e&&"none"===e.style.display&&(e.style.display="block");var n=this.shadowRoot.getElementById("prompt-pulse-rings");n&&!1!==(null===(t=this.config.promptAnimation)||void 0===t?void 0:t.showPulseRings)&&"none"===n.style.display&&(n.style.display="block")},100)}this.isOpen&&!this.isActive&&this.config.behavior.autoConnect&&this.startChat()}}showErrorToast(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"error",n=document.createElement("div");n.className="widget-toast widget-toast-".concat(e),n.textContent=t;var A="error"===e?"#ef4444":"warning"===e?"#f59e0b":"#3b82f6";if(Object.assign(n.style,{position:"fixed",bottom:"20px",left:"50%",transform:"translateX(-50%)",backgroundColor:A,color:"white",padding:"12px 24px",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:"10003",fontSize:"14px",fontWeight:"500",maxWidth:"90%",textAlign:"center",animation:"slideUp 0.3s ease-out",fontFamily:"inherit",pointerEvents:"auto"}),!document.getElementById("widget-toast-styles")){var o=document.createElement("style");o.id="widget-toast-styles",o.textContent="\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateX(-50%) translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateX(-50%) translateY(0);\n }\n }\n @keyframes slideDown {\n from {\n opacity: 1;\n transform: translateX(-50%) translateY(0);\n }\n to {\n opacity: 0;\n transform: translateX(-50%) translateY(20px);\n }\n }\n ",document.head.appendChild(o)}(this.shadowRoot||document.body).appendChild(n),setTimeout(()=>{n.style.animation="slideDown 0.3s ease-out",setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n)},300)},4e3)}showMobileLandingError(t){if(this.shadowRoot){var e=this.shadowRoot.getElementById("ttpMobileLanding"),n=this.shadowRoot.querySelector(".ttp-mobile-fab"),A=this.shadowRoot.getElementById("ttpMobileLandingError");if(e&&A){var o=A.querySelector(".ttp-mobile-landing__error-text");o&&(o.textContent=t),A.style.display="flex",e.classList.add("active"),n&&(n.style.display="none"),this.isMobileLandingOpen=!0}}}showConfirmModal(t){var{title:e="Confirm",message:n="Are you sure?",confirmText:A="Confirm",cancelText:o="Cancel",confirmButtonClass:i="primary",onConfirm:r,onCancel:a}=t,s=document.createElement("div");s.className="widget-modal-overlay",s.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n ";var c=document.createElement("div");c.className="widget-confirm-modal",c.style.cssText="\n background: white;\n border-radius: 12px;\n padding: 24px;\n max-width: 400px;\n width: 90%;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);\n ";var l="danger"===i?"widget-modal-btn--danger":"widget-modal-btn--primary";c.innerHTML='\n <h3 style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: #1e293b;">'.concat(e,'</h3>\n <p style="margin: 0 0 24px 0; color: #64748b; font-size: 14px; line-height: 1.5;">').concat(n,'</p>\n <div style="display: flex; gap: 12px; justify-content: flex-end;">\n <button class="widget-modal-btn widget-modal-btn--cancel" data-action="cancel" style="\n padding: 10px 20px;\n border: 1px solid #e2e8f0;\n background: white;\n color: #64748b;\n border-radius: 8px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n ">\n ').concat(o,'\n </button>\n <button class="widget-modal-btn ').concat(l,'" data-action="confirm" style="\n padding: 10px 20px;\n border: none;\n background: ').concat("danger"===i?"#ef4444":"#7c3aed",';\n color: white;\n border-radius: 8px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n ">\n ').concat(A,"\n </button>\n </div>\n "),s.appendChild(c),(this.shadowRoot||document.body).appendChild(s),c.querySelector('[data-action="confirm"]').onclick=()=>{s.remove(),null==r||r()},c.querySelector('[data-action="cancel"]').onclick=()=>{s.remove(),null==a||a()},s.onclick=t=>{t.target===s&&(s.remove(),null==a||a())}}startChat(){var t=this;return AA(function*(){t.isActive=!0,t.textInterface.setActive(!0)})()}sendMessage(){var t=this;return AA(function*(){yield t.textInterface.sendMessage()})()}updateSendButtonState(){this.textInterface.updateSendButtonState()}showBackButtonWarning(){var t,e;null!==(t=this.voiceInterface)&&void 0!==t&&t.isActive&&null!==(e=this.voiceInterface.desktop)&&void 0!==e&&e.showBackButtonWarning&&this.voiceInterface.desktop.showBackButtonWarning()}buildWebSocketUrl(){if(!this.config.agentId)throw new Error("agentId is required");var t=this.config.websocketUrl||"wss://backend.talktopc.com/ws/conv",e=new URL(t,"wss://placeholder.com"),n=e.searchParams;n.delete("signed_token"),n.has("agentId")||n.append("agentId",this.config.agentId),this.config.appId&&!n.has("appId")&&n.append("appId",this.config.appId),!1!==this.config.demo&&n.append("demo","true");var A="".concat(e.origin).concat(e.pathname,"?").concat(n.toString());return"undefined"!=typeof __DEV__&&__DEV__&&console.log("[TTPAgentSDK] WebSocket URL:",A),A}addMessage(t,e){this.textInterface.addMessage(t,e)}beginStreaming(){this.textInterface.beginStreaming()}appendStreamingChunk(t){this.textInterface.appendStreamingChunk(t)}finalizeStreaming(t){this.textInterface.finalizeStreaming(t)}stopStreamingState(){this.textInterface.stopStreamingState()}showError(t){this.textInterface.showError(t)}updateStatus(t){}updateConfig(t){var e,n,A,o,i,r,a,s,c=iA({},this.config);if(t.panel&&(c.panel=iA(iA({},this.config.panel),t.panel)),t.voice){var l,d=t.voice,{agentName:p}=d,u=function(t,e){if(null==t)return{};var n,A,o=function(t,e){if(null==t)return{};var n={};for(var A in t)if({}.hasOwnProperty.call(t,A)){if(-1!==e.indexOf(A))continue;n[A]=t[A]}return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(A=0;A<i.length;A++)n=i[A],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(d,eA);c.voice=iA(iA({},this.config.voice),u),t.voice.micButtonHint&&(c.voice.micButtonHint=iA(iA({},null===(l=this.config.voice)||void 0===l?void 0:l.micButtonHint),t.voice.micButtonHint)),delete c.voice.agentName}if(t.text&&(c.text=iA(iA({},this.config.text),t.text),t.text.sendButtonHint&&(c.text.sendButtonHint=iA(iA({},null===(s=this.config.text)||void 0===s?void 0:s.sendButtonHint),t.text.sendButtonHint))),void 0!==t.language&&(c.language=t.language),void 0!==t.language){var h=String(t.language).toLowerCase().split(/[-_]/)[0];"he"===h||"ar"===h?c.direction="rtl":void 0===t.direction&&(c.direction="ltr")}t.translations&&(c.translations=t.translations,this.translations=t.translations),t.button&&(c.button=iA(iA({},this.config.button),t.button)),t.header&&(c.header=iA(iA({},this.config.header),t.header)),t.icon&&(c.icon=iA(iA({},this.config.icon),t.icon)),t.messages&&(c.messages=iA(iA({},this.config.messages),t.messages)),t.animation&&(c.animation=iA(iA({},this.config.animation),t.animation)),t.behavior&&(c.behavior=iA(iA({},this.config.behavior),t.behavior)),t.accessibility&&(c.accessibility=iA(iA({},this.config.accessibility),t.accessibility)),t.tooltips&&(c.tooltips=iA(iA({},this.config.tooltips),t.tooltips)),t.landing&&(c.landing=iA(iA({},this.config.landing),t.landing)),t.footer&&(c.footer=iA(iA({},this.config.footer),t.footer)),void 0!==t.direction&&void 0===c.direction&&(c.direction=t.direction),void 0!==t.primaryColor&&(c.primaryColor=t.primaryColor),c.onConversationStart=void 0!==t.onConversationStart?t.onConversationStart:this.config.onConversationStart,c.onConversationEnd=void 0!==t.onConversationEnd?t.onConversationEnd:this.config.onConversationEnd,c.onBargeIn=void 0!==t.onBargeIn?t.onBargeIn:this.config.onBargeIn,c.onAudioStartPlaying=void 0!==t.onAudioStartPlaying?t.onAudioStartPlaying:this.config.onAudioStartPlaying,c.onAudioStoppedPlaying=void 0!==t.onAudioStoppedPlaying?t.onAudioStoppedPlaying:this.config.onAudioStoppedPlaying,c.onSubtitleDisplay=void 0!==t.onSubtitleDisplay?t.onSubtitleDisplay:this.config.onSubtitleDisplay,c.onVoiceCallButtonClick=void 0!==t.onVoiceCallButtonClick?t.onVoiceCallButtonClick:this.config.onVoiceCallButtonClick,void 0!==t.useShadowDOM&&(c.useShadowDOM=t.useShadowDOM),Object.keys(t).forEach(e=>{["panel","button","header","footer","icon","messages","direction","voice","text","animation","behavior","accessibility","language","tooltips","landing","primaryColor","useShadowDOM","onConversationStart","onConversationEnd","onBargeIn","onAudioStartPlaying","onAudioStoppedPlaying","onSubtitleDisplay","onVoiceCallButtonClick"].includes(e)||(c[e]=t[e])}),null===(e=this.config)||void 0===e||e.language;var g=!1!==(null===(n=this.config)||void 0===n?void 0:n.useShadowDOM);if(this.config=this.mergeWithDefaults(c),!1!==this.config.useShadowDOM===g&&this.container){var m=document.getElementById("ttp-widget-shadow-host");m&&!this.config.useShadowDOM&&m.remove();var v=document.getElementById("ttp-widget-container");if(v&&this.config.useShadowDOM&&v.remove(),this.config.useShadowDOM)if(this.shadowRoot)this.container=this.shadowRoot;else{var f=document.getElementById("ttp-widget-shadow-host");f?(this.shadowRoot=f.shadowRoot,this.container=this.shadowRoot):(this.createShadowHost(),this.container=this.shadowRoot)}else{if(this.regularContainer)this.container=this.regularContainer;else{var w=document.getElementById("ttp-widget-container");w?(this.regularContainer=w,this.container=w):(this.createRegularContainer(),this.container=this.regularContainer)}this.shadowRoot=document}}else{var B=document.getElementById("ttp-widget-shadow-host");B&&B.remove();var b=document.getElementById("ttp-widget-container");if(b&&b.remove(),!1===g){var y=document.getElementById("ttp-widget-styles");y&&y.remove()}this.config.useShadowDOM?(this.createShadowHost(),this.container=this.shadowRoot):(this.createRegularContainer(),this.container=this.regularContainer,this.shadowRoot=document)}var x=this.config.language||"en",C=iA(iA(iA({},this.config),this.config.voice),{},{agentName:this.config.agentName,language:x,translations:this.translations,shadowRoot:this.shadowRoot,websocketUrl:this.config.websocketUrl,agentSettingsOverride:this.config.agentSettingsOverride,visualAssistant:this.config.visualAssistant,inputFormat:this.config.inputFormat,outputContainer:(null===(A=this.config.voice)||void 0===A?void 0:A.outputContainer)||"raw",outputEncoding:(null===(o=this.config.voice)||void 0===o?void 0:o.outputEncoding)||"pcm",outputSampleRate:(null===(i=this.config.voice)||void 0===i?void 0:i.outputSampleRate)||44100,outputChannels:(null===(r=this.config.voice)||void 0===r?void 0:r.outputChannels)||1,outputBitDepth:(null===(a=this.config.voice)||void 0===a?void 0:a.outputBitDepth)||16,onConversationStart:this.config.onConversationStart,onConversationEnd:this.config.onConversationEnd,onBargeIn:this.config.onBargeIn,onAudioStartPlaying:this.config.onAudioStartPlaying,onAudioStoppedPlaying:this.config.onAudioStoppedPlaying,onSubtitleDisplay:this.config.onSubtitleDisplay});this.voiceInterface=new Ce(C);var Q=iA(iA(iA({},this.config),this.config.text),{},{language:x,translations:this.translations,shadowRoot:this.shadowRoot});this.textInterface=new Fe(Q,this.sdk),this.createWidget(),this.textInterface&&this.textInterface.updateInputAttributes&&this.textInterface.updateInputAttributes()}destroy(){this.promptAutoHideTimer&&(clearTimeout(this.promptAutoHideTimer),this.promptAutoHideTimer=null);var t=document.getElementById("ttp-widget-shadow-host");t&&t.remove();var e=document.getElementById("ttp-widget-container");e&&e.remove();var n=document.getElementById("ttp-widget-styles");n&&n.remove(),this.sdk&&this.sdk.destroy(),this.voiceInterface&&this.voiceInterface.destroy(),this._flavor&&this._flavor.destroy&&(this._flavor.destroy(),this._flavor=null)}startVoiceCall(){var t=this;return AA(function*(){yield t.voiceInterface.startVoiceCall(),t._flushPendingClientTools()})()}endVoiceCall(){this.voiceInterface.endVoiceCall()}toggleMute(){this.voiceInterface.toggleMute()}toggleSpeaker(){this.voiceInterface.toggleSpeaker()}injectData(t){var e=arguments,n=this;return AA(function*(){var A,o=e.length>1&&void 0!==e[1]?e[1]:{};if(!t||!t.trim())throw console.warn("TTPChatWidget: Cannot inject empty data"),new Error("Cannot inject empty data");if(!n.voiceInterface||!n.voiceInterface.isActive)throw console.warn("TTPChatWidget: Cannot inject data - voice call is not active"),new Error("Voice call is not active");var i=null===(A=n.voiceInterface)||void 0===A?void 0:A.getVoiceSDK();if(!i)throw console.warn("TTPChatWidget: VoiceSDK not available"),new Error("VoiceSDK not available");try{return yield i.injectData(t,iA(iA({},o),{},{source:o.source||"widget_programmatic"}))}catch(t){throw t}})()}registerToolHandler(t,e){var n;return null!==(n=this.voiceInterface)&&void 0!==n&&n.sdk?this.voiceInterface.sdk.registerToolHandler(t,e):(this._pendingClientTools=this._pendingClientTools||[],this._pendingClientTools.push({name:t,handler:e}),console.warn("TTPChatWidget: Tool handler queued - voice interface SDK not ready yet"),this._flushPendingClientTools(),this)}unregisterToolHandler(t){var e;return null!==(e=this.voiceInterface)&&void 0!==e&&e.sdk?this.voiceInterface.sdk.unregisterToolHandler(t):(this._pendingClientTools&&(this._pendingClientTools=this._pendingClientTools.filter(e=>e.name!==t)),this)}hasToolHandler(t){var e;return!(null===(e=this.voiceInterface)||void 0===e||!e.sdk)&&this.voiceInterface.sdk.hasToolHandler(t)}getRegisteredTools(){var t;return null!==(t=this.voiceInterface)&&void 0!==t&&t.sdk?this.voiceInterface.sdk.getRegisteredTools():this._pendingClientTools?this._pendingClientTools.map(t=>t.name):[]}_flushPendingClientTools(){var t;this._pendingClientTools&&null!==(t=this.voiceInterface)&&void 0!==t&&t.sdk&&(this._pendingClientTools.forEach(t=>{var{name:e,handler:n}=t;this.voiceInterface.sdk.registerToolHandler(e,n)}),this._pendingClientTools=null,console.log("TTPChatWidget: Flushed pending client tools"))}registerClientTool(t,e){return this.registerToolHandler(t,e)}unregisterClientTool(t){return this.unregisterToolHandler(t)}hasClientTool(t){return this.hasToolHandler(t)}getRegisteredClientTools(){return this.getRegisteredTools()}}function dA(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function pA(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?dA(Object(n),!0).forEach(function(e){uA(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dA(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function uA(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class hA extends lA{constructor(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(pA(pA({},n),{},{flavor:n.flavor||{type:"ecommerce",partnerId:null===(t=n.partner)||void 0===t?void 0:t.name,shopifyDomain:null===(e=n.partner)||void 0===e?void 0:e.shopifyDomain}}))}}class gA{constructor(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.images=e.images||[],this.title=e.title||"",this.autoRotate=!1!==e.autoRotate,this.timeout=null!==(t=e.timeout)&&void 0!==t?t:10,this.onDismiss=e.onDismiss||(()=>{}),this.current=0,this.container=null,this.imageEl=null,this.captionEl=null,this.dotsEl=null,this._rotateInterval=null,this._dismissTimeout=null,this._interactionTimeout=null,this._dragging=!1,this._startX=0,this._swiped=!1,this._dragThreshold=40,this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._boundMouseMove=this._onMouseMove.bind(this),this._boundMouseUp=this._onMouseUp.bind(this),this._dismissed=!1}mount(t){t&&0!==this.images.length&&(this._buildDOM(),t.appendChild(this.container),this._setupDragEvents(),this._startAutoRotate(),this._startAutoDismiss())}dismiss(){if(!this._dismissed){if(this._dismissed=!0,this._stopAutoRotate(),this._stopAutoDismiss(),this._removeEventListeners(),this.container){this.container.classList.add("ttp-gallery--hiding");var t=this.container;setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},280)}this.container=null,this.onDismiss()}}replace(t){var e,n,A=null===(e=this.container)||void 0===e?void 0:e.parentNode;A&&(this._stopAutoRotate(),this._stopAutoDismiss(),this._removeEventListeners(),this.container&&this.container.remove(),this.images=t.images||[],this.title=t.title||"",this.autoRotate=!1!==t.autoRotate,this.timeout=null!==(n=t.timeout)&&void 0!==n?n:10,this.current=0,this._dismissed=!1,this._buildDOM(),A.appendChild(this.container),this._setupDragEvents(),this._startAutoRotate(),this._startAutoDismiss())}_buildDOM(){this.container=document.createElement("div"),this.container.className="ttp-gallery";var t=document.createElement("div");t.className="ttp-gallery-header";var e=document.createElement("span");e.className="ttp-gallery-title",e.textContent=this.title,t.appendChild(e);var n=document.createElement("button");n.className="ttp-gallery-close",n.setAttribute("aria-label","Close gallery"),n.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',n.addEventListener("click",()=>this.dismiss()),t.appendChild(n),this.container.appendChild(t);var A=document.createElement("div");if(A.className="ttp-gallery-slide-area",this.images.length>1){var o=document.createElement("button");o.className="ttp-gallery-arrow ttp-gallery-arrow--left",o.setAttribute("aria-label","Previous image"),o.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"/></svg>',o.addEventListener("click",()=>{this._goTo(this.current-1),this._pauseAutoRotate()}),A.appendChild(o)}var i=document.createElement("div");if(i.className="ttp-gallery-image-container",this.imageEl=document.createElement("img"),this.imageEl.className="ttp-gallery-image",this.imageEl.alt="",this.imageEl.draggable=!1,i.appendChild(this.imageEl),A.appendChild(i),this.images.length>1){var r=document.createElement("button");r.className="ttp-gallery-arrow ttp-gallery-arrow--right",r.setAttribute("aria-label","Next image"),r.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>',r.addEventListener("click",()=>{this._goTo(this.current+1),this._pauseAutoRotate()}),A.appendChild(r)}this.container.appendChild(A),this.captionEl=document.createElement("div"),this.captionEl.className="ttp-gallery-caption",this.container.appendChild(this.captionEl),this.images.length>1&&(this.dotsEl=document.createElement("div"),this.dotsEl.className="ttp-gallery-dots",this.images.forEach((t,e)=>{var n=document.createElement("div");n.className="ttp-gallery-dot",n.addEventListener("click",()=>{this._goTo(e),this._pauseAutoRotate()}),this.dotsEl.appendChild(n)}),this.container.appendChild(this.dotsEl)),this._updateSlide()}_updateSlide(){var t=this.images[this.current];t&&this.imageEl&&(this.imageEl.src=t.url,this.imageEl.alt=t.caption||"",this.captionEl&&(this.captionEl.textContent=t.caption||"",this.captionEl.style.display=t.caption?"":"none"),this.dotsEl&&this.dotsEl.querySelectorAll(".ttp-gallery-dot").forEach((t,e)=>t.classList.toggle("ttp-gallery-dot--active",e===this.current)))}_goTo(t){0!==this.images.length&&(this.current=(t%this.images.length+this.images.length)%this.images.length,this._updateSlide())}_startAutoRotate(){!this.autoRotate||this.images.length<3||(this._rotateInterval=setInterval(()=>this._goTo(this.current+1),3e3))}_stopAutoRotate(){this._rotateInterval&&(clearInterval(this._rotateInterval),this._rotateInterval=null),this._interactionTimeout&&(clearTimeout(this._interactionTimeout),this._interactionTimeout=null)}_pauseAutoRotate(){this._stopAutoRotate(),!this.autoRotate||this.images.length<3||(this._interactionTimeout=setTimeout(()=>{this._startAutoRotate()},5e3))}_startAutoDismiss(){this.timeout<=0||(this._dismissTimeout=setTimeout(()=>this.dismiss(),1e3*this.timeout))}_stopAutoDismiss(){this._dismissTimeout&&(clearTimeout(this._dismissTimeout),this._dismissTimeout=null)}_setupDragEvents(){if(!(this.images.length<=1)){var t=this.container.querySelector(".ttp-gallery-slide-area");t&&(t.addEventListener("touchstart",t=>{this._dragging=!0,this._startX=t.touches[0].clientX,this._swiped=!1},{passive:!0}),t.addEventListener("mousedown",t=>{this._dragging=!0,this._startX=t.clientX,this._swiped=!1}),document.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),document.addEventListener("touchend",this._boundTouchEnd),document.addEventListener("mousemove",this._boundMouseMove),document.addEventListener("mouseup",this._boundMouseUp))}}_onTouchMove(t){if(this._dragging){var e=t.touches[0].clientX-this._startX;Math.abs(e)>this._dragThreshold&&(this._goTo(this.current+(e>0?-1:1)),this._startX=t.touches[0].clientX,this._swiped=!0,this._pauseAutoRotate())}}_onTouchEnd(){this._dragging=!1,this._swiped&&setTimeout(()=>{this._swiped=!1},400)}_onMouseMove(t){if(this._dragging){var e=t.clientX-this._startX;Math.abs(e)>this._dragThreshold&&(this._goTo(this.current+(e>0?-1:1)),this._startX=t.clientX,this._swiped=!0,this._pauseAutoRotate())}}_onMouseUp(){this._dragging=!1,this._swiped&&setTimeout(()=>{this._swiped=!1},400)}_removeEventListeners(){document.removeEventListener("touchmove",this._boundTouchMove),document.removeEventListener("touchend",this._boundTouchEnd),document.removeEventListener("mousemove",this._boundMouseMove),document.removeEventListener("mouseup",this._boundMouseUp)}static injectStyles(t){if(!gA._stylesInjected.has(t)){gA._stylesInjected.add(t);var e=gA.generateCSS(),n=t.querySelector("style");if(n)n.textContent+="\n"+e;else{var A=document.createElement("style");A.textContent=e,t.appendChild(A)}}}static generateCSS(){return"\n/* ═══════════════════════════════════════\n GALLERY VIEWER\n ═══════════════════════════════════════ */\n\n.ttp-gallery {\n width: 100%;\n background: #fff;\n border-radius: 14px;\n overflow: hidden;\n box-shadow: 0 4px 20px rgba(0,0,0,0.1);\n animation: ttpGalleryIn 0.3s cubic-bezier(0.23, 1, 0.32, 1);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.ttp-gallery.ttp-gallery--hiding {\n animation: ttpGalleryOut 0.28s ease forwards;\n pointer-events: none;\n}\n\n@keyframes ttpGalleryIn {\n from { opacity: 0; transform: translateY(-10px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes ttpGalleryOut {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(-10px); }\n}\n\n/* ── Header ── */\n\n.ttp-gallery-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 12px 6px;\n}\n\n.ttp-gallery-title {\n font-size: 13px;\n font-weight: 600;\n color: #1e293b;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ttp-gallery-close {\n width: 28px;\n height: 28px;\n border: none;\n border-radius: 50%;\n background: rgba(0,0,0,0.06);\n color: #64748b;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n flex-shrink: 0;\n transition: background 0.15s;\n}\n.ttp-gallery-close:hover {\n background: rgba(0,0,0,0.1);\n}\n\n/* ── Slide Area ── */\n\n.ttp-gallery-slide-area {\n position: relative;\n width: 100%;\n aspect-ratio: 16 / 10;\n background: #f1f5f9;\n user-select: none;\n -webkit-user-select: none;\n cursor: grab;\n overflow: hidden;\n}\n.ttp-gallery-slide-area:active {\n cursor: grabbing;\n}\n\n.ttp-gallery-image-container {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ttp-gallery-image {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n transition: opacity 0.2s ease;\n pointer-events: none;\n}\n\n/* ── Arrows ── */\n\n.ttp-gallery-arrow {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n z-index: 2;\n width: 32px;\n height: 32px;\n border: none;\n border-radius: 50%;\n background: rgba(255,255,255,0.85);\n color: #334155;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n box-shadow: 0 2px 8px rgba(0,0,0,0.12);\n transition: background 0.15s, transform 0.15s;\n -webkit-tap-highlight-color: transparent;\n touch-action: manipulation;\n}\n.ttp-gallery-arrow:hover {\n background: #fff;\n transform: translateY(-50%) scale(1.05);\n}\n.ttp-gallery-arrow:active {\n transform: translateY(-50%) scale(0.95);\n}\n.ttp-gallery-arrow--left {\n left: 8px;\n}\n.ttp-gallery-arrow--right {\n right: 8px;\n}\n\n/* ── Caption ── */\n\n.ttp-gallery-caption {\n padding: 6px 12px;\n font-size: 12px;\n color: #64748b;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* ── Dots ── */\n\n.ttp-gallery-dots {\n display: flex;\n justify-content: center;\n gap: 6px;\n padding: 4px 0 10px;\n}\n\n.ttp-gallery-dot {\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background: #cbd5e1;\n cursor: pointer;\n transition: all 0.25s;\n -webkit-tap-highlight-color: transparent;\n}\n\n.ttp-gallery-dot--active {\n width: 18px;\n border-radius: 4px;\n background: #3b82f6;\n}\n\n/* ── Mobile gallery (mounted to body) ── */\n\n.ttp-gallery--mobile {\n position: fixed !important;\n left: 8px !important;\n right: 8px !important;\n z-index: 2147483645 !important;\n border-radius: 16px;\n box-shadow: 0 8px 32px rgba(0,0,0,0.18);\n}\n"}static injectMobileStyles(){if(!document.getElementById("ttp-gallery-mobile-styles")){var t=document.createElement("style");t.id="ttp-gallery-mobile-styles",t.textContent=gA.generateCSS(),document.head.appendChild(t)}}static injectFullscreenStyles(){if(!document.getElementById("ttp-gallery-fullscreen-viewer-styles")){var t=document.createElement("style");t.id="ttp-gallery-fullscreen-viewer-styles",t.textContent=gA.generateCSS()+"\n"+gA.generateFullscreenCSS(),document.head.appendChild(t)}}static generateFullscreenCSS(){return"\n/* ═══════════════════════════════════════\n GALLERY — FULLSCREEN IMMERSIVE\n ═══════════════════════════════════════ */\n\n.ttp-gallery--fullscreen {\n width: 100vw;\n height: 100vh;\n background: transparent;\n border-radius: 0;\n box-shadow: none;\n position: relative;\n animation: ttpGalleryFsIn 0.4s ease;\n overflow: hidden;\n}\n\n.ttp-gallery--fullscreen.ttp-gallery--hiding {\n animation: ttpGalleryFsOut 0.3s ease forwards;\n}\n\n@keyframes ttpGalleryFsIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@keyframes ttpGalleryFsOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* ── Header: floating top bar ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-header {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n z-index: 10;\n padding: 16px 20px;\n background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);\n}\n\n.ttp-gallery--fullscreen .ttp-gallery-title {\n font-size: 18px;\n color: #fff;\n text-shadow: 0 1px 4px rgba(0,0,0,0.5);\n}\n\n.ttp-gallery--fullscreen .ttp-gallery-close {\n width: 40px;\n height: 40px;\n background: rgba(255,255,255,0.15);\n color: #fff;\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n}\n.ttp-gallery--fullscreen .ttp-gallery-close:hover {\n background: rgba(255,255,255,0.25);\n}\n.ttp-gallery--fullscreen .ttp-gallery-close svg {\n width: 22px;\n height: 22px;\n}\n\n/* ── Slide area: fills entire viewport ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-slide-area {\n width: 100vw;\n height: 100vh;\n aspect-ratio: auto;\n background: transparent;\n}\n\n.ttp-gallery--fullscreen .ttp-gallery-image {\n width: 100%;\n height: 100%;\n object-fit: contain;\n}\n\n/* ── Arrows: large, floating on edges ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-arrow {\n width: 52px;\n height: 52px;\n background: rgba(255,255,255,0.12);\n color: #fff;\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: none;\n}\n.ttp-gallery--fullscreen .ttp-gallery-arrow:hover {\n background: rgba(255,255,255,0.25);\n transform: translateY(-50%) scale(1.05);\n}\n.ttp-gallery--fullscreen .ttp-gallery-arrow svg {\n width: 28px;\n height: 28px;\n}\n.ttp-gallery--fullscreen .ttp-gallery-arrow--left { left: 16px; }\n.ttp-gallery--fullscreen .ttp-gallery-arrow--right { right: 16px; }\n\n/* ── Caption: floating bottom center ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-caption {\n position: absolute;\n bottom: 56px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 10;\n font-size: 15px;\n color: #fff;\n text-shadow: 0 1px 6px rgba(0,0,0,0.6);\n background: rgba(0,0,0,0.35);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n padding: 8px 20px;\n border-radius: 20px;\n max-width: 80vw;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* ── Dots: floating bottom ── */\n\n.ttp-gallery--fullscreen .ttp-gallery-dots {\n position: absolute;\n bottom: 20px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 10;\n gap: 10px;\n padding: 6px 14px;\n background: rgba(0,0,0,0.3);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n border-radius: 20px;\n}\n.ttp-gallery--fullscreen .ttp-gallery-dot {\n width: 10px;\n height: 10px;\n background: rgba(255,255,255,0.4);\n}\n.ttp-gallery--fullscreen .ttp-gallery-dot--active {\n width: 28px;\n border-radius: 5px;\n background: #fff;\n}\n\n/* ── Mobile tweaks ── */\n\n@media (max-width: 768px) {\n .ttp-gallery--fullscreen .ttp-gallery-arrow {\n width: 40px;\n height: 40px;\n }\n .ttp-gallery--fullscreen .ttp-gallery-arrow--left { left: 8px; }\n .ttp-gallery--fullscreen .ttp-gallery-arrow--right { right: 8px; }\n .ttp-gallery--fullscreen .ttp-gallery-caption {\n font-size: 13px;\n bottom: 50px;\n }\n}\n"}}function mA(o){var[i,r]=A(!1),a=n(null);return e(()=>(a.current=new sn({getCartTarget:()=>{var t;return null!==(t=null==o?void 0:o.current)&&void 0!==t?t:null},onCartBump:()=>{},onRipple:()=>{}}),()=>{a.current&&(a.current.destroy(),a.current=null)}),[o]),{triggerFly:t((t,e,n)=>{var A=a.current;A?A.isAnimating||(r(!0),A.triggerFly(t,e,()=>{r(A.isAnimating),n&&n()})):n&&n()},[]),isAnimating:i}}function vA(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(t);e&&(A=A.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,A)}return n}function fA(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vA(Object(n),!0).forEach(function(e){wA(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vA(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function wA(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function BA(t,e,n,A,o,i,r){try{var a=t[i](r),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(A,o)}function bA(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){BA(i,A,o,r,a,"next",t)}function a(t){BA(i,A,o,r,a,"throw",t)}r(void 0)})}}!function(t,e,n){(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}(gA,"_stylesInjected",new WeakSet);class yA{constructor(t){console.log("🚀 AgentSDK v2.1.8 initialized with config:",t),this.config=t,this.voiceSDK=null,this.isConnected=!1,this.isListening=!1,this.wasListening=!1,this._resumeInfo=null,this.onConnected=()=>{},this.onDisconnected=()=>{},this.onError=t=>console.error("SDK Error:",t),this.onTranscript=t=>{},this.onAgentSpeaking=t=>{},this.onConversationStart=t.onConversationStart||(()=>{}),this.onConversationEnd=t.onConversationEnd||(()=>{}),this.onBargeIn=t.onBargeIn||(()=>{}),this.onAudioStartPlaying=t.onAudioStartPlaying||(()=>{}),this.onAudioStoppedPlaying=t.onAudioStoppedPlaying||(()=>{}),this.onSubtitleDisplay=t.onSubtitleDisplay||(()=>{}),this.onUserTranscript=null,this.onUnsupportedAction=null}checkResumeBeforeConnect(){if(void 0!==this._resumeChecked)return this._resumeInfo;try{var t,e=this.config.visualAssistant||(null===(t=this.config.agentSettingsOverride)||void 0===t?void 0:t.visualAssistant),n=new Pt({autoReconnect:!1,agentId:this.config.agentId,appId:this.config.appId,language:this.config.language||"en",visualAssistant:e,protocolVersion:2}).checkAndResume();return this._resumeChecked=!0,n?(console.log("🔄 [AGENT SDK] Found resume state before connect:",n),this._resumeInfo=n,n):(this._resumeInfo=null,null)}catch(t){return console.warn("⚠️ [AGENT SDK] Error checking resume:",t),this._resumeChecked=!0,this._resumeInfo=null,null}}connect(){var t=this;return bA(function*(){try{var e;t.voiceSDK&&(console.log("🔌 AgentSDK: Cleaning up existing connection"),t.voiceSDK.destroy(),t.voiceSDK=null);var n=t.config.visualAssistant||(null===(e=t.config.agentSettingsOverride)||void 0===e?void 0:e.visualAssistant);if(t.voiceSDK=new Pt(fA(fA({websocketUrl:t.config.websocketUrl,autoReconnect:!1,agentId:t.config.agentId,appId:t.config.appId,language:t.config.language||"en"},t.config.inputFormat||{}),{},{agentSettingsOverride:t.config.agentSettingsOverride,visualAssistant:n,protocolVersion:2,outputContainer:t.config.outputContainer||"raw",outputEncoding:t.config.outputEncoding||"pcm",outputSampleRate:t.config.outputSampleRate||44100,outputChannels:t.config.outputChannels||1,outputBitDepth:t.config.outputBitDepth||16,flavor:t.config.flavor||null})),t._resumeInfo&&(console.log("🔄 [AGENT SDK] Using stored resume info:",t._resumeInfo),console.log(" From:",t._resumeInfo.fromPage,"→ To:",t._resumeInfo.toPage)),t.voiceSDK.on("connected",()=>{t.isConnected=!0,t.onConnected()}),setTimeout(()=>{t.voiceSDK&&t.voiceSDK.isConnected&&!t.isConnected&&(t.isConnected=!0,t.onConnected())},10),t.voiceSDK.on("disconnected",e=>{if(t.isConnected=!1,e&&1008===e.code&&e.reason&&(e.reason.includes("Domain not whitelisted")||e.reason.includes("domain")||e.reason.includes("whitelist"))){var n=new Error("DOMAIN_NOT_WHITELISTED");n.reason=e.reason,n.code=e.code,t.onError(n)}if((t.isListening||t.wasListening)&&(console.log("🎤 [AGENT SDK] disconnected event - calling onConversationEnd hook (isListening:",t.isListening,", wasListening:",t.wasListening,")"),t.onConversationEnd&&"function"==typeof t.onConversationEnd))try{t.onConversationEnd(),console.log("🎤 [AGENT SDK] ✅ onConversationEnd hook called from disconnected event"),t.wasListening=!1}catch(t){console.error("🎤 [AGENT SDK] ❌ Error calling onConversationEnd from disconnected:",t)}t.onDisconnected()}),t.voiceSDK.on("domainError",e=>{t.onError(e)}),t.voiceSDK.on("error",e=>{t.onError(e)}),t.voiceSDK.on("message",e=>{t.handleWebSocketMessage(e)}),t.voiceSDK.on("recordingStarted",()=>{if(t.isListening=!0,t.wasListening=!0,t.onConversationStart&&"function"==typeof t.onConversationStart)try{t.onConversationStart()}catch(t){console.error("🎤 [AGENT SDK] ❌ Error calling onConversationStart:",t)}}),t.voiceSDK.on("recordingStopped",()=>{console.log("🎤 [AGENT SDK] recordingStopped event received");var e=t.isListening;if(t.isListening=!1,e&&t.onConversationEnd&&"function"==typeof t.onConversationEnd)try{console.log("🎤 [AGENT SDK] ✅ Calling onConversationEnd hook from recordingStopped"),t.onConversationEnd(),console.log("🎤 [AGENT SDK] ✅ onConversationEnd hook called successfully"),t.wasListening=!1}catch(t){console.error("🎤 [AGENT SDK] ❌ Error calling onConversationEnd:",t)}}),t.voiceSDK.on("playbackStarted",()=>{t.onAgentSpeaking(!0),t.onAudioStartPlaying(),t.onPlaybackStarted&&"function"==typeof t.onPlaybackStarted&&t.onPlaybackStarted()}),t.voiceSDK.on("playbackStopped",()=>{t.onAgentSpeaking(!1),t.onAudioStoppedPlaying()}),t.voiceSDK.on("bargeIn",e=>{t.onBargeIn(e)}),t.voiceSDK.on("transcriptDisplay",e=>{console.log("📝 [AGENT SDK] transcriptDisplay event received:",e),e&&e.text&&(console.log("📝 [AGENT SDK] Calling onTranscript with text:",e.text),t.onTranscript&&"function"==typeof t.onTranscript?t.onTranscript(e.text):console.warn("📝 [AGENT SDK] ⚠️ onTranscript is not a function!",typeof t.onTranscript)),t.onSubtitleDisplay(e)}),t.voiceSDK.on("user_transcript",e=>{console.log("📝 [AGENT SDK] user_transcript event received:",e),t.onUserTranscript&&"function"==typeof t.onUserTranscript&&t.onUserTranscript(e.text,e.final)}),t._pendingToolHandlers&&t._pendingToolHandlers.size>0)for(var[A,o]of(console.log("🔧 AgentSDK: Registering ".concat(t._pendingToolHandlers.size," pending tool handlers")),t._pendingToolHandlers))t.voiceSDK.registerToolHandler(A,o);yield t.voiceSDK.connect()}catch(e){throw t.onError(e),e}})()}handleWebSocketMessage(t){var e=t.t||t.type;switch(e){case"connected":case"hello_ack":console.log("Session started successfully");break;case"user_transcript":case"agent_response":case"barge_in":case"stop_playing":default:break;case"error":this.onError(new Error(t.message||t.error||"Unknown error"));break;case"show_items":case"show_products":case"cart_updated":case"add_to_store_cart":"function"==typeof this.onUnsupportedAction&&this.onUnsupportedAction(e,t)}}startListening(){var t=arguments,e=this;return bA(function*(){var n=t.length>0&&void 0!==t[0]?t[0]:null;if(console.log("🎤 AgentSDK: startListening() called",n?"(with existing stream)":""),!e.voiceSDK)throw console.error("❌ AgentSDK: No voiceSDK instance available"),new Error("No voiceSDK instance available");try{console.log("🎤 AgentSDK: Starting recording..."),(yield e.voiceSDK.startRecording(n))&&console.log("✅ AgentSDK: Recording started successfully")}catch(t){if(t.isServerRejection||"ServerRejected"===t.name)throw t;throw console.error("❌ AgentSDK: Failed to start recording:",t),t}})()}stopListening(){this.voiceSDK&&this.voiceSDK.stopRecording()}hangup(){this.voiceSDK&&this.voiceSDK.hangup()}updateVariables(t){this.voiceSDK&&this.isConnected&&this.voiceSDK.sendMessage({t:"update_variables",variables:t})}disconnect(){this.voiceSDK&&(this.voiceSDK.destroy(),this.voiceSDK=null),this.isConnected=!1,this.isListening=!1}registerToolHandler(t,e){if(this.voiceSDK)return this.voiceSDK.registerToolHandler(t,e);this._pendingToolHandlers||(this._pendingToolHandlers=new Map),this._pendingToolHandlers.set(t,e),console.log("🔧 AgentSDK: Queued tool handler '".concat(t,"' for registration after connect"))}unregisterToolHandler(t){if(this.voiceSDK)return this.voiceSDK.unregisterToolHandler(t);this._pendingToolHandlers&&this._pendingToolHandlers.delete(t)}hasToolHandler(t){var e;return this.voiceSDK?this.voiceSDK.hasToolHandler(t):(null===(e=this._pendingToolHandlers)||void 0===e?void 0:e.has(t))||!1}getRegisteredTools(){return this.voiceSDK?this.voiceSDK.getRegisteredTools():this._pendingToolHandlers?Array.from(this._pendingToolHandlers.keys()):[]}}var xA="2.43.0",CA="2026-03-26T01:56:50.079Z";console.log("%c TTP Agent SDK v".concat(xA," (").concat(CA,") "),"background: #4f46e5; color: white; font-size: 12px; font-weight: bold; padding: 2px 6px; border-radius: 4px;");const QA={VoiceSDK_v2:Pt,TextChatSDK:Vt,WebSocketManager:Wt,AudioRecorder:k,AudioPlayer:Yt,EventEmitter:f,AgentSDK:yA,TTPChatWidget:lA,TTPEcommerceWidget:hA,ItemCard:Ne,GalleryViewer:gA,FlyToCart:sn,useFlyToCart:mA,VERSION:xA};export{yA as AgentSDK,Yt as AudioPlayer,k as AudioRecorder,CA as BUILD_TIME,f as EventEmitter,sn as FlyToCart,gA as GalleryViewer,Ne as ItemCard,s as MicPermissionModals,a as MicPermissionUtils,lA as TTPChatWidget,hA as TTPEcommerceWidget,Vt as TextChatSDK,xA as VERSION,Pt as VoiceSDK_v2,Wt as WebSocketManager,QA as default,mA as useFlyToCart};
|
|
3
3
|
//# sourceMappingURL=agent-widget.esm.js.map
|