ttp-agent-sdk 2.38.4 → 2.40.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 +6526 -1483
- 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/demos/index.html +45 -0
- package/dist/demos/test-ecommerce.html +143 -160
- package/dist/demos/test-tour.html +376 -0
- package/dist/demos/widget-customization.html +1685 -604
- package/dist/examples/test-ecommerce.html +143 -160
- package/dist/examples/test-index.html +45 -0
- package/dist/examples/test-restaurant.html +372 -0
- package/dist/examples/test-tour.html +376 -0
- package/dist/examples/widget-customization.html +1685 -604
- package/examples/test-ecommerce.html +143 -160
- package/examples/test-index.html +45 -0
- package/examples/test-restaurant.html +372 -0
- package/examples/test-tour.html +376 -0
- package/examples/widget-customization.html +1685 -604
- 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 A,useRef as t,useState as n}from"react";var o={354:function(e){e.exports=function(){var e=function(A,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,A){e.__proto__=A}||function(e,A){for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t])},e(A,t)};function A(A,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=A}e(A,t),A.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var t=function(){return t=Object.assign||function(e){for(var A,t=1,n=arguments.length;t<n;t++)for(var o in A=arguments[t])Object.prototype.hasOwnProperty.call(A,o)&&(e[o]=A[o]);return e},t.apply(this,arguments)};function n(e,A,t,n){return new(t||(t=Promise))(function(o,i){function r(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var A;e.done?o(e.value):(A=e.value,A instanceof t?A:new t(function(e){e(A)})).then(r,a)}s((n=n.apply(e,A||[])).next())})}function o(e,A){var t,n,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(t)throw new TypeError("Generator is already executing.");for(;r;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=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++,n=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=A.call(e,r)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function i(e,A,t){if(t||2===arguments.length)for(var n,o=0,i=A.length;o<i;o++)!n&&o in A||(n||(n=Array.prototype.slice.call(A,0,o)),n[o]=A[o]);return e.concat(n||A)}for(var r=function(){function e(e,A,t,n){this.left=e,this.top=A,this.width=t,this.height=n}return e.prototype.add=function(A,t,n,o){return new e(this.left+A,this.top+t,this.width+n,this.height+o)},e.fromClientRect=function(A,t){return new e(t.left+A.windowBounds.left,t.top+A.windowBounds.top,t.width,t.height)},e.fromDOMRectList=function(A,t){var n=Array.from(t).find(function(e){return 0!==e.width});return n?new e(n.left+A.windowBounds.left,n.top+A.windowBounds.top,n.width,n.height):e.EMPTY},e.EMPTY=new e(0,0,0,0),e}(),a=function(e,A){return r.fromClientRect(e,A.getBoundingClientRect())},s=function(e){for(var A=[],t=0,n=e.length;t<n;){var o=e.charCodeAt(t++);if(o>=55296&&o<=56319&&t<n){var i=e.charCodeAt(t++);56320==(64512&i)?A.push(((1023&o)<<10)+(1023&i)+65536):(A.push(o),t--)}else A.push(o)}return A},c=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var t=e.length;if(!t)return"";for(var n=[],o=-1,i="";++o<t;){var r=e[o];r<=65535?n.push(r):(r-=65536,n.push(55296+(r>>10),r%1024+56320)),(o+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="undefined"==typeof Uint8Array?[]:new Uint8Array(256),u=0;u<64;u++)d[l.charCodeAt(u)]=u;for(var p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h="undefined"==typeof Uint8Array?[]:new Uint8Array(256),g=0;g<64;g++)h[p.charCodeAt(g)]=g;for(var m=function(e,A,t){return e.slice?e.slice(A,t):new Uint16Array(Array.prototype.slice.call(e,A,t))},f=function(){function e(e,A,t,n,o,i){this.initialValue=e,this.errorValue=A,this.highStart=t,this.highValueIndex=n,this.index=o,this.data=i}return e.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=((A=this.index[e>>5])<<2)+(31&e),this.data[A];if(e<=65535)return A=((A=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[A];if(e<this.highStart)return A=2080+(e>>11),A=this.index[A],A+=e>>5&63,A=((A=this.index[A])<<2)+(31&e),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v="undefined"==typeof Uint8Array?[]:new Uint8Array(256),w=0;w<64;w++)v[B.charCodeAt(w)]=w;var b=10,y=13,C=15,x=17,Q=18,F=19,U=20,S=21,E=22,I=24,k=25,T=26,H=27,D=28,M=30,L=32,P=33,K=34,_=35,R=37,O=38,V=39,N=40,G=42,W=[9001,65288],j="×",z="÷",q=function(e){var A,t,n,o=function(e){var A,t,n,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(A=0;A<a;A+=4)t=h[e.charCodeAt(A)],n=h[e.charCodeAt(A+1)],o=h[e.charCodeAt(A+2)],i=h[e.charCodeAt(A+3)],l[s++]=t<<2|n>>4,l[s++]=(15&n)<<4|o>>2,l[s++]=(3&o)<<6|63&i;return c}(e),i=Array.isArray(o)?function(e){for(var A=e.length,t=[],n=0;n<A;n+=4)t.push(e[n+3]<<24|e[n+2]<<16|e[n+1]<<8|e[n]);return t}(o):new Uint32Array(o),r=Array.isArray(o)?function(e){for(var A=e.length,t=[],n=0;n<A;n+=2)t.push(e[n+1]<<8|e[n]);return t}(o):new Uint16Array(o),a=m(r,12,i[4]/2),s=2===i[5]?m(r,(24+i[4])/2):(A=i,t=Math.ceil((24+i[4])/4),A.slice?A.slice(t,n):new Uint32Array(Array.prototype.slice.call(A,t,n)));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=[M,36],J=[1,2,3,5],Y=[b,8],Z=[H,T],$=J.concat(Y),ee=[O,V,N,K,_],Ae=[C,y],te=function(e,A,t,n){var o=n[t];if(Array.isArray(e)?-1!==e.indexOf(o):e===o)for(var i=t;i<=n.length;){if((s=n[++i])===A)return!0;if(s!==b)break}if(o===b)for(i=t;i>0;){var r=n[--i];if(Array.isArray(e)?-1!==e.indexOf(r):e===r)for(var a=t;a<=n.length;){var s;if((s=n[++a])===A)return!0;if(s!==b)break}if(r!==b)break}return!1},ne=function(e,A){for(var t=e;t>=0;){var n=A[t];if(n!==b)return n;t--}return 0},oe=function(e,A,t,n,o){if(0===t[n])return j;var i=n-1;if(Array.isArray(o)&&!0===o[i])return j;var r=i-1,a=i+1,s=A[i],c=r>=0?A[r]:0,l=A[a];if(2===s&&3===l)return j;if(-1!==J.indexOf(s))return"!";if(-1!==J.indexOf(l))return j;if(-1!==Y.indexOf(l))return j;if(8===ne(i,A))return z;if(11===q.get(e[i]))return j;if((s===L||s===P)&&11===q.get(e[a]))return j;if(7===s||7===l)return j;if(9===s)return j;if(-1===[b,y,C].indexOf(s)&&9===l)return j;if(-1!==[x,Q,F,I,D].indexOf(l))return j;if(ne(i,A)===E)return j;if(te(23,E,i,A))return j;if(te([x,Q],S,i,A))return j;if(te(12,12,i,A))return j;if(s===b)return z;if(23===s||23===l)return j;if(16===l||16===s)return z;if(-1!==[y,C,S].indexOf(l)||14===s)return j;if(36===c&&-1!==Ae.indexOf(s))return j;if(s===D&&36===l)return j;if(l===U)return j;if(-1!==X.indexOf(l)&&s===k||-1!==X.indexOf(s)&&l===k)return j;if(s===H&&-1!==[R,L,P].indexOf(l)||-1!==[R,L,P].indexOf(s)&&l===T)return j;if(-1!==X.indexOf(s)&&-1!==Z.indexOf(l)||-1!==Z.indexOf(s)&&-1!==X.indexOf(l))return j;if(-1!==[H,T].indexOf(s)&&(l===k||-1!==[E,C].indexOf(l)&&A[a+1]===k)||-1!==[E,C].indexOf(s)&&l===k||s===k&&-1!==[k,D,I].indexOf(l))return j;if(-1!==[k,D,I,x,Q].indexOf(l))for(var d=i;d>=0;){if((u=A[d])===k)return j;if(-1===[D,I].indexOf(u))break;d--}if(-1!==[H,T].indexOf(l))for(d=-1!==[x,Q].indexOf(s)?r:i;d>=0;){var u;if((u=A[d])===k)return j;if(-1===[D,I].indexOf(u))break;d--}if(O===s&&-1!==[O,V,K,_].indexOf(l)||-1!==[V,K].indexOf(s)&&-1!==[V,N].indexOf(l)||-1!==[N,_].indexOf(s)&&l===N)return j;if(-1!==ee.indexOf(s)&&-1!==[U,T].indexOf(l)||-1!==ee.indexOf(l)&&s===H)return j;if(-1!==X.indexOf(s)&&-1!==X.indexOf(l))return j;if(s===I&&-1!==X.indexOf(l))return j;if(-1!==X.concat(k).indexOf(s)&&l===E&&-1===W.indexOf(e[a])||-1!==X.concat(k).indexOf(l)&&s===Q)return j;if(41===s&&41===l){for(var p=t[i],h=1;p>0&&41===A[--p];)h++;if(h%2!=0)return j}return s===L&&l===P?j:z},ie=function(e,A){A||(A={lineBreak:"normal",wordBreak:"normal"});var t=function(e,A){void 0===A&&(A="strict");var t=[],n=[],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(A)&&-1!==[8208,8211,12316,12448].indexOf(e))return n.push(i),t.push(16);if(4===r||11===r){if(0===i)return n.push(i),t.push(M);var a=t[i-1];return-1===$.indexOf(a)?(n.push(n[i-1]),t.push(a)):(n.push(i),t.push(M))}return n.push(i),31===r?t.push("strict"===A?S:R):r===G||29===r?t.push(M):43===r?e>=131072&&e<=196605||e>=196608&&e<=262141?t.push(R):t.push(M):void t.push(r)}),[n,t,o]}(e,A.lineBreak),n=t[0],o=t[1],i=t[2];"break-all"!==A.wordBreak&&"break-word"!==A.wordBreak||(o=o.map(function(e){return-1!==[k,M,G].indexOf(e)?R:e}));var r="keep-all"===A.wordBreak?i.map(function(A,t){return A&&e[t]>=19968&&e[t]<=40959}):void 0;return[n,o,r]},re=function(){function e(e,A,t,n){this.codePoints=e,this.required="!"===A,this.start=t,this.end=n}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},ue=function(e){return 10===e||9===e||32===e},pe=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 pe(e)||le(e)||e===ae},ge=function(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e},me=function(e,A){return 92===e&&10!==A},fe=function(e,A,t){return e===ae?pe(A)||me(A,t):!!pe(e)||!(92!==e||!me(e,A))},Be=function(e,A,t){return e===se||e===ae?!!le(A)||46===A&&le(t):le(46===e?A:e)},ve=function(e){var A=0,t=1;e[A]!==se&&e[A]!==ae||(e[A]===ae&&(t=-1),A++);for(var n=[];le(e[A]);)n.push(e[A++]);var o=n.length?parseInt(c.apply(void 0,n),10):0;46===e[A]&&A++;for(var i=[];le(e[A]);)i.push(e[A++]);var r=i.length,a=r?parseInt(c.apply(void 0,i),10):0;69!==e[A]&&101!==e[A]||A++;var s=1;e[A]!==se&&e[A]!==ae||(e[A]===ae&&(s=-1),A++);for(var l=[];le(e[A]);)l.push(e[A++]);var d=l.length?parseInt(c.apply(void 0,l),10):0;return t*(o+a*Math.pow(10,-r))*Math.pow(10,s*d)},we={type:2},be={type:3},ye={type:4},Ce={type:13},xe={type:8},Qe={type:21},Fe={type:9},Ue={type:10},Se={type:11},Ee={type:12},Ie={type:14},ke={type:23},Te={type:1},He={type:25},De={type:24},Me={type:26},Le={type:27},Pe={type:28},Ke={type:29},_e={type:31},Re={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=[],A=this.consumeToken();A!==Re;)e.push(A),A=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case 34:return this.consumeStringToken(34);case 35:var A=this.peekCodePoint(0),t=this.peekCodePoint(1),n=this.peekCodePoint(2);if(he(A)||me(t,n)){var o=fe(A,t,n)?2:1;return{type:5,value:this.consumeName(),flags:o}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Ce;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(),Ie;break;case se:if(Be(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(Be(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(),De;break;case 46:if(Be(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 Me;case 59:return Le;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),u=this.peekCodePoint(2);if(fe(l,d,u))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 Ke;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),xe;break;case 123:return Se;case 125:return Ee;case 117:case 85:var p=this.peekCodePoint(0),h=this.peekCodePoint(1);return p!==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 Re}return ue(e)?(this.consumeWhiteSpace(),_e):le(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):pe(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=[],A=this.consumeCodePoint();de(A)&&e.length<6;)e.push(A),A=this.consumeCodePoint();for(var t=!1;63===A&&e.length<6;)e.push(A),A=this.consumeCodePoint(),t=!0;if(t)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 n=parseInt(c.apply(void 0,e),16);if(this.peekCodePoint(0)===ae&&de(this.peekCodePoint(1))){this.consumeCodePoint(),A=this.consumeCodePoint();for(var o=[];de(A)&&o.length<6;)o.push(A),A=this.consumeCodePoint();return{type:30,start:n,end:parseInt(c.apply(void 0,o),16)}}return{type:30,start:n,end:n}},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 A=this.peekCodePoint(0);if(39===A||34===A){var t=this.consumeStringToken(this.consumeCodePoint());return 0===t.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===ce||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:t.value}):(this.consumeBadUrlRemnants(),ke)}for(;;){var n=this.consumeCodePoint();if(n===ce||41===n)return{type:22,value:c.apply(void 0,e)};if(ue(n))return this.consumeWhiteSpace(),this.peekCodePoint(0)===ce||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:c.apply(void 0,e)}):(this.consumeBadUrlRemnants(),ke);if(34===n||39===n||40===n||ge(n))return this.consumeBadUrlRemnants(),ke;if(92===n){if(!me(n,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),ke;e.push(this.consumeEscapedCodePoint())}else e.push(n)}},e.prototype.consumeWhiteSpace=function(){for(;ue(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 A="";e>0;){var t=Math.min(5e4,e);A+=c.apply(void 0,this._value.splice(0,t)),e-=t}return this._value.shift(),A},e.prototype.consumeStringToken=function(e){for(var A="",t=0;;){var n=this._value[t];if(n===ce||void 0===n||n===e)return{type:0,value:A+=this.consumeStringSlice(t)};if(10===n)return this._value.splice(0,t),Te;if(92===n){var o=this._value[t+1];o!==ce&&void 0!==o&&(10===o?(A+=this.consumeStringSlice(t),t=-1,this._value.shift()):me(n,o)&&(A+=this.consumeStringSlice(t),A+=c(this.consumeEscapedCodePoint()),t=-1))}t++}},e.prototype.consumeNumber=function(){var e=[],A=4,t=this.peekCodePoint(0);for(t!==se&&t!==ae||e.push(this.consumeCodePoint());le(this.peekCodePoint(0));)e.push(this.consumeCodePoint());t=this.peekCodePoint(0);var n=this.peekCodePoint(1);if(46===t&&le(n))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=8;le(this.peekCodePoint(0));)e.push(this.consumeCodePoint());t=this.peekCodePoint(0),n=this.peekCodePoint(1);var o=this.peekCodePoint(2);if((69===t||101===t)&&((n===se||n===ae)&&le(o)||le(n)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=8;le(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[ve(e),A]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),A=e[0],t=e[1],n=this.peekCodePoint(0),o=this.peekCodePoint(1),i=this.peekCodePoint(2);return fe(n,o,i)?{type:15,number:A,flags:t,unit:this.consumeName()}:37===n?(this.consumeCodePoint(),{type:16,number:A,flags:t}):{type:17,number:A,flags:t}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(de(e)){for(var A=c(e);de(this.peekCodePoint(0))&&A.length<6;)A+=c(this.consumeCodePoint());ue(this.peekCodePoint(0))&&this.consumeCodePoint();var t=parseInt(A,16);return 0===t||function(e){return e>=55296&&e<=57343}(t)||t>1114111?65533:t}return e===ce?65533:e},e.prototype.consumeName=function(){for(var e="";;){var A=this.consumeCodePoint();if(he(A))e+=c(A);else{if(!me(A,this.peekCodePoint(0)))return this.reconsumeCodePoint(A),e;e+=c(this.consumeEscapedCodePoint())}}},e}(),Ve=function(){function e(e){this._tokens=e}return e.create=function(A){var t=new Oe;return t.write(A),new e(t.read())},e.parseValue=function(A){return e.create(A).parseComponentValue()},e.parseValues=function(A){return e.create(A).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 A=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return A;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var A=this.consumeComponentValue();if(32===A.type)return e;e.push(A),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 A={type:e,values:[]},t=this.consumeToken();;){if(32===t.type||Ye(t,e))return A;this.reconsumeToken(t),A.values.push(this.consumeComponentValue()),t=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var A={name:e.value,values:[],type:18};;){var t=this.consumeToken();if(32===t.type||3===t.type)return A;this.reconsumeToken(t),A.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?Re:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Ne=function(e){return 15===e.type},Ge=function(e){return 17===e.type},We=function(e){return 20===e.type},je=function(e){return 0===e.type},ze=function(e,A){return We(e)&&e.value===A},qe=function(e){return 31!==e.type},Xe=function(e){return 31!==e.type&&4!==e.type},Je=function(e){var A=[],t=[];return e.forEach(function(e){if(4===e.type){if(0===t.length)throw new Error("Error parsing function args, zero tokens for arg");return A.push(t),void(t=[])}31!==e.type&&t.push(e)}),t.length&&A.push(t),A},Ye=function(e,A){return 11===A&&12===e.type||28===A&&29===e.type||2===A&&3===e.type},Ze=function(e){return 17===e.type||15===e.type},$e=function(e){return 16===e.type||Ze(e)},eA=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},AA={type:17,number:0,flags:4},tA={type:16,number:50,flags:4},nA={type:16,number:100,flags:4},oA=function(e,A,t){var n=e[0],o=e[1];return[iA(n,A),iA(void 0!==o?o:n,t)]},iA=function(e,A){if(16===e.type)return e.number/100*A;if(Ne(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},rA="grad",aA="turn",sA=function(e,A){if(15===A.type)switch(A.unit){case"deg":return Math.PI*A.number/180;case rA:return Math.PI/200*A.number;case"rad":return A.number;case aA:return 2*Math.PI*A.number}throw new Error("Unsupported angle type")},cA=function(e){return 15===e.type&&("deg"===e.unit||e.unit===rA||"rad"===e.unit||e.unit===aA)},lA=function(e){switch(e.filter(We).map(function(e){return e.value}).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[AA,AA];case"to top":case"bottom":return dA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[AA,nA];case"to right":case"left":return dA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[nA,nA];case"to bottom":case"top":return dA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[nA,AA];case"to left":case"right":return dA(270)}return 0},dA=function(e){return Math.PI*e/180},uA=function(e,A){if(18===A.type){var t=wA[A.name];if(void 0===t)throw new Error('Attempting to parse an unsupported color function "'+A.name+'"');return t(e,A.values)}if(5===A.type){if(3===A.value.length){var n=A.value.substring(0,1),o=A.value.substring(1,2),i=A.value.substring(2,3);return gA(parseInt(n+n,16),parseInt(o+o,16),parseInt(i+i,16),1)}if(4===A.value.length){n=A.value.substring(0,1),o=A.value.substring(1,2),i=A.value.substring(2,3);var r=A.value.substring(3,4);return gA(parseInt(n+n,16),parseInt(o+o,16),parseInt(i+i,16),parseInt(r+r,16)/255)}if(6===A.value.length)return n=A.value.substring(0,2),o=A.value.substring(2,4),i=A.value.substring(4,6),gA(parseInt(n,16),parseInt(o,16),parseInt(i,16),1);if(8===A.value.length)return n=A.value.substring(0,2),o=A.value.substring(2,4),i=A.value.substring(4,6),r=A.value.substring(6,8),gA(parseInt(n,16),parseInt(o,16),parseInt(i,16),parseInt(r,16)/255)}if(20===A.type){var a=yA[A.value.toUpperCase()];if(void 0!==a)return a}return yA.TRANSPARENT},pA=function(e){return!(255&e)},hA=function(e){var A=255&e,t=255&e>>8,n=255&e>>16,o=255&e>>24;return A<255?"rgba("+o+","+n+","+t+","+A/255+")":"rgb("+o+","+n+","+t+")"},gA=function(e,A,t,n){return(e<<24|A<<16|t<<8|Math.round(255*n))>>>0},mA=function(e,A){if(17===e.type)return e.number;if(16===e.type){var t=3===A?1:255;return 3===A?e.number/100*t:Math.round(e.number/100*t)}return 0},fA=function(e,A){var t=A.filter(Xe);if(3===t.length){var n=t.map(mA),o=n[0],i=n[1],r=n[2];return gA(o,i,r,1)}if(4===t.length){var a=t.map(mA),s=(o=a[0],i=a[1],r=a[2],a[3]);return gA(o,i,r,s)}return 0};function BA(e,A,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(A-e)*t*6+e:t<.5?A:t<2/3?6*(A-e)*(2/3-t)+e:e}var vA=function(e,A){var t=A.filter(Xe),n=t[0],o=t[1],i=t[2],r=t[3],a=(17===n.type?dA(n.number):sA(e,n))/(2*Math.PI),s=$e(o)?o.number/100:0,c=$e(i)?i.number/100:0,l=void 0!==r&&$e(r)?iA(r,1):1;if(0===s)return gA(255*c,255*c,255*c,1);var d=c<=.5?c*(s+1):c+s-c*s,u=2*c-d,p=BA(u,d,a+1/3),h=BA(u,d,a),g=BA(u,d,a-1/3);return gA(255*p,255*h,255*g,l)},wA={hsl:vA,hsla:vA,rgb:fA,rgba:fA},bA=function(e,A){return uA(e,Ve.create(A).parseComponentValue())},yA={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},CA={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,A){return A.map(function(e){if(We(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},xA={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},QA=function(e,A){var t=uA(e,A[0]),n=A[1];return n&&$e(n)?{color:t,stop:n}:{color:t,stop:null}},FA=function(e,A){var t=e[0],n=e[e.length-1];null===t.stop&&(t.stop=AA),null===n.stop&&(n.stop=nA);for(var o=[],i=0,r=0;r<e.length;r++){var a=e[r].stop;if(null!==a){var s=iA(a,A);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,u=(l-o[c-1])/(d+1),p=1;p<=d;p++)o[c+p-1]=u*p;c=null}}return e.map(function(e,t){return{color:e.color,stop:Math.max(Math.min(1,o[t]/A),0)}})},UA=function(e,A,t){var n="number"==typeof e?e:function(e,A,t){var n=A/2,o=t/2,i=iA(e[0],A)-n,r=o-iA(e[1],t);return(Math.atan2(r,i)+2*Math.PI)%(2*Math.PI)}(e,A,t),o=Math.abs(A*Math.sin(n))+Math.abs(t*Math.cos(n)),i=A/2,r=t/2,a=o/2,s=Math.sin(n-Math.PI/2)*a,c=Math.cos(n-Math.PI/2)*a;return[o,i-c,i+c,r-s,r+s]},SA=function(e,A){return Math.sqrt(e*e+A*A)},EA=function(e,A,t,n,o){return[[0,0],[0,A],[e,0],[e,A]].reduce(function(e,A){var i=A[0],r=A[1],a=SA(t-i,n-r);return(o?a<e.optimumDistance:a>e.optimumDistance)?{optimumCorner:A,optimumDistance:a}:e},{optimumDistance:o?1/0:-1/0,optimumCorner:null}).optimumCorner},IA=function(e,A){var t=dA(180),n=[];return Je(A).forEach(function(A,o){if(0===o){var i=A[0];if(20===i.type&&-1!==["top","left","right","bottom"].indexOf(i.value))return void(t=lA(A));if(cA(i))return void(t=(sA(e,i)+dA(270))%dA(360))}var r=QA(e,A);n.push(r)}),{angle:t,stops:n,type:1}},kA="closest-side",TA="farthest-side",HA="closest-corner",DA="farthest-corner",MA="circle",LA="ellipse",PA="cover",KA="contain",_A=function(e,A){var t=0,n=3,o=[],i=[];return Je(A).forEach(function(A,r){var a=!0;if(0===r?a=A.reduce(function(e,A){if(We(A))switch(A.value){case"center":return i.push(tA),!1;case"top":case"left":return i.push(AA),!1;case"right":case"bottom":return i.push(nA),!1}else if($e(A)||Ze(A))return i.push(A),!1;return e},a):1===r&&(a=A.reduce(function(e,A){if(We(A))switch(A.value){case MA:return t=0,!1;case LA:return t=1,!1;case KA:case kA:return n=0,!1;case TA:return n=1,!1;case HA:return n=2,!1;case PA:case DA:return n=3,!1}else if(Ze(A)||$e(A))return Array.isArray(n)||(n=[]),n.push(A),!1;return e},a)),a){var s=QA(e,A);o.push(s)}}),{size:n,shape:t,stops:o,position:i,type:2}},RA=function(e,A){if(22===A.type){var t={url:A.value,type:0};return e.cache.addImage(A.value),t}if(18===A.type){var n=VA[A.name];if(void 0===n)throw new Error('Attempting to parse an unsupported image function "'+A.name+'"');return n(e,A.values)}throw new Error("Unsupported image type "+A.type)};var OA,VA={"linear-gradient":function(e,A){var t=dA(180),n=[];return Je(A).forEach(function(A,o){if(0===o){var i=A[0];if(20===i.type&&"to"===i.value)return void(t=lA(A));if(cA(i))return void(t=sA(e,i))}var r=QA(e,A);n.push(r)}),{angle:t,stops:n,type:1}},"-moz-linear-gradient":IA,"-ms-linear-gradient":IA,"-o-linear-gradient":IA,"-webkit-linear-gradient":IA,"radial-gradient":function(e,A){var t=0,n=3,o=[],i=[];return Je(A).forEach(function(A,r){var a=!0;if(0===r){var s=!1;a=A.reduce(function(e,A){if(s)if(We(A))switch(A.value){case"center":return i.push(tA),e;case"top":case"left":return i.push(AA),e;case"right":case"bottom":return i.push(nA),e}else($e(A)||Ze(A))&&i.push(A);else if(We(A))switch(A.value){case MA:return t=0,!1;case LA:return t=1,!1;case"at":return s=!0,!1;case kA:return n=0,!1;case PA:case TA:return n=1,!1;case KA:case HA:return n=2,!1;case DA:return n=3,!1}else if(Ze(A)||$e(A))return Array.isArray(n)||(n=[]),n.push(A),!1;return e},a)}if(a){var c=QA(e,A);o.push(c)}}),{size:n,shape:t,stops:o,position:i,type:2}},"-moz-radial-gradient":_A,"-ms-radial-gradient":_A,"-o-radial-gradient":_A,"-webkit-radial-gradient":_A,"-webkit-gradient":function(e,A){var t=dA(180),n=[],o=1;return Je(A).forEach(function(A,t){var i=A[0];if(0===t){if(We(i)&&"linear"===i.value)return void(o=1);if(We(i)&&"radial"===i.value)return void(o=2)}if(18===i.type)if("from"===i.name){var r=uA(e,i.values[0]);n.push({stop:AA,color:r})}else if("to"===i.name)r=uA(e,i.values[0]),n.push({stop:nA,color:r});else if("color-stop"===i.name){var a=i.values.filter(Xe);if(2===a.length){r=uA(e,a[1]);var s=a[0];Ge(s)&&n.push({stop:{type:16,number:100*s.number,flags:s.flags},color:r})}}}),1===o?{angle:(t+dA(180))%dA(360),stops:n,type:o}:{size:3,shape:0,stops:n,position:[],type:o}}},NA={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,A){if(0===A.length)return[];var t=A[0];return 20===t.type&&"none"===t.value?[]:A.filter(function(e){return Xe(e)&&function(e){return!(20===e.type&&"none"===e.value||18===e.type&&!VA[e.name])}(e)}).map(function(A){return RA(e,A)})}},GA={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,A){return A.map(function(e){if(We(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},WA={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,A){return Je(A).map(function(e){return e.filter($e)}).map(eA)}},jA={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,A){return Je(A).map(function(e){return e.filter(We).map(function(e){return e.value}).join(" ")}).map(zA)}},zA=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"}(OA||(OA={}));var qA,XA={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,A){return Je(A).map(function(e){return e.filter(JA)})}},JA=function(e){return We(e)||$e(e)},YA=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},ZA=YA("top"),$A=YA("right"),et=YA("bottom"),At=YA("left"),tt=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,A){return eA(A.filter($e))}}},nt=tt("top-left"),ot=tt("top-right"),it=tt("bottom-right"),rt=tt("bottom-left"),at=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,A){switch(A){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},st=at("top"),ct=at("right"),lt=at("bottom"),dt=at("left"),ut=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,A){return Ne(A)?A.number:0}}},pt=ut("top"),ht=ut("right"),gt=ut("bottom"),mt=ut("left"),ft={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Bt={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,A){return"rtl"===A?1:0}},vt={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,A){return A.filter(We).reduce(function(e,A){return e|wt(A.value)},0)}},wt=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},bt={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,A){switch(A){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},yt={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,A){return 20===A.type&&"normal"===A.value?0:17===A.type||15===A.type?A.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(qA||(qA={}));var Ct,xt={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,A){return"strict"===A?qA.STRICT:qA.NORMAL}},Qt={name:"line-height",initialValue:"normal",prefix:!1,type:4},Ft=function(e,A){return We(e)&&"normal"===e.value?1.2*A:17===e.type?A*e.number:$e(e)?iA(e,A):A},Ut={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,A){return 20===A.type&&"none"===A.value?null:RA(e,A)}},St={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,A){return"inside"===A?0:1}},Et={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,A){switch(A){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}}},It=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},kt=It("top"),Tt=It("right"),Ht=It("bottom"),Dt=It("left"),Mt={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,A){return A.filter(We).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}})}},Lt={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,A){return"break-word"===A?"break-word":"normal"}},Pt=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Kt=Pt("top"),_t=Pt("right"),Rt=Pt("bottom"),Ot=Pt("left"),Vt={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,A){switch(A){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Nt={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,A){switch(A){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Gt={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,A){return 1===A.length&&ze(A[0],"none")?[]:Je(A).map(function(A){for(var t={color:yA.TRANSPARENT,offsetX:AA,offsetY:AA,blur:AA},n=0,o=0;o<A.length;o++){var i=A[o];Ze(i)?(0===n?t.offsetX=i:1===n?t.offsetY=i:t.blur=i,n++):t.color=uA(e,i)}return t})}},Wt={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(e,A){switch(A){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},jt={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(e,A){if(20===A.type&&"none"===A.value)return null;if(18===A.type){var t=zt[A.name];if(void 0===t)throw new Error('Attempting to parse an unsupported transform function "'+A.name+'"');return t(A.values)}return null}},zt={matrix:function(e){var A=e.filter(function(e){return 17===e.type}).map(function(e){return e.number});return 6===A.length?A:null},matrix3d:function(e){var A=e.filter(function(e){return 17===e.type}).map(function(e){return e.number}),t=A[0],n=A[1];A[2],A[3];var o=A[4],i=A[5];A[6],A[7],A[8],A[9],A[10],A[11];var r=A[12],a=A[13];return A[14],A[15],16===A.length?[t,n,o,i,r,a]:null}},qt={type:16,number:50,flags:4},Xt=[qt,qt],Jt={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,A){var t=A.filter($e);return 2!==t.length?Xt:[t[0],t[1]]}},Yt={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(e,A){switch(A){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"}(Ct||(Ct={}));for(var Zt={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,A){switch(A){case"break-all":return Ct.BREAK_ALL;case"keep-all":return Ct.KEEP_ALL;default:return Ct.NORMAL}}},$t={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,A){if(20===A.type)return{auto:!0,order:0};if(Ge(A))return{auto:!1,order:A.number};throw new Error("Invalid z-index number parsed")}},en={name:"time",parse:function(e,A){if(15===A.type)switch(A.unit.toLowerCase()){case"s":return 1e3*A.number;case"ms":return A.number}throw new Error("Unsupported time type")}},An={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,A){return Ge(A)?A.number:1}},tn={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},nn={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,A){return A.filter(We).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})}},on={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(e,A){var t=[],n=[];return A.forEach(function(e){switch(e.type){case 20:case 0:t.push(e.value);break;case 17:t.push(e.number.toString());break;case 4:n.push(t.join(" ")),t.length=0}}),t.length&&n.push(t.join(" ")),n.map(function(e){return-1===e.indexOf(" ")?e:"'"+e+"'"})}},rn={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},an={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,A){return Ge(A)?A.number:We(A)&&"bold"===A.value?700:400}},sn={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,A){return A.filter(We).map(function(e){return e.value})}},cn={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(e,A){switch(A){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},ln=function(e,A){return 0!==(e&A)},dn={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(e,A){if(0===A.length)return[];var t=A[0];return 20===t.type&&"none"===t.value?[]:A}},un={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(e,A){if(0===A.length)return null;var t=A[0];if(20===t.type&&"none"===t.value)return null;for(var n=[],o=A.filter(qe),i=0;i<o.length;i++){var r=o[i],a=o[i+1];if(20===r.type){var s=a&&Ge(a)?a.number:1;n.push({counter:r.value,increment:s})}}return n}},pn={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,A){if(0===A.length)return[];for(var t=[],n=A.filter(qe),o=0;o<n.length;o++){var i=n[o],r=n[o+1];if(We(i)&&"none"!==i.value){var a=r&&Ge(r)?r.number:0;t.push({counter:i.value,reset:a})}}return t}},hn={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,A){return A.filter(Ne).map(function(A){return en.parse(e,A)})}},gn={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(e,A){if(0===A.length)return null;var t=A[0];if(20===t.type&&"none"===t.value)return null;var n=[],o=A.filter(je);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;n.push({open:r,close:a})}return n}},mn=function(e,A,t){if(!e)return"";var n=e[Math.min(A,e.length-1)];return n?t?n.open:n.close:""},fn={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,A){return 1===A.length&&ze(A[0],"none")?[]:Je(A).map(function(A){for(var t={color:255,offsetX:AA,offsetY:AA,blur:AA,spread:AA,inset:!1},n=0,o=0;o<A.length;o++){var i=A[o];ze(i,"inset")?t.inset=!0:Ze(i)?(0===n?t.offsetX=i:1===n?t.offsetY=i:2===n?t.blur=i:t.spread=i,n++):t.color=uA(e,i)}return t})}},Bn={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,A){var t=[];return A.filter(We).forEach(function(e){switch(e.value){case"stroke":t.push(1);break;case"fill":t.push(0);break;case"markers":t.push(2)}}),[0,1,2].forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}},vn={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},wn={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,A){return Ne(A)?A.number:0}},bn=function(){function e(e,A){var t,n;this.animationDuration=xn(e,hn,A.animationDuration),this.backgroundClip=xn(e,CA,A.backgroundClip),this.backgroundColor=xn(e,xA,A.backgroundColor),this.backgroundImage=xn(e,NA,A.backgroundImage),this.backgroundOrigin=xn(e,GA,A.backgroundOrigin),this.backgroundPosition=xn(e,WA,A.backgroundPosition),this.backgroundRepeat=xn(e,jA,A.backgroundRepeat),this.backgroundSize=xn(e,XA,A.backgroundSize),this.borderTopColor=xn(e,ZA,A.borderTopColor),this.borderRightColor=xn(e,$A,A.borderRightColor),this.borderBottomColor=xn(e,et,A.borderBottomColor),this.borderLeftColor=xn(e,At,A.borderLeftColor),this.borderTopLeftRadius=xn(e,nt,A.borderTopLeftRadius),this.borderTopRightRadius=xn(e,ot,A.borderTopRightRadius),this.borderBottomRightRadius=xn(e,it,A.borderBottomRightRadius),this.borderBottomLeftRadius=xn(e,rt,A.borderBottomLeftRadius),this.borderTopStyle=xn(e,st,A.borderTopStyle),this.borderRightStyle=xn(e,ct,A.borderRightStyle),this.borderBottomStyle=xn(e,lt,A.borderBottomStyle),this.borderLeftStyle=xn(e,dt,A.borderLeftStyle),this.borderTopWidth=xn(e,pt,A.borderTopWidth),this.borderRightWidth=xn(e,ht,A.borderRightWidth),this.borderBottomWidth=xn(e,gt,A.borderBottomWidth),this.borderLeftWidth=xn(e,mt,A.borderLeftWidth),this.boxShadow=xn(e,fn,A.boxShadow),this.color=xn(e,ft,A.color),this.direction=xn(e,Bt,A.direction),this.display=xn(e,vt,A.display),this.float=xn(e,bt,A.cssFloat),this.fontFamily=xn(e,on,A.fontFamily),this.fontSize=xn(e,rn,A.fontSize),this.fontStyle=xn(e,cn,A.fontStyle),this.fontVariant=xn(e,sn,A.fontVariant),this.fontWeight=xn(e,an,A.fontWeight),this.letterSpacing=xn(e,yt,A.letterSpacing),this.lineBreak=xn(e,xt,A.lineBreak),this.lineHeight=xn(e,Qt,A.lineHeight),this.listStyleImage=xn(e,Ut,A.listStyleImage),this.listStylePosition=xn(e,St,A.listStylePosition),this.listStyleType=xn(e,Et,A.listStyleType),this.marginTop=xn(e,kt,A.marginTop),this.marginRight=xn(e,Tt,A.marginRight),this.marginBottom=xn(e,Ht,A.marginBottom),this.marginLeft=xn(e,Dt,A.marginLeft),this.opacity=xn(e,An,A.opacity);var o=xn(e,Mt,A.overflow);this.overflowX=o[0],this.overflowY=o[o.length>1?1:0],this.overflowWrap=xn(e,Lt,A.overflowWrap),this.paddingTop=xn(e,Kt,A.paddingTop),this.paddingRight=xn(e,_t,A.paddingRight),this.paddingBottom=xn(e,Rt,A.paddingBottom),this.paddingLeft=xn(e,Ot,A.paddingLeft),this.paintOrder=xn(e,Bn,A.paintOrder),this.position=xn(e,Nt,A.position),this.textAlign=xn(e,Vt,A.textAlign),this.textDecorationColor=xn(e,tn,null!==(t=A.textDecorationColor)&&void 0!==t?t:A.color),this.textDecorationLine=xn(e,nn,null!==(n=A.textDecorationLine)&&void 0!==n?n:A.textDecoration),this.textShadow=xn(e,Gt,A.textShadow),this.textTransform=xn(e,Wt,A.textTransform),this.transform=xn(e,jt,A.transform),this.transformOrigin=xn(e,Jt,A.transformOrigin),this.visibility=xn(e,Yt,A.visibility),this.webkitTextStrokeColor=xn(e,vn,A.webkitTextStrokeColor),this.webkitTextStrokeWidth=xn(e,wn,A.webkitTextStrokeWidth),this.wordBreak=xn(e,Zt,A.wordBreak),this.zIndex=xn(e,$t,A.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return pA(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 ln(this.display,4)||ln(this.display,33554432)||ln(this.display,268435456)||ln(this.display,536870912)||ln(this.display,67108864)||ln(this.display,134217728)},e}(),yn=function(e,A){this.content=xn(e,dn,A.content),this.quotes=xn(e,gn,A.quotes)},Cn=function(e,A){this.counterIncrement=xn(e,un,A.counterIncrement),this.counterReset=xn(e,pn,A.counterReset)},xn=function(e,A,t){var n=new Oe,o=null!=t?t.toString():A.initialValue;n.write(o);var i=new Ve(n.read());switch(A.type){case 2:var r=i.parseComponentValue();return A.parse(e,We(r)?r.value:A.initialValue);case 0:return A.parse(e,i.parseComponentValue());case 1:return A.parse(e,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(A.format){case"angle":return sA(e,i.parseComponentValue());case"color":return uA(e,i.parseComponentValue());case"image":return RA(e,i.parseComponentValue());case"length":var a=i.parseComponentValue();return Ze(a)?a:AA;case"length-percentage":var s=i.parseComponentValue();return $e(s)?s:AA;case"time":return en.parse(e,i.parseComponentValue())}}},Qn=function(e,A){var t=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===t||A===t},Fn=function(e,A){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Qn(A,3),this.styles=new bn(e,window.getComputedStyle(A,null)),ko(A)&&(this.styles.animationDuration.some(function(e){return e>0})&&(A.style.animationDuration="0s"),null!==this.styles.transform&&(A.style.transform="none")),this.bounds=a(this.context,A),Qn(A,4)&&(this.flags|=16)},Un="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),En=0;En<64;En++)Sn[Un.charCodeAt(En)]=En;for(var In=function(e,A,t){return e.slice?e.slice(A,t):new Uint16Array(Array.prototype.slice.call(e,A,t))},kn=function(){function e(e,A,t,n,o,i){this.initialValue=e,this.errorValue=A,this.highStart=t,this.highValueIndex=n,this.index=o,this.data=i}return e.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=((A=this.index[e>>5])<<2)+(31&e),this.data[A];if(e<=65535)return A=((A=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[A];if(e<this.highStart)return A=2080+(e>>11),A=this.index[A],A+=e>>5&63,A=((A=this.index[A])<<2)+(31&e),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Tn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Dn=0;Dn<64;Dn++)Hn[Tn.charCodeAt(Dn)]=Dn;var Mn,Ln=8,Pn=9,Kn=11,_n=12,Rn=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var t=e.length;if(!t)return"";for(var n=[],o=-1,i="";++o<t;){var r=e[o];r<=65535?n.push(r):(r-=65536,n.push(55296+(r>>10),r%1024+56320)),(o+1===t||n.length>16384)&&(i+=String.fromCharCode.apply(String,n),n.length=0)}return i},On=function(e){var A,t,n,o=function(e){var A,t,n,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(A=0;A<a;A+=4)t=Sn[e.charCodeAt(A)],n=Sn[e.charCodeAt(A+1)],o=Sn[e.charCodeAt(A+2)],i=Sn[e.charCodeAt(A+3)],l[s++]=t<<2|n>>4,l[s++]=(15&n)<<4|o>>2,l[s++]=(3&o)<<6|63&i;return c}(e),i=Array.isArray(o)?function(e){for(var A=e.length,t=[],n=0;n<A;n+=4)t.push(e[n+3]<<24|e[n+2]<<16|e[n+1]<<8|e[n]);return t}(o):new Uint32Array(o),r=Array.isArray(o)?function(e){for(var A=e.length,t=[],n=0;n<A;n+=2)t.push(e[n+1]<<8|e[n]);return t}(o):new Uint16Array(o),a=In(r,12,i[4]/2),s=2===i[5]?In(r,(24+i[4])/2):(A=i,t=Math.ceil((24+i[4])/4),A.slice?A.slice(t,n):new Uint32Array(Array.prototype.slice.call(A,t,n)));return new kn(i[0],i[1],i[2],i[3],a,s)}("AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA="),Vn="×",Nn=function(e){return On.get(e)},Gn=function(e,A,t){var n=t-2,o=A[n],i=A[t-1],r=A[t];if(2===i&&3===r)return Vn;if(2===i||3===i||4===i)return"÷";if(2===r||3===r||4===r)return"÷";if(i===Ln&&-1!==[Ln,Pn,Kn,_n].indexOf(r))return Vn;if(!(i!==Kn&&i!==Pn||r!==Pn&&10!==r))return Vn;if((i===_n||10===i)&&10===r)return Vn;if(13===r||5===r)return Vn;if(7===r)return Vn;if(1===i)return Vn;if(13===i&&14===r){for(;5===o;)o=A[--n];if(14===o)return Vn}if(15===i&&15===r){for(var a=0;15===o;)a++,o=A[--n];if(a%2==0)return Vn}return"÷"},Wn=function(e){var A=function(e){for(var A=[],t=0,n=e.length;t<n;){var o=e.charCodeAt(t++);if(o>=55296&&o<=56319&&t<n){var i=e.charCodeAt(t++);56320==(64512&i)?A.push(((1023&o)<<10)+(1023&i)+65536):(A.push(o),t--)}else A.push(o)}return A}(e),t=A.length,n=0,o=0,i=A.map(Nn);return{next:function(){if(n>=t)return{done:!0,value:null};for(var e=Vn;n<t&&(e=Gn(0,i,++n))===Vn;);if(e!==Vn||n===t){var r=Rn.apply(null,A.slice(o,n));return o=n,{value:r,done:!1}}return{done:!0,value:null}}}},jn=function(e){return 0===e[0]&&255===e[1]&&0===e[2]&&255===e[3]},zn=function(e,A,t,n,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",A.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",n.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),r.appendChild(a),a.appendChild(o),r},qn=function(e){return new Promise(function(A,t){var n=new Image;n.onload=function(){return A(n)},n.onerror=t,n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(e))})},Xn={get SUPPORT_RANGE_BOUNDS(){var e=function(e){if(e.createRange){var A=e.createRange();if(A.getBoundingClientRect){var t=e.createElement("boundtest");t.style.height="123px",t.style.display="block",e.body.appendChild(t),A.selectNode(t);var n=A.getBoundingClientRect(),o=Math.round(n.height);if(e.body.removeChild(t),123===o)return!0}}return!1}(document);return Object.defineProperty(Xn,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Xn.SUPPORT_RANGE_BOUNDS&&function(e){var A=e.createElement("boundtest");A.style.width="50px",A.style.display="block",A.style.fontSize="12px",A.style.letterSpacing="0px",A.style.wordSpacing="0px",e.body.appendChild(A);var t=e.createRange();A.innerHTML="function"==typeof"".repeat?"👨".repeat(10):"";var n=A.firstChild,o=s(n.data).map(function(e){return c(e)}),i=0,r={},a=o.every(function(e,A){t.setStart(n,i),t.setEnd(n,i+e.length);var o=t.getBoundingClientRect();i+=e.length;var a=o.x>r.x||o.y>r.y;return r=o,0===A||a});return e.body.removeChild(A),a}(document);return Object.defineProperty(Xn,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=function(e){var A=new Image,t=e.createElement("canvas"),n=t.getContext("2d");if(!n)return!1;A.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{n.drawImage(A,0,0),t.toDataURL()}catch(e){return!1}return!0}(document);return Object.defineProperty(Xn,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?function(e){var A=e.createElement("canvas"),t=100;A.width=t,A.height=t;var n=A.getContext("2d");if(!n)return Promise.reject(!1);n.fillStyle="rgb(0, 255, 0)",n.fillRect(0,0,t,t);var o=new Image,i=A.toDataURL();o.src=i;var r=zn(t,t,0,0,o);return n.fillStyle="red",n.fillRect(0,0,t,t),qn(r).then(function(A){n.drawImage(A,0,0);var o=n.getImageData(0,0,t,t).data;n.fillStyle="red",n.fillRect(0,0,t,t);var r=e.createElement("div");return r.style.backgroundImage="url("+i+")",r.style.height=t+"px",jn(o)?qn(zn(t,t,0,0,r)):Promise.reject(!1)}).then(function(e){return n.drawImage(e,0,0),jn(n.getImageData(0,0,t,t).data)}).catch(function(){return!1})}(document):Promise.resolve(!1);return Object.defineProperty(Xn,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=void 0!==(new Image).crossOrigin;return Object.defineProperty(Xn,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(Xn,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Xn,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(Xn,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Jn=function(e,A){this.text=e,this.bounds=A},Yn=function(e,A){var t=A.ownerDocument;if(t){var n=t.createElement("html2canvaswrapper");n.appendChild(A.cloneNode(!0));var o=A.parentNode;if(o){o.replaceChild(n,A);var i=a(e,n);return n.firstChild&&o.replaceChild(n.firstChild,n),i}}return r.EMPTY},Zn=function(e,A,t){var n=e.ownerDocument;if(!n)throw new Error("Node has no owner document");var o=n.createRange();return o.setStart(e,A),o.setEnd(e,A+t),o},$n=function(e){if(Xn.SUPPORT_NATIVE_TEXT_SEGMENTATION){var A=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(A.segment(e)).map(function(e){return e.segment})}return function(e){for(var A,t=Wn(e),n=[];!(A=t.next()).done;)A.value&&n.push(A.value.slice());return n}(e)},eo=function(e,A){return 0!==A.letterSpacing?$n(e):function(e,A){if(Xn.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(e)).map(function(e){return e.segment})}return to(e,A)}(e,A)},Ao=[32,160,4961,65792,65793,4153,4241],to=function(e,A){for(var t,n=function(e,A){var t=s(e),n=ie(t,A),o=n[0],i=n[1],r=n[2],a=t.length,c=0,l=0;return{next:function(){if(l>=a)return{done:!0,value:null};for(var e=j;l<a&&(e=oe(t,i,o,++l,r))===j;);if(e!==j||l===a){var A=new re(t,e,c,l);return c=l,{value:A,done:!1}}return{done:!0,value:null}}}}(e,{lineBreak:A.lineBreak,wordBreak:"break-word"===A.overflowWrap?"break-word":A.wordBreak}),o=[],i=function(){if(t.value){var e=t.value.slice(),A=s(e),n="";A.forEach(function(e){-1===Ao.indexOf(e)?n+=c(e):(n.length&&o.push(n),o.push(c(e)),n="")}),n.length&&o.push(n)}};!(t=n.next()).done;)i();return o},no=function(e,A,t){this.text=oo(A.data,t.textTransform),this.textBounds=function(e,A,t,n){var o=eo(A,t),i=[],a=0;return o.forEach(function(A){if(t.textDecorationLine.length||A.trim().length>0)if(Xn.SUPPORT_RANGE_BOUNDS){var o=Zn(n,a,A.length).getClientRects();if(o.length>1){var s=$n(A),c=0;s.forEach(function(A){i.push(new Jn(A,r.fromDOMRectList(e,Zn(n,c+a,A.length).getClientRects()))),c+=A.length})}else i.push(new Jn(A,r.fromDOMRectList(e,o)))}else{var l=n.splitText(A.length);i.push(new Jn(A,Yn(e,n))),n=l}else Xn.SUPPORT_RANGE_BOUNDS||(n=n.splitText(A.length));a+=A.length}),i}(e,this.text,t,A)},oo=function(e,A){switch(A){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,A,t){return e.length>0?A+t.toUpperCase():e},ao=function(e){function t(A,t){var n=e.call(this,A,t)||this;return n.src=t.currentSrc||t.src,n.intrinsicWidth=t.naturalWidth,n.intrinsicHeight=t.naturalHeight,n.context.cache.addImage(n.src),n}return A(t,e),t}(Fn),so=function(e){function t(A,t){var n=e.call(this,A,t)||this;return n.canvas=t,n.intrinsicWidth=t.width,n.intrinsicHeight=t.height,n}return A(t,e),t}(Fn),co=function(e){function t(A,t){var n=e.call(this,A,t)||this,o=new XMLSerializer,i=a(A,t);return t.setAttribute("width",i.width+"px"),t.setAttribute("height",i.height+"px"),n.svg="data:image/svg+xml,"+encodeURIComponent(o.serializeToString(t)),n.intrinsicWidth=t.width.baseVal.value,n.intrinsicHeight=t.height.baseVal.value,n.context.cache.addImage(n.svg),n}return A(t,e),t}(Fn),lo=function(e){function t(A,t){var n=e.call(this,A,t)||this;return n.value=t.value,n}return A(t,e),t}(Fn),uo=function(e){function t(A,t){var n=e.call(this,A,t)||this;return n.start=t.start,n.reversed="boolean"==typeof t.reversed&&!0===t.reversed,n}return A(t,e),t}(Fn),po=[{type:15,flags:0,unit:"px",number:3}],ho=[{type:16,flags:0,number:50}],go="checkbox",mo="radio",fo="password",Bo=707406591,vo=function(e){function t(A,t){var n,o,i,a=e.call(this,A,t)||this;switch(a.type=t.type.toLowerCase(),a.checked=t.checked,a.value=0===(i=(o=t).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=(n=a.bounds).width>n.height?new r(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width<n.height?new r(n.left,n.top+(n.height-n.width)/2,n.width,n.width):n),a.type){case go:a.styles.borderTopRightRadius=a.styles.borderTopLeftRadius=a.styles.borderBottomRightRadius=a.styles.borderBottomLeftRadius=po;break;case mo:a.styles.borderTopRightRadius=a.styles.borderTopLeftRadius=a.styles.borderBottomRightRadius=a.styles.borderBottomLeftRadius=ho}return a}return A(t,e),t}(Fn),wo=function(e){function t(A,t){var n=e.call(this,A,t)||this,o=t.options[t.selectedIndex||0];return n.value=o&&o.text||"",n}return A(t,e),t}(Fn),bo=function(e){function t(A,t){var n=e.call(this,A,t)||this;return n.value=t.value,n}return A(t,e),t}(Fn),yo=function(e){function t(A,t){var n=e.call(this,A,t)||this;n.src=t.src,n.width=parseInt(t.width,10)||0,n.height=parseInt(t.height,10)||0,n.backgroundColor=n.styles.backgroundColor;try{if(t.contentWindow&&t.contentWindow.document&&t.contentWindow.document.documentElement){n.tree=Fo(A,t.contentWindow.document.documentElement);var o=t.contentWindow.document.documentElement?bA(A,getComputedStyle(t.contentWindow.document.documentElement).backgroundColor):yA.TRANSPARENT,i=t.contentWindow.document.body?bA(A,getComputedStyle(t.contentWindow.document.body).backgroundColor):yA.TRANSPARENT;n.backgroundColor=pA(o)?pA(i)?n.styles.backgroundColor:i:o}}catch(e){}return n}return A(t,e),t}(Fn),Co=["OL","UL","MENU"],xo=function(e,A,t,n){for(var o=A.firstChild,i=void 0;o;o=i)if(i=o.nextSibling,Eo(o)&&o.data.trim().length>0)t.textNodes.push(new no(e,o,t.styles));else if(Io(o))if(Wo(o)&&o.assignedNodes)o.assignedNodes().forEach(function(A){return xo(e,A,t,n)});else{var r=Qo(e,o);r.styles.isVisible()&&(Uo(o,r,n)?r.flags|=4:So(r.styles)&&(r.flags|=2),-1!==Co.indexOf(o.tagName)&&(r.flags|=8),t.elements.push(r),o.slot,o.shadowRoot?xo(e,o.shadowRoot,r,n):No(o)||Lo(o)||Go(o)||xo(e,o,r,n))}},Qo=function(e,A){return Ro(A)?new ao(e,A):Ko(A)?new so(e,A):Lo(A)?new co(e,A):Ho(A)?new lo(e,A):Do(A)?new uo(e,A):Mo(A)?new vo(e,A):Go(A)?new wo(e,A):No(A)?new bo(e,A):Oo(A)?new yo(e,A):new Fn(e,A)},Fo=function(e,A){var t=Qo(e,A);return t.flags|=4,xo(e,A,t,t),t},Uo=function(e,A,t){return A.styles.isPositionedWithZIndex()||A.styles.opacity<1||A.styles.isTransformed()||Po(e)&&t.styles.isTransparent()},So=function(e){return e.isPositioned()||e.isFloating()},Eo=function(e){return e.nodeType===Node.TEXT_NODE},Io=function(e){return e.nodeType===Node.ELEMENT_NODE},ko=function(e){return Io(e)&&void 0!==e.style&&!To(e)},To=function(e){return"object"==typeof e.className},Ho=function(e){return"LI"===e.tagName},Do=function(e){return"OL"===e.tagName},Mo=function(e){return"INPUT"===e.tagName},Lo=function(e){return"svg"===e.tagName},Po=function(e){return"BODY"===e.tagName},Ko=function(e){return"CANVAS"===e.tagName},_o=function(e){return"VIDEO"===e.tagName},Ro=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},Go=function(e){return"SELECT"===e.tagName},Wo=function(e){return"SLOT"===e.tagName},jo=function(e){return e.tagName.indexOf("-")>0},zo=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var A=this.counters[e];return A&&A.length?A[A.length-1]:1},e.prototype.getCounterValues=function(e){return this.counters[e]||[]},e.prototype.pop=function(e){var A=this;e.forEach(function(e){return A.counters[e].pop()})},e.prototype.parse=function(e){var A=this,t=e.counterIncrement,n=e.counterReset,o=!0;null!==t&&t.forEach(function(e){var t=A.counters[e.counter];t&&0!==e.increment&&(o=!1,t.length||t.push(1),t[Math.max(0,t.length-1)]+=e.increment)});var i=[];return o&&n.forEach(function(e){var t=A.counters[e.counter];i.push(e.counter),t||(t=A.counters[e.counter]=[]),t.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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Jo={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Yo={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,A,t,n,o,i){return e<A||e>t?ai(e,o,i.length>0):n.integers.reduce(function(A,t,o){for(;e>=t;)e-=t,A+=n.values[o];return A},"")+i},$o=function(e,A,t,n){var o="";do{t||e--,o=n(e)+o,e/=A}while(e*A>=A);return o},ei=function(e,A,t,n,o){var i=t-A+1;return(e<0?"-":"")+($o(Math.abs(e),i,n,function(e){return c(Math.floor(e%i)+A)})+o)},Ai=function(e,A,t){void 0===t&&(t=". ");var n=A.length;return $o(Math.abs(e),n,!1,function(e){return A[Math.floor(e%n)]})+t},ti=function(e,A,t,n,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 A[0]+a;for(var s=0;r>0&&s<=4;s++){var c=r%10;0===c&&ln(i,1)&&""!==a?a=A[c]+a:c>1||1===c&&0===s||1===c&&1===s&&ln(i,2)||1===c&&1===s&&ln(i,4)&&e>100||1===c&&s>1&&ln(i,8)?a=A[c]+(s>0?t[s-1]:"")+a:1===c&&s>0&&(a=t[s-1]+a),r=Math.floor(r/10)}return(e<0?n:"")+a},ni="十百千萬",oi="拾佰仟萬",ii="マイナス",ri="마이너스",ai=function(e,A,t){var n=t?". ":"",o=t?"、":"",i=t?", ":"",r=t?" ":"";switch(A){case 0:return"•"+r;case 1:return"◦"+r;case 2:return"◾"+r;case 5:var a=ei(e,48,57,!0,n);return a.length<4?"0"+a:a;case 4:return Ai(e,"〇一二三四五六七八九",o);case 6:return Zo(e,1,3999,qo,3,n).toLowerCase();case 7:return Zo(e,1,3999,qo,3,n);case 8:return ei(e,945,969,!1,n);case 9:return ei(e,97,122,!1,n);case 10:return ei(e,65,90,!1,n);case 11:return ei(e,1632,1641,!0,n);case 12:case 49:return Zo(e,1,9999,Xo,3,n);case 35:return Zo(e,1,9999,Xo,3,n).toLowerCase();case 13:return ei(e,2534,2543,!0,n);case 14:case 30:return ei(e,6112,6121,!0,n);case 15:return Ai(e,"子丑寅卯辰巳午未申酉戌亥",o);case 16:return Ai(e,"甲乙丙丁戊己庚辛壬癸",o);case 17:case 48:return ti(e,"零一二三四五六七八九",ni,"負",o,14);case 47:return ti(e,"零壹貳參肆伍陸柒捌玖",oi,"負",o,15);case 42:return ti(e,"零一二三四五六七八九",ni,"负",o,14);case 41:return ti(e,"零壹贰叁肆伍陆柒捌玖",oi,"负",o,15);case 26:return ti(e,"〇一二三四五六七八九","十百千万",ii,o,0);case 25:return ti(e,"零壱弐参四伍六七八九","拾百千万",ii,o,7);case 31:return ti(e,"영일이삼사오육칠팔구","십백천만",ri,i,7);case 33:return ti(e,"零一二三四五六七八九","十百千萬",ri,i,0);case 32:return ti(e,"零壹貳參四五六七八九","拾百千",ri,i,7);case 18:return ei(e,2406,2415,!0,n);case 20:return Zo(e,1,19999,Yo,3,n);case 21:return ei(e,2790,2799,!0,n);case 22:return ei(e,2662,2671,!0,n);case 22:return Zo(e,1,10999,Jo,3,n);case 23:return Ai(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Ai(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return ei(e,3302,3311,!0,n);case 28:return Ai(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",o);case 29:return Ai(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",o);case 34:return ei(e,3792,3801,!0,n);case 37:return ei(e,6160,6169,!0,n);case 38:return ei(e,4160,4169,!0,n);case 39:return ei(e,2918,2927,!0,n);case 40:return ei(e,1776,1785,!0,n);case 43:return ei(e,3046,3055,!0,n);case 44:return ei(e,3174,3183,!0,n);case 45:return ei(e,3664,3673,!0,n);case 46:return ei(e,3872,3881,!0,n);default:return ei(e,48,57,!0,n)}},si="data-html2canvas-ignore",ci=function(){function e(e,A,t){if(this.context=e,this.options=t,this.scrolledElements=[],this.referenceElement=A,this.counters=new zo,this.quoteDepth=0,!A.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(A.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,A){var t=this,i=di(e,A);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 n(t,void 0,void 0,function(){var e,t;return o(this,function(n){switch(n.label){case 0:return this.scrolledElements.forEach(vi),s&&(s.scrollTo(A.left,A.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||s.scrollY===A.top&&s.scrollX===A.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(s.scrollX-A.left,s.scrollY-A.top,0,0))),e=this.options.onclone,void 0===(t=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:n.sent(),n.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,pi(c)]:[3,4];case 3:n.sent(),n.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then(function(){return e(c,t)}).then(function(){return i})]:[2,i]}})})});return c.open(),c.write(fi(document.doctype)+"<html></html>"),Bi(this.referenceElement.ownerDocument,r,a),c.replaceChild(c.adoptNode(this.documentElement),c.documentElement),c.close(),l},e.prototype.createElementClone=function(e){if(Qn(e,2),Ko(e))return this.createCanvasClone(e);if(_o(e))return this.createVideoClone(e);if(Vo(e))return this.createStyleClone(e);var A=e.cloneNode(!1);return Ro(A)&&(Ro(e)&&e.currentSrc&&e.currentSrc!==e.src&&(A.src=e.currentSrc,A.srcset=""),"lazy"===A.loading&&(A.loading="eager")),jo(A)?this.createCustomElementClone(A):A},e.prototype.createCustomElementClone=function(e){var A=document.createElement("html2canvascustomelement");return mi(e.style,A),A},e.prototype.createStyleClone=function(e){try{var A=e.sheet;if(A&&A.cssRules){var t=[].slice.call(A.cssRules,0).reduce(function(e,A){return A&&"string"==typeof A.cssText?e+A.cssText:e},""),n=e.cloneNode(!1);return n.textContent=t,n}}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 A;if(this.options.inlineImages&&e.ownerDocument){var t=e.ownerDocument.createElement("img");try{return t.src=e.toDataURL(),t}catch(A){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var n=e.cloneNode(!1);try{n.width=e.width,n.height=e.height;var o=e.getContext("2d"),i=n.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!==(A=e.getContext("webgl2"))&&void 0!==A?A: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 n}catch(A){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return n},e.prototype.createVideoClone=function(e){var A=e.ownerDocument.createElement("canvas");A.width=e.offsetWidth,A.height=e.offsetHeight;var t=A.getContext("2d");try{return t&&(t.drawImage(e,0,0,A.width,A.height),this.options.allowTaint||t.getImageData(0,0,A.width,A.height)),A}catch(A){this.context.logger.info("Unable to clone video as it is tainted",e)}var n=e.ownerDocument.createElement("canvas");return n.width=e.offsetWidth,n.height=e.offsetHeight,n},e.prototype.appendChildNode=function(e,A,t){Io(A)&&("SCRIPT"===A.tagName||A.hasAttribute(si)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(A))||this.options.copyStyles&&Io(A)&&Vo(A)||e.appendChild(this.cloneNode(A,t))},e.prototype.cloneChildNodes=function(e,A,t){for(var n=this,o=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;o;o=o.nextSibling)if(Io(o)&&Wo(o)&&"function"==typeof o.assignedNodes){var i=o.assignedNodes();i.length&&i.forEach(function(e){return n.appendChildNode(A,e,t)})}else this.appendChildNode(A,o,t)},e.prototype.cloneNode=function(e,A){if(Eo(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var t=e.ownerDocument.defaultView;if(t&&Io(e)&&(ko(e)||To(e))){var n=this.createElementClone(e);n.style.transitionProperty="none";var o=t.getComputedStyle(e),i=t.getComputedStyle(e,":before"),r=t.getComputedStyle(e,":after");this.referenceElement===e&&ko(n)&&(this.clonedReferenceElement=n),Po(n)&&Ci(n);var a=this.counters.parse(new Cn(this.context,o)),s=this.resolvePseudoContent(e,n,i,Mn.BEFORE);jo(e)&&(A=!0),_o(e)||this.cloneChildNodes(e,n,A),s&&n.insertBefore(s,n.firstChild);var c=this.resolvePseudoContent(e,n,r,Mn.AFTER);return c&&n.appendChild(c),this.counters.pop(a),(o&&(this.options.copyStyles||To(e))&&!Oo(e)||A)&&mi(o,n),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([n,e.scrollLeft,e.scrollTop]),(No(e)||Go(e))&&(No(n)||Go(n))&&(n.value=e.value),n}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,A,t,n){var o=this;if(t){var i=t.content,r=A.ownerDocument;if(r&&i&&"none"!==i&&"-moz-alt-content"!==i&&"none"!==t.display){this.counters.parse(new Cn(this.context,t));var a=new yn(this.context,t),s=r.createElement("html2canvaspseudoelement");mi(t,s),a.content.forEach(function(A){if(0===A.type)s.appendChild(r.createTextNode(A.value));else if(22===A.type){var t=r.createElement("img");t.src=A.value,t.style.opacity="1",s.appendChild(t)}else if(18===A.type){if("attr"===A.name){var n=A.values.filter(We);n.length&&s.appendChild(r.createTextNode(e.getAttribute(n[0].value)||""))}else if("counter"===A.name){var i=A.values.filter(Xe),c=i[0],l=i[1];if(c&&We(c)){var d=o.counters.getCounterValue(c.value),u=l&&We(l)?Et.parse(o.context,l.value):3;s.appendChild(r.createTextNode(ai(d,u,!1)))}}else if("counters"===A.name){var p=A.values.filter(Xe),h=(c=p[0],p[1]);if(l=p[2],c&&We(c)){var g=o.counters.getCounterValues(c.value),m=l&&We(l)?Et.parse(o.context,l.value):3,f=h&&0===h.type?h.value:"",B=g.map(function(e){return ai(e,m,!1)}).join(f);s.appendChild(r.createTextNode(B))}}}else if(20===A.type)switch(A.value){case"open-quote":s.appendChild(r.createTextNode(mn(a.quotes,o.quoteDepth++,!0)));break;case"close-quote":s.appendChild(r.createTextNode(mn(a.quotes,--o.quoteDepth,!1)));break;default:s.appendChild(r.createTextNode(A.value))}}),s.className=wi+" "+bi;var c=n===Mn.BEFORE?" "+wi:" "+bi;return To(A)?A.className.baseValue+=c:A.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"}(Mn||(Mn={}));var li,di=function(e,A){var t=e.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=A.width.toString(),t.height=A.height.toString(),t.scrolling="no",t.setAttribute(si,"true"),e.body.appendChild(t),t},ui=function(e){return new Promise(function(A){e.complete?A():e.src?(e.onload=A,e.onerror=A):A()})},pi=function(e){return Promise.all([].slice.call(e.images,0).map(ui))},hi=function(e){return new Promise(function(A,t){var n=e.contentWindow;if(!n)return t("No window assigned for iframe");var o=n.document;n.onload=e.onload=function(){n.onload=e.onload=null;var t=setInterval(function(){o.body.childNodes.length>0&&"complete"===o.readyState&&(clearInterval(t),A(e))},50)}})},gi=["all","d","content"],mi=function(e,A){for(var t=e.length-1;t>=0;t--){var n=e.item(t);-1===gi.indexOf(n)&&A.style.setProperty(n,e.getPropertyValue(n))}return A},fi=function(e){var A="";return e&&(A+="<!DOCTYPE ",e.name&&(A+=e.name),e.internalSubset&&(A+=e.internalSubset),e.publicId&&(A+='"'+e.publicId+'"'),e.systemId&&(A+='"'+e.systemId+'"'),A+=">"),A},Bi=function(e,A,t){e&&e.defaultView&&(A!==e.defaultView.pageXOffset||t!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(A,t)},vi=function(e){var A=e[0],t=e[1],n=e[2];A.scrollLeft=t,A.scrollTop=n},wi="___html2canvas___pseudoelement_before",bi="___html2canvas___pseudoelement_after",yi='{\n content: "" !important;\n display: none !important;\n}',Ci=function(e){xi(e,"."+wi+":before"+yi+"\n ."+bi+":after"+yi)},xi=function(e,A){var t=e.ownerDocument;if(t){var n=t.createElement("style");n.textContent=A,e.appendChild(n)}},Qi=function(){function e(){}return e.getOrigin=function(A){var t=e._link;return t?(t.href=A,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},e.isSameOrigin=function(A){return e.getOrigin(A)===e._origin},e.setContext=function(A){e._link=A.document.createElement("a"),e._origin=e.getOrigin(A.location.href)},e._origin="about:blank",e}(),Fi=function(){function e(e,A){this.context=e,this._options=A,this._cache={}}return e.prototype.addImage=function(e){var A=Promise.resolve();return this.has(e)?A:Hi(e)||Ii(e)?((this._cache[e]=this.loadImage(e)).catch(function(){}),A):A},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return n(this,void 0,void 0,function(){var A,t,n,i,r=this;return o(this,function(o){switch(o.label){case 0:return A=Qi.isSameOrigin(e),t=!ki(e)&&!0===this._options.useCORS&&Xn.SUPPORT_CORS_IMAGES&&!A,n=!ki(e)&&!A&&!Hi(e)&&"string"==typeof this._options.proxy&&Xn.SUPPORT_CORS_XHR&&!t,A||!1!==this._options.allowTaint||ki(e)||Hi(e)||n||t?(i=e,n?[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,A){var n=new Image;n.onload=function(){return e(n)},n.onerror=A,(Ti(i)||t)&&(n.crossOrigin="anonymous"),n.src=i,!0===n.complete&&setTimeout(function(){return e(n)},500),r._options.imageTimeout>0&&setTimeout(function(){return A("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 A=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(o,i){var r=Xn.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 "+n+" with status code "+a.status)},a.onerror=i;var s=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+s+"url="+encodeURIComponent(e)+"&responseType="+r),"text"!==r&&a instanceof XMLHttpRequest&&(a.responseType=r),A._options.imageTimeout){var c=A._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return i("Timed out ("+c+"ms) proxying "+n)}}a.send()})},e}(),Ui=/^data:image\/svg\+xml/i,Si=/^data:image\/.*;base64,/i,Ei=/^data:image\/.*/i,Ii=function(e){return Xn.SUPPORT_SVG_DRAWING||!Di(e)},ki=function(e){return Ei.test(e)},Ti=function(e){return Si.test(e)},Hi=function(e){return"blob"===e.substr(0,4)},Di=function(e){return"svg"===e.substr(-3).toLowerCase()||Ui.test(e)},Mi=function(){function e(e,A){this.type=0,this.x=e,this.y=A}return e.prototype.add=function(A,t){return new e(this.x+A,this.y+t)},e}(),Li=function(e,A,t){return new Mi(e.x+(A.x-e.x)*t,e.y+(A.y-e.y)*t)},Pi=function(){function e(e,A,t,n){this.type=1,this.start=e,this.startControl=A,this.endControl=t,this.end=n}return e.prototype.subdivide=function(A,t){var n=Li(this.start,this.startControl,A),o=Li(this.startControl,this.endControl,A),i=Li(this.endControl,this.end,A),r=Li(n,o,A),a=Li(o,i,A),s=Li(r,a,A);return t?new e(this.start,n,r,s):new e(s,a,i,this.end)},e.prototype.add=function(A,t){return new e(this.start.add(A,t),this.startControl.add(A,t),this.endControl.add(A,t),this.end.add(A,t))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Ki=function(e){return 1===e.type},_i=function(e){var A=e.styles,t=e.bounds,n=oA(A.borderTopLeftRadius,t.width,t.height),o=n[0],i=n[1],r=oA(A.borderTopRightRadius,t.width,t.height),a=r[0],s=r[1],c=oA(A.borderBottomRightRadius,t.width,t.height),l=c[0],d=c[1],u=oA(A.borderBottomLeftRadius,t.width,t.height),p=u[0],h=u[1],g=[];g.push((o+a)/t.width),g.push((p+l)/t.width),g.push((i+h)/t.height),g.push((s+d)/t.height);var m=Math.max.apply(Math,g);m>1&&(o/=m,i/=m,a/=m,s/=m,l/=m,d/=m,p/=m,h/=m);var f=t.width-a,B=t.height-d,v=t.width-l,w=t.height-h,b=A.borderTopWidth,y=A.borderRightWidth,C=A.borderBottomWidth,x=A.borderLeftWidth,Q=iA(A.paddingTop,e.bounds.width),F=iA(A.paddingRight,e.bounds.width),U=iA(A.paddingBottom,e.bounds.width),S=iA(A.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=o>0||i>0?Ri(t.left+x/3,t.top+b/3,o-x/3,i-b/3,li.TOP_LEFT):new Mi(t.left+x/3,t.top+b/3),this.topRightBorderDoubleOuterBox=o>0||i>0?Ri(t.left+f,t.top+b/3,a-y/3,s-b/3,li.TOP_RIGHT):new Mi(t.left+t.width-y/3,t.top+b/3),this.bottomRightBorderDoubleOuterBox=l>0||d>0?Ri(t.left+v,t.top+B,l-y/3,d-C/3,li.BOTTOM_RIGHT):new Mi(t.left+t.width-y/3,t.top+t.height-C/3),this.bottomLeftBorderDoubleOuterBox=p>0||h>0?Ri(t.left+x/3,t.top+w,p-x/3,h-C/3,li.BOTTOM_LEFT):new Mi(t.left+x/3,t.top+t.height-C/3),this.topLeftBorderDoubleInnerBox=o>0||i>0?Ri(t.left+2*x/3,t.top+2*b/3,o-2*x/3,i-2*b/3,li.TOP_LEFT):new Mi(t.left+2*x/3,t.top+2*b/3),this.topRightBorderDoubleInnerBox=o>0||i>0?Ri(t.left+f,t.top+2*b/3,a-2*y/3,s-2*b/3,li.TOP_RIGHT):new Mi(t.left+t.width-2*y/3,t.top+2*b/3),this.bottomRightBorderDoubleInnerBox=l>0||d>0?Ri(t.left+v,t.top+B,l-2*y/3,d-2*C/3,li.BOTTOM_RIGHT):new Mi(t.left+t.width-2*y/3,t.top+t.height-2*C/3),this.bottomLeftBorderDoubleInnerBox=p>0||h>0?Ri(t.left+2*x/3,t.top+w,p-2*x/3,h-2*C/3,li.BOTTOM_LEFT):new Mi(t.left+2*x/3,t.top+t.height-2*C/3),this.topLeftBorderStroke=o>0||i>0?Ri(t.left+x/2,t.top+b/2,o-x/2,i-b/2,li.TOP_LEFT):new Mi(t.left+x/2,t.top+b/2),this.topRightBorderStroke=o>0||i>0?Ri(t.left+f,t.top+b/2,a-y/2,s-b/2,li.TOP_RIGHT):new Mi(t.left+t.width-y/2,t.top+b/2),this.bottomRightBorderStroke=l>0||d>0?Ri(t.left+v,t.top+B,l-y/2,d-C/2,li.BOTTOM_RIGHT):new Mi(t.left+t.width-y/2,t.top+t.height-C/2),this.bottomLeftBorderStroke=p>0||h>0?Ri(t.left+x/2,t.top+w,p-x/2,h-C/2,li.BOTTOM_LEFT):new Mi(t.left+x/2,t.top+t.height-C/2),this.topLeftBorderBox=o>0||i>0?Ri(t.left,t.top,o,i,li.TOP_LEFT):new Mi(t.left,t.top),this.topRightBorderBox=a>0||s>0?Ri(t.left+f,t.top,a,s,li.TOP_RIGHT):new Mi(t.left+t.width,t.top),this.bottomRightBorderBox=l>0||d>0?Ri(t.left+v,t.top+B,l,d,li.BOTTOM_RIGHT):new Mi(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=p>0||h>0?Ri(t.left,t.top+w,p,h,li.BOTTOM_LEFT):new Mi(t.left,t.top+t.height),this.topLeftPaddingBox=o>0||i>0?Ri(t.left+x,t.top+b,Math.max(0,o-x),Math.max(0,i-b),li.TOP_LEFT):new Mi(t.left+x,t.top+b),this.topRightPaddingBox=a>0||s>0?Ri(t.left+Math.min(f,t.width-y),t.top+b,f>t.width+y?0:Math.max(0,a-y),Math.max(0,s-b),li.TOP_RIGHT):new Mi(t.left+t.width-y,t.top+b),this.bottomRightPaddingBox=l>0||d>0?Ri(t.left+Math.min(v,t.width-x),t.top+Math.min(B,t.height-C),Math.max(0,l-y),Math.max(0,d-C),li.BOTTOM_RIGHT):new Mi(t.left+t.width-y,t.top+t.height-C),this.bottomLeftPaddingBox=p>0||h>0?Ri(t.left+x,t.top+Math.min(w,t.height-C),Math.max(0,p-x),Math.max(0,h-C),li.BOTTOM_LEFT):new Mi(t.left+x,t.top+t.height-C),this.topLeftContentBox=o>0||i>0?Ri(t.left+x+S,t.top+b+Q,Math.max(0,o-(x+S)),Math.max(0,i-(b+Q)),li.TOP_LEFT):new Mi(t.left+x+S,t.top+b+Q),this.topRightContentBox=a>0||s>0?Ri(t.left+Math.min(f,t.width+x+S),t.top+b+Q,f>t.width+x+S?0:a-x+S,s-(b+Q),li.TOP_RIGHT):new Mi(t.left+t.width-(y+F),t.top+b+Q),this.bottomRightContentBox=l>0||d>0?Ri(t.left+Math.min(v,t.width-(x+S)),t.top+Math.min(B,t.height+b+Q),Math.max(0,l-(y+F)),d-(C+U),li.BOTTOM_RIGHT):new Mi(t.left+t.width-(y+F),t.top+t.height-(C+U)),this.bottomLeftContentBox=p>0||h>0?Ri(t.left+x+S,t.top+w,Math.max(0,p-(x+S)),h-(C+U),li.BOTTOM_LEFT):new Mi(t.left+x+S,t.top+t.height-(C+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 Ri=function(e,A,t,n,o){var i=(Math.sqrt(2)-1)/3*4,r=t*i,a=n*i,s=e+t,c=A+n;switch(o){case li.TOP_LEFT:return new Pi(new Mi(e,c),new Mi(e,c-a),new Mi(s-r,A),new Mi(s,A));case li.TOP_RIGHT:return new Pi(new Mi(e,A),new Mi(e+r,A),new Mi(s,c-a),new Mi(s,c));case li.BOTTOM_RIGHT:return new Pi(new Mi(s,A),new Mi(s,A+a),new Mi(e+r,c),new Mi(e,c));case li.BOTTOM_LEFT:default:return new Pi(new Mi(s,c),new Mi(s-r,c),new Mi(e,A+a),new Mi(e,A))}},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,A,t){this.offsetX=e,this.offsetY=A,this.matrix=t,this.type=0,this.target=6},Gi=function(e,A){this.path=e,this.target=A,this.type=1},Wi=function(e){this.opacity=e,this.type=2,this.target=6},ji=function(e){return 1===e.type},zi=function(e,A){return e.length===A.length&&e.some(function(e,t){return e===A[t]})},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,A){if(this.container=e,this.parent=A,this.effects=[],this.curves=new _i(this.container),this.container.styles.opacity<1&&this.effects.push(new Wi(this.container.styles.opacity)),null!==this.container.styles.transform){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,o=this.container.styles.transform;this.effects.push(new Ni(t,n,o))}if(0!==this.container.styles.overflowX){var i=Oi(this.curves),r=Vi(this.curves);zi(i,r)?this.effects.push(new Gi(i,6)):(this.effects.push(new Gi(i,2)),this.effects.push(new Gi(r,4)))}}return e.prototype.getEffects=function(e){for(var A=-1===[2,3].indexOf(this.container.styles.position),t=this.parent,n=this.effects.slice(0);t;){var o=t.effects.filter(function(e){return!ji(e)});if(A||0!==t.container.styles.position||!t.parent){if(n.unshift.apply(n,o),A=-1===[2,3].indexOf(t.container.styles.position),0!==t.container.styles.overflowX){var i=Oi(t.curves),r=Vi(t.curves);zi(i,r)||n.unshift(new Gi(r,6))}}else n.unshift.apply(n,o);t=t.parent}return n.filter(function(A){return ln(A.target,e)})},e}(),Ji=function(e,A,t,n){e.container.elements.forEach(function(o){var i=ln(o.flags,4),r=ln(o.flags,2),a=new Xi(o,e);ln(o.styles.display,2048)&&n.push(a);var s=ln(o.flags,8)?[]:n;if(i||r){var c=i||o.styles.isPositioned()?t:A,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 u=0;c.negativeZIndex.some(function(e,A){return d>e.element.container.styles.zIndex.order?(u=A,!1):u>0}),c.negativeZIndex.splice(u,0,l)}else if(d>0){var p=0;c.positiveZIndex.some(function(e,A){return d>=e.element.container.styles.zIndex.order?(p=A+1,!1):p>0}),c.positiveZIndex.splice(p,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else o.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);Ji(a,l,i?l:t,s)}else o.styles.isInlineLevel()?A.inlineLevel.push(a):A.nonInlineLevel.push(a),Ji(a,A,t,s);ln(o.flags,8)&&Yi(o,s)})},Yi=function(e,A){for(var t=e instanceof uo?e.start:1,n=e instanceof uo&&e.reversed,o=0;o<A.length;o++){var i=A[o];i.container instanceof lo&&"number"==typeof i.container.value&&0!==i.container.value&&(t=i.container.value),i.listValue=ai(t,i.container.styles.listStyleType,!0),t+=n?-1:1}},Zi=function(e,A){switch(A){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,A){var t=[];return Ki(e)?t.push(e.subdivide(.5,!1)):t.push(e),Ki(A)?t.push(A.subdivide(.5,!0)):t.push(A),t},er=function(e,A,t,n){var o=[];return Ki(e)?o.push(e.subdivide(.5,!1)):o.push(e),Ki(t)?o.push(t.subdivide(.5,!0)):o.push(t),Ki(n)?o.push(n.subdivide(.5,!0).reverse()):o.push(n),Ki(A)?o.push(A.subdivide(.5,!1).reverse()):o.push(A),o},Ar=function(e){var A=e.bounds,t=e.styles;return A.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},tr=function(e){var A=e.styles,t=e.bounds,n=iA(A.paddingLeft,t.width),o=iA(A.paddingRight,t.width),i=iA(A.paddingTop,t.width),r=iA(A.paddingBottom,t.width);return t.add(n+A.borderLeftWidth,i+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+n+o),-(A.borderTopWidth+A.borderBottomWidth+i+r))},nr=function(e,A,t){var n=function(e,A){return 0===e?A.bounds:2===e?tr(A):Ar(A)}(ar(e.styles.backgroundOrigin,A),e),o=function(e,A){return 0===e?A.bounds:2===e?tr(A):Ar(A)}(ar(e.styles.backgroundClip,A),e),i=rr(ar(e.styles.backgroundSize,A),t,n),r=i[0],a=i[1],s=oA(ar(e.styles.backgroundPosition,A),n.width-r,n.height-a);return[sr(ar(e.styles.backgroundRepeat,A),s,i,n,o),Math.round(n.left+s[0]),Math.round(n.top+s[1]),r,a]},or=function(e){return We(e)&&e.value===OA.AUTO},ir=function(e){return"number"==typeof e},rr=function(e,A,t){var n=A[0],o=A[1],i=A[2],r=e[0],a=e[1];if(!r)return[0,0];if($e(r)&&a&&$e(a))return[iA(r,t.width),iA(a,t.height)];var s=ir(i);if(We(r)&&(r.value===OA.CONTAIN||r.value===OA.COVER))return ir(i)?t.width/t.height<i!=(r.value===OA.COVER)?[t.width,t.width/i]:[t.height*i,t.height]:[t.width,t.height];var c=ir(n),l=ir(o),d=c||l;if(or(r)&&(!a||or(a)))return c&&l?[n,o]:s||d?d&&s?[c?n:o*i,l?o:n/i]:[c?n:t.width,l?o:t.height]:[t.width,t.height];if(s){var u=0,p=0;return $e(r)?u=iA(r,t.width):$e(a)&&(p=iA(a,t.height)),or(r)?u=p*i:a&&!or(a)||(p=u/i),[u,p]}var h=null,g=null;if($e(r)?h=iA(r,t.width):a&&$e(a)&&(g=iA(a,t.height)),null===h||a&&!or(a)||(g=c&&l?h/n*o:t.height),null!==g&&or(r)&&(h=c&&l?g/o*n:t.width),null!==h&&null!==g)return[h,g];throw new Error("Unable to calculate background-size for element")},ar=function(e,A){var t=e[A];return void 0===t?e[0]:t},sr=function(e,A,t,n,o){var i=A[0],r=A[1],a=t[0],s=t[1];switch(e){case 2:return[new Mi(Math.round(n.left),Math.round(n.top+r)),new Mi(Math.round(n.left+n.width),Math.round(n.top+r)),new Mi(Math.round(n.left+n.width),Math.round(s+n.top+r)),new Mi(Math.round(n.left),Math.round(s+n.top+r))];case 3:return[new Mi(Math.round(n.left+i),Math.round(n.top)),new Mi(Math.round(n.left+i+a),Math.round(n.top)),new Mi(Math.round(n.left+i+a),Math.round(n.height+n.top)),new Mi(Math.round(n.left+i),Math.round(n.height+n.top))];case 1:return[new Mi(Math.round(n.left+i),Math.round(n.top+r)),new Mi(Math.round(n.left+i+a),Math.round(n.top+r)),new Mi(Math.round(n.left+i+a),Math.round(n.top+r+s)),new Mi(Math.round(n.left+i),Math.round(n.top+r+s))];default:return[new Mi(Math.round(o.left),Math.round(o.top)),new Mi(Math.round(o.left+o.width),Math.round(o.top)),new Mi(Math.round(o.left+o.width),Math.round(o.height+o.top)),new Mi(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,A){var t=this._document.createElement("div"),n=this._document.createElement("img"),o=this._document.createElement("span"),i=this._document.body;t.style.visibility="hidden",t.style.fontFamily=e,t.style.fontSize=A,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",i.appendChild(t),n.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",o.style.fontFamily=e,o.style.fontSize=A,o.style.margin="0",o.style.padding="0",o.appendChild(this._document.createTextNode(cr)),t.appendChild(o),t.appendChild(n);var r=n.offsetTop-o.offsetTop+2;t.removeChild(o),t.appendChild(this._document.createTextNode(cr)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return i.removeChild(t),{baseline:r,middle:a}},e.prototype.getMetrics=function(e,A){var t=e+" "+A;return void 0===this._data[t]&&(this._data[t]=this.parseMetrics(e,A)),this._data[t]},e}(),dr=function(e,A){this.context=e,this.options=A},ur=function(e){function t(A,t){var n=e.call(this,A,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new lr(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return A(t,e),t.prototype.applyEffects=function(e){for(var A=this;this._activeEffects.length;)this.popEffect();e.forEach(function(e){return A.applyEffect(e)})},t.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)),ji(e)&&(this.path(e.path),this.ctx.clip()),this._activeEffects.push(e)},t.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},t.prototype.renderStack=function(e){return n(this,void 0,void 0,function(){return o(this,function(A){switch(A.label){case 0:return e.element.container.styles.isVisible()?[4,this.renderStackContent(e)]:[3,2];case 1:A.sent(),A.label=2;case 2:return[2]}})})},t.prototype.renderNode=function(e){return n(this,void 0,void 0,function(){return o(this,function(A){switch(A.label){case 0:return ln(e.container.flags,16),e.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(e)]:[3,3];case 1:return A.sent(),[4,this.renderNodeContent(e)];case 2:A.sent(),A.label=3;case 3:return[2]}})})},t.prototype.renderTextWithLetterSpacing=function(e,A,t){var n=this;0===A?this.ctx.fillText(e.text,e.bounds.left,e.bounds.top+t):$n(e.text).reduce(function(A,o){return n.ctx.fillText(o,A,e.bounds.top+t),A+n.ctx.measureText(o).width},e.bounds.left)},t.prototype.createFontStyle=function(e){var A=e.fontVariant.filter(function(e){return"normal"===e||"small-caps"===e}).join(""),t=fr(e.fontFamily).join(", "),n=Ne(e.fontSize)?""+e.fontSize.number+e.fontSize.unit:e.fontSize.number+"px";return[[e.fontStyle,A,e.fontWeight,n,t].join(" "),t,n]},t.prototype.renderTextNode=function(e,A){return n(this,void 0,void 0,function(){var t,n,i,r,a,s,c,l,d=this;return o(this,function(o){return t=this.createFontStyle(A),n=t[0],i=t[1],r=t[2],this.ctx.font=n,this.ctx.direction=1===A.direction?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(i,r),s=a.baseline,c=a.middle,l=A.paintOrder,e.textBounds.forEach(function(e){l.forEach(function(t){switch(t){case 0:d.ctx.fillStyle=hA(A.color),d.renderTextWithLetterSpacing(e,A.letterSpacing,s);var n=A.textShadow;n.length&&e.text.trim().length&&(n.slice(0).reverse().forEach(function(t){d.ctx.shadowColor=hA(t.color),d.ctx.shadowOffsetX=t.offsetX.number*d.options.scale,d.ctx.shadowOffsetY=t.offsetY.number*d.options.scale,d.ctx.shadowBlur=t.blur.number,d.renderTextWithLetterSpacing(e,A.letterSpacing,s)}),d.ctx.shadowColor="",d.ctx.shadowOffsetX=0,d.ctx.shadowOffsetY=0,d.ctx.shadowBlur=0),A.textDecorationLine.length&&(d.ctx.fillStyle=hA(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(A){switch(A){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:A.webkitTextStrokeWidth&&e.text.trim().length&&(d.ctx.strokeStyle=hA(A.webkitTextStrokeColor),d.ctx.lineWidth=A.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]})})},t.prototype.renderReplacedElement=function(e,A,t){if(t&&e.intrinsicWidth>0&&e.intrinsicHeight>0){var n=tr(e),o=Vi(A);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(t,0,0,e.intrinsicWidth,e.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(e){return n(this,void 0,void 0,function(){var A,n,i,a,s,c,l,d,u,p,h,g,m,f,B,v,w,b;return o(this,function(o){switch(o.label){case 0:this.applyEffects(e.getEffects(4)),A=e.container,n=e.curves,i=A.styles,a=0,s=A.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(!(A instanceof ao))return[3,8];o.label=5;case 5:return o.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return B=o.sent(),this.renderReplacedElement(A,n,B),[3,8];case 7:return o.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof so&&this.renderReplacedElement(A,n,A.canvas),!(A instanceof co))return[3,12];o.label=9;case 9:return o.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return B=o.sent(),this.renderReplacedElement(A,n,B),[3,12];case 11:return o.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof yo&&A.tree?[4,new t(this.context,{scale:this.options.scale,backgroundColor:A.backgroundColor,x:0,y:0,width:A.width,height:A.height}).render(A.tree)]:[3,14];case 13:l=o.sent(),A.width&&A.height&&this.ctx.drawImage(l,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),o.label=14;case 14:if(A instanceof vo&&(d=Math.min(A.bounds.width,A.bounds.height),A.type===go?A.checked&&(this.ctx.save(),this.path([new Mi(A.bounds.left+.39363*d,A.bounds.top+.79*d),new Mi(A.bounds.left+.16*d,A.bounds.top+.5549*d),new Mi(A.bounds.left+.27347*d,A.bounds.top+.44071*d),new Mi(A.bounds.left+.39694*d,A.bounds.top+.5649*d),new Mi(A.bounds.left+.72983*d,A.bounds.top+.23*d),new Mi(A.bounds.left+.84*d,A.bounds.top+.34085*d),new Mi(A.bounds.left+.39363*d,A.bounds.top+.79*d)]),this.ctx.fillStyle=hA(Bo),this.ctx.fill(),this.ctx.restore()):A.type===mo&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+d/2,A.bounds.top+d/2,d/4,0,2*Math.PI,!0),this.ctx.fillStyle=hA(Bo),this.ctx.fill(),this.ctx.restore())),pr(A)&&A.value.length){switch(u=this.createFontStyle(i),w=u[0],p=u[1],h=this.fontMetrics.getMetrics(w,p).baseline,this.ctx.font=w,this.ctx.fillStyle=hA(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=gr(A.styles.textAlign),b=tr(A),g=0,A.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 Mi(b.left,b.top),new Mi(b.left+b.width,b.top),new Mi(b.left+b.width,b.top+b.height),new Mi(b.left,b.top+b.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Jn(A.value,m),i.letterSpacing,h),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!ln(A.styles.display,2048))return[3,20];if(null===A.styles.listStyleImage)return[3,19];if(0!==(f=A.styles.listStyleImage).type)return[3,18];B=void 0,v=f.url,o.label=15;case 15:return o.trys.push([15,17,,18]),[4,this.context.cache.match(v)];case 16:return B=o.sent(),this.ctx.drawImage(B,A.bounds.left-(B.width+10),A.bounds.top),[3,18];case 17:return o.sent(),this.context.logger.error("Error loading list-style-image "+v),[3,18];case 18:return[3,20];case 19:e.listValue&&-1!==A.styles.listStyleType&&(w=this.createFontStyle(i)[0],this.ctx.font=w,this.ctx.fillStyle=hA(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",b=new r(A.bounds.left,A.bounds.top+iA(A.styles.paddingTop,A.bounds.width),A.bounds.width,Ft(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Jn(e.listValue,b),i.letterSpacing,Ft(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),o.label=20;case 20:return[2]}})})},t.prototype.renderStackContent=function(e){return n(this,void 0,void 0,function(){var A,t,n,i,r,a,s,c,l,d,u,p,h,g,m;return o(this,function(o){switch(o.label){case 0:return ln(e.element.container.flags,16),[4,this.renderNodeBackgroundAndBorders(e.element)];case 1:o.sent(),A=0,t=e.negativeZIndex,o.label=2;case 2:return A<t.length?(m=t[A],[4,this.renderStack(m)]):[3,5];case 3:o.sent(),o.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(e.element)];case 6:o.sent(),n=0,i=e.nonInlineLevel,o.label=7;case 7:return n<i.length?(m=i[n],[4,this.renderNode(m)]):[3,10];case 8:o.sent(),o.label=9;case 9:return n++,[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:u=0,p=e.zeroOrAutoZIndexOrTransformedOrOpacity,o.label=23;case 23:return u<p.length?(m=p[u],[4,this.renderStack(m)]):[3,26];case 24:o.sent(),o.label=25;case 25:return u++,[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]}})})},t.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()},t.prototype.path=function(e){this.ctx.beginPath(),this.formatPath(e),this.ctx.closePath()},t.prototype.formatPath=function(e){var A=this;e.forEach(function(e,t){var n=Ki(e)?e.start:e;0===t?A.ctx.moveTo(n.x,n.y):A.ctx.lineTo(n.x,n.y),Ki(e)&&A.ctx.bezierCurveTo(e.startControl.x,e.startControl.y,e.endControl.x,e.endControl.y,e.end.x,e.end.y)})},t.prototype.renderRepeat=function(e,A,t,n){this.path(e),this.ctx.fillStyle=A,this.ctx.translate(t,n),this.ctx.fill(),this.ctx.translate(-t,-n)},t.prototype.resizeImage=function(e,A,t){var n;if(e.width===A&&e.height===t)return e;var o=(null!==(n=this.canvas.ownerDocument)&&void 0!==n?n:document).createElement("canvas");return o.width=Math.max(1,A),o.height=Math.max(1,t),o.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,A,t),o},t.prototype.renderBackgroundImage=function(e){return n(this,void 0,void 0,function(){var A,t,n,i,r,a;return o(this,function(s){switch(s.label){case 0:A=e.styles.backgroundImage.length-1,t=function(t){var i,r,a,s,c,l,d,u,p,h,g,m,f,B,v,w,b,y,C,x,Q,F,U,S,E,I,k,T,H,D,M;return o(this,function(o){switch(o.label){case 0:if(0!==t.type)return[3,5];i=void 0,r=t.url,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.context.cache.match(r)];case 2:return i=o.sent(),[3,4];case 3:return o.sent(),n.context.logger.error("Error loading background-image "+r),[3,4];case 4:return i&&(a=nr(e,A,[i.width,i.height,i.width/i.height]),w=a[0],F=a[1],U=a[2],C=a[3],x=a[4],B=n.ctx.createPattern(n.resizeImage(i,C,x),"repeat"),n.renderRepeat(w,B,F,U)),[3,6];case 5:1===t.type?(s=nr(e,A,[null,null,null]),w=s[0],F=s[1],U=s[2],C=s[3],x=s[4],c=UA(t.angle,C,x),l=c[0],d=c[1],u=c[2],p=c[3],h=c[4],(g=document.createElement("canvas")).width=C,g.height=x,m=g.getContext("2d"),f=m.createLinearGradient(d,p,u,h),FA(t.stops,l).forEach(function(e){return f.addColorStop(e.stop,hA(e.color))}),m.fillStyle=f,m.fillRect(0,0,C,x),C>0&&x>0&&(B=n.ctx.createPattern(g,"repeat"),n.renderRepeat(w,B,F,U))):function(e){return 2===e.type}(t)&&(v=nr(e,A,[null,null,null]),w=v[0],b=v[1],y=v[2],C=v[3],x=v[4],Q=0===t.position.length?[tA]:t.position,F=iA(Q[0],C),U=iA(Q[Q.length-1],x),S=function(e,A,t,n,o){var i=0,r=0;switch(e.size){case 0:0===e.shape?i=r=Math.min(Math.abs(A),Math.abs(A-n),Math.abs(t),Math.abs(t-o)):1===e.shape&&(i=Math.min(Math.abs(A),Math.abs(A-n)),r=Math.min(Math.abs(t),Math.abs(t-o)));break;case 2:if(0===e.shape)i=r=Math.min(SA(A,t),SA(A,t-o),SA(A-n,t),SA(A-n,t-o));else if(1===e.shape){var a=Math.min(Math.abs(t),Math.abs(t-o))/Math.min(Math.abs(A),Math.abs(A-n)),s=EA(n,o,A,t,!0),c=s[0],l=s[1];r=a*(i=SA(c-A,(l-t)/a))}break;case 1:0===e.shape?i=r=Math.max(Math.abs(A),Math.abs(A-n),Math.abs(t),Math.abs(t-o)):1===e.shape&&(i=Math.max(Math.abs(A),Math.abs(A-n)),r=Math.max(Math.abs(t),Math.abs(t-o)));break;case 3:if(0===e.shape)i=r=Math.max(SA(A,t),SA(A,t-o),SA(A-n,t),SA(A-n,t-o));else if(1===e.shape){a=Math.max(Math.abs(t),Math.abs(t-o))/Math.max(Math.abs(A),Math.abs(A-n));var d=EA(n,o,A,t,!1);c=d[0],l=d[1],r=a*(i=SA(c-A,(l-t)/a))}}return Array.isArray(e.size)&&(i=iA(e.size[0],n),r=2===e.size.length?iA(e.size[1],o):i),[i,r]}(t,F,U,C,x),E=S[0],I=S[1],E>0&&I>0&&(k=n.ctx.createRadialGradient(b+F,y+U,0,b+F,y+U,E),FA(t.stops,2*E).forEach(function(e){return k.addColorStop(e.stop,hA(e.color))}),n.path(w),n.ctx.fillStyle=k,E!==I?(T=e.bounds.left+.5*e.bounds.width,H=e.bounds.top+.5*e.bounds.height,M=1/(D=I/E),n.ctx.save(),n.ctx.translate(T,H),n.ctx.transform(1,0,0,D,0,0),n.ctx.translate(-T,-H),n.ctx.fillRect(b,M*(y-H)+H,C,x*M),n.ctx.restore()):n.ctx.fill())),o.label=6;case 6:return A--,[2]}})},n=this,i=0,r=e.styles.backgroundImage.slice(0).reverse(),s.label=1;case 1:return i<r.length?(a=r[i],[5,t(a)]):[3,4];case 2:s.sent(),s.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},t.prototype.renderSolidBorder=function(e,A,t){return n(this,void 0,void 0,function(){return o(this,function(n){return this.path(Zi(t,A)),this.ctx.fillStyle=hA(e),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(e,A,t,i){return n(this,void 0,void 0,function(){var n,r;return o(this,function(o){switch(o.label){case 0:return A<3?[4,this.renderSolidBorder(e,t,i)]:[3,2];case 1:return o.sent(),[2];case 2:return n=function(e,A){switch(A){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,t),this.path(n),this.ctx.fillStyle=hA(e),this.ctx.fill(),r=function(e,A){switch(A){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,t),this.path(r),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(e){return n(this,void 0,void 0,function(){var A,t,n,i,r,a,s,c,l=this;return o(this,function(o){switch(o.label){case 0:return this.applyEffects(e.getEffects(2)),A=e.container.styles,t=!pA(A.backgroundColor)||A.backgroundImage.length,n=[{style:A.borderTopStyle,color:A.borderTopColor,width:A.borderTopWidth},{style:A.borderRightStyle,color:A.borderRightColor,width:A.borderRightWidth},{style:A.borderBottomStyle,color:A.borderBottomColor,width:A.borderBottomWidth},{style:A.borderLeftStyle,color:A.borderLeftColor,width:A.borderLeftWidth}],i=hr(ar(A.backgroundClip,0),e.curves),t||A.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),pA(A.backgroundColor)||(this.ctx.fillStyle=hA(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(e.container)]):[3,2];case 1:o.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(A){l.ctx.save();var t,n,o,i,r,a=Oi(e.curves),s=A.inset?0:1e4,c=(t=a,n=-s+(A.inset?1:-1)*A.spread.number,o=(A.inset?1:-1)*A.spread.number,i=A.spread.number*(A.inset?-2:2),r=A.spread.number*(A.inset?-2:2),t.map(function(e,A){switch(A){case 0:return e.add(n,o);case 1:return e.add(n+i,o);case 2:return e.add(n+i,o+r);case 3:return e.add(n,o+r)}return e}));A.inset?(l.path(a),l.ctx.clip(),l.mask(c)):(l.mask(a),l.ctx.clip(),l.path(c)),l.ctx.shadowOffsetX=A.offsetX.number+s,l.ctx.shadowOffsetY=A.offsetY.number,l.ctx.shadowColor=hA(A.color),l.ctx.shadowBlur=A.blur.number,l.ctx.fillStyle=A.inset?hA(A.color):"rgba(0,0,0,1)",l.ctx.fill(),l.ctx.restore()}),o.label=2;case 2:r=0,a=0,s=n,o.label=3;case 3:return a<s.length?0!==(c=s[a]).style&&!pA(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]}})})},t.prototype.renderDashedDottedBorder=function(e,A,t,i,r){return n(this,void 0,void 0,function(){var n,a,s,c,l,d,u,p,h,g,m,f,B,v,w,b;return o(this,function(o){return this.ctx.save(),n=function(e,A){switch(A){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,t),a=Zi(i,t),2===r&&(this.path(a),this.ctx.clip()),Ki(a[0])?(s=a[0].start.x,c=a[0].start.y):(s=a[0].x,c=a[0].y),Ki(a[1])?(l=a[1].end.x,d=a[1].end.y):(l=a[1].x,d=a[1].y),u=0===t||2===t?Math.abs(s-l):Math.abs(c-d),this.ctx.beginPath(),3===r?this.formatPath(n):this.formatPath(a.slice(0,2)),p=A<3?3*A:2*A,h=A<3?2*A:A,3===r&&(p=A,h=A),g=!0,u<=2*p?g=!1:u<=2*p+h?(p*=m=u/(2*p+h),h*=m):(f=Math.floor((u+h)/(p+h)),B=(u-f*p)/(f-1),h=(v=(u-(f+1)*p)/f)<=0||Math.abs(h-B)<Math.abs(h-v)?B:v),g&&(3===r?this.ctx.setLineDash([0,p+h]):this.ctx.setLineDash([p,h])),3===r?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=2*A+1.1,this.ctx.strokeStyle=hA(e),this.ctx.stroke(),this.ctx.setLineDash([]),2===r&&(Ki(a[0])&&(w=a[3],b=a[0],this.ctx.beginPath(),this.formatPath([new Mi(w.end.x,w.end.y),new Mi(b.start.x,b.start.y)]),this.ctx.stroke()),Ki(a[1])&&(w=a[1],b=a[2],this.ctx.beginPath(),this.formatPath([new Mi(w.end.x,w.end.y),new Mi(b.start.x,b.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(e){return n(this,void 0,void 0,function(){var A;return o(this,function(t){switch(t.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=hA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),n=new Xi(e,null),o=new qi(n),Ji(n,o,o,i=[]),Yi(n.container,i),A=o,[4,this.renderStack(A)];case 1:return t.sent(),this.applyEffects([]),[2,this.canvas]}var n,o,i})})},t}(dr),pr=function(e){return e instanceof bo||e instanceof wo||e instanceof vo&&e.type!==mo&&e.type!==go},hr=function(e,A){switch(e){case 0:return Oi(A);case 2:return function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]}(A);default:return Vi(A)}},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},Br=function(e){function t(A,t){var n=e.call(this,A,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return A(t,e),t.prototype.render=function(e){return n(this,void 0,void 0,function(){var A,t;return o(this,function(n){switch(n.label){case 0:return A=zn(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e),[4,vr(A)];case 1:return t=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=hA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(t,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},t}(dr),vr=function(e){return new Promise(function(A,t){var n=new Image;n.onload=function(){A(n)},n.onerror=t,n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(e))})},wr=function(){function e(e){var A=e.id,t=e.enabled;this.id=A,this.enabled=t,this.start=Date.now()}return e.prototype.debug=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];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=[],A=0;A<arguments.length;A++)e[A]=arguments[A];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=[],A=0;A<arguments.length;A++)e[A]=arguments[A];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=[],A=0;A<arguments.length;A++)e[A]=arguments[A];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(A,t){var n;this.windowBounds=t,this.instanceName="#"+e.instanceCount++,this.logger=new wr({id:this.instanceName,enabled:A.logging}),this.cache=null!==(n=A.cache)&&void 0!==n?n:new Fi(this,A)}return e.instanceCount=1,e}();"undefined"!=typeof window&&Qi.setContext(window);var yr=function(e,A){return n(void 0,void 0,void 0,function(){var n,i,s,c,l,d,u,p,h,g,m,f,B,v,w,b,y,C,x,Q,F,U,S,E,I,k,T,H,D,M,L,P,K,_,R,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(!(n=e.ownerDocument))throw new Error("Element is not attached to a Document");if(!(i=n.defaultView))throw new Error("Document is not attached to a Window");return s={allowTaint:null!==(U=A.allowTaint)&&void 0!==U&&U,imageTimeout:null!==(S=A.imageTimeout)&&void 0!==S?S:15e3,proxy:A.proxy,useCORS:null!==(E=A.useCORS)&&void 0!==E&&E},c=t({logging:null===(I=A.logging)||void 0===I||I,cache:A.cache},s),l={windowWidth:null!==(k=A.windowWidth)&&void 0!==k?k:i.innerWidth,windowHeight:null!==(T=A.windowHeight)&&void 0!==T?T:i.innerHeight,scrollX:null!==(H=A.scrollX)&&void 0!==H?H:i.pageXOffset,scrollY:null!==(D=A.scrollY)&&void 0!==D?D:i.pageYOffset},d=new r(l.scrollX,l.scrollY,l.windowWidth,l.windowHeight),u=new br(c,d),p=null!==(M=A.foreignObjectRendering)&&void 0!==M&&M,h={allowTaint:null!==(L=A.allowTaint)&&void 0!==L&&L,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:p,copyStyles:p},u.logger.debug("Starting document clone with size "+d.width+"x"+d.height+" scrolled to "+-d.left+","+-d.top),g=new ci(u,e,h),(m=g.clonedReferenceElement)?[4,g.toIFrame(n,d)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return f=o.sent(),B=Po(m)||"HTML"===m.tagName?function(e){var A=e.body,t=e.documentElement;if(!A||!t)throw new Error("Unable to get document size");var n=Math.max(Math.max(A.scrollWidth,t.scrollWidth),Math.max(A.offsetWidth,t.offsetWidth),Math.max(A.clientWidth,t.clientWidth)),o=Math.max(Math.max(A.scrollHeight,t.scrollHeight),Math.max(A.offsetHeight,t.offsetHeight),Math.max(A.clientHeight,t.clientHeight));return new r(0,0,n,o)}(m.ownerDocument):a(u,m),v=B.width,w=B.height,b=B.left,y=B.top,C=Cr(u,m,A.backgroundColor),x={canvas:A.canvas,backgroundColor:C,scale:null!==(K=null!==(P=A.scale)&&void 0!==P?P:i.devicePixelRatio)&&void 0!==K?K:1,x:(null!==(_=A.x)&&void 0!==_?_:0)+b,y:(null!==(R=A.y)&&void 0!==R?R:0)+y,width:null!==(O=A.width)&&void 0!==O?O:Math.ceil(v),height:null!==(V=A.height)&&void 0!==V?V:Math.ceil(w)},p?(u.logger.debug("Document cloned, using foreign object rendering"),[4,new Br(u,x).render(m)]):[3,3];case 2:return Q=o.sent(),[3,5];case 3:return u.logger.debug("Document cloned, element located at "+b+","+y+" with size "+v+"x"+w+" using computed rendering"),u.logger.debug("Starting DOM parsing"),F=Fo(u,m),C===F.styles.backgroundColor&&(F.styles.backgroundColor=yA.TRANSPARENT),u.logger.debug("Starting renderer for element at "+x.x+","+x.y+" with size "+x.width+"x"+x.height),[4,new ur(u,x).render(F)];case 4:Q=o.sent(),o.label=5;case 5:return(null===(N=A.removeContainer)||void 0===N||N)&&(ci.destroy(f)||u.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),u.logger.debug("Finished rendering"),[2,Q]}})})},Cr=function(e,A,t){var n=A.ownerDocument,o=n.documentElement?bA(e,getComputedStyle(n.documentElement).backgroundColor):yA.TRANSPARENT,i=n.body?bA(e,getComputedStyle(n.body).backgroundColor):yA.TRANSPARENT,r="string"==typeof t?bA(e,t):null===t?yA.TRANSPARENT:4294967295;return A===n.documentElement?pA(o)?pA(i)?r:i:o:r};return function(e,A){return void 0===A&&(A={}),yr(e,A)}}()}},i={};function r(e){var A=i[e];if(void 0!==A)return A.exports;var t=i[e]={exports:{}};return o[e].call(t.exports,t,t.exports,r),t.exports}r.n=e=>{var A=e&&e.__esModule?()=>e.default:()=>e;return r.d(A,{a:A}),A},r.d=(e,A)=>{for(var t in A)r.o(A,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:A[t]})},r.o=(e,A)=>Object.prototype.hasOwnProperty.call(e,A),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:()=>Xe,getPermissionInstructions:()=>Ze,openSettings:()=>$e});var s={};r.r(s),r.d(s,{showBlockedModal:()=>oA,showNoMicrophoneModal:()=>iA,showPrePromptModal:()=>nA});const c=class{constructor(){this.events={}}on(e,A){return this.events[e]||(this.events[e]=[]),this.events[e].push(A),this}off(e,A){return this.events[e]?(this.events[e]=this.events[e].filter(e=>e!==A),this):this}emit(e){for(var A=arguments.length,t=new Array(A>1?A-1:0),n=1;n<A;n++)t[n-1]=arguments[n];return!!this.events[e]&&(this.events[e].forEach(e=>{e(...t)}),!0)}once(e,A){var t=this,n=function(){A(...arguments),t.off(e,n)};return this.on(e,n)}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 A=e instanceof Uint8Array?e:new Uint8Array(e),t=new Int16Array(A.length),n=0;n<A.length;n++)t[n]=this.mulawToLinear(A[n]);return t.buffer}encode(e){for(var A=e instanceof Int16Array?e:new Int16Array(e),t=new Uint8Array(A.length),n=0;n<A.length;n++)t[n]=this.linearToMulaw(A[n]);return t}mulawToLinear(e){var A=1<<3+(e>>4&7);return(128&e?-1:1)*(132+(15&e)*A+(A>>1)-4)}linearToMulaw(e){var A=e>>8&128;A&&(e=-e),e>32635&&(e=32635),e+=132;for(var t=7,n=16384;0===(e&n)&&t>0;t--,n>>=1);return 255&~(A|t<<4|e>>t+3&15)}},u=class{constructor(){this.name="PCMA"}decode(e){for(var A=e instanceof Uint8Array?e:new Uint8Array(e),t=new Int16Array(A.length),n=0;n<A.length;n++)t[n]=this.alawToLinear(A[n]);return t.buffer}encode(e){for(var A=e instanceof Int16Array?e:new Int16Array(e),t=new Uint8Array(A.length),n=0;n<A.length;n++)t[n]=this.linearToAlaw(A[n]);return t}alawToLinear(e){var A=(e^=85)>>4&7,t=15&e;return(128&e?-1:1)*(0===A?8+(t<<4):264+(t<<4)<<A-1)}linearToAlaw(e){var A,t,n=e>>8&128;if(n&&(e=-e),e>32635&&(e=32635),e<256)A=0,t=e>>4;else{A=7;for(var o=16384;0===(e&o)&&A>0;A--,o>>=1);t=e>>A+3&15}return 85^(n|A<<4|t)}};function p(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function h(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){p(i,n,o,r,a,"next",e)}function a(e){p(i,n,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.sentenceTimings=[],this.isCheckingTranscripts=!1,this._isStopped=!1,this._currentSentenceId=0,this.codecs={pcm:new l,pcmu:new d,pcma:new u},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 A;this.validateFormat(e)||(console.warn("⚠️ AudioPlayer: Invalid format, using defaults:",e),e=this.getDefaultFormat());var t=null===(A=this.outputFormat)||void 0===A?void 0:A.sampleRate,n=e.sampleRate;this.outputFormat=e,console.log("✅ AudioPlayer v2: Format set:",e),this.audioContext&&t&&t!==n&&(console.warn("⚠️ AudioPlayer: Sample rate changed, recreating AudioContext"),console.warn(" Old: ".concat(t,"Hz → New: ").concat(n,"Hz")),this.stopImmediate(),this._cleanupAudioContext(),console.log("ℹ️ AudioContext will be recreated on next audio chunk with correct sample rate"))}validateFormat(e){var A,t;if(!e)return!1;var n=null===(A=e.container)||void 0===A?void 0:A.toLowerCase(),o=null===(t=e.encoding)||void 0===t?void 0:t.toLowerCase();return n&&o&&this.SUPPORTED_CONTAINERS.includes(n)&&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 A=this.createAudioBlob(e);this.audioQueue.push(A),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 A=this;return h(function*(){if(A._isStopped)console.log("🛑 AudioPlayer: Ignoring PCM chunk - playback was stopped (barge-in)");else{var t,n=A.prepareChunk(e);if(n)A._emptySentenceTimeout&&(clearTimeout(A._emptySentenceTimeout),A._emptySentenceTimeout=null),A.preparedBuffer.length>=A.MAX_PREPARED_BUFFER_SIZE&&(A.preparedBuffer.shift(),console.warn("⚠️ AudioPlayer: preparedBuffer at max size (".concat(A.MAX_PREPARED_BUFFER_SIZE,"), dropped oldest frame"))),A.preparedBuffer.push(n),A.isSchedulingFrames||A._isStopped?setTimeout(()=>{A.preparedBuffer.length>0&&!A.isSchedulingFrames&&!A._isStopped&&A.schedulePreparedFrames()},5):A.schedulePreparedFrames(),A.pcmChunkQueue.length>0&&!A.isProcessingPcmQueue&&A.processPcmQueue();else console.error("❌ AudioPlayer: playChunk failed - prepareChunk returned null"),console.error(" pcmData length:",(null==e?void 0:e.byteLength)||"undefined"),console.error(" outputFormat:",A.outputFormat),console.error(" audioContext:",A.audioContext?"initialized":"not initialized"),console.error(" audioContext state:",(null===(t=A.audioContext)||void 0===t?void 0:t.state)||"N/A"),A.emit("playbackError",new Error("Failed to prepare PCM chunk for playback"))}})()}prepareChunk(e){try{var A;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 t=e;if(e.byteLength%2!=0){console.warn("⚠️ Odd PCM chunk size, padding:",e.byteLength);var n=new Uint8Array(e.byteLength+1);n.set(new Uint8Array(e),0),n[e.byteLength]=0,t=n.buffer}for(var o=new Int16Array(t),i=new Float32Array(o.length),r=1/32768,a=o.length,s=0;s<a;s++)i[s]=o[s]*r;var c=(null===(A=this.outputFormat)||void 0===A?void 0:A.sampleRate)||this.audioContext.sampleRate,l=this.audioContext.sampleRate,d=this.audioContext.createBuffer(1,i.length,c);d.getChannelData(0).set(i);var u=d.duration,p=i.length,h=u;return l!==c&&(h=p/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 A=e.preparedBuffer.length,t=Math.min(A,5);0===t&&A>0&&(t=1);try{e.audioContext||e.initializeAudioContext(),yield e.waitForAudioContextReady();for(var n=0,o=function*(){if(e._isStopped)return console.log("🛑 AudioPlayer: Stopping frame scheduling - playback was stopped"),0;var A=e.preparedBuffer.shift();if(!A)return 0;var t=e.audioContext.createBufferSource();t.buffer=A.buffer,t.connect(e.gainNode||e.audioContext.destination),e.scheduledSources.add(t);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,displayed:!1}),console.log("📝 AudioPlayer: Sentence scheduled at ".concat(e.nextStartTime.toFixed(3),'s: "').concat(e.pendingSentenceText.substring(0,40),'..."')),e.pendingSentenceText=null,e.isCheckingTranscripts||e.startTranscriptChecker()),t.start(e.nextStartTime),e.nextStartTime+=A.duration,e.nextStartTime=Math.round(1e6*e.nextStartTime)/1e6;var a=e.nextStartTime-A.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(A.duration.toFixed(4),"s (").concat((1e3*A.duration).toFixed(2),"ms), Queued: ").concat(e.preparedBuffer.length,", Scheduled: ").concat(e.scheduledBuffers))),e.scheduledBuffers++,n++,t.onended=()=>{if(!e._isStopped&&e.scheduledSources.has(t))if(e.scheduledSources.delete(t),!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 A=()=>{e._isStopped||(e.preparedBuffer.length>0&&!e.isSchedulingFrames&&e.scheduledBuffers>0?e.schedulePreparedFrames():e.scheduledBuffers>0&&!e._isStopped&&setTimeout(A,10))};setTimeout(A,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&&n<t&&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(A){console.error("❌ AudioPlayer v2: Error scheduling frames:",A),e.emit("playbackError",A),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 A,t;if(e._isStopped){console.log("🛑 AudioPlayer: Stopping PCM queue processing - playback was stopped");break}var n=e.pcmChunkQueue.shift();if(n){var o=n;if(n.byteLength%2!=0){console.warn("⚠️ Odd PCM chunk size, padding:",n.byteLength);var i=new Uint8Array(n.byteLength+1);i.set(new Uint8Array(n),0),i[n.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===(A=e.outputFormat)||void 0===A?void 0:A.sampleRate)||e.audioContext.sampleRate,u=e.audioContext.sampleRate;null!==(t=e.outputFormat)&&void 0!==t&&t.sampleRate?e.scheduledBuffers<3&&console.log("🎵 AudioPlayer: Creating buffer at ".concat(d,"Hz (AudioContext: ").concat(u,"Hz)")):console.warn("⚠️ AudioPlayer: outputFormat.sampleRate not set! Using AudioContext sample rate:",u);var p=e.audioContext.createBuffer(1,a.length,d);p.getChannelData(0).set(a);var h=e.audioContext.createBufferSource();h.buffer=p,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=p.duration,f=a.length,B=m;if(u!==d&&(B=f/u,e.scheduledBuffers<3&&(console.log("🔄 Resampling detected: ".concat(d,"Hz → ").concat(u,"Hz")),console.log(" Buffer duration: ".concat(m.toFixed(4),"s, Calculated: ").concat(B.toFixed(4),"s")))),h.start(e.nextStartTime),e.nextStartTime+=B,e.nextStartTime=Math.round(1e6*e.nextStartTime)/1e6,e.scheduledBuffers<3){var v=e.nextStartTime-B;console.log("🎵 AudioPlayer: Scheduled chunk ".concat(e.scheduledBuffers+1," at ").concat(v.toFixed(4),"s, next at ").concat(e.nextStartTime.toFixed(4),"s")),console.log(" Duration: ".concat(B.toFixed(4),"s (").concat((1e3*B).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(A){console.error("❌ AudioPlayer v2: Error playing chunk:",A),e.emit("playbackError",A),e.isProcessingPcmQueue=!1}}})()}createAudioBlob(e){var A=new Uint8Array(e);console.log("🎵 AudioPlayer: Processing ".concat(A.length," bytes")),console.log("🎵 AudioPlayer: Negotiated format:",this.outputFormat);var t=this.outputFormat&&this.outputFormat.container&&"wav"===this.outputFormat.container.toLowerCase(),n=this.outputFormat&&this.outputFormat.container&&"raw"===this.outputFormat.container.toLowerCase(),o=this.isWavFile(A);if(o&&console.log("🎵 AudioPlayer: Data has WAV header (RIFF)"),n&&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(A);if(n&&!o)console.log("🎵 AudioPlayer: Processing as RAW data (as negotiated)");else{if(t&&o)return console.log("✅ AudioPlayer: Processing as WAV file (matches negotiation)"),this.handleWavFile(A);if(t&&!o)return console.warn("⚠️ AudioPlayer: Negotiated WAV but data lacks WAV header. Attempting WAV processing anyway."),this.handleWavFile(A);if(!this.outputFormat&&o)return console.log("🎵 AudioPlayer: No format negotiated, auto-detecting WAV"),this.handleWavFile(A);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(A)}isWavFile(e){return e.length>=44&&82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]}handleWavFile(e){var A=this.parseWavHeader(e);if(console.log("🎵 WAV file detected:",{format:A.audioFormat,encoding:this.getEncodingName(A.audioFormat),sampleRate:A.sampleRate,channels:A.channels,bitDepth:A.bitsPerSample}),1===A.audioFormat)return console.log("✅ PCM WAV - using directly"),new Blob([e],{type:"audio/wav"});var t=this.getCodecForWavFormat(A.audioFormat);if(!t)throw new Error("Unsupported WAV format code: ".concat(A.audioFormat));console.log("🔄 Non-PCM WAV - converting to PCM WAV");var n=e.slice(44),o=t.decode(n),i=this.createWavHeader(o.byteLength,A.sampleRate,A.channels,16);return new Blob([i,o],{type:"audio/wav"})}handleRawData(e){var A,t,n=this.outputFormat.encoding.toLowerCase(),o=this.getCodec(n);if(!o)throw new Error("No codec found for encoding: ".concat(n));if(console.log("🎵 AudioPlayer: Decoding ".concat(n.toUpperCase()," to PCM")),console.log("🎵 AudioPlayer: Input format - bitDepth: ".concat(this.outputFormat.bitDepth,", sampleRate: ").concat(this.outputFormat.sampleRate)),"pcm"===n){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."),A=this.convert24BitTo16Bit(e),t=16):8===i?(console.log("🔄 AudioPlayer: Converting 8-bit PCM to 16-bit PCM"),A=this.convert8BitTo16Bit(e),t=16):(A=e.buffer,t=i,console.log("✅ AudioPlayer: Using native ".concat(i,"-bit PCM (no conversion needed)")))}else A=o.decode(e),t=16,console.log("🔄 AudioPlayer: Decoded ".concat(n.toUpperCase()," to 16-bit PCM"));var r=this.createWavHeader(A.byteLength,this.outputFormat.sampleRate,this.outputFormat.channels,t);return new Blob([r,A],{type:"audio/wav"})}convert24BitTo16Bit(e){for(var A=Math.floor(e.length/3),t=new Int16Array(A),n=0;n<A;n++){var o=e[3*n],i=e[3*n+1],r=e[3*n+2],a=o|i<<8|(255&r)<<16;128&r&&(a|=4278190080),t[n]=Math.max(-32768,Math.min(32767,Math.round(a/256)))}return t.buffer}convert8BitTo16Bit(e){for(var A=e.length,t=new Int16Array(A),n=0;n<A;n++){var o=e[n];t[n]=256*(o-128)}return t.buffer}getCodec(e){var A={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[A]}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 A=new DataView(e.buffer,e.byteOffset,e.byteLength);return{audioFormat:A.getUint16(20,!0),channels:A.getUint16(22,!0),sampleRate:A.getUint32(24,!0),byteRate:A.getUint32(28,!0),blockAlign:A.getUint16(32,!0),bitsPerSample:A.getUint16(34,!0)}}createWavHeader(e,A,t,n){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,t,!0),i.setUint32(24,A,!0),i.setUint32(28,A*t*n/8,!0),i.setUint16(32,t*n/8,!0),i.setUint16(34,n,!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 A=e.audioContext;return"running"===A.state?Promise.resolve():"suspended"===A.state&&(yield A.resume(),"running"!==A.state)?new Promise(t=>{var n=setTimeout(()=>{A&&e._waitForReadyStateHandler&&(A.removeEventListener("statechange",e._waitForReadyStateHandler),e._waitForReadyStateHandler=null),console.warn("⚠️ AudioPlayer: AudioContext did not become running within timeout - proceeding anyway"),t()},2e3),o=()=>{if(!A)return clearTimeout(n),e._waitForReadyStateHandler=null,console.warn("⚠️ AudioPlayer: AudioContext became null during state change"),void t();"running"===A.state&&(clearTimeout(n),e._waitForReadyStateHandler&&(A.removeEventListener("statechange",e._waitForReadyStateHandler),e._waitForReadyStateHandler=null),t())};e._waitForReadyStateHandler=o,A.addEventListener("statechange",o),A&&"running"===A.state&&(clearTimeout(n),e._waitForReadyStateHandler&&(A.removeEventListener("statechange",e._waitForReadyStateHandler),e._waitForReadyStateHandler=null),t())}):"closed"===A.state?(console.warn("⚠️ AudioPlayer: AudioContext was closed, recreating..."),e.initializeAudioContext(),e.waitForAudioContextReady()):Promise.resolve()})()}initializeAudioContext(){var e,A,t=(null===(e=this.outputFormat)||void 0===e?void 0:e.sampleRate)||44100;if(48e3!==t&&44100!==t&&(console.log("ℹ️ AudioPlayer: Backend requested ".concat(t,"Hz, but browser may resample")),console.log(" Consider requesting 44100Hz or 48000Hz from backend to avoid resampling and improve quality")),this.audioContext){var n=this.audioContext.sampleRate;if(!(Math.abs(n-t)>100))return;console.warn("⚠️ AudioPlayer: AudioContext sample rate (".concat(n,"Hz) doesn't match format (").concat(t,"Hz), recreating...")),this.stopImmediate(),this._cleanupAudioContext()}if(g&&"closed"!==g.state&&m===t){console.log("♻️ AudioPlayer: Reusing shared AudioContext at ".concat(t,"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(t,"Hz (from outputFormat: ").concat((null===(A=this.outputFormat)||void 0===A?void 0:A.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:t,latencyHint:"playback"}),g=this.audioContext,m=t,console.log("✅ AudioContext created at ".concat(this.audioContext.sampleRate,"Hz (requested: ").concat(t,"Hz)")),Math.abs(this.audioContext.sampleRate-t)>100?(console.error("❌ CRITICAL: Browser sample rate mismatch!"),console.error(" Requested: ".concat(t,"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!==t&&(console.warn("⚠️ Browser adjusted sample rate: ".concat(t,"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 A=e.audioContext.sampleRate,t=e.audioContext.createBuffer(1,.15*A,A),n=e.audioContext.createBufferSource();n.buffer=t,n.connect(e.audioContext.destination),n.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 A=e.audioQueue.shift();if(A)try{var t=!e.isPlaying&&null===e.currentSource;e.audioContext||e.initializeAudioContext(),yield e.waitForAudioContextReady();var n=e.audioContext,o=yield A.arrayBuffer(),i=yield n.decodeAudioData(o),r=t&&!e.isPlaying&&null===e.currentSource,a=n.createBufferSource();a.buffer=i,a.connect(e.gainNode||n.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(A){console.error("❌ AudioPlayer v2: Error processing queue:",A),e.currentSource=null,e.emit("playbackError",A),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 A=0,t=Array.from(this.scheduledSources),n=t.length;for(var o of(this.scheduledSources.clear(),this.scheduledBuffers=0,t))try{o.stop(),A++}catch(e){console.log(" Source already stopped or not started:",e.message)}console.log(" Stopped ".concat(A," sources (cleared ").concat(n," 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){var A=this._isStopped,t=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)")):t&&console.log("📝 AudioPlayer: New sentence queued while audio playing - will start after current sentence finishes"),this.pendingSentenceText=e,console.log('📝 AudioPlayer: New sentence marked: "'.concat(e.substring(0,40),'..." (wasStopped: ').concat(A,", isPlaying: ").concat(t,")")),this._emptySentenceTimeout&&clearTimeout(this._emptySentenceTimeout);var n=e;this._emptySentenceTimeout=setTimeout(()=>{this.pendingSentenceText!==n||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(n.substring(0,40),'..."')),this.pendingSentenceText===n&&(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 A=this.audioContext.currentTime;for(var t of this.sentenceTimings)!t.displayed&&A>=t.startTime&&(t.displayed=!0,console.log("📝 AudioPlayer: Display transcript at ".concat(A.toFixed(3),'s: "').concat(t.text.substring(0,40),'..."')),this.emit("transcriptDisplay",{text:t.text}));this.isPlaying||this.scheduledBuffers>0?requestAnimationFrame(e):(this.isCheckingTranscripts=!1,console.log("📝 AudioPlayer: Transcript checker stopped"))}};requestAnimationFrame(e)}}clearTranscriptState(){this.pendingSentenceText=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 B{constructor(){this.events={}}on(e,A){this.events[e]||(this.events[e]=[]),this.events[e].push(A)}off(e,A){this.events[e]&&(this.events[e]=this.events[e].filter(e=>e!==A))}emit(e){for(var A=arguments.length,t=new Array(A>1?A-1:0),n=1;n<A;n++)t[n-1]=arguments[n];this.events[e]&&this.events[e].forEach(A=>{try{A(...t)}catch(A){console.error("Error in event listener for ".concat(e,":"),A)}})}removeAllListeners(e){e?delete this.events[e]:this.events={}}}function v(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function w(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){v(i,n,o,r,a,"next",e)}function a(e){v(i,n,o,r,a,"throw",e)}r(void 0)})}}function b(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function y(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?b(Object(t),!0).forEach(function(A){C(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}function C(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}function x(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Q(e){var A,t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null!==(A=null===(t=navigator.mediaDevices)||void 0===t||null===(n=t.getSupportedConstraints)||void 0===n?void 0:n.call(t))&&void 0!==A?A:{},r={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:i.channelCount?{ideal:1}:1};return i.sampleRate&&e&&(r.sampleRate={ideal:e}),x()&&i.voiceIsolation&&(r.voiceIsolation=!0),y(y({},r),o)}var F=null,U=null,S=!1,E=null;class I extends B{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 A of e){var t=A.src;if(t&&(t.includes("agent-widget.js")||t.includes("ttp-agent-sdk")))try{new URL(t);var n=t.substring(0,t.lastIndexOf("/"));return"".concat(n,"/audio-processor.js")}catch(e){var o=t.substring(0,t.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 A=Q(e.config.sampleRate||e.config.outputSampleRate||44100,e.config.audioConstraints);return(yield navigator.mediaDevices.getUserMedia({audio:A})).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 A=this;return w(function*(){var t=Q(e,A.config.audioConstraints);return navigator.mediaDevices.getUserMedia({audio:t})})()}start(){var e=arguments,A=this;return w(function*(){var t=e.length>0&&void 0!==e[0]?e[0]:{};if(A._starting)console.warn("⚠️ AudioRecorder: start() already in progress, ignoring duplicate call");else{A._starting=!0;try{var n=A.config.sampleRate||A.config.outputSampleRate||44100,o=t.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)"),A.mediaStream=o):(console.warn("⚠️ AudioRecorder: Existing stream has no live tracks, falling back to getUserMedia"),A.mediaStream=yield A._getUserMediaStream(n))}else{console.log("🎤 AudioRecorder: Requesting microphone access...");var c=yield A.checkPermissionState();c&&console.log("📋 AudioRecorder: Current permission state: ".concat(c)),A.mediaStream=yield A._getUserMediaStream(n)}if(A.config.checkConnection&&"function"==typeof A.config.checkConnection&&!A.config.checkConnection()){A.mediaStream.getTracks().forEach(e=>e.stop()),A.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===n)console.log("♻️ AudioRecorder: Reusing shared AudioContext (iOS-safe)"),A.audioContext=F,"suspended"===A.audioContext.state&&(yield A.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,E=null}A.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n}),F=A.audioContext,U=n,S=!1,console.log("🎵 AudioRecorder: Created new shared AudioContext at",n,"Hz")}if("suspended"===A.audioContext.state&&(yield A.audioContext.resume()),A.config.checkConnection&&"function"==typeof A.config.checkConnection&&!A.config.checkConnection()){A.mediaStream.getTracks().forEach(e=>e.stop()),A.mediaStream=null,A.audioContext=null;var d=new Error("Connection lost - server may have rejected the call");throw d.name="ServerRejected",d.isServerRejection=!0,d}var u=A.getAudioProcessorPath();if(S&&E===u?console.log("♻️ AudioRecorder: AudioWorklet module already loaded, skipping"):(yield A.audioContext.audioWorklet.addModule(u),S=!0,E=u,console.log("✅ AudioRecorder: AudioWorklet module loaded")),A.config.checkConnection&&"function"==typeof A.config.checkConnection&&!A.config.checkConnection()){A.mediaStream.getTracks().forEach(e=>e.stop()),A.mediaStream=null,A.audioContext=null;var p=new Error("Connection lost - server may have rejected the call");throw p.name="ServerRejected",p.isServerRejection=!0,p}A.audioWorkletNode=new AudioWorkletNode(A.audioContext,"audio-processor",{processorOptions:{sampleRate:n,outputSampleRate:A.config.outputSampleRate}});var h=A.audioContext.createMediaStreamSource(A.mediaStream);h.connect(A.audioWorkletNode),A.mediaStreamSource=h,A.audioWorkletNode.port.onmessage=e=>{var{type:t,data:n}=e.data;"pcm_audio_data"===t&&A.emit("audioData",n)},A.audioWorkletNode.port.postMessage({type:"setForceContinuous",data:{enabled:!0,bypassVad:x()}}),console.log("✅ AudioRecorder: Microphone access granted"),A.isRecording=!0,A.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 A.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,A.emit("error",f),f}finally{A._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(A){throw e.emit("error",A),A}})()}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 A=e.mediaStream.getAudioTracks();0===A.filter(e=>"live"===e.readyState).length&&A.length>0&&(console.warn("⚠️ AudioRecorder: All audio tracks are inactive. Recording may have stopped."),e.emit("tracksInactive"))}}catch(A){console.error("❌ AudioRecorder: Failed to resume AudioContext:",A),e.emit("error",A)}})()}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,E=null}}class k{static extractPcmFromWav(e){var A=e instanceof Uint8Array?e:new Uint8Array(e);if(A.length<44)throw new Error("WAV data too short (< 44 bytes)");if("RIFF"!==String.fromCharCode(A[0],A[1],A[2],A[3]))throw new Error("Not a valid WAV file - missing RIFF header");if("WAVE"!==String.fromCharCode(A[8],A[9],A[10],A[11]))throw new Error("Not a valid WAV file - missing WAVE format");for(var t=A[22]|A[23]<<8,n=A[24]|A[25]<<8|A[26]<<16|A[27]<<24,o=A[34]|A[35]<<8,i=-1,r=12;r<A.length-8;r+=4){if("data"===String.fromCharCode(A[r],A[r+1],A[r+2],A[r+3])){i=r;break}r+=4+(A[r+4]|A[r+5]<<8|A[r+6]<<16|A[r+7]<<24)}if(-1===i)throw new Error("No data chunk found in WAV");var a=A[i+4]|A[i+5]<<8|A[i+6]<<16|A[i+7]<<24,s=i+8,c=Math.min(a,A.length-s);return{pcmData:A.slice(s,s+c).buffer,format:{sampleRate:n,channels:t,bitDepth:o}}}static isWavFile(e){return e.length>=44&&82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]}static createWavHeader(e,A,t,n){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,t,!0),i.setUint32(24,A,!0),i.setUint32(28,A*t*n/8,!0),i.setUint16(32,t*n/8,!0),i.setUint16(34,n,!0),i.setUint32(36,1684108385,!1),i.setUint32(40,e,!0),o}static wrapPcmInWav(e,A){var t=k.createWavHeader(e.byteLength,A.sampleRate,A.channels||1,A.bitDepth||16),n=new Uint8Array(t.byteLength+e.byteLength);return n.set(new Uint8Array(t),0),n.set(new Uint8Array(e),t.byteLength),n.buffer}}const T=k,H=class{constructor(){this.codecs={pcm:new l,pcmu:new d,pcma:new u}}decodeToPcm(e,A){var t=null==A?void 0:A.toLowerCase();if(!t||"pcm"===t)return e instanceof ArrayBuffer?e:e instanceof Uint8Array?e.buffer:e;var n=this.codecs[t];if(!n)throw new Error("Unsupported encoding: ".concat(A));var o=e instanceof Uint8Array?e:new Uint8Array(e);return n.decode(o)}encodeFromPcm(e,A){var t=null==A?void 0:A.toLowerCase();if(!t||"pcm"===t)return e;var n=this.codecs[t];if(!n)throw new Error("Unsupported target encoding: ".concat(A));var o=n.encode(e);return o instanceof Uint8Array?o.buffer:o}getCodec(e){var A=null==e?void 0:e.toLowerCase();return this.codecs[A]||null}};class D{static convert(e,A,t){if(A===t)return e;if(8===A)throw new Error("Source bit depth cannot be 8-bit (only 16-bit or 24-bit supported)");var n=A/8,o=t/8,i=e.byteLength/n;if(new ArrayBuffer(i*o),16===A&&16===t)return e;if(24===A&&16===t)return D.convert24To16(e);if(16===A&&24===t)return D.convert16To24(e);if(16===A&&8===t)return D.convert16To8(e);if(24===A&&8===t)return D.convert24To8(e);throw new Error("Unsupported bit depth conversion: ".concat(A,"-bit → ").concat(t,"-bit"))}static convert24To16(e){for(var A=new Uint8Array(e),t=Math.floor(A.length/3),n=new Int16Array(t),o=0;o<t;o++){var i=A[3*o],r=A[3*o+1],a=A[3*o+2],s=i|r<<8|(255&a)<<16;128&a&&(s|=4278190080),n[o]=Math.max(-32768,Math.min(32767,Math.round(s/256)))}return n.buffer}static convert16To24(e){for(var A=new Int16Array(e),t=new Uint8Array(3*A.length),n=0;n<A.length;n++){var o=256*A[n];t[3*n]=255&o,t[3*n+1]=o>>8&255,t[3*n+2]=o>>16&255}return t.buffer}static convert16To8(e){for(var A=new Int16Array(e),t=new Uint8Array(A.length),n=0;n<A.length;n++){var o=A[n];t[n]=Math.max(0,Math.min(255,Math.round(o/256+128)))}return t.buffer}static convert24To8(e){var A=D.convert24To16(e);return D.convert16To8(A)}}const M=D;function L(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}const P=class{static resample(e,A,t){return(n=function*(){if(A===t)return e;for(var n=new Int16Array(e),o=new Float32Array(n.length),i=1/32768,r=0;r<n.length;r++)o[r]=n[r]*i;var a=Math.ceil(o.length*t/A),s=new OfflineAudioContext(1,a,t),c=s.createBuffer(1,o.length,A);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),u=new Int16Array(d.length),p=0;p<d.length;p++){var h=Math.max(-1,Math.min(1,d[p]));u[p]=Math.round(32767*h)}return u.buffer},function(){var e=this,A=arguments;return new Promise(function(t,o){var i=n.apply(e,A);function r(e){L(i,t,o,r,a,"next",e)}function a(e){L(i,t,o,r,a,"throw",e)}r(void 0)})})();var n}};class K{static convert(e,A,t){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16;if(A===t)return e;if(1===A&&1===t)return e;if(1===A&&2===t)return K.monoToStereo(e,n);if(2===A&&1===t)return K.stereoToMono(e,n);throw new Error("Unsupported channel conversion: ".concat(A," → ").concat(t))}static monoToStereo(e,A){for(var t=A/8,n=e.byteLength/t,o=new ArrayBuffer(n*t*2),i=new Uint8Array(e),r=new Uint8Array(o),a=0;a<n;a++)for(var s=a*t,c=a*t*2,l=0;l<t;l++)r[c+l]=i[s+l],r[c+t+l]=i[s+l];return o}static stereoToMono(e,A){var t=A/8,n=e.byteLength/(2*t),o=new ArrayBuffer(n*t),i=new Uint8Array(e),r=new Uint8Array(o);if(16===A)for(var a=0;a<n;a++){var s=a*t*2,c=s+t,l=(i[s]|i[s+1]<<8)<<16>>16,d=(i[c]|i[c+1]<<8)<<16>>16,u=Math.round((l+d)/2),p=a*t;r[p]=255&u,r[p+1]=u>>8&255}else for(var h=0;h<n;h++)for(var g=h*t*2,m=h*t,f=0;f<t;f++)r[m+f]=i[g+f];return o}}const _=K;function R(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function O(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?R(Object(t),!0).forEach(function(A){V(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):R(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}function V(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}function N(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}const G=class{constructor(e,A){this.requestedFormat=e,this.actualFormat=A,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 A,t=this;return(A=function*(){if(!t.needsConversion())return e instanceof ArrayBuffer?e:e.buffer;var A=e instanceof ArrayBuffer?e:e.buffer,n=O({},t.actualFormat);if(t.conversionSteps.includes("extract_wav")){var o=T.extractPcmFromWav(A);A=o.pcmData,n=O(O({},n),{},{container:"raw",sampleRate:o.format.sampleRate,channels:o.format.channels,bitDepth:o.format.bitDepth}),console.log("🔄 AudioFormatConverter: Extracted PCM from WAV",o.format)}if(t.conversionSteps.includes("decode_encoding")&&(A=t.encodingConverter.decodeToPcm(A,n.encoding),n.encoding="pcm",n.bitDepth=16,console.log("🔄 AudioFormatConverter: Decoded ".concat(t.actualFormat.encoding.toUpperCase()," → PCM"))),24===n.bitDepth&&n.bitDepth!==t.requestedFormat.bitDepth&&(t.conversionSteps.includes("resample")||t.conversionSteps.includes("convert_channels")||24!==t.requestedFormat.bitDepth)&&(A=M.convert(A,24,16),n.bitDepth=16,console.log("🔄 AudioFormatConverter: Normalized 24-bit → 16-bit PCM")),t.conversionSteps.includes("resample")&&(A=yield P.resample(A,n.sampleRate,t.requestedFormat.sampleRate),n.sampleRate=t.requestedFormat.sampleRate,console.log("🔄 AudioFormatConverter: Resampled ".concat(t.actualFormat.sampleRate,"Hz → ").concat(t.requestedFormat.sampleRate,"Hz"))),t.conversionSteps.includes("convert_channels")&&(A=_.convert(A,n.channels,t.requestedFormat.channels,n.bitDepth),n.channels=t.requestedFormat.channels,console.log("🔄 AudioFormatConverter: Converted channels ".concat(t.actualFormat.channels," → ").concat(t.requestedFormat.channels))),t.conversionSteps.includes("convert_bitdepth")&&(A=M.convert(A,n.bitDepth,t.requestedFormat.bitDepth),n.bitDepth=t.requestedFormat.bitDepth,console.log("🔄 AudioFormatConverter: Converted bit depth ".concat(t.actualFormat.bitDepth,"-bit → ").concat(t.requestedFormat.bitDepth,"-bit"))),t.conversionSteps.includes("encode_encoding")){var i=t.encodingConverter.encodeFromPcm(A,t.requestedFormat.encoding);A=i instanceof ArrayBuffer?i:i.buffer,n.encoding=t.requestedFormat.encoding,console.log("🔄 AudioFormatConverter: Encoded PCM → ".concat(t.requestedFormat.encoding.toUpperCase()))}return t.conversionSteps.includes("wrap_wav")&&(A=T.wrapPcmInWav(A,n),n.container="wav",console.log("🔄 AudioFormatConverter: Wrapped in WAV container")),console.log("✅ AudioFormatConverter: Conversion complete"),A},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=A.apply(e,t);function r(e){N(i,n,o,r,a,"next",e)}function a(e){N(i,n,o,r,a,"throw",e)}r(void 0)})})()}};function W(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}const j=class{constructor(e){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>null;this.handlers=new Map,this.sendMessage=e,this.getConversationId=A}registerHandler(e,A){if("function"!=typeof A)throw new Error("Handler for tool '".concat(e,"' must be a function"));this.handlers.set(e,A),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 A,t=this;return(A=function*(){var{toolCallId:A,toolName:n,parameters:o}=e,i=Date.now(),r=(new Date).toISOString();console.log("🔧 ClientTools: [".concat(r,"] Received tool call '").concat(n,"' (id: ").concat(A,")")),console.log(" 📋 Full message received:",JSON.stringify(e,null,2)),console.log(" ⏱️ Start time: ".concat(i,"ms (").concat(new Date(i).toISOString(),")"));var a=t.handlers.get(n);if(!a){var s=Array.from(t.handlers.keys());return console.error("🔧 ClientTools: No handler registered for '".concat(n,"'")),console.error(" 📋 Currently registered tools:",s),console.error(" 📋 Total registered: ".concat(s.length)),void t.sendError(A,n,"No handler registered for tool '".concat(n,"'"),"NO_HANDLER",i)}try{var c=yield a(o),l=Date.now()-i;console.log("🔧 ClientTools: Tool '".concat(n,"' completed in ").concat(l,"ms")),t.sendResult(A,n,c,l)}catch(e){var d,u,p=Date.now()-i;console.error("🔧 ClientTools: Tool '".concat(n,"' 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!==(u=e.message)&&void 0!==u&&u.includes("not supported"))&&(h="API_UNAVAILABLE"),t.sendError(A,n,e.message||"Unknown error",h,p)}},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=A.apply(e,t);function r(e){W(i,n,o,r,a,"next",e)}function a(e){W(i,n,o,r,a,"throw",e)}r(void 0)})})()}sendResult(e,A,t,n){var o=this.getConversationId(),i=(new Date).toISOString(),r={t:"client_tool_result",toolCallId:e,toolName:A,conversationId:o,result:t,executionTimeMs:n};console.log("🔧 ClientTools: [".concat(i,"] Sending result for tool '").concat(A,"'")),console.log(" 📋 toolCallId: ".concat(e)),console.log(" 📋 conversationId: ".concat(o||"null")),console.log(" 📋 toolName: ".concat(A)),console.log(" 📋 result:",t),console.log(" 📋 Full message:",JSON.stringify(r,null,2)),this.sendMessage(r),console.log("✅ ClientTools: Result message sent at ".concat(i))}sendError(e,A,t,n,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:A,conversationId:a,error:t,errorCode:n,executionTimeMs:i};console.log("🔧 ClientTools: [".concat(r,"] Sending error for tool '").concat(A,"'")),console.log(" 📋 toolCallId: ".concat(e)),console.log(" 📋 conversationId: ".concat(a||"null")),console.log(" 📋 toolName: ".concat(A)),console.log(" 📋 error: ".concat(t,", errorCode: ").concat(n)),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 z=r(354),q=r.n(z);function X(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function J(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?X(Object(t),!0).forEach(function(A){Y(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):X(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}function Y(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}function Z(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}var $={useCORS:!0,allowTaint:!1,backgroundColor:"#ffffff",scale:1,logging:!1,imageTimeout:15e3};function ee(){return Ae.apply(this,arguments)}function Ae(){var e;return e=function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:A=null,format:t="jpeg",quality:n=.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(A){var l=document.querySelector(A);if(!l)throw new Error("Element not found: ".concat(A));c=l,console.log("📸 SDK Screenshot: Capturing element: ".concat(A))}else console.log("📸 SDK Screenshot: Capturing entire page");var d=J(J({},$),{},{scale:o});a&&!A&&(d.windowHeight=document.documentElement.scrollHeight,d.height=document.documentElement.scrollHeight,d.y=0);var u=yield q()(c,d);console.log("📸 SDK Screenshot: Canvas created (".concat(u.width,"x").concat(u.height,")"));var p=u;(i||r)&&(p=function(e,A,t){var{width:n,height:o}=e,i=1;if(A&&n>A&&(i=Math.min(i,A/n)),t&&o>t&&(i=Math.min(i,t/o)),1===i)return e;var r=Math.round(n*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}(u,i,r),p!==u&&console.log("📸 SDK Screenshot: Resized to ".concat(p.width,"x").concat(p.height)));var h="jpeg"===t?"image/jpeg":"image/png",g=p.toDataURL(h,"jpeg"===t?n: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:p.width,height:p.height,captureTimeMs:m,selector:A||"body"}}catch(e){throw console.error("📸 SDK Screenshot: Capture failed:",e),new Error("Screenshot capture failed: ".concat(e.message))}},Ae=function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){Z(i,n,o,r,a,"next",e)}function a(e){Z(i,n,o,r,a,"throw",e)}r(void 0)})},Ae.apply(this,arguments)}var te={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 ne(e){if(!e)return!1;var A=(e.type||"").toLowerCase(),t=(e.name||"").toLowerCase(),n=(e.id||"").toLowerCase(),o=(e.className||"").toLowerCase(),i=(e.autocomplete||"").toLowerCase(),r=(e.placeholder||"").toLowerCase(),a=(e.getAttribute("aria-label")||"").toLowerCase(),s="".concat(t," ").concat(n," ").concat(o," ").concat(r," ").concat(a);if(te.types.includes(A))return!0;if(te.autocomplete.includes(i))return!0;for(var c of te.names)if(s.includes(c))return!0;for(var l of te.dataAttributes)if(e.hasAttribute(l))return!0;return"password"===(e.inputMode||"").toLowerCase()}function oe(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function ie(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?oe(Object(t),!0).forEach(function(A){re(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):oe(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}function re(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}function ae(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}var se={buttons:20,links:30,forms:5,fieldsPerForm:15,sections:10,headings:15,maxTextLength:100,maxSummaryLength:150};function ce(e){var A,t;if(!e||!e.tagName)return null;if(null!==(A=e.dataset)&&void 0!==A&&A.testid)return'[data-testid="'.concat(e.dataset.testid,'"]');if(null!==(t=e.dataset)&&void 0!==t&&t.cy)return'[data-cy="'.concat(e.dataset.cy,'"]');var n=e.getAttribute("aria-label");if(n&&n.length<50)return'[aria-label="'.concat(n.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 A;return(null===(A=e.innerText)||void 0===A?void 0:A.trim())===r}).length)return"".concat(a,':contains("').concat(r.replace(/"/g,'\\"'),'")')}}return function(e){for(var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,t=[],n=e,o=0;n&&n!==document.body&&o<A;){var i=n.tagName.toLowerCase();if(n.id&&!le(n.id)){t.unshift("#".concat(CSS.escape(n.id)));break}var r=de(n);if(r)t.unshift("".concat(i,".").concat(r));else{var a,s=null===(a=n.parentElement)||void 0===a?void 0:a.children;if(s&&s.length>1){var c=Array.from(s).indexOf(n)+1;t.unshift("".concat(i,":nth-child(").concat(c,")"))}else t.unshift(i)}n=n.parentElement,o++}return t.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(A=>A.test(e))}function de(e){var A=Array.from(e.classList||[]),t=[/^(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 A.filter(e=>!t.some(A=>A.test(e))&&e.length>2&&e.length<30)[0]||null}function ue(e){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,t=e.getBoundingClientRect();return t.bottom>=-A&&t.top<=window.innerHeight+A&&t.right>=0&&t.left<=window.innerWidth}function pe(e){if(!e)return!1;var A=window.getComputedStyle(e);return"none"!==A.display&&"hidden"!==A.visibility&&"0"!==A.opacity&&e.offsetWidth>0&&e.offsetHeight>0}function he(){return ge.apply(this,arguments)}function ge(){return e=function*(){var e,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=ie(ie({},se),A.limits),n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,A=[],t=document.querySelectorAll('button, [type="submit"], [type="button"], [role="button"], .btn, .button');for(var n of t){if(A.length>=e.buttons)break;if(pe(n)){var o=(n.innerText||n.value||n.getAttribute("aria-label")||"").trim();o&&A.push({selector:ce(n),text:o.substring(0,e.maxTextLength),type:n.type||"button",disabled:n.disabled||!1,inViewport:ue(n,0)})}}return A}(t),o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,A=[],t=document.querySelectorAll("a[href]"),n=window.location.origin;for(var o of t){if(A.length>=e.links)break;if(pe(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===n}catch(e){}A.push({selector:ce(o),text:i.substring(0,e.maxTextLength),href:r,internal:a,inViewport:ue(o,0)})}}}}return A}(t),{forms:i,sensitiveCount:r}=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,A=[],t=document.querySelectorAll("form"),n=0;for(var o of t){if(A.length>=e.forms)break;if(pe(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(ne(a))n++;else{var l=null;if(a.id){var d,u=document.querySelector('label[for="'.concat(a.id,'"]'));l=null==u||null===(d=u.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&&A.push({selector:ce(o),id:o.id||null,action:o.action||null,method:(o.method||"get").toUpperCase(),fields:i})}}return{forms:A,sensitiveCount:n}}(t),a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,A=[],t=document.querySelectorAll('section, article, main, [role="main"], [role="region"], .section');for(var n of t){var o,i,r;if(A.length>=e.sections)break;if(pe(n)){var a=n.querySelector("h1, h2, h3"),s=(null==a||null===(o=a.innerText)||void 0===o?void 0:o.trim())||"",c=n.querySelector("p"),l=s||(null==c||null===(i=c.innerText)||void 0===i?void 0:i.trim().substring(0,e.maxSummaryLength))||(null===(r=n.innerText)||void 0===r?void 0:r.trim().substring(0,e.maxSummaryLength))||"";A.push({selector:ce(n),id:n.id||null,tagName:n.tagName.toLowerCase(),summary:l.substring(0,e.maxSummaryLength),inViewport:ue(n,0)})}}return A}(t),s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se,A=[],t=document.querySelectorAll("h1, h2, h3");for(var n of t){var o;if(A.length>=e.headings)break;if(pe(n)){var i=null===(o=n.innerText)||void 0===o?void 0:o.trim();i&&A.push({selector:ce(n),level:n.tagName.toLowerCase(),text:i.substring(0,e.maxTextLength),inViewport:ue(n,0)})}}return A}(t),c=n.length+o.length+i.reduce((e,A)=>e+A.fields.length,0)+a.length+s.length,l=n.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,u=navigator.language||navigator.languages&&navigator.languages[0]||null,p=d||u||null;return{url:window.location.href,title:document.title,timestamp:Date.now(),language:p,viewport:{width:window.innerWidth,height:window.innerHeight,scrollX:window.scrollX,scrollY:window.scrollY,pageHeight:document.documentElement.scrollHeight},buttons:n,links:o,forms:i,sections:a,headings:s,metadata:{totalElements:c,visibleInViewport:l,formsCount:i.length,sensitiveFieldsFiltered:r}}},ge=function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){ae(i,n,o,r,a,"next",e)}function a(e){ae(i,n,o,r,a,"throw",e)}r(void 0)})},ge.apply(this,arguments);var e}function me(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function fe(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){me(i,n,o,r,a,"next",e)}function a(e){me(i,n,o,r,a,"throw",e)}r(void 0)})}}function Be(){return Be=fe(function*(){var e,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:t,color:n="#6366f1",duration:o=3e3}=A;if(!t)return{success:!1,error:"Selector is required"};var i=document.querySelector(t);if(!i)return{success:!1,error:"Element not found: ".concat(t)};i.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),yield xe(400);var r=i.getBoundingClientRect();ve();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(n,";\n border-color: ").concat(n,";\n box-shadow: 0 0 20px ").concat(n,"80, 0 0 40px ").concat(n,"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:t,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}}}}),Be.apply(this,arguments)}function ve(){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:A,x:t,y:n,direction:o,amount:i=500,position:r="center",behavior:a="smooth"}=e;if(A){var s=document.querySelector(A);if(!s)return{success:!1,error:"Element not found: ".concat(A)};var c="top"===r?"start":"bottom"===r?"end":"center";s.scrollIntoView({behavior:a,block:c,inline:"nearest"}),yield xe("smooth"===a?500:100);var l=s.getBoundingClientRect();return{success:!0,scrollType:"element",selector:A,elementPosition:{top:l.top,left:l.left}}}if("up"===o||"down"===o){var d,u=i||500,p=window.scrollY,h=document.documentElement.scrollHeight-window.innerHeight;return d="up"===o?Math.max(0,p-u):Math.min(h,p+u),window.scrollTo({top:d,left:window.scrollX,behavior:a}),yield xe("smooth"===a?500:100),{success:!0,scrollType:"relative",direction:o,amount:u,scrolledFrom:{y:p},scrolledTo:{y:window.scrollY},atTop:0===window.scrollY,atBottom:window.scrollY>=h-1}}return void 0!==t||void 0!==n?(window.scrollTo({top:null!=n?n:window.scrollY,left:null!=t?t:window.scrollX,behavior:a}),yield xe("smooth"===a?500:100),{success:!0,scrollType:"position",scrolledTo:{x:null!=t?t:window.scrollX,y:null!=n?n: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,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{url:t}=A;if(!t)return{success:!1,error:"URL is required"};try{e=new URL(t,window.location.origin)}catch(e){return{success:!1,error:"Invalid URL: ".concat(t)}}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(A){return{success:!1,error:"Failed to open external link in new tab: "+A.message,attempted:e.href}}var n=window.location.href;return window.location.href=e.href,{success:!0,navigatedTo:e.href,from:n}}),be.apply(this,arguments)}function ye(){return ye=fe(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:A,value:t,triggerEvents:n=!0}=e;if(!A)return{success:!1,error:"Selector is required"};if(null==t)return{success:!1,error:"Value is required"};var o=document.querySelector(A);if(!o)return{success:!1,error:"Element not found: ".concat(A)};var i=o.tagName.toLowerCase();if(!["input","textarea","select"].includes(i))return{success:!1,error:"Element is not a form field: ".concat(i)};if(ne(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 xe(300),o.focus(),"select"===i){var r=Array.from(o.options).find(e=>e.value===t||e.text.toLowerCase()===t.toLowerCase());o.value=r?r.value:t}else if("checkbox"===o.type||"radio"===o.type){var a=!0===t||"true"===t||"1"===t;o.checked=a}else o.value=t;if(n){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,t),o.dispatchEvent(new Event("input",{bubbles:!0})))}return ve(),o.classList.add("ttp-fill-success"),setTimeout(()=>{o.classList.remove("ttp-fill-success")},2e3),{success:!0,selector:A,fieldType:o.type||i,fieldName:o.name||null,filled:!0}}),ye.apply(this,arguments)}function Ce(){return Ce=fe(function*(){var e,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{selector:t,waitForNavigation:n=!1,openInNewTab:o=!1,isExternal:i=!1,href:r=null}=A;if(!t)return{success:!1,error:"Selector is required"};var a=document.querySelector(t);if(!a)return{success:!1,error:"Element not found: ".concat(t)};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 xe(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 xe(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:t,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(n){var u,p=window.location.href,h=new Promise(e=>{var A=setTimeout(()=>{e({navigated:!1})},5e3),t=()=>{clearTimeout(A),window.removeEventListener("beforeunload",t),e({navigated:!0})};window.addEventListener("beforeunload",t)});a.click();var g=yield h;return{success:!0,selector:t,clicked:!0,elementInfo:{tag:a.tagName.toLowerCase(),text:(null===(u=a.innerText)||void 0===u?void 0:u.trim().substring(0,50))||null},navigated:g.navigated||window.location.href!==p}}return a.click(),{success:!0,selector:t,clicked:!0,elementInfo:{tag:a.tagName.toLowerCase(),text:(null===(e=a.innerText)||void 0===e?void 0:e.trim().substring(0,50))||null}}}),Ce.apply(this,arguments)}function xe(e){return new Promise(A=>setTimeout(A,e))}function Qe(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function Fe(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){Qe(i,n,o,r,a,"next",e)}function a(e){Qe(i,n,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 A=yield he(e);return console.log("[TTP] ✅ Page structure extracted:",{buttons:A.buttons.length,links:A.links.length,forms:A.forms.length,headings:A.headings.length}),A})),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 A=yield function(){return Be.apply(this,arguments)}(e);return A.success?console.log("[TTP] ✅ Element highlighted"):console.warn("[TTP] ⚠️ Highlight failed:",A.error),A})),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 A,t;console.log("[TTP] 📜 Scrolling to position:","(".concat(null!==(A=e.x)&&void 0!==A?A:"current",", ").concat(null!==(t=e.y)&&void 0!==t?t:"current",")"))}else console.log("[TTP] 📜 Scroll called with params:",e);var n=yield function(){return we.apply(this,arguments)}(e);return n.success?console.log("[TTP] ✅ Scrolled successfully"):console.warn("[TTP] ⚠️ Scroll failed:",n.error),n})),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 A=yield function(){return be.apply(this,arguments)}(e);return A.success?console.log("[TTP] ✅ Navigation initiated"):console.warn("[TTP] ⚠️ Navigation blocked:",A.error),A})),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 A=yield function(){return ye.apply(this,arguments)}(e);return A.success?console.log("[TTP] ✅ Field filled"):console.warn("[TTP] ⚠️ Fill failed:",A.error),A})),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 A=yield function(){return Ce.apply(this,arguments)}(e);return A.success?console.log("[TTP] ✅ Element clicked"):console.warn("[TTP] ⚠️ Click failed:",A.error),A}));var A=e.getRegisteredTools(),t=["read_page","highlight_element","scroll_to_element","navigate_to","fill_field","click_element"].filter(e=>!A.includes(e));t.length>0&&console.error("[TTP] ❌ Some visual tools failed to register:",t)}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 Ee(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function Ie(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){Ee(i,n,o,r,a,"next",e)}function a(e){Ee(i,n,o,r,a,"throw",e)}r(void 0)})}}function ke(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function Te(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?ke(Object(t),!0).forEach(function(A){He(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ke(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}function He(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}class De 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},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 A=Te(Te({},this.config),{},{checkConnection:()=>this.isConnected&&this.websocket&&this.websocket.readyState===WebSocket.OPEN});this.audioRecorder=new I(A),this.setupAudioPlayerEvents(),this.setupAudioRecorderEvents(),this.clientToolsRegistry=new j(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",Ie(function*(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};console.log("📸 VoiceSDK: capture_screen tool called with params:",A);var{selector:t=null,format:n="jpeg",quality:o=.85,scale:i=1,fullPage:r=!1,maxWidth:a=1280,maxHeight:s=1280}=A;try{var c=yield ee({selector:t,format:n,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(A){throw console.error("📸 VoiceSDK: Screenshot capture failed:",A),e.emit("screenshotError",{error:A.message}),A}})),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 A=this.clientToolsRegistry.getRegisteredTools(),t=["read_page","click_element","fill_field","highlight_element","scroll_to_element","navigate_to"],n=A.filter(e=>t.includes(e));if(n.length!==t.length){var o=t.filter(e=>!n.includes(e));console.error("❌ VoiceSDK: Some visual tools failed to register:",o),console.error(" Registered visual tools:",n)}}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(De.RESUME_STORAGE_KEY);if(e){var A=JSON.parse(e);if(A&&A.conversationId)return console.log("📦 VoiceSDK v2: Found stored conversationId:",A.conversationId),A.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 A={},t=sessionStorage.getItem(De.RESUME_STORAGE_KEY);if(t)try{A=JSON.parse(t)}catch(e){}A.conversationId=e,A.timestamp=Date.now(),A.fromPage=A.fromPage||window.location.pathname+window.location.search,sessionStorage.setItem(De.RESUME_STORAGE_KEY,JSON.stringify(A)),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(De.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(De.RESUME_STORAGE_KEY);if(!e)return null;var A=JSON.parse(e),t=Date.now()-A.timestamp;return t>De.RESUME_TTL_MS?(console.log("[VoiceSDK] Resume state expired:",t,"ms"),this._clearResumeState(),null):(console.log("[VoiceSDK] Found valid resume state:",A,"age:",t,"ms"),A)}catch(e){return console.warn("[VoiceSDK] Failed to get resume state:",e),null}}_clearResumeState(){try{if("undefined"==typeof sessionStorage)return;sessionStorage.removeItem(De.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 A=window.location.pathname+window.location.search;return console.log("[VoiceSDK] Auto-resuming conversation:",e.conversationId),console.log("[VoiceSDK] Page change:",e.fromPage,"→",A),{conversationId:e.conversationId,fromPage:e.fromPage,toPage:A}}getDefaultContainer(e){return"wav"===e.outputCodec?"wav":"raw"}validateInputFormat(e){var A;if(!e)return"Input format is required";var t=null===(A=e.encoding)||void 0===A?void 0:A.toLowerCase();return t&&De.SUPPORTED_INPUT_ENCODINGS.includes(t)?e.sampleRate&&De.SUPPORTED_INPUT_SAMPLE_RATES.includes(e.sampleRate)?e.bitDepth&&De.SUPPORTED_INPUT_BIT_DEPTHS.includes(e.bitDepth)?e.channels&&De.SUPPORTED_INPUT_CHANNELS.includes(e.channels)?null:"Unsupported input channels: ".concat(e.channels,". Supported: ").concat(De.SUPPORTED_INPUT_CHANNELS.join(", ")):"Unsupported input bit depth: ".concat(e.bitDepth,". Supported: ").concat(De.SUPPORTED_INPUT_BIT_DEPTHS.join(", ")):"Unsupported input sample rate: ".concat(e.sampleRate,". Supported: ").concat(De.SUPPORTED_INPUT_SAMPLE_RATES.join(", ")):"Unsupported input encoding: ".concat(e.encoding,". Supported: ").concat(De.SUPPORTED_INPUT_ENCODINGS.join(", "))}validateOutputFormat(e){var A,t;if(!e)return"Output format is required";var n=null===(A=e.encoding)||void 0===A?void 0:A.toLowerCase();if(!n||!De.SUPPORTED_OUTPUT_ENCODINGS.includes(n))return"Unsupported output encoding: ".concat(e.encoding,". Supported: ").concat(De.SUPPORTED_OUTPUT_ENCODINGS.join(", "));if(!e.sampleRate||!De.SUPPORTED_OUTPUT_SAMPLE_RATES.includes(e.sampleRate))return"Unsupported output sample rate: ".concat(e.sampleRate,". Supported: ").concat(De.SUPPORTED_OUTPUT_SAMPLE_RATES.join(", "));if(!e.bitDepth||!De.SUPPORTED_OUTPUT_BIT_DEPTHS.includes(e.bitDepth))return"Unsupported output bit depth: ".concat(e.bitDepth,". Supported: ").concat(De.SUPPORTED_OUTPUT_BIT_DEPTHS.join(", "));if(!e.channels||!De.SUPPORTED_OUTPUT_CHANNELS.includes(e.channels))return"Unsupported output channels: ".concat(e.channels,". Supported: ").concat(De.SUPPORTED_OUTPUT_CHANNELS.join(", "));var o=null===(t=e.container)||void 0===t?void 0:t.toLowerCase();return o&&De.SUPPORTED_OUTPUT_CONTAINERS.includes(o)?null:"Unsupported output container: ".concat(e.container,". Supported: ").concat(De.SUPPORTED_OUTPUT_CONTAINERS.join(", "))}validateConfig(){var e={encoding:"pcm",sampleRate:this.config.sampleRate,channels:this.config.channels,bitDepth:this.config.bitDepth},A=this.validateInputFormat(e);if(A)return console.error("❌ VoiceSDK v2: Invalid input format:",A),void this.emit("error",new Error(A));var t={encoding:this.config.outputEncoding,sampleRate:this.config.outputSampleRate,channels:this.config.outputChannels,bitDepth:this.config.outputBitDepth,container:this.config.outputContainer},n=this.validateOutputFormat(t);return n?(console.error("❌ VoiceSDK v2: Invalid output format:",n),void this.emit("error",new Error(n))):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 A=this.currentPlayingSentenceId?this.currentPlayingSentenceId+1:1;this.currentPlayingSentenceId=A;var t={text:e.text,role:"assistant",sentenceId:A,final:!0,timestamp:Date.now()};console.log("📝 VoiceSDK v2: Emitting synced transcriptDisplay from AudioPlayer:",t),this.emit("transcriptDisplay",t),this.emit("transcript",t)}),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,A=new URL(e,"wss://placeholder.com"),t=A.searchParams;t.delete("signed_token"),this.config.agentId&&!t.has("agentId")&&t.append("agentId",this.config.agentId),this.config.appId&&!t.has("appId")&&t.append("appId",this.config.appId);var n=this.getStoredConversationId();n&&!t.has("conversationId")&&(t.append("conversationId",n),console.log("🔄 VoiceSDK v2: Attempting resume via query param:",n));var o=window.location.pathname+window.location.search;o&&!t.has("currentPage")&&t.append("currentPage",o);var i=t.toString();return i?"".concat(A.origin).concat(A.pathname,"?").concat(i):"".concat(A.origin).concat(A.pathname)}connect(){var e=this;return Ie(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 A=e.buildWebSocketUrl();return"undefined"!=typeof __DEV__&&__DEV__&&(console.log("[TTPAgentSDK] WebSocket URL:",A),console.log("🔌 VoiceSDK v2: Connecting to",A)),yield new Promise((t,n)=>{e.websocket=new WebSocket(A),e.websocket.onopen=()=>{if(e.isConnected=!0,e.hasEverConnected=!0,e.clientToolsRegistry){e.clientToolsRegistry.setSendMessage(A=>e.sendMessage(A));var A=e.clientToolsRegistry.getRegisteredTools(),n=["read_page","capture_screen","highlight_element","click_element","fill_field","scroll_to_element","navigate_to"].filter(e=>!A.includes(e));if(n.length>0){console.warn("⚠️ VoiceSDK v2: Missing tools detected, re-registering:",n),e._registerBuiltInTools();var o=e.clientToolsRegistry.getRegisteredTools();console.log("🔧 VoiceSDK v2: Tools after re-registration:",o)}}e.sendHelloMessage(),e.emit("connected"),t(!0)},e.websocket.onerror=e=>{console.error("❌ VoiceSDK v2: WebSocket error:",e),n(e)},e.websocket.onclose=A=>{if(console.log("🔌 VoiceSDK v2: WebSocket closed:",A.code,A.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 t=new Error("Connection closed - data injection cancelled");t.error="CONNECTION_CLOSED",e.pendingInjections.forEach((A,n)=>{clearTimeout(A.timeout),A.reject(t),e.emit("dataInjectionError",{error:"CONNECTION_CLOSED",message:"Connection closed - data injection cancelled",correlationId:n})}),e.pendingInjections.clear()}e.emit("disconnected",A),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=A=>{e.handleMessage(A)}})}catch(A){return console.error("🔌 VoiceSDK v2: Connection failed:",A),e.emit("error",A),!1}})()}detectBrowserLocale(){var e,A,t=navigator.language||(null===(e=navigator.languages)||void 0===e?void 0:e[0])||"en-US";return{language:(null===(A=t.split("-")[0])||void 0===A?void 0:A.toLowerCase())||"en",fullLocale:t}}sendHelloMessage(){var e=this;return Ie(function*(){if(e.isConnected){var A={encoding:"pcm",sampleRate:e.config.sampleRate,channels:e.config.channels,bitDepth:e.config.bitDepth},t={encoding:e.config.outputEncoding,sampleRate:e.config.outputSampleRate,channels:e.config.outputChannels,bitDepth:e.config.outputBitDepth,container:e.config.outputContainer},n=e.validateInputFormat(A);if(n)return console.error("❌ VoiceSDK v2: Cannot send hello - invalid input format:",n),void e.emit("error",new Error("Invalid input format: ".concat(n)));var o=e.validateOutputFormat(t);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:A,requestedOutputFormat:t,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"),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(A){console.error("VoiceSDK v2: Failed to send hello:",A),e.emit("error",A)}}else console.warn("VoiceSDK v2: Cannot send hello - not connected")})()}handleMessage(e){var A;if(e.data instanceof ArrayBuffer||e.data instanceof Blob)this.handleBinaryMessage(e.data);else try{var t=JSON.parse(e.data);switch("audio"!==t.t&&console.log("📥 VoiceSDK v2: Received message type:",t.t,"Full message:",JSON.stringify(t).substring(0,200)),!this.conversationId&&t.conversationId&&(this.conversationId=t.conversationId,console.log("🔍 VoiceSDK v2: Captured conversationId from message:",this.conversationId),this.emit("conversationIdChanged",this.conversationId)),"audio"!==t.t&&console.log("📨 VoiceSDK v2: Received message type:",t.t,t),t.t){case"hello_ack":this.handleHelloAck(t);break;case"transcript":console.log("📝 VoiceSDK v2: Processing transcript message:",t),this.handleTranscript(t);break;case"user_transcript":console.log("📝 VoiceSDK v2: Received user_transcript:",t),this.emit("user_transcript",{text:t.text,final:!1!==t.final,timestamp:t.timestamp||Date.now()});break;case"agent_response":if(console.log("📝 VoiceSDK v2: Received agent_response:",t),(t.text||t.transcript)&&(console.log("📝 VoiceSDK v2: agent_response contains transcript data:",t.text||t.transcript),t.sentenceId&&(t.text||t.transcript))){var n={t:"transcript",sentenceId:t.sentenceId,text:t.text||t.transcript,role:t.role||"assistant",final:!1!==t.final,timestamp:t.timestamp||Date.now()};console.log("📝 VoiceSDK v2: Converting agent_response to transcript:",n),this.handleTranscript(n)}this.emit("message",t);break;case"error":case"show_products":case"cart_updated":case"add_to_store_cart":this.emit("message",t);break;case"barge_in":this.emit("bargeIn",t),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",t),this.stopAudioPlayback();break;case"audio_start":console.log("📝 VoiceSDK v2: Received audio_start with text:",t.text),this.lastAudioStartTime=Date.now(),this.audioPlayer&&(this.audioPlayer.isPlaying||(null===(A=this.audioPlayer.scheduledSources)||void 0===A?void 0:A.size)>0)&&console.log("📝 VoiceSDK v2: New sentence received while audio playing - will queue and wait for current sentence to finish"),t.text&&this.audioPlayer&&this.audioPlayer.markNewSentence(t.text),this.emit("message",t);break;case"client_tool_call":this.clientToolsRegistry.handleToolCall(t);break;case"text_inject_ack":this.handleTextInjectAck(t);break;case"data_inject_ack":this.handleDataInjectAck(t);break;case"data_inject_error":this.handleDataInjectError(t);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":t.ok?console.log("✅ [VISUAL ASSISTANT] Page context acknowledged"):console.warn("⚠️ [VISUAL ASSISTANT] Page context error:",t.error);break;case"screenshot_ack":t.ok?console.log("✅ [VISUAL ASSISTANT] Screenshot acknowledged"):console.warn("⚠️ [VISUAL ASSISTANT] Screenshot error:",t.error);break;default:if(console.log("VoiceSDK v2: Unknown message type:",t.t,"Full message:",JSON.stringify(t).substring(0,300)),(t.text||t.transcript||t.transcription)&&(console.log("📝 VoiceSDK v2: Unknown message contains transcript-like data:",{text:t.text,transcript:t.transcript,transcription:t.transcription,sentenceId:t.sentenceId,role:t.role}),t.sentenceId&&(t.text||t.transcript||t.transcription))){var i={t:"transcript",sentenceId:t.sentenceId,text:t.text||t.transcript||t.transcription,role:t.role||"assistant",final:!1!==t.final,timestamp:t.timestamp||Date.now()};console.log("📝 VoiceSDK v2: Attempting to process unknown message as transcript:",i),this.handleTranscript(i)}this.emit("message",t)}}catch(A){var r,a,s="string"==typeof e.data?e.data:String(e.data),c=(null===(r=A.message)||void 0===r||null===(r=r.match(/position (\d+)/))||void 0===r?void 0:r[1])||"unknown",l=parseInt(c,10);if(console.error("VoiceSDK v2: Error parsing message:",A),console.error("VoiceSDK v2: Raw message length:",s.length),console.error("VoiceSDK v2: Error at position:",l),"unknown"!==l&&l>0){var d=Math.max(0,l-50),u=Math.min(s.length,l+50),p=s.substring(d,u),h=" ".repeat(l-d)+"^";console.error("VoiceSDK v2: Context around error:"),console.error(p),console.error(h);var g=s.charAt(l),m=g.charCodeAt(0);console.error('VoiceSDK v2: Problematic character: "'.concat(g,'" (charCode: ').concat(m,")")),m<32&&9!==m&&10!==m&&13!==m&&console.error("VoiceSDK v2: This is an unescaped control character. The backend should escape it in JSON strings.")}var f=s.includes("client_tool_call")||s.includes('"t":"client_tool_call"');if(f){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=s.match(/"toolName"\s*:\s*"([^"]+)"/);B&&console.error('⚠️ VoiceSDK v2: Attempted tool: "'.concat(B[1],'"'));var v=s.match(/"toolCallId"\s*:\s*"([^"]+)"/);v&&console.error('⚠️ VoiceSDK v2: Tool call ID: "'.concat(v[1],'"'))}if(null!==(a=A.message)&&void 0!==a&&a.includes("Bad control character")){console.warn("VoiceSDK v2: Attempting to recover by sanitizing control characters...");try{var w=s;w=w.replace(/([^\\])([\x00-\x08\x0B\x0C\x0E-\x1F])/g,(e,A,t)=>{var n=t.charCodeAt(0);return A+({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"}[n]||"\\u".concat(n.toString(16).padStart(4,"0")))});var b=JSON.parse(w);if(console.warn("✅ VoiceSDK v2: Successfully recovered message after sanitization!"),console.warn("✅ VoiceSDK v2: Processing recovered message..."),"client_tool_call"===b.t&&this.clientToolsRegistry)console.warn("✅ VoiceSDK v2: Recovered client_tool_call - executing tool"),this.clientToolsRegistry.handleToolCall(b);else{var y=b;"audio"!==y.t&&console.log("📥 VoiceSDK v2: Received message type:",y.t,"Full message:",JSON.stringify(y).substring(0,200)),!this.conversationId&&y.conversationId&&(this.conversationId=y.conversationId,console.log("🔍 VoiceSDK v2: Captured conversationId from message:",this.conversationId),this.emit("conversationIdChanged",this.conversationId)),"audio"!==y.t&&console.log("📨 VoiceSDK v2: Received message type:",y.t,y),"client_tool_call"===y.t?this.clientToolsRegistry.handleToolCall(y):this.emit("message",y)}return}catch(e){console.error("❌ VoiceSDK v2: Recovery attempt failed:",e)}}console.error("VoiceSDK v2: First 500 chars of raw message:",s.substring(0,500)),this.emit("error",{type:"json_parse_error",error:A,rawMessage:s.substring(0,1e3),position:l,wasToolCall:f})}}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 A={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},t=[];if(this.requestedOutputFormat.container!==A.container&&t.push('container: "'.concat(this.requestedOutputFormat.container,'" → "').concat(A.container,'"')),this.requestedOutputFormat.encoding!==A.encoding&&t.push('encoding: "'.concat(this.requestedOutputFormat.encoding,'" → "').concat(A.encoding,'"')),this.requestedOutputFormat.sampleRate!==A.sampleRate&&t.push("sampleRate: ".concat(this.requestedOutputFormat.sampleRate,"Hz → ").concat(A.sampleRate,"Hz")),this.requestedOutputFormat.bitDepth!==A.bitDepth&&t.push("bitDepth: ".concat(this.requestedOutputFormat.bitDepth,"-bit → ").concat(A.bitDepth,"-bit")),this.requestedOutputFormat.channels!==A.channels&&t.push("channels: ".concat(this.requestedOutputFormat.channels," → ").concat(A.channels)),t.length>0){console.warn("⚠️ VoiceSDK v2: Format negotiation mismatch!"),console.warn(" Requested:",this.requestedOutputFormat),console.warn(" Negotiated:",A),console.warn(" Differences:",t.join(", "));try{if(this.formatConverter=new G(this.requestedOutputFormat,A),this.formatConverter.needsConversion()){var n=this.formatConverter.getConversionSteps();console.log("🔄 VoiceSDK v2: Format conversion enabled"),console.log(" Conversion steps:",n.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!",A),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 A=arguments,t=this;return Ie(function*(){var n=A.length>1&&void 0!==A[1]?A[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"),t.emit("dataInjectionError",i),new Error(i.message)}if(!t.isConnected||!t.websocket){var r={error:"NOT_CONNECTED",message:"Voice call is not active"};throw console.warn("VoiceSDK v2: Cannot inject data - not connected"),t.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)"),t.emit("dataInjectionError",a),new Error(a.message)}var s=t.generateCorrelationId(),c=n.timeout||1e4,l=n.source||"programmatic",d={t:"data_inject",data:o,correlationId:s,source:l,timestamp:Date.now()};return n.metadata&&(d.metadata=n.metadata),new Promise((e,A)=>{var n=setTimeout(()=>{t.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),t.emit("dataInjectionError",e),A(new Error(e.message))},c);if(t.pendingInjections.set(s,{resolve:A=>{clearTimeout(n),e(A)},reject:e=>{clearTimeout(n),A(e)},timeout:n}),t.sendMessage(d))console.log("📤 VoiceSDK v2: Sent data_inject message:",{correlationId:s,dataLength:o.length,source:l});else{t.pendingInjections.delete(s),clearTimeout(n);var i={error:"SEND_FAILED",message:"Failed to send data injection message"};console.warn("VoiceSDK v2: Failed to send data injection message"),t.emit("dataInjectionError",i),A(new Error(i.message))}})})()}handleDataInjectAck(e){var A=e.correlationId;if(A){var t=this.pendingInjections.get(A);t?(this.pendingInjections.delete(A),t.resolve(e),this.emit("dataInjected",{correlationId:A,data:e.data,metadata:e.metadata}),console.log("✅ VoiceSDK v2: Data injection acknowledged:",A)):console.warn("VoiceSDK v2: data_inject_ack received for unknown correlationId:",A)}else console.warn("VoiceSDK v2: data_inject_ack received without correlationId")}handleDataInjectError(e){var A=e.correlationId;if(A){var t=this.pendingInjections.get(A);if(t){this.pendingInjections.delete(A);var n=new Error(e.message||"Data injection failed");n.error=e.error,n.correlationId=A,t.reject(n),this.emit("dataInjectionError",{error:e.error,message:e.message,correlationId:A}),console.warn("❌ VoiceSDK v2: Data injection error:",A,e.error)}else console.warn("VoiceSDK v2: data_inject_error received for unknown correlationId:",A)}else console.warn("VoiceSDK v2: data_inject_error received without correlationId")}handleTranscript(e){if(e.sentenceId&&e.text){var A=e.sentenceId,t={text:e.text,role:e.role||"assistant",sentenceId:A,final:!1!==e.final,timestamp:e.timestamp||Date.now()};this.transcriptQueue.push(t),console.log("📝 VoiceSDK v2: Received transcript for sentence",A,":",t.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",A),this.emit("transcriptDisplay",t),this.currentPlayingSentenceId=A,this.emit("transcript",t)}else console.warn("⚠️ VoiceSDK v2: Invalid transcript message:",e)}handleBinaryMessage(e){var A=this;return Ie(function*(){var t,n=t=e instanceof Blob?yield e.arrayBuffer():e;if(A.formatConverter&&A.formatConverter.needsConversion())try{n=yield A.formatConverter.convert(t),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"),n=t}var o=A.formatConverter&&A.formatConverter.needsConversion()?A.requestedOutputFormat:A.outputAudioFormat||{container:A.config.outputContainer||"raw",encoding:A.config.outputEncoding||"pcm",sampleRate:A.config.outputSampleRate||16e3,bitDepth:A.config.outputBitDepth||16,channels:A.config.outputChannels||1},i=o.container||"raw",r=(o.encoding||"pcm").toLowerCase();if("raw"===i){var a=n;if("pcm"!==r){var s=A.audioPlayer.getCodec(r);if(s){var c=s.decode(new Uint8Array(n));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"))}A.audioPlayer.outputFormat||(console.warn("⚠️ VoiceSDK v2: outputFormat not set on AudioPlayer, setting from playbackFormat"),A.audioPlayer.setOutputFormat(o)),A.audioFrameCount++,A.audioPlayer.playChunk(a)}else A.audioFrameCount++,A.audioPlayer.playAudio(n)})()}sendMessage(e){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return console.warn("VoiceSDK v2: Cannot send message - not connected"),!1;try{var A=(new Date).toISOString(),t=this.websocket?this.websocket.readyState:"NO_WEBSOCKET",n=this.websocket?{0:"CONNECTING",1:"OPEN",2:"CLOSING",3:"CLOSED"}[t]:"NO_WEBSOCKET";if("client_tool_result"!==e.t&&"client_tool_error"!==e.t||(console.log("📤 VoiceSDK v2: [".concat(A,"] Sending tool ").concat(e.t)),console.log(" 🔌 WebSocket state: ".concat(n," (").concat(t,")")),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(n,")")),!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(A,"] 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,A=this;return Ie(function*(){var t=e.length>0&&void 0!==e[0]?e[0]:null;if(!A.isConnected){var n=new Error("Not connected to voice server");throw A.emit("error",n),n}if(A.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 A.audioRecorder.start(t?{existingMediaStream:t}:{}),!A.isConnected||!A.websocket||A.websocket.readyState!==WebSocket.OPEN){try{yield A.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 A.audioPlayer.resumeAudioContext(),A.sendMessage({t:"start_continuous_mode",ttpId:A.generateTtpId()}),A._requestWakeLock(),!0}catch(n){if(A.audioRecorder&&A.audioRecorder.isRecording)try{yield A.audioRecorder.stop()}catch(e){}if(n.isServerRejection||"ServerRejected"===n.name)return!1;if(console.error("❌ VoiceSDK v2: Failed to start recording:",n),"NotAllowedError"===n.name||"PermissionDeniedError"===n.name){var i=new Error("Microphone permission denied. Please allow microphone access in your browser settings and try again.");i.name=n.name,i.originalError=n,A.emit("error",i)}else A.emit("error",n);return!1}})()}stopRecording(){var e=this;return Ie(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(A){return console.error("VoiceSDK v2: Error stopping recording:",A),e.emit("error",A),!1}})()}toggleRecording(){var e=this;return Ie(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 Ie(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(A){console.warn("📱 VoiceSDK v2: Failed to request wake lock:",A.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 Ie(function*(){if(null!==e.wakeLock)try{yield e.wakeLock.release(),e.wakeLock=null,console.log("📱 VoiceSDK v2: Screen wake lock released")}catch(A){console.warn("📱 VoiceSDK v2: Error releasing wake lock:",A.message),e.wakeLock=null}})()}stopAudioPlayback(){this.audioPlayer.stopImmediate(),this.clearTranscriptState()}handleBargeIn(){var e=this;return Ie(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(),A=Math.random().toString(36).substr(2,9);return"inj_".concat(e,"_").concat(this.injectionCounter,"_").concat(A)}registerToolHandler(e,A){return this.clientToolsRegistry.registerHandler(e,A)}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((A,t)=>{clearTimeout(A.timeout),A.reject(e)}),this.pendingInjections.clear()}this.audioPlayer&&this.audioPlayer.destroy(),this.audioRecorder&&this.audioRecorder.destroy(),f.closeSharedContext(),I.closeSharedContext(),this.clientToolsRegistry&&this.clientToolsRegistry.getRegisteredTools().forEach(e=>this.clientToolsRegistry.unregisterHandler(e)),this.removeAllListeners()}}}He(De,"RESUME_STORAGE_KEY","voice_resume_state"),He(De,"RESUME_TTL_MS",1e4),He(De,"SUPPORTED_INPUT_ENCODINGS",["pcm","pcmu","pcma"]),He(De,"SUPPORTED_INPUT_SAMPLE_RATES",[8e3,16e3,22050,24e3,44100,48e3]),He(De,"SUPPORTED_INPUT_BIT_DEPTHS",[8,16,24]),He(De,"SUPPORTED_INPUT_CHANNELS",[1]),He(De,"SUPPORTED_OUTPUT_ENCODINGS",["pcm","pcmu","pcma"]),He(De,"SUPPORTED_OUTPUT_SAMPLE_RATES",[8e3,16e3,22050,24e3,44100,48e3]),He(De,"SUPPORTED_OUTPUT_BIT_DEPTHS",[8,16,24]),He(De,"SUPPORTED_OUTPUT_CHANNELS",[1]),He(De,"SUPPORTED_OUTPUT_CONTAINERS",["raw","wav"]);const Me=De;function Le(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function Pe(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function Ke(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?Pe(Object(t),!0).forEach(function(A){_e(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Pe(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}function _e(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}class Re extends B{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var A=this.readScriptTagConfig();this.config=Ke({baseWsUrl:"wss://backend.talktopc.com/chat/websocket",appId:e.appId||A.appId,agentId:e.agentId||A.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,A=new URLSearchParams;return this.config.appId&&A.append("appId",this.config.appId),this.config.agentId&&A.append("agentId",this.config.agentId),this.config.conversationId&&A.append("conversationId",this.config.conversationId),"".concat(e,"?").concat(A.toString())}sendMessage(e){var A,t=this;return(A=function*(){return new Promise((A,n)=>{if(e&&e.trim())if(t.config.appId&&t.config.agentId){var o={text:e,resolve:A,reject:n};t.config.inFlight?t.config.queue.push(o):t.executeTask(o)}else n(new Error("Missing appId or agentId"));else n(new Error("Message is empty"))})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=A.apply(e,t);function r(e){Le(i,n,o,r,a,"next",e)}function a(e){Le(i,n,o,r,a,"throw",e)}r(void 0)})})()}executeTask(e){if(this.config.inFlight=!0,this.fullResponseBuffer="",!this.config.conversationId){var A=this.getPersistedConversationId();A&&(this.config.conversationId=A,console.log("🔍 TextChatSDK hydrated conversationId from storage:",A))}var t=this.buildWebSocketUrl(this.config.baseWsUrl);"undefined"!=typeof __DEV__&&__DEV__&&console.log("[TTPAgentSDK] WebSocket URL:",t);var n=this.config.baseWsUrl.endsWith("/websocket")?this.config.baseWsUrl.replace(/\/websocket$/,""):"".concat(this.config.baseWsUrl,"/websocket"),o=this.buildWebSocketUrl(n),i=!1,r=!1,a=null,s=A=>{if(!r)try{var t={message:e.text},n=this.config.forceConversationId||this.config.conversationId;n&&(t.conversationId=n,this.config.forceConversationId&&!this.config.conversationId&&(this.config.conversationId=n,this.persistConversationId(n))),console.log("🔍 TextChatSDK sending payload:",t,"conversationId in config:",this.config.conversationId),A.send(JSON.stringify(t)),r=!0}catch(t){e.reject(t),this.emit("error",t);try{A.close()}catch(e){}}},c=e=>()=>{this.config.conversationId?s(e):a=setTimeout(()=>s(e),200)},l=A=>t=>{try{try{console.log("🔎 [TextChatSDK] WS <= raw:",t.data)}catch(e){}var n=JSON.parse(t.data);try{console.log("🔎 [TextChatSDK] WS <= parsed:",n)}catch(e){}if("hello"===n.type&&n.conversationId){if(console.log("🔍 TextChatSDK received conversationId:",n.conversationId),this.config.conversationId=n.conversationId,this.persistConversationId(n.conversationId),this.emit&&this.emit("conversationIdChanged",n.conversationId),!r&&A&&1===A.readyState){if(a)try{clearTimeout(a)}catch(e){}s(A)}return}if(!this.config.conversationId&&n.conversationId&&(console.log("🔍 TextChatSDK captured conversationId from message:",n.conversationId),this.config.conversationId=n.conversationId,this.persistConversationId(n.conversationId)),"chunk"===n.type&&"string"==typeof n.content)this.fullResponseBuffer+=n.content,this.emit("chunk",n.content);else if("done"===n.type){try{var o=n.text||n.content||n.answer||n.message||"";o&&!this.fullResponseBuffer&&(this.fullResponseBuffer=o)}catch(e){}!this.config.conversationId&&n.conversationId&&(console.log("🔍 TextChatSDK captured conversationId from done:",n.conversationId),this.config.conversationId=n.conversationId),this.persistConversationId(this.config.conversationId),this.emit("done",{text:this.fullResponseBuffer}),e.resolve({conversationId:this.config.conversationId,fullText:this.fullResponseBuffer});try{A.close()}catch(e){}}else if("error"===n.type){var i=new Error(n.message||"Server error");this.emit("error",i),e.reject(i);try{A.close()}catch(e){}}}catch(e){}},d=A=>{if(1008===A.code&&A.reason&&(A.reason.includes("Domain not whitelisted")||A.reason.includes("domain")||A.reason.includes("whitelist"))){var t=new Error("DOMAIN_NOT_WHITELISTED");return t.reason=A.reason,t.code=A.code,this.emit("domainError",t),e.reject(t),this.config.inFlight=!1,void this.drainQueue()}this.config.inFlight=!1,this.drainQueue()},u=new WebSocket(t);u.onopen=c(u),u.onmessage=l(u),u.onerror=(A=>t=>{if(!i){i=!0;try{A.close()}catch(e){}var n=new WebSocket(o);return n.onopen=c(n),n.onmessage=l(n),n.onerror=A=>{this.emit("error",A),e.reject(A)},void(n.onclose=d)}this.emit("error",t),e.reject(t)})(u),u.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=Ke(Ke({},this.config),e)}destroy(){this.config.queue=[],this.config.inFlight=!1,this.removeAllListeners()}}function Oe(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}const Ve=new class extends B{constructor(){super(),this.connections=new Map,this.connectionCounts=new Map,this.creatingConnections=new Set}getConnection(e){var A,t=this;return(A=function*(){if(t.connections.has(e)){var A=t.connections.get(e);return t.connectionCounts.set(e,(t.connectionCounts.get(e)||0)+1),A}if(t.creatingConnections&&t.creatingConnections.has(e))return new Promise(A=>{var n=()=>{if(t.connections.has(e)){var o=t.connections.get(e);t.connectionCounts.set(e,(t.connectionCounts.get(e)||0)+1),A(o)}else setTimeout(n,50)};n()});t.creatingConnections.add(e);var n=new WebSocket(e);return t.connections.set(e,n),t.connectionCounts.set(e,1),n.addEventListener("open",A=>{t.creatingConnections.delete(e),t.emit("open",A,e)}),n.addEventListener("close",A=>{t.creatingConnections.delete(e),t.connections.delete(e),t.connectionCounts.delete(e),t.emit("close",A,e)}),n.addEventListener("error",A=>{t.creatingConnections.delete(e),t.emit("error",A,e)}),n.addEventListener("message",A=>{t.emit("message",A,e)}),n},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=A.apply(e,t);function r(e){Oe(i,n,o,r,a,"next",e)}function a(e){Oe(i,n,o,r,a,"throw",e)}r(void 0)})})()}releaseConnection(e){if(this.connections.has(e)){var A=this.connectionCounts.get(e)||0,t=Math.max(0,A-1);if(this.connectionCounts.set(e,t),0===t){var n=this.connections.get(e);n&&n.readyState===WebSocket.OPEN&&n.close(1e3,"No more subscribers"),this.connections.delete(e),this.connectionCounts.delete(e)}}}forceClose(e){if(this.connections.has(e)){var A=this.connections.get(e);A&&A.readyState===WebSocket.OPEN&&A.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[A,t]of this.connections.entries())e[A]={readyState:t.readyState,subscribers:this.connectionCounts.get(A)||0};return e}clearAll(){for(var[e,A]of this.connections.entries())A&&A.readyState===WebSocket.OPEN&&A.close(1e3,"Clear all");this.connections.clear(),this.connectionCounts.clear(),this.creatingConnections.clear()}};function Ne(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}class Ge extends B{constructor(e){super(),this.config=e,this.ws=null,this.isConnected=!1,this.connectionId=null}connect(){var e,A=this;return(e=function*(){return new Promise((e,t)=>{try{A.connectionId=Date.now()+"_"+Math.random().toString(36).substr(2,9),A.connectResolve=e,A.connectReject=t;var n=A.config.websocketUrl;Ve.getConnection(n,A.config).then(t=>{A.ws=t,A.setupEventListeners(),t.readyState===WebSocket.OPEN&&(A.isConnected=!0,A.emit("connected"),e(),A.connectResolve=null,A.connectReject=null)}).catch(e=>{console.error("🔌 WebSocketManager: Connection failed ".concat(A.connectionId),e),t(e),A.connectResolve=null,A.connectReject=null})}catch(e){console.error("🔌 WebSocketManager: Connection error ".concat(A.connectionId),e),t(e),A.connectResolve=null,A.connectReject=null}})},function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){Ne(i,n,o,r,a,"next",e)}function a(e){Ne(i,n,o,r,a,"throw",e)}r(void 0)})})()}setupEventListeners(){if(this.ws){var e=(e,A)=>{A===this.config.websocketUrl&&(this.isConnected=!0,this.emit("connected"),this.connectResolve&&(this.connectResolve(),this.connectResolve=null,this.connectReject=null))},A=(e,A)=>{A===this.config.websocketUrl&&(this.isConnected=!1,this.emit("disconnected",e))},t=(e,A)=>{A===this.config.websocketUrl&&(this.emit("error",e),this.connectReject&&(this.connectReject(e),this.connectResolve=null,this.connectReject=null))},n=(e,A)=>{A===this.config.websocketUrl&&this.handleMessage(e)};Ve.on("open",e),Ve.on("close",A),Ve.on("error",t),Ve.on("message",n),this.eventHandlers={open:e,close:A,error:t,message:n}}}disconnect(){this.eventHandlers&&(Ve.off("open",this.eventHandlers.open),Ve.off("close",this.eventHandlers.close),Ve.off("error",this.eventHandlers.error),Ve.off("message",this.eventHandlers.message));var e=this.config.websocketUrl;e&&Ve.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 A=JSON.parse(e.data);"barge_in_ack"!==A.t&&"stop_sending"!==A.t||this.emit("bargeIn",A),"stop_playing"===A.t&&this.emit("stopPlaying",A),this.emit("message",A)}catch(e){this.emit("error",e)}}getStatus(){return{isConnected:this.isConnected,readyState:this.ws?this.ws.readyState:null,connectionId:this.connectionId}}static getSingletonStatus(){return Ve.getAllConnections()}static clearAllConnections(){Ve.clearAll()}}function We(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function je(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){We(i,n,o,r,a,"next",e)}function a(e){We(i,n,o,r,a,"throw",e)}r(void 0)})}}class ze extends B{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 je(function*(){if(!e.audioContext||"closed"===e.audioContext.state)try{var A={sampleRate:e.config.sampleRate||e.config.outputSampleRate||44100};if(e.audioContext=new(window.AudioContext||window.webkitAudioContext)(A),"suspended"===e.audioContext.state&&(yield e.audioContext.resume()),"running"===e.audioContext.state)try{var t=e.audioContext.sampleRate,n=e.audioContext.createBuffer(1,.01*t,t),o=e.audioContext.createBufferSource();o.buffer=n,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(A){console.warn("AudioPlayer: Failed to pre-initialize AudioContext:",A),e.audioContextReady=!1}})()}playAudio(e){try{var A=this.createAudioBlob(e);if(this.audioQueue.push(A),!this.isPlaying&&!this.isProcessingQueue&&!this.currentSource){var t=this.audioContextReady?0:50;setTimeout(()=>this.processQueue(),t)}}catch(e){this.emit("playbackError",e)}}createAudioBlob(e){var A=new Uint8Array(e);if(A.length>=4){if(82===A[0]&&73===A[1]&&70===A[2]&&70===A[3])return new Blob([e],{type:"audio/wav"});if(255===A[0]&&!(224&~A[1]))return new Blob([e],{type:"audio/mpeg"});if(79===A[0]&&103===A[1]&&103===A[2]&&83===A[3])return new Blob([e],{type:"audio/ogg"})}return new Blob([e],{type:"audio/wav"})}processQueue(){var e=this;return je(function*(){if(!e.isProcessingQueue&&0!==e.audioQueue.length){e.isProcessingQueue=!0;var A=e.audioQueue.shift();if(A)try{var t=!e.isPlaying&&null===e.currentSource;e.audioContext&&"closed"!==e.audioContext.state||(yield e.initializeAudioContext());var n=e.audioContext;"suspended"===n.state&&(yield n.resume(),t&&(yield new Promise(e=>setTimeout(e,10)))),"running"!==n.state&&(console.warn("AudioPlayer: AudioContext not in running state:",n.state),"suspended"===n.state&&(yield n.resume(),yield new Promise(e=>setTimeout(e,10))));var o=yield A.arrayBuffer(),i=yield n.decodeAudioData(o),r=t&&!e.isPlaying&&null===e.currentSource,a=n.createBufferSource();a.buffer=i,a.connect(n.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(A){e.currentSource=null,e.emit("playbackError",A),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 je(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 qe(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function Xe(){var e=navigator.userAgent,A=/iPad|iPhone|iPod/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,t=/Android/.test(e),n=/Mac/.test(e)&&!A,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";A?l="safari":c?l="samsung":i?l="chrome":r?l="safari":a?l="firefox":s&&(l="edge");var d="unknown";return A?d="ios":t?d="android":n?d="mac":o&&(d="windows"),{platform:d,browser:l,isIOS:A,isAndroid:t,isMac:n,isWindows:o,isMobile:A||t,isDesktop:!A&&!t}}function Je(){return Ye.apply(this,arguments)}function Ye(){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"},Ye=function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){qe(i,n,o,r,a,"next",e)}function a(e){qe(i,n,o,r,a,"throw",e)}r(void 0)})},Ye.apply(this,arguments)}function Ze(e){var{platform:A,browser:t}=e,n={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"===A?n.ios:"android"===A?n["android_".concat(t)]||n.android_chrome:n["desktop_".concat(t)]||n.desktop_chrome}function $e(e){var{isIOS:A,isAndroid:t,browser:n}=e;if(A)try{return window.location.href="app-settings:",!0}catch(e){return console.warn("Could not open iOS settings:",e),!1}if(t&&"chrome"===n)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 eA(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function AA(){var e;return e=function*(){var e,A,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{default:0,android:3e3,ios:0},{isIOS:n,isAndroid:o}=Xe(),i=null!==(e=t.default)&&void 0!==e?e:0;if(o)i=null!==(A=t.android)&&void 0!==A?A:i;else if(n){var r;i=null!==(r=t.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)))},AA=function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){eA(i,n,o,r,a,"next",e)}function a(e){eA(i,n,o,r,a,"throw",e)}r(void 0)})},AA.apply(this,arguments)}class tA{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 nA(e,A){var t=new tA,n=t.createOverlay(),o=Xe(),i=function(){var e=Xe();return e.isIOS||e.isAndroid}();n.style.background="rgba(0, 0, 0, 0.3)",n.style.backdropFilter="none",n.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&&(n.style.alignItems="flex-end",n.style.paddingBottom="max(20px, env(safe-area-inset-bottom, 20px))",n.style.paddingTop="20px"),n.appendChild(r),t.overlay=n,t.modal=r,r.querySelector('[data-action="accept"]').addEventListener("click",()=>{t.close(),e()}),r.querySelector('[data-action="cancel"]').addEventListener("click",()=>{t.close(),A()}),n.addEventListener("click",e=>{e.target===n&&(t.close(),A())}),t.show(),t}function oA(e,A){var t,n,o,i=new tA,r=i.createOverlay(),a=Xe(),s=Ze(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:A,browser:t}=e,n=document.getElementsByTagName("script"),o="";for(var i of n){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"===A?"ios-settings.svg":"android"===A?"android-chrome.svg":"chrome"===t?"desktop-chrome.svg":"safari"===t?"desktop-safari.svg":"firefox"===t?"desktop-firefox.svg":"edge"===t?"desktop-edge.svg":"desktop-chrome.svg",!o||""===o||o.startsWith("/")){for(var c of n){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 u=window.location.pathname.split("/");u.pop(),(o=window.location.origin+u.join("/"))&&o!==window.location.origin||(o=window.location.origin)}}o=o.replace(/\/$/,"");var p="".concat(o,"/shared/mic-permission-assets/").concat(s);return"undefined"!=typeof console&&console.log&&console.log("[MicPermission] Visual guide path:",p,"Base path:",o,"Platform:",A,"Browser:",t),p}(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===(t=c.querySelector('[data-action="close"]'))||void 0===t||t.addEventListener("click",()=>{i.close(),e()}),null===(n=c.querySelector('[data-action="open-settings"]'))||void 0===n||n.addEventListener("click",()=>{$e(a)}),null===(o=c.querySelector('[data-action="refresh"]'))||void 0===o||o.addEventListener("click",()=>{window.location.reload()});var u=c.querySelector('[data-action="show-hint"]');u&&u.addEventListener("click",()=>{i.close(),e(),function(){var e=document.getElementById("mic-address-bar-hint");e&&e.remove(),Xe();var A=document.getElementsByTagName("script"),t="";for(var n of A){var o=n.src;if(o&&(o.includes("agent-widget.js")||o.includes("ttp-agent-sdk")||o.includes("ttp-sdk-front")))try{new URL(o),t=o.substring(0,o.lastIndexOf("/"));break}catch(e){var i=o.match(/^(.*\/)[^\/]+$/);if(i){t=i[1];break}}}if(!t||""===t||t.startsWith("/")){for(var r of A){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){t=s[1].replace(/\/[^\/]+\.js$/,"");break}}if(!t&&(a.includes("cdn.talktopc.com")||a.includes("talktopc.com"))){t="https://cdn.talktopc.com/ttp-agent-sdk";break}}}if(!t||""===t)if(window.location.hostname.includes("cdn.talktopc.com")||window.location.hostname.includes("talktopc.com"))t="https://cdn.talktopc.com/ttp-agent-sdk";else{var c=window.location.pathname.split("/");c.pop(),(t=window.location.origin+c.join("/"))&&t!==window.location.origin||(t=window.location.origin)}}t=t.replace(/\/$/,"");var l="".concat(t,"/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 u=document.createElement("div");u.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 p=document.createElement("div");p.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=()=>{p.style.display="none"},p.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 B=document.createElement("style");B.id="mic-address-bar-hint-styles",B.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(B)}g.appendChild(m),u.appendChild(p),u.appendChild(g),u.appendChild(f),d.appendChild(u),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 p=c.querySelector(".mic-permission-modal__alt-toggle");if(p&&s.altSteps){var h=p.nextElementSibling;h&&(h.style.display="none",p.addEventListener("click",()=>{"none"===h.style.display?(h.style.display="block",p.innerHTML="▼ ".concat(s.altTitle||"Alternative method")):(h.style.display="none",p.innerHTML="▶ ".concat(s.altTitle||"Alternative method"))}))}return r.addEventListener("click",A=>{A.target===r&&(i.close(),e())}),i.show(),i}function iA(e){var A=new tA,t=A.createOverlay(),n=document.createElement("div");return n.className="mic-permission-modal",n.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 ',t.appendChild(n),A.overlay=t,A.modal=n,n.querySelector('[data-action="retry"]').addEventListener("click",()=>{window.location.reload()}),n.querySelector('[data-action="close"]').addEventListener("click",()=>{A.close(),e()}),t.addEventListener("click",n=>{n.target===t&&(A.close(),e())}),A.show(),A}class rA{constructor(e){this.voiceInterface=e,this.config=e.config}t(e){return this.voiceInterface.t(e)}getText(e,A){return this.voiceInterface.getText(e,A)}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,A)=>'<div class="mobile-waveform-bar" data-index="'.concat(A,'"></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 aA{constructor(e){this.voiceInterface=e,this.config=e.config}generateCSS(){var e,A=this.config.avatarBackgroundColor||"#667eea",t=this.config.avatarActiveBackgroundColor||this.config.avatarBackgroundColor||"#667eea",n=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",u=this.config.liveTranscriptTextColor||this.config.transcriptTextColor||"#64748b",p=this.config.liveTranscriptFontSize||"14px",h=this.config.controlButtonSecondaryColor||"#64748b",g=this.config.liveIndicatorDotColor||"#10b981",m=this.config.liveIndicatorTextColor||"#10b981",f=this.config.micButtonColor||d,B=this.config.speakerButtonColor||d,v=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(A," 0%, ").concat(t," 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(n,";\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(u).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(v).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(B).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(A," 0%, ").concat(t,' 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(n,";\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(A,", ").concat(t,");\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(B).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(v).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(u).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(n).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(B).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(v).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 .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: 1;\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(p).concat(b,";\n color: ").concat(u).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(u).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(u).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(A," !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-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 }\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-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 sA{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 A=document.getElementById("mobile-voice-call-bar-container");if(A){var t=A.querySelector("#mobileTranscriptText");t&&(t.textContent=e,t.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 n=A.querySelector("#mobileMessagesContainer");if(n){var o=n.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"),A=this.voiceInterface.shadowRoot.getElementById("conversationHeader"),t=this.voiceInterface.shadowRoot.getElementById("conversationToggleText"),n=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"),A&&A.classList.add("expanded"),t&&(t.textContent="Hide history"),n&&n.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"),A&&A.classList.remove("expanded"),t&&(t.textContent="Show history"),n&&n.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,A){if(!this.voiceInterface.isMobile&&A&&A.trim()){if(this.currentLiveMessage&&this.finalizeLiveMessage(),this.conversationMessages||(this.conversationMessages=[]),"user"!==e)return this.currentLiveMessage={role:e,content:A},this.updateLiveMessageRow(),void console.log("📝 [TRANSCRIPT] Assistant message set as live (via addConversationMessage)");this.conversationMessages.push({role:e,content:A}),console.log("📝 [TRANSCRIPT] User message added to history"),this.voiceInterface.conversationExpanded&&this.renderConversationMessages()}}updateLiveMessageRow(){var e=this.voiceInterface.shadowRoot.getElementById("liveMessageRow"),A=this.voiceInterface.shadowRoot.getElementById("liveMessageText"),t=null==e?void 0:e.querySelector(".message-avatar");if(e&&A)if(this.currentLiveMessage&&this.currentLiveMessage.content&&this.currentLiveMessage.content.trim()){t&&("user"===this.currentLiveMessage.role?(t.textContent="U",t.className="message-avatar user"):(t.innerHTML='<div class="orb"></div>',t.className="message-avatar assistant")),A.textContent=this.currentLiveMessage.content,e.style.display="flex";var n=A.querySelector(".typing-cursor")||document.createElement("span");n.className="typing-cursor",A.querySelector(".typing-cursor")||A.appendChild(n)}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 A=[...this.conversationMessages];if(this.currentLiveMessage&&A.length>0){var t=A[A.length-1];t.role===this.currentLiveMessage.role&&t.content===this.currentLiveMessage.content&&(A=A.slice(0,-1))}console.log("📝 [TRANSCRIPT] Rendering",A.length,"messages (live message excluded)"),e.innerHTML=A.map(e=>{var A="user"===e.role;return'\n <div class="message-row '.concat(e.role,'">\n <div class="message-avatar ').concat(e.role,'">\n ').concat(A?"U":'<div class="orb"></div>','\n </div>\n <div class="message-bubble">').concat(this.escapeHtml(e.content),"</div>\n </div>\n ")}).join("");var n=this.voiceInterface.shadowRoot.getElementById("conversationHistory");n&&setTimeout(()=>{n.scrollTop=n.scrollHeight},10)}else console.warn("📝 [TRANSCRIPT] conversationMessages container not found")}}class cA{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 A,t;this._textInjectTimeout&&(clearTimeout(this._textInjectTimeout),this._textInjectTimeout=null),this._mobileTextInjectTimeout&&(clearTimeout(this._mobileTextInjectTimeout),this._mobileTextInjectTimeout=null);var n=this.shadowRoot.getElementById("voiceTextInput"),o=this.shadowRoot.getElementById("voiceSendBtn");n&&(n.disabled=!1),o&&(o.disabled=!(null!=n&&null!==(A=n.value)&&void 0!==A&&A.trim()));var i=document.getElementById("mobileTextInput"),r=document.getElementById("mobileSendBtn");if(i&&(i.disabled=!1),r&&(r.disabled=!(null!=i&&null!==(t=i.value)&&void 0!==t&&t.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"),A=this.shadowRoot.getElementById("voiceSendBtn");if(e&&A){var t=e.value.trim();t&&this._sendTextMessage(t,e,A,!1)}else console.warn("VoiceInterface: Missing UI elements for desktop text send")}sendMobileTextMessage(){var e=document.getElementById("mobile-voice-call-bar-container"),A=null==e?void 0:e.querySelector("#mobileTextInput"),t=null==e?void 0:e.querySelector("#mobileSendBtn");A&&t?this._sendTextMessage(A.value.trim(),A,t,!0):console.warn("VoiceInterface: Missing UI elements for mobile text send")}_sendTextMessage(e,A,t,n){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){A.value="",t&&(t.disabled=!0);try{var r=this.voiceInterface.sdk.voiceSDK;null!=r&&r.stopAudioPlayback&&r.stopAudioPlayback()}catch(e){}this.showTextInputStatus(n?"mobile":"desktop","sending","Sending...");try{if(this.voiceInterface.sdk.voiceSDK.sendMessage({t:"text_inject",text:i})){var a=setTimeout(()=>{n?this._mobileTextInjectTimeout=null:this._textInjectTimeout=null,A.disabled=!1,t&&(t.disabled=!1),this.showTextInputStatus(n?"mobile":"desktop","error","No response")},5e3);n?this._mobileTextInjectTimeout=a:this._textInjectTimeout=a,n?this.voiceInterface.addMobileMessage("user",i):this.voiceInterface.addConversationMessage("user",i)}else A.disabled=!1,t&&(t.disabled=!1),this.showTextInputStatus(n?"mobile":"desktop","error","Failed to send")}catch(e){console.error("Error sending text message:",e),A.disabled=!1,t&&(t.disabled=!1),this.showTextInputStatus(n?"mobile":"desktop","error","Error sending")}}else this.showTextInputStatus(n?"mobile":"desktop","error","Enter text first")}else console.warn("VoiceInterface: Cannot send text - call not active")}showTextInputStatus(e,A,t){"mobile"===e?this.showMobileTextInputStatus(A,t):this.showDesktopTextInputStatus(A,t)}showDesktopTextInputStatus(e,A){var t=this.shadowRoot.querySelector(".voice-input-hint");t&&(this._originalHintText||(this._originalHintText=t.textContent),t.classList.remove("voice-input-hint--sending","voice-input-hint--success","voice-input-hint--queued","voice-input-hint--error"),"sending"===e?(t.classList.add("voice-input-hint--sending"),t.textContent=A||"Sending..."):"success"===e?(t.classList.add("voice-input-hint--success"),t.textContent=A||"Sent",this.clearTextInputStatusAfterDelay(3e3)):"queued"===e?(t.classList.add("voice-input-hint--queued"),t.textContent=A||"Queued"):"error"===e?(t.classList.add("voice-input-hint--error"),t.textContent=A||"Error",this.clearTextInputStatusAfterDelay(3e3)):"clear"===e&&(t.textContent=this._originalHintText||this.t("voiceActive")||"Voice is still active • Type or speak",this._originalHintText=null))}showMobileTextInputStatus(e,A){var t=document.querySelector(".mobile-input-hint");t&&(this._originalMobileHintText||(this._originalMobileHintText=t.textContent),t.classList.remove("mobile-input-hint--sending","mobile-input-hint--success","mobile-input-hint--queued","mobile-input-hint--error"),"sending"===e?(t.classList.add("mobile-input-hint--sending"),t.textContent=A||"Sending..."):"success"===e?(t.classList.add("mobile-input-hint--success"),t.textContent=A||"Sent",this.clearMobileTextInputStatusAfterDelay(3e3)):"queued"===e?(t.classList.add("mobile-input-hint--queued"),t.textContent=A||"Queued"):"error"===e?(t.classList.add("mobile-input-hint--error"),t.textContent=A||"Error",this.clearMobileTextInputStatusAfterDelay(3e3)):"clear"===e&&(t.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 lA{constructor(e){this.voiceInterface=e,this.config=e.config,this.shadowRoot=e.shadowRoot}setupEventHandlers(e){var A=this.shadowRoot.getElementById("startCallBtn"),t=this.shadowRoot.getElementById("desktopEndCallBtn"),n=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(A&&(A.onclick=()=>this.voiceInterface.startVoiceCall()),t&&(t.onclick=()=>this.voiceInterface.endVoiceCall()),n&&(n.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 A=document.getElementById("mobile-voice-call-bar-container");if(A){var t=A.querySelector("#mobileMuteBtn"),n=A.querySelector("#mobileSpeakerBtn"),o=A.querySelector("#mobileEndCallBtn"),i=A.querySelector("#mobileTranscriptRow"),r=A.querySelector("#mobileCloseTranscriptBtn"),a=A.querySelector("#mobileTextInput"),s=A.querySelector("#mobileSendBtn"),c=(e,A,t)=>{if(!t)return!1;var n=t.getBoundingClientRect();return e>=n.left&&e<=n.right&&A>=n.top&&A<=n.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})},u=e=>{var A,t=document.getElementById("mobile-voice-call-bar-container");if(t&&l&&e.changedTouches.length){var n=e.changedTouches[0],o=n.clientX,i=n.clientY,r=Math.abs(o-l.x),a=Math.abs(i-l.y);if(l=null,!(r>15||a>15)){var s=t.querySelector("#mobileMuteBtn"),d=t.querySelector("#mobileSpeakerBtn"),u=t.querySelector("#mobileEndCallBtn"),p=t.querySelector("#mobileTranscriptRow"),h=t.querySelector("#mobileCloseTranscriptBtn"),g=t.querySelector("#mobileSendBtn"),m=t.querySelector("#mobileTextInput"),f=t.querySelector("#mobileTranscriptOverlay"),B=f&&("flex"===f.style.display||"flex"===getComputedStyle(f).display);c(o,i,u)?(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()):B&&c(o,i,h)?(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.voiceInterface.collapseMobileTranscript()):B&&c(o,i,g)&&null!=m&&null!==(A=m.value)&&void 0!==A&&A.trim()?(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.voiceInterface.sendMobileTextMessage()):!B&&c(o,i,p)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.voiceInterface.expandMobileTranscript())}}else l=null};document.addEventListener("touchstart",d,{passive:!0,capture:!0}),document.addEventListener("touchend",u,{passive:!1,capture:!0}),this._mobileTouchCleanup=()=>{document.removeEventListener("touchstart",d,{capture:!0}),document.removeEventListener("touchend",u,{capture:!0})},t&&t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.voiceInterface.toggleMute()}),n&&n.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 p=()=>{s&&a&&(s.disabled=!a.value.trim())};a&&(a.addEventListener("input",p),a.addEventListener("keyup",p),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 dA{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 A,t,n,o,i,r,a=e.clientHeight||e.offsetHeight||400,s=e.clientWidth||e.offsetWidth||400;a<=350?(A=80,t=80,n=48,o=54,i=6,r=12):a<=450?(A=100,t=100,n=56,o=62,i=8,r=14):a<=550?(A=120,t=120,n=64,o=70,i=10,r=16):a<=700?(A=140,t=140,n=72,o=78,i=12,r=18):(A=160,t=160,n=80,o=86,i=14,r=20);var c=this.shadowRoot.querySelector(".voice-avatar, .voice-avatar-active");c&&(c.style.width="".concat(A,"px"),c.style.height="".concat(A,"px"),c.style.fontSize="".concat(.5*A,"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 u=this.shadowRoot.querySelector(".voice-transcript");u&&(u.style.minHeight="".concat(t,"px"),u.style.maxHeight="".concat(t,"px"),u.style.height="".concat(t,"px"),u.style.width="min(360px, ".concat(s-40,"px)"),u.style.boxSizing="border-box");var p=this.shadowRoot.querySelector(".transcript-label");p&&(p.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"),B=g.querySelector(".voice-send-btn"),v=g.querySelector(".voice-input-hint");if(m&&B){var w=Math.max(32,Math.min(40,.7*n));B.style.width="".concat(w,"px"),B.style.height="".concat(w,"px");var b=B.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*n))),"px 0")),v&&(v.style.fontSize="".concat(Math.max(8,Math.min(11,r-4)),"px"),v.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(n,"px"),e.style.height="".concat(n,"px");var A=e.querySelector("svg");if(A){var t=.65*n;A.style.setProperty("width","".concat(t,"px"),"important"),A.style.setProperty("height","".concat(t,"px"),"important"),A.style.setProperty("min-width","".concat(t,"px"),"important"),A.style.setProperty("min-height","".concat(t,"px"),"important")}});var C=this.shadowRoot.querySelector(".voice-control-btn.primary");if(C){C.style.width="".concat(o,"px"),C.style.height="".concat(o,"px");var x=C.querySelector("svg");if(x){var Q=.7*o;x.style.setProperty("width","".concat(Q,"px"),"important"),x.style.setProperty("height","".concat(Q,"px"),"important"),x.style.setProperty("min-width","".concat(Q,"px"),"important"),x.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 E=F.querySelector("svg");if(E){var I=Math.max(22,.5*U);E.style.width="".concat(I,"px"),E.style.height="".concat(I,"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 A,t=this.config.statusText;A=t||(this.voiceInterface.isActive&&!this.voiceInterface.isMicMuted?this.t("listening"):this.t("connected")),e.textContent=A;var n=this.shadowRoot.getElementById("desktopStatusText");n&&n!==e&&(n.textContent=A)}}}updateLiveWaveform(e){if(!this.voiceInterface.isMobile){var A=this.shadowRoot.getElementById("desktopLiveWaveform");A&&A.querySelectorAll(".desktop-live-bar").forEach((A,t)=>{if(e){var n=40*Math.random()+8;A.style.height="".concat(n,"px")}else A.style.height="8px"})}}showError(e){var A=this.shadowRoot.getElementById("transcriptText");A&&(A.textContent="".concat(this.t("error"),": ").concat(e),A.classList.remove("empty"))}showDomainError(){console.log("🚫 Showing domain error in widget UI...");var e=this.shadowRoot.getElementById("voiceIdleState");if(e){var A=e.querySelector(".voice-status-title"),t=e.querySelector(".voice-status-subtitle"),n=e.querySelector("#startCallBtn"),o=this.t("domainNotValidated"),i=this.t("domainErrorMessage");console.log("🚫 Domain error title:",o),console.log("🚫 Domain error message:",i),A?(A.textContent=o,A.style.color="#991B1B",A.style.fontSize="20px",A.style.fontWeight="600",A.style.marginLeft="20px",A.style.marginRight="20px",A.style.textAlign="center",console.log("✅ Updated statusTitle with domain error")):console.warn("⚠️ .voice-status-title element not found"),t?(t.textContent=i,t.style.color="#991B1B",t.style.fontSize="16px",t.style.marginLeft="20px",t.style.marginRight="20px",t.style.marginTop="12px",t.style.textAlign="center",t.style.lineHeight="1.5",console.log("✅ Updated statusSubtitle with domain error")):console.warn("⚠️ .voice-status-subtitle element not found"),n?(n.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):t&&t.parentNode?t.parentNode.insertBefore(r,t.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"),A=this.shadowRoot.getElementById("liveTextCollapsed");if(e){var t=e.textContent,n=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=n,e.textContent=t,t&&""!==t.trim()||e.classList.add("empty"))},5e3)}else if(A){var o=A.textContent;A.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(()=>{A&&(A.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 uA{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.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 A=document.createElement("style");A.id="mobile-voice-call-bar-styles",A.textContent=this.voiceInterface.styles.generateMobileCSS(),document.head.appendChild(A)}var t=document.createElement("div");t.id="mobile-voice-call-bar-container",t.innerHTML='\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">'.concat(this.t("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,A)=>'<div class="mobile-waveform-bar" data-index="'.concat(A,'"></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\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(t);var n=t.querySelector("#mobileMuteBtn"),o=t.querySelector("#mobileSpeakerBtn"),i=t.querySelector("#mobileEndCallBtn");if(n){n.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=n.querySelector(".mobile-mic-icon"),a=n.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()}removeMobileMinimizedBar(){var e=document.getElementById("mobile-voice-call-bar-container");e&&e.remove()}expandMobileTranscript(){var e=document.getElementById("mobile-voice-call-bar-container"),A=null==e?void 0:e.querySelector("#mobileTranscriptOverlay");if(A){A.style.display="flex",this.isTranscriptExpanded=!0;var t=null==e?void 0:e.querySelector("#mobileTextInput"),n=null==e?void 0:e.querySelector("#mobileSendBtn");t&&setTimeout(()=>t.focus(),100),n&&t&&(n.disabled=!t.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"),A=null==e?void 0:e.querySelector("#mobileTranscriptOverlay");A&&(A.style.display="none",this.isTranscriptExpanded=!1)}updateMobileStatus(e){var A=document.getElementById("mobile-voice-call-bar-container"),t=null==A?void 0:A.querySelector("#mobileStatusText"),n=null==A?void 0:A.querySelector("#mobileHeaderStatusText"),o=null==A?void 0:A.querySelector("#mobileStatusDot");if(t||n){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"),t&&(t.textContent=r),n&&(n.textContent=r),o&&(o.style.backgroundColor=a,o.style.boxShadow="paused"===e?"none":"0 0 8px ".concat(a))}}addMobileMessage(e,A){this.voiceInterface.messages.push({type:e,text:A});var t=document.getElementById("mobile-voice-call-bar-container"),n=null==t?void 0:t.querySelector("#mobileMessagesContainer");if(n){var o=document.createElement("div");o.className="mobile-message-bubble ".concat(e),o.textContent=A,n.appendChild(o),n.scrollTop=n.scrollHeight}}startWaveformAnimation(){this.waveformInterval&&clearInterval(this.waveformInterval);var e=document.getElementById("mobile-voice-call-bar-container"),A=null==e?void 0:e.querySelector("#mobileWaveform");A&&(this.waveformInterval=setInterval(()=>{A.querySelectorAll(".mobile-waveform-bar").forEach((e,A)=>{var t=60*Math.random()+10;e.style.height="".concat(t,"px")})},100))}stopWaveformAnimation(){this.waveformInterval&&(clearInterval(this.waveformInterval),this.waveformInterval=null);var e=document.getElementById("mobile-voice-call-bar-container"),A=null==e?void 0:e.querySelector("#mobileWaveform");A&&A.querySelectorAll(".mobile-waveform-bar").forEach(e=>{e.style.height="10px"})}cleanup(){this.stopWaveformAnimation(),this.collapseMobileTranscript(),this.removeMobileMinimizedBar(),this.voiceInterface.messages=[]}}function pA(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function hA(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){pA(i,n,o,r,a,"next",e)}function a(e){pA(i,n,o,r,a,"throw",e)}r(void 0)})}}class gA{constructor(e){var A;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=Xe(),this.isMobile=this.deviceInfo.isMobile,this.conversationExpanded=!1,this.isMicMuted=!1,this.isSpeakerMuted=!1;var t=e.visualAssistant||(null===(A=e.agentSettingsOverride)||void 0===A?void 0:A.visualAssistant);this.sdk=new YA({agentId:e.agentId,appId:e.appId,websocketUrl:e.websocketUrl,agentSettingsOverride:e.agentSettingsOverride,visualAssistant:t,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}),this.templates=new rA(this),this.styles=new aA(this),this.transcript=new sA(this),this.textHandlers=new cA(this),this.handlers=new lA(this),this.desktop=new dA(this),this.mobile=new uA(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,A)=>{this._pendingUserTranscriptFrame&&cancelAnimationFrame(this._pendingUserTranscriptFrame),this._pendingUserTranscriptFrame=requestAnimationFrame(()=>{this._pendingUserTranscriptFrame=null;var A=document.getElementById("mobile-voice-call-bar-container");if(A){var t=A.querySelector("#mobileTranscriptText");t&&(t.textContent="You: "+e,t.style.color="#fde68a")}else{var n=this.shadowRoot.getElementById("liveTextCollapsed");if(n){n.textContent="",n.classList.remove("muted"),n.style.color="#1e293b";var o=document.createElement("span");o.style.fontWeight="600",o.style.opacity="0.7",o.textContent="You: ",n.appendChild(o),n.appendChild(document.createTextNode(e))}}}),A&&(this.isMobile?this.addMobileMessage("user",e):(this.transcript.finalizeLiveMessage(),this.addConversationMessage("user",e)))},this.sdk.onPlaybackStarted=()=>{console.log("🔊 [VOICE INTERFACE] Playback started - updating status to listening"),this.isMobile?this.updateMobileStatus("listening"):this.updateDesktopStatus()},this.sdk.onAgentSpeaking=e=>{var A=this.shadowRoot.getElementById("voiceAvatarActive");A&&(e?(A.classList.add("speaking"),this.isMobile?(this.updateMobileStatus("speaking"),this.startWaveformAnimation()):(this.updateDesktopStatus(),this.startDesktopWaveformAnimation())):(A.classList.remove("speaking"),this.isMobile?(this.updateMobileStatus("listening"),this.startWaveformAnimation()):(this.updateDesktopStatus(),this.startDesktopWaveformAnimation())))},this.sdk.onDisconnected=function(){var A=hA(function*(A){console.log("🔌 WebSocket disconnected, hanging up call..."),A&&(1008===A.code&&A.reason&&(A.reason.includes("Domain not whitelisted")||A.reason.includes("domain")||A.reason.includes("whitelist"))||1008===A.code&&A.reason&&A.reason.includes("localhost"))?(console.error("❌ Domain not whitelisted - WebSocket closed:",A.code,A.reason),yield e.endCallOnServerRejection()):e.isActive&&(e.isActive=!1,e.endVoiceCall())});return function(e){return A.apply(this,arguments)}}(),this.sdk.onError=function(){var A=hA(function*(A){if(A&&("DOMAIN_NOT_WHITELISTED"===A.message||A.message&&A.message.includes("Domain not whitelisted")))return console.error("❌ Voice SDK Error: Domain not whitelisted:",A),void(yield e.endCallOnServerRejection());A.isServerRejection||"ServerRejected"===A.name||(console.error("❌ Voice SDK Error:",A),e.showError(A.message||A))});return function(e){return A.apply(this,arguments)}}(),this.sdk.onUnsupportedAction=e=>{console.warn('⚠️ Received "'.concat(e,'" but this is not an E-Commerce widget. Use TTPEcommerceWidget instead.'));var A="This widget does not support e-commerce features. Please use TTPEcommerceWidget to display products.";this.config.onErrorToast&&this.config.onErrorToast(A,"warning"),this.isMobile&&this.config.onMobileError&&this.config.onMobileError(A)}}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 A,t,n=this.config.language||"en";return((null===(A=this.config.translations)||void 0===A?void 0:A[n])||(null===(t=this.config.translations)||void 0===t?void 0:t.en)||{})[e]||e}getText(e,A){return void 0!==this.config[e]&&null!==this.config[e]?this.config[e]:this.t(A)}getTooltip(e){var A,t=null===(A=this.config.tooltips)||void 0===A?void 0:A[e];return null!=t?t:{mute:this.t("mute"),speaker:this.t("speaker"),endCall:this.t("endCall")}[e]||""}_updateTimerElements(e,A){var t=this.shadowRoot.getElementById("voiceTimer");t&&(t.textContent=e);var n=this.shadowRoot.getElementById("desktopTimerText"),o=this.shadowRoot.getElementById("compactTimerText");if(n&&(n.textContent=e),o&&(o.textContent=e),!o&&!n&&A<2e3){console.warn("⚠️ Timer elements not found - compactTimerText:",!!o,"desktopTimerText:",!!n,"elapsed:",A);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 hA(function*(){if(e.isActive)console.log("⚠️ Voice call already active");else{console.log("🎤 Starting voice call...");var A=yield Je();if(console.log("📋 Current permission state: ".concat(A)),"denied"===A)throw console.log("🚫 Permission is denied, showing blocked modal..."),e.resetConnectingState(),Xe(),oA(()=>{console.log("Blocked modal closed")}),new Error("Microphone permission denied");if("prompt"===A||"unknown"===A){console.log("📋 Permission is in prompt state, showing pre-prompt modal with call view...");var t=e.shadowRoot.getElementById("voiceIdleState"),n=e.shadowRoot.getElementById("voiceActiveState");return t&&(t.style.display="none"),n&&(n.style.display="flex"),new Promise((A,o)=>{nA(hA(function*(){console.log("✅ Pre-prompt accepted, proceeding with voice call...");try{yield e.proceedWithVoiceCall(),A()}catch(e){o(e)}}),()=>{console.log("❌ Pre-prompt cancelled"),t&&(t.style.display="flex"),n&&(n.style.display="none"),e.resetConnectingState(),o(new Error("Call cancelled by user"))})})}yield e.proceedWithVoiceCall()}})()}proceedWithVoiceCall(){var e=this;return hA(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 A=e.shadowRoot.getElementById("desktopConversationPanel"),t=e.shadowRoot.getElementById("conversationHeader"),n=e.shadowRoot.getElementById("conversationToggleText"),o=e.shadowRoot.querySelector(".voice-interface"),i=e.shadowRoot.getElementById("desktopVoiceSection"),r=e.shadowRoot.getElementById("compactVoiceSection");A&&(A.classList.remove("expanded"),A.classList.add("collapsed")),t&&t.classList.remove("expanded"),n&&(n.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 u=document.getElementById("text-chat-button");u&&(u.style.display="none",console.log("✅ Floating button hidden (permission granted, fallback)"))}var p=e.shadowRoot.querySelector(".ttp-mobile-fab");p&&(p.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 B=e.shadowRoot.getElementById("text-chat-panel");if(B)B.style.display="";else{var v=document.getElementById("text-chat-panel");v&&(v.style.display="")}return Xe(),void oA(()=>{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 C,x=null!==(C=e.config.connectionDelay)&&void 0!==C?C:{default:0,android:3e3,ios:0};yield function(){return AA.apply(this,arguments)}(x)}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=A=>{A&&("DOMAIN_NOT_WHITELISTED"===A.message||A.message&&A.message.includes("Domain not whitelisted"))&&(F=!0,console.log("🚫 Server rejected connection before starting audio capture")),U&&U.call(e.sdk,A)},e.sdk.onDisconnected=A=>{A&&1008===A.code&&A.reason&&(A.reason.includes("Domain not whitelisted")||A.reason.includes("domain")||A.reason.includes("whitelist"))&&(F=!0,console.log("🚫 Server disconnected due to domain error before starting audio capture")),S&&S.call(e.sdk,A)};for(var E=0;E<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)),E++}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 I=e._preliminaryInputStream||null;if(I&&(e._preliminaryInputStream=null),yield e.sdk.startListening(I),!(e.sdk.isConnected&&e.sdk.voiceSDK&&e.sdk.voiceSDK.isConnected&&e.sdk.voiceSDK.websocket&&e.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN)){var k;if(null!==(k=e.sdk.voiceSDK)&&void 0!==k&&k.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 D=e.shadowRoot.getElementById("text-chat-panel");if(D)D.style.display="";else{var M=document.getElementById("text-chat-panel");M&&(M.style.display="")}var L=e.shadowRoot.getElementById("text-chat-button");if(L)L.style.display="";else{var P=document.getElementById("text-chat-button");P&&(P.style.display="")}}throw T}if(!e.callStartTime){e.callStartTime=Date.now(),console.log("⏱️ Starting call timer at",new Date(e.callStartTime).toISOString());var K=()=>{if(e.callStartTime){var A=Date.now()-e.callStartTime,t=Math.floor(A/6e4),n=Math.floor(A%6e4/1e3),o="".concat(t.toString().padStart(2,"0"),":").concat(n.toString().padStart(2,"0"));e._updateTimerElements(o,A)}};setTimeout(()=>{K(),e.callTimerInterval=setInterval(K,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 _=e._preliminaryInputStream||null;_&&(e._preliminaryInputStream=null),yield e.sdk.startListening(_),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 R=e.shadowRoot.getElementById("voiceIdleState");R&&(R.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 G=document.getElementById("text-chat-button");G&&(G.style.display="")}}throw T}if(!e.callStartTime){e.callStartTime=Date.now(),console.log("⏱️ Starting call timer at",new Date(e.callStartTime).toISOString());var W=()=>{if(e.callStartTime){var A=Date.now()-e.callStartTime,t=Math.floor(A/6e4),n=Math.floor(A%6e4/1e3),o="".concat(t.toString().padStart(2,"0"),":").concat(n.toString().padStart(2,"0"));e._updateTimerElements(o,A)}};setTimeout(()=>{W(),e.callTimerInterval=setInterval(W,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?(Xe(),oA(()=>{e.resetUIState()})):"NotFoundError"===T.name||"DevicesNotFoundError"===T.name?iA(()=>{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 A=document.getElementById("text-chat-panel");A&&(A.style.display="")}}var t=this.shadowRoot.getElementById("voiceIdleState"),n=this.shadowRoot.getElementById("voiceActiveState");t&&(t.style.display="flex"),n&&(n.style.display="none")}endCallOnServerRejection(){var e=this;return hA(function*(){console.log("🚫 Server rejected call - ending call and stopping audio capture/VAD..."),console.log("🚫 Calling endCallOnServerRejection() - will show domain error message");var A=e.shadowRoot.getElementById("voiceInterface"),t=e.shadowRoot.getElementById("landingScreen");if(A&&(A.classList.add("active"),console.log("✅ Made voice interface visible")),t&&(t.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 n,o,i=null===(n=e.sdk.voiceSDK)||void 0===n?void 0:n.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(A){console.warn("Error stopping listening on server rejection:",A);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 u=document.getElementById("text-chat-button");u&&(u.style.display="")}var p=e.shadowRoot.querySelector(".ttp-mobile-fab");p&&(p.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 A=this.shadowRoot.getElementById(e);if(A){A.classList.remove("muted");var t=A.querySelector(".desktop-mic-icon"),n=A.querySelector(".desktop-mic-off-icon");t&&(t.style.display="block"),n&&(n.style.display="none")}}),["desktopSpeakerBtn","desktopSpeakerBtnCompact"].forEach(e=>{var A=this.shadowRoot.getElementById(e);if(A){A.classList.remove("muted");var t=A.querySelector(".desktop-speaker-icon"),n=A.querySelector(".desktop-speaker-off-icon");t&&(t.style.display="block"),n&&(n.style.display="none")}});var A=document.getElementById("mobile-voice-call-bar-container"),t=null==A?void 0:A.querySelector("#mobileMuteBtn");if(t){t.classList.remove("muted");var n=t.querySelector(".mobile-mic-icon"),o=t.querySelector(".mobile-mic-off-icon");n&&(n.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==A?void 0:A.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 u=document.getElementById("text-chat-button");u&&(u.style.display="",console.log("✅ Floating button restored (call ended, fallback)"))}var p=this.shadowRoot.getElementById("voiceActiveState");if(p&&(p.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 B=this.shadowRoot.getElementById("voiceAvatarActive");B&&B.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"),A=this.shadowRoot.getElementById("voiceActiveState");if(e){var t=e.querySelector(".voice-status-title"),n=e.querySelector(".voice-status-subtitle"),o=e.querySelector("#startCallBtn");if(t&&(t.textContent=this.t("connecting")),n&&(n.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"}A&&(A.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 A=e.querySelector("#domainErrorBackBtn");A&&A.parentNode&&A.parentNode.removeChild(A);var t=e.querySelector(".voice-status-title"),n=e.querySelector(".voice-status-subtitle"),o=e.querySelector("#startCallBtn");if(t&&(t.textContent=this.getText("startCallTitle","clickToStartCall"),t.style.color="",t.style.fontSize="",t.style.fontWeight="",t.style.marginLeft="",t.style.marginRight="",t.style.textAlign=""),n&&(n.textContent=this.getText("startCallSubtitle","realTimeVoice"),n.style.color="",n.style.fontSize="",n.style.marginLeft="",n.style.marginRight="",n.style.marginTop="",n.style.textAlign="",n.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,A){return this.transcript.addConversationMessage(e,A)}renderConversationMessages(){return this.transcript.renderConversationMessages()}escapeHtml(e){var A=document.createElement("div");return A.textContent=e,A.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 A=this.shadowRoot.getElementById("desktopMuteBtn"),t=this.shadowRoot.getElementById("desktopMuteBtnCompact");if(this.isMobile||this.updateDesktopStatus(),A){var n=A.querySelector(".desktop-mic-icon"),o=A.querySelector(".desktop-mic-off-icon");n&&o&&(e.enabled?(A.classList.remove("muted"),n.style.display="block",o.style.display="none"):(A.classList.add("muted"),n.style.display="none",o.style.display="block"))}if(t){var i=t.querySelector(".desktop-mic-icon"),r=t.querySelector(".desktop-mic-off-icon");i&&r&&(e.enabled?(t.classList.remove("muted"),i.style.display="block",r.style.display="none"):(t.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"),A=this.shadowRoot.getElementById("desktopSpeakerBtnCompact");if(e){var t=e.querySelector(".desktop-speaker-icon"),n=e.querySelector(".desktop-speaker-off-icon");t&&n&&(this.isSpeakerMuted?(e.classList.add("muted"),t.style.display="none",n.style.display="block"):(e.classList.remove("muted"),t.style.display="block",n.style.display="none"))}if(A){var o=A.querySelector(".desktop-speaker-icon"),i=A.querySelector(".desktop-speaker-off-icon");o&&i&&(this.isSpeakerMuted?(A.classList.add("muted"),o.style.display="none",i.style.display="block"):(A.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,A){return this.mobile.addMobileMessage(e,A)}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,A=Math.floor(e/6e4),t=Math.floor(e%6e4/1e3),n="".concat(A.toString().padStart(2,"0"),":").concat(t.toString().padStart(2,"0"));this._updateTimerElements(n,e)}};e(),this.callTimerInterval=setInterval(e,1e3)}}stopWaveformAnimation(){return this.mobile.stopWaveformAnimation()}resetMuteState(){var e,A;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 t=this.sdk.voiceSDK.audioRecorder.mediaStream.getAudioTracks()[0];t&&(t.enabled=!0)}null!==(A=this.sdk)&&void 0!==A&&null!==(A=A.voiceSDK)&&void 0!==A&&A.audioPlayer&&this.sdk.voiceSDK.audioPlayer.setMuted(!1),["desktopMuteBtn","desktopMuteBtnCompact"].forEach(e=>{var A=this.shadowRoot.getElementById(e);if(A){A.classList.remove("muted");var t=A.querySelector(".desktop-mic-icon"),n=A.querySelector(".desktop-mic-off-icon");t&&(t.style.display="block"),n&&(n.style.display="none")}}),["desktopSpeakerBtn","desktopSpeakerBtnCompact"].forEach(e=>{var A=this.shadowRoot.getElementById(e);if(A){A.classList.remove("muted");var t=A.querySelector(".desktop-speaker-icon"),n=A.querySelector(".desktop-speaker-off-icon");t&&(t.style.display="block"),n&&(n.style.display="none")}});var n=document.getElementById("mobile-voice-call-bar-container"),o=null==n?void 0:n.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==n?void 0:n.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 mA(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function fA(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){mA(i,n,o,r,a,"next",e)}function a(e){mA(i,n,o,r,a,"throw",e)}r(void 0)})}}class BA{constructor(e,A){this.config=e,this.sdk=A,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 A,t,n=this.config.language||"en";return((null===(A=this.config.translations)||void 0===A?void 0:A[n])||(null===(t=this.config.translations)||void 0===t?void 0:t.en)||{})[e]||e}generateHTML(){var e,A,t,n,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!==(A=this.config.sendButtonHint)&&void 0!==A&&A.text||null!==(t=this.config.panel)&&void 0!==t&&null!==(t=t.sendButtonHint)&&void 0!==t&&t.text?'\n <div class="send-button-hint" style="color: '.concat((null===(n=this.config.sendButtonHint)||void 0===n?void 0:n.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,A,t,n,o,i,r,a,s,c,l,d,u,p=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===(A=this.config.panel)||void 0===A?void 0:A.sendButtonHoverColor)||"#6D28D9",m=this.config.sendButtonTextColor||(null===(t=this.config.panel)||void 0===t?void 0:t.sendButtonTextColor)||"#FFFFFF",f=(this.config.inputPlaceholder||null===(n=this.config.panel)||void 0===n||n.inputPlaceholder,this.config.inputBorderColor||(null===(o=this.config.panel)||void 0===o?void 0:o.inputBorderColor)||"#E5E7EB"),B=this.config.inputFocusColor||(null===(i=this.config.panel)||void 0===i?void 0:i.inputFocusColor)||"#7C3AED",v=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,C=this.config.inputPadding||(null===(l=this.config.panel)||void 0===l?void 0:l.inputPadding)||"6px 14px",x=!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(x,"; \n flex: 1; \n flex-direction: column; \n min-height: 0; \n overflow: hidden; \n }\n .text-interface.active { display: flex").concat(x,"; }\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(p.borderRadius,"px").concat(x,"; \n max-width: 80%; \n font-size: ").concat(p.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(p.userBackgroundColor).concat(x,"; \n color: ").concat(p.userTextColor||p.textColor).concat(x,"; \n }\n .message.agent .message-bubble { \n background: ").concat(p.agentBackgroundColor).concat(x,"; \n color: ").concat(p.agentTextColor||p.textColor).concat(x,"; \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(p.systemBackgroundColor,";\n align-self: flex-start;\n }\n .message.error {\n background: ").concat(p.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(C,";\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(v,";\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(B,";\n background: ").concat("#FFFFFF"===v?"#FFFFFF":v,";\n box-shadow: 0 0 0 3px ").concat(B,"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===(u=this.config.panel)||void 0===u?void 0:u.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(p.errorBackgroundColor,";\n border-radius: ").concat(p.borderRadius,"px;\n color: #991B1B;\n font-size: ").concat(p.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"),A=this.shadowRoot.getElementById("messageInput"),t=this.shadowRoot.getElementById("newChatBtn");if(e&&(e.onclick=()=>this.sendMessage()),t&&(t.onclick=()=>this.startNewChat()),this.updateInputAttributes(),A){A.style.height="32px",A.style.overflow="hidden";var n=()=>{A.style.height="auto";var e=Math.min(A.scrollHeight,120);A.style.height=e+"px",A.style.overflowY=e>=120?"auto":"hidden",e>=120&&setTimeout(()=>{A.scrollTop=A.scrollHeight},0)};A.addEventListener("input",n),A.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey?"Enter"===e.key&&e.shiftKey&&setTimeout(n,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 A=this.shadowRoot.getElementById("messageInput");A&&A.focus()}updateInputAttributes(){var e=this.shadowRoot.getElementById("messageInput");if(e){var A,t=this.config.inputPlaceholder||(null===(A=this.config.panel)||void 0===A?void 0:A.inputPlaceholder)||this.t("typeMessage")||"Type your message...";e.placeholder=t,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 fA(function*(){e.isActive=!0,e.updateSendButtonState()})()}sendMessage(){var e=this;return fA(function*(){var A=e.shadowRoot.getElementById("messageInput"),t=A.value.trim();if(t){e.isActive||(yield e.startChat()),e.addMessage("user",t),A.value="",A.style.height="32px",A.style.overflow="hidden";try{e.beginStreaming(),yield e.sdk.sendMessage(t)}catch(A){console.error("❌ Failed to send message:",A),A&&("DOMAIN_NOT_WHITELISTED"===A.message||A.message&&A.message.includes("Domain not whitelisted"))||e.showError(A),e.stopStreamingState()}}})()}updateSendButtonState(){var e=this.shadowRoot.getElementById("sendButton");e&&(e.disabled=!this.isActive)}addMessage(e,A){var t,n,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===(t=this.config.messages)||void 0===t?void 0:t.userAvatarIcon)||"👤":(null===(n=this.config.messages)||void 0===n?void 0:n.agentAvatarIcon)||"🤖";s.textContent=c;var l=document.createElement("div");l.className="message-bubble",l.textContent=A,r.appendChild(s),r.appendChild(l),o.appendChild(r),o.scrollTop=o.scrollHeight}}beginStreaming(){var e,A=this.shadowRoot.getElementById("messagesContainer");if(A){this.stopStreamingState();var t=document.createElement("div"),n="rtl"===this.config.direction?"edge-right":"edge-left";t.className="message agent ".concat(n),t.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>',t.appendChild(o),t.appendChild(i),A.appendChild(t),this.streamingEl=i,this.hasStartedStreaming=!1,A.scrollTop=A.scrollHeight}}appendStreamingChunk(e){if(this.streamingEl){this.hasStartedStreaming||(this.streamingEl.textContent="",this.hasStartedStreaming=!0),this.streamingEl.textContent+=e;var A=this.shadowRoot.getElementById("messagesContainer");A&&(A.scrollTop=A.scrollHeight)}}finalizeStreaming(e){if(this.streamingEl){this.streamingEl.textContent=e||this.streamingEl.textContent;var A=this.shadowRoot.getElementById("agent-streaming");A&&(A.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 A=this.shadowRoot.getElementById("messagesContainer");if(A){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 t,n=document.createElement("div");n.className="error-message",n.style.cssText="padding: 16px; margin: 12px; border-radius: 8px; background: "+((null===(t=this.config.messages)||void 0===t?void 0:t.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"),n.appendChild(o),n.appendChild(i),A.appendChild(n)}else{var r=document.createElement("div");r.className="error-message",r.textContent="string"==typeof e?e:(null==e?void 0:e.message)||e,A.appendChild(r)}A.scrollTop=A.scrollHeight}}setActive(e){this.isActive=e,this.updateSendButtonState()}}class vA{constructor(e){this.config=e,this.translations=e.translations||{},this.shadowRoot=e.shadowRoot}t(e){var A=this.config.language||"en";return(this.translations[A]||this.translations.en||{})[e]||e}generateHTML(){var e,A=this.config.landing||{};return e="image"===A.logoType&&A.logoImageUrl?'<img src="'.concat(A.logoImageUrl,'" alt="Logo" style="max-width: 44px; max-height: 44px; object-fit: contain; border: none; outline: none;">'):'<span class="landing-avatar-emoji">'.concat(A.logoIcon||A.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(A.title||this.t("landingTitle"),'</h2>\n <p class="landing-subtitle">').concat(A.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(A.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(A.textCardTitle||this.t("textChat"),"</span>\n </button>\n </div>\n </div>\n ")}generateCSS(){var e=this.config.landing||{},A=(this.config.animation,!1===this.config.useShadowDOM?" !important":"");return"\n /* ===== LANDING SCREEN - New Design ===== */\n .landing-screen { \n display: none".concat(A,"; \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(A,"; \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 A=e.logoBackgroundColor||e.avatarBackground||"linear-gradient(135deg, #667eea 0%, #764ba2 100%)";return"background: ".concat(A,"; box-shadow: 0 8px 28px rgba(102, 126, 234, 0.35); border: none;")}return"background: transparent; box-shadow: none; border: none; outline: none;"}var t=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;")})(),"\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,A=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("landingScreen");A&&A.classList.add("active")}hide(){var e,A=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("landingScreen");A&&A.classList.remove("active")}setupEventHandlers(){var e,A,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("mode-card-voice"),o=null===(A=this.shadowRoot)||void 0===A?void 0:A.getElementById("mode-card-text");n&&t.onSelectVoice&&(n.onclick=t.onSelectVoice),o&&t.onSelectText&&(o.onclick=t.onSelectText)}}const wA={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."}};function bA(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function yA(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){bA(i,n,o,r,a,"next",e)}function a(e){bA(i,n,o,r,a,"throw",e)}r(void 0)})}}function CA(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function xA(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?CA(Object(t),!0).forEach(function(A){QA(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):CA(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}function QA(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}class FA{constructor(){var e,A,t,n,o,i,r,a,s,c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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 Re(this.config),this.isOpen=!1,this.isActive=!1,this.translations=wA,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=xA(xA(xA({},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===(A=this.config.text)||void 0===A?void 0:A.sendButtonColor)||this.config.sendButtonColor||"#7C3AED",language:(null===(t=this.config.voice)||void 0===t?void 0:t.language)||this.config.language||"en",websocketUrl:this.config.websocketUrl,agentSettingsOverride:this.config.agentSettingsOverride,visualAssistant:this.config.visualAssistant,translations:this.translations,shadowRoot:this.shadowRoot,textSDK:this.sdk,outputContainer:(null===(n=this.config.voice)||void 0===n?void 0:n.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,A,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 o,i=n.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===(A=this.config.behavior)||void 0===A?void 0:A.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,A)=>{this.showErrorToast(e,A)},onMobileError:e=>{this.showMobileLandingError(e)}});this.voiceInterface=new gA(l);var d=xA(xA(xA({},this.config),this.config.text),{},{translations:this.translations,shadowRoot:this.shadowRoot});if(this.textInterface=new BA(d,this.sdk),"unified"===((null===(s=this.config.behavior)||void 0===s?void 0:s.mode)||"unified")){var u=xA(xA({},this.config),{},{translations:this.translations,shadowRoot:this.shadowRoot});this.landingScreen=new vA(u)}else this.landingScreen=null;if(this.createWidget(),this.setupEventHandlers(),this.config.behavior.startOpen||this.config.behavior.autoOpen)if(window.innerWidth<=768){var p,h,g=null===(p=this.shadowRoot)||void 0===p?void 0:p.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,B=null===(f=this.shadowRoot)||void 0===f?void 0:f.getElementById("text-chat-panel");B&&(this.isOpen=!0,B.classList.add("open"))}this.checkAndHandleResume()}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 A,t,n=null===(A=this.shadowRoot)||void 0===A?void 0:A.getElementById("ttpMobileLanding"),o=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".ttp-mobile-fab");n&&(n.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 A;console.error("❌ [WIDGET] Failed to auto-resume call:",e),"unified"===((null===(A=this.config.behavior)||void 0===A?void 0:A.mode)||"unified")&&this.showLanding()})},100)}}open(){var e;if(!this.isOpen){var A=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("text-chat-panel");A&&(this.isOpen=!0,A.classList.add("open"))}}mergeWithDefaults(e){var A,t,n,o,i,r,a,s,c,l,d,u,p,h,g,m,f,B,v,w,b,y,C,x,Q,F,U,S,E,I,k,T,H,D,M,L,P,K,_,R,O,V,N,G,W,j,z,q,X,J,Y,Z,$,ee,Ae,te,ne,oe,ie,re,ae,se,ce,le,de,ue,pe,he,ge,me,fe,Be,ve,we,be,ye,Ce,xe,Qe,Fe,Ue,Se,Ee,Ie,ke,Te,He,De,Me,Le,Pe,Ke,_e,Re,Oe,Ve,Ne,Ge,We,je,ze,qe,Xe,Je,Ye,Ze,$e,eA,AA,tA,nA,oA,iA,rA,aA,sA,cA,lA,dA,uA,pA,hA,gA,mA,fA,BA,vA,wA,bA,yA,CA,QA,FA,UA,SA,EA,IA,kA,TA,HA=e.position||"bottom-right";if("string"==typeof HA){var DA=HA.split("-");HA={vertical:DA[0]||"bottom",horizontal:DA[1]||"right",offset:e.positionOffset||{x:20,y:20}}}var MA=e.primaryColor||(null===(A=e.button)||void 0===A?void 0:A.primaryColor)||(null===(t=e.button)||void 0===t?void 0:t.backgroundColor)||"#FFFFFF",LA={};e.landing&&Object.keys(e.landing).forEach(A=>{var t=e.landing[A];null!=t&&""!==t&&(LA[A]=t)});var PA={};return e.header&&Object.keys(e.header).forEach(A=>{var t=e.header[A];null!=t&&""!==t&&(PA[A]=t)}),xA({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:xA({type:(null===(n=e.icon)||void 0===n?void 0:n.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:xA({vertical:HA.vertical||"bottom",horizontal:HA.horizontal||"right",offset:HA.offset||{x:20,y:20}},"object"==typeof e.position?e.position:{}),button:xA({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===(u=e.icon)||void 0===u?void 0:u.backgroundColor)||"#FFFFFF",hoverColor:(null===(p=e.button)||void 0===p?void 0:p.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:xA({width:(null===(B=e.panel)||void 0===B?void 0:B.width)||360,height:(null===(v=e.panel)||void 0===v?void 0:v.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===(C=e.panel)||void 0===C?void 0:C.border)||"1px solid #E5E7EB"},e.panel),voice:xA({micButtonColor:(null===(x=e.voice)||void 0===x?void 0:x.micButtonColor)||(null===(Q=e.panel)||void 0===Q?void 0:Q.micButtonColor)||MA,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:xA(xA({text:(null===(S=e.voice)||void 0===S||null===(S=S.micButtonHint)||void 0===S?void 0:S.text)||(null===(E=e.panel)||void 0===E||null===(E=E.micButtonHint)||void 0===E?void 0:E.text)||"Click the button to start voice conversation",color:(null===(I=e.voice)||void 0===I||null===(I=I.micButtonHint)||void 0===I?void 0:I.color)||(null===(k=e.panel)||void 0===k||null===(k=k.micButtonHint)||void 0===k?void 0:k.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===(D=e.voice)||void 0===D?void 0:D.micButtonHint),null===(M=e.panel)||void 0===M?void 0:M.micButtonHint),avatarBackgroundColor:(null===(L=e.voice)||void 0===L?void 0:L.avatarBackgroundColor)||"#667eea",avatarActiveBackgroundColor:(null===(P=e.voice)||void 0===P?void 0:P.avatarActiveBackgroundColor)||"#667eea",statusTitleColor:(null===(K=e.voice)||void 0===K?void 0:K.statusTitleColor)||"#1e293b",statusSubtitleColor:(null===(_=e.voice)||void 0===_?void 0:_.statusSubtitleColor)||"#64748b",statusDotColor:(null===(R=e.voice)||void 0===R?void 0:R.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===(G=e.voice)||void 0===G?void 0:G.startCallTitle)||null,startCallSubtitle:(null===(W=e.voice)||void 0===W?void 0:W.startCallSubtitle)||null,startCallButtonText:(null===(j=e.voice)||void 0===j?void 0:j.startCallButtonText)||null,transcriptBackgroundColor:(null===(z=e.voice)||void 0===z?void 0:z.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===(J=e.voice)||void 0===J?void 0:J.controlButtonColor)||"#FFFFFF",controlButtonSecondaryColor:(null===(Y=e.voice)||void 0===Y?void 0:Y.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:xA({sendButtonColor:(null===(ee=e.text)||void 0===ee?void 0:ee.sendButtonColor)||(null===(Ae=e.panel)||void 0===Ae?void 0:Ae.sendButtonColor)||"#7C3AED",sendButtonHoverColor:(null===(te=e.text)||void 0===te?void 0:te.sendButtonHoverColor)||(null===(ne=e.panel)||void 0===ne?void 0:ne.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===(ue=e.text)||void 0===ue?void 0:ue.sendButtonFontWeight)||(null===(pe=e.panel)||void 0===pe?void 0:pe.sendButtonFontWeight)||"500",sendButtonHint:xA(xA({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===(Be=e.text)||void 0===Be||null===(Be=Be.sendButtonHint)||void 0===Be?void 0:Be.fontSize)||(null===(ve=e.panel)||void 0===ve||null===(ve=ve.sendButtonHint)||void 0===ve?void 0:ve.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===(Ce=e.panel)||void 0===Ce?void 0:Ce.inputPlaceholder)||"Type your message...",inputBorderColor:(null===(xe=e.text)||void 0===xe?void 0:xe.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===(Ee=e.panel)||void 0===Ee?void 0:Ee.inputBackgroundColor)||"#FFFFFF",inputTextColor:(null===(Ie=e.text)||void 0===Ie?void 0:Ie.inputTextColor)||(null===(ke=e.panel)||void 0===ke?void 0:ke.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===(De=e.text)||void 0===De?void 0:De.inputBorderRadius)||(null===(Me=e.panel)||void 0===Me?void 0:Me.inputBorderRadius)||20,inputPadding:(null===(Le=e.text)||void 0===Le?void 0:Le.inputPadding)||(null===(Pe=e.panel)||void 0===Pe?void 0:Pe.inputPadding)||"6px 14px"},e.text),landing:(()=>{var A={};return e.landing&&Object.keys(e.landing).forEach(t=>{var n=e.landing[t];(null!=n&&""!==n||!1===n)&&(A[t]=n)}),xA({backgroundColor:A.backgroundColor||"linear-gradient(180deg, #f8fafc 0%, #e0e7ff 100%)",logo:A.logo||"🤖",title:A.title||null,titleColor:A.titleColor||"#1e293b",modeCardBackgroundColor:A.modeCardBackgroundColor||"#FFFFFF",modeCardBorderColor:A.modeCardBorderColor||"#E2E8F0",modeCardHoverBorderColor:A.modeCardHoverBorderColor||"#7C3AED",modeCardIconBackgroundColor:A.modeCardIconBackgroundColor||"#7C3AED",modeCardTitleColor:A.modeCardTitleColor||"#111827",voiceCardIcon:A.voiceCardIcon||"🎤",textCardIcon:A.textCardIcon||"💬",voiceCardTitle:A.voiceCardTitle||null,textCardTitle:A.textCardTitle||null,callButtonText:A.callButtonText||null,chatButtonText:A.chatButtonText||null,statusText:A.statusText||null},A)})(),header:(()=>{var A={};return e.header&&Object.keys(e.header).forEach(t=>{var n=e.header[t];t.startsWith("onlineIndicator")?null!=n&&(A[t]=n):null!=n&&""!==n&&(A[t]=n)}),xA({title:A.title||"Chat Assistant",showTitle:!1!==A.showTitle,backgroundColor:A.backgroundColor||"#7C3AED",textColor:A.textColor||"#FFFFFF",showCloseButton:!1!==A.showCloseButton,mobileLabel:A.mobileLabel||"Chat"},A)})(),footer:xA({show:!1!==(null===(Ke=e.footer)||void 0===Ke?void 0:Ke.show),backgroundColor:(null===(_e=e.footer)||void 0===_e?void 0:_e.backgroundColor)||"#f9fafb",textColor:(null===(Re=e.footer)||void 0===Re?void 0:Re.textColor)||"#9ca3af",hoverColor:(null===(Oe=e.footer)||void 0===Oe?void 0:Oe.hoverColor)||"#7C3AED"},e.footer),tooltips:xA({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===(Ge=e.tooltips)||void 0===Ge?void 0:Ge.close)||null,mute:(null===(We=e.tooltips)||void 0===We?void 0:We.mute)||null,speaker:(null===(je=e.tooltips)||void 0===je?void 0:je.speaker)||null,endCall:(null===(ze=e.tooltips)||void 0===ze?void 0:ze.endCall)||null},e.tooltips),messages:xA({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===(Je=e.messages)||void 0===Je?void 0:Je.systemBackgroundColor)||"#DCFCE7",errorBackgroundColor:(null===(Ye=e.messages)||void 0===Ye?void 0:Ye.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===(eA=e.messages)||void 0===eA?void 0:eA.textColor)||"#1F2937",agentTextColor:(null===(AA=e.messages)||void 0===AA?void 0:AA.agentTextColor)||(null===(tA=e.messages)||void 0===tA?void 0:tA.textColor)||"#1F2937",userAvatarIcon:(null===(nA=e.messages)||void 0===nA?void 0:nA.userAvatarIcon)||"👤",agentAvatarIcon:(null===(oA=e.messages)||void 0===oA?void 0:oA.agentAvatarIcon)||"🤖",fontSize:(null===(iA=e.messages)||void 0===iA?void 0:iA.fontSize)||"14px",borderRadius:(null===(rA=e.messages)||void 0===rA?void 0:rA.borderRadius)||16},e.messages),animation:xA({enableHover:!1!==(null===(aA=e.animation)||void 0===aA?void 0:aA.enableHover),enablePulse:!1!==(null===(sA=e.animation)||void 0===sA?void 0:sA.enablePulse),enableSlide:!1!==(null===(cA=e.animation)||void 0===cA?void 0:cA.enableSlide),duration:(null===(lA=e.animation)||void 0===lA?void 0:lA.duration)||.3},e.animation),promptAnimation:xA({enabled:!0===(null===(dA=e.promptAnimation)||void 0===dA?void 0:dA.enabled),text:(null===(uA=e.promptAnimation)||void 0===uA?void 0:uA.text)||"Try me!",backgroundColor:(null===(pA=e.promptAnimation)||void 0===pA?void 0:pA.backgroundColor)||"linear-gradient(135deg, #7c3aed, #4f46e5)",textColor:(null===(hA=e.promptAnimation)||void 0===hA?void 0:hA.textColor)||"#ffffff",animationType:(null===(gA=e.promptAnimation)||void 0===gA?void 0:gA.animationType)||"bounce",showShimmer:!1!==(null===(mA=e.promptAnimation)||void 0===mA?void 0:mA.showShimmer),showPulseRings:!1!==(null===(fA=e.promptAnimation)||void 0===fA?void 0:fA.showPulseRings),hideAfterClick:!1!==(null===(BA=e.promptAnimation)||void 0===BA?void 0:BA.hideAfterClick),hideAfterSeconds:void 0!==(null===(vA=e.promptAnimation)||void 0===vA?void 0:vA.hideAfterSeconds)?e.promptAnimation.hideAfterSeconds:null,position:(null===(wA=e.promptAnimation)||void 0===wA?void 0:wA.position)||"top"},e.promptAnimation),behavior:xA({autoOpen:(null===(bA=e.behavior)||void 0===bA?void 0:bA.autoOpen)||!1,startOpen:(null===(yA=e.behavior)||void 0===yA?void 0:yA.startOpen)||!1,hidden:(null===(CA=e.behavior)||void 0===CA?void 0:CA.hidden)||!1,autoConnect:(null===(QA=e.behavior)||void 0===QA?void 0:QA.autoConnect)||!1,showWelcomeMessage:!1!==(null===(FA=e.behavior)||void 0===FA?void 0:FA.showWelcomeMessage),welcomeMessage:(null===(UA=e.behavior)||void 0===UA?void 0:UA.welcomeMessage)||"Hello! How can I help you today?",enableVoiceMode:void 0===(null===(SA=e.behavior)||void 0===SA?void 0:SA.enableVoiceMode)||e.behavior.enableVoiceMode,mode:(null===(EA=e.behavior)||void 0===EA?void 0:EA.mode)||"unified"},e.behavior),accessibility:xA({ariaLabel:(null===(IA=e.accessibility)||void 0===IA?void 0:IA.ariaLabel)||"Chat Assistant",ariaDescription:(null===(kA=e.accessibility)||void 0===kA?void 0:kA.ariaDescription)||"Click to open chat assistant",keyboardNavigation:!1!==(null===(TA=e.accessibility)||void 0===TA?void 0:TA.keyboardNavigation)},e.accessibility),customStyles:e.customStyles||"",useShadowDOM:!1!==e.useShadowDOM,variables:e.variables||{},forceConversationId:e.forceConversationId,visualAssistant:e.visualAssistant,onConversationStart:e.onConversationStart,onConversationEnd:e.onConversationEnd,onBargeIn:e.onBargeIn,onAudioStartPlaying:e.onAudioStartPlaying,onAudioStoppedPlaying:e.onAudioStoppedPlaying,onSubtitleDisplay:e.onSubtitleDisplay,onVoiceCallButtonClick:e.onVoiceCallButtonClick,primaryColor:MA},"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:A}=e;this.textInterface.finalizeStreaming(A)})}createShadowHost(){var e=document.getElementById("ttp-widget-shadow-host");e&&e.remove();var A=document.createElement("div");A.id="ttp-widget-shadow-host",A.style.cssText="position: fixed; z-index: 10000; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; overflow: visible;",this.shadowRoot=A.attachShadow({mode:"open"}),document.body.appendChild(A)}createRegularContainer(){var e=document.getElementById("ttp-widget-container");e&&e.remove();var A=document.createElement("div");A.id="ttp-widget-container",A.style.cssText="position: fixed; z-index: 10000; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; overflow: visible;",document.body.appendChild(A),this.regularContainer=A}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 A=this.generateWidgetHTML();if(this.config.useShadowDOM){var t="\n <style>".concat(e,"</style>\n ").concat(A,"\n ");this.shadowRoot.innerHTML=t}else this.injectStylesIntoHead(e),this.container.innerHTML=A;this.setupWidgetEvents();var n=this.shadowRoot.getElementById("text-chat-panel");if(n)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,n.classList.add("open"),this.hidePrompt();else this.showPrompt();else setTimeout(()=>{this.showPrompt()},100);setTimeout(()=>{this.isOpen?this.hidePrompt():this.showPrompt()},200)}injectStylesIntoHead(e){var A,t,n=document.getElementById("ttp-widget-styles");n&&n.remove();var o={small:50,medium:60,large:70,xl:80}[null===(A=this.config.button)||void 0===A?void 0:A.size]||60,i={small:20,medium:28,large:36,xl:44}[null===(t=this.config.icon)||void 0===t?void 0:t.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,A=this.config.button,t=this.config.icon,n=(this.config.panel,this.config.header),o=(this.config.animation,{small:50,medium:60,large:70,xl:80}[A.size]||60),i={small:20,medium:28,large:36,xl:44}[t.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,u=e=>{var A=this.config.language||"en";return(this.translations[A]||this.translations.en)[e]||e},p=e=>{var A,t=null===(A=this.config.tooltips)||void 0===A?void 0:A[e];return null!=t?t:{newChat:u("newChat"),back:u("back"),close:u("close"),mute:u("mute"),speaker:u("speaker"),endCall:u("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(n.mobileLabel||"Chat",'</span>\n <span class="ttp-mobile-fab__status">\n <span class="ttp-mobile-fab__dot"></span>\n ').concat(void 0!==n.onlineIndicatorText&&null!==n.onlineIndicatorText?n.onlineIndicatorText:u("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(n.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||u("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||u("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||u("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(n.backgroundColor||"#7C3AED"," !important; color: ").concat(n.textColor||"#FFFFFF",' !important;">\n <div>\n ').concat(n.showTitle?'<div class="header-title">'.concat(n.title,"</div>"):"",'\n <div class="header-status" style="color: ').concat(n.onlineIndicatorColor||"rgba(255,255,255,0.7)",' !important;">\n <span class="status-dot" style="background: ').concat(n.onlineIndicatorDotColor||"#10b981",' !important;"></span>\n <span>').concat(void 0!==n.onlineIndicatorText&&null!==n.onlineIndicatorText?n.onlineIndicatorText:u("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(p("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(p("back"),'" style="display: none;">\n <span style="font-size: 16px;">‹</span>\n </button>'):"","\n \n \x3c!-- Close Button --\x3e\n ").concat(n.showCloseButton?'<button class="header-icon close-btn" id="closeBtn" title="'+p("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"),A="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(A,'" 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,A=e.offset||{x:20,y:20},t="";return"top"===e.vertical?t+="top: ".concat(A.y,"px;"):"bottom"===e.vertical?t+="bottom: ".concat(A.y,"px;"):"center"===e.vertical&&(t+="top: 50%; transform: translateY(-50%);"),"left"===e.horizontal?t+="left: ".concat(A.x,"px;"):"right"===e.horizontal?t+="right: ".concat(A.x,"px;"):"center"===e.horizontal&&(t+="left: 50%; transform: translateX(-50%);"),t}generateIconHTML(e){var A=this.config.icon;switch(A.type){case"custom":return'<img src="'.concat(A.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(A.emoji,"</span>");case"text":return'<span style="font-size: '.concat(Math.floor(.6*e),'px; font-weight: bold; color: white;">').concat(A.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,A){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;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(t,';">\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 A="#7c3aed";if(e.backgroundColor&&e.backgroundColor.includes("gradient")){var t=e.backgroundColor.match(/#[0-9a-fA-F]{6}/);t&&(A=t[0])}else A=e.backgroundColor;return'\n <div class="prompt-pulse-rings" id="prompt-pulse-rings">\n <div class="prompt-pulse-ring" style="background-color: '.concat(A,'33;"></div>\n <div class="prompt-pulse-ring" style="background-color: ').concat(A,'1a;"></div>\n </div>\n ')}generateCSS(e,A,t){var n,o,i,r,a,s=this.config.button,c=this.config.icon,l=this.config.panel,d=this.config.header,u=(this.config.messages,this.config.animation),p=(null===(n=this.config.behavior)||void 0===n?void 0:n.mode)||"unified",h="unified"===p,g="unified"===p||"voice-only"===p,m="unified"===p||"text-only"===p,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(A,"px;\n height: ").concat(A,"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(u.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(u.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(A,"px;\n height: ").concat(A,"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(A,"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(A,"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(u.enableSlide?"transition: all ".concat(u.duration,"s ease;"):"","\n box-sizing: border-box;\n }\n \n #text-chat-panel.open {\n display: flex").concat(f,";\n ").concat(u.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,A=this;if(this.shadowRoot){this.setupPromptAnimation();var t=this.shadowRoot.getElementById("text-chat-button");t&&(t.onclick=()=>{this.config.promptAnimation.hideAfterClick&&this.hidePrompt(),this.togglePanel()});var n=this.shadowRoot.getElementById("closeBtn");n&&(n.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"),u=this.shadowRoot.getElementById("voiceInterface");c&&(c.onclick=()=>{var e,A,t;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!==(t=this.voiceInterface)&&void 0!==t&&t.resetConnectingState&&this.voiceInterface.resetConnectingState(),void this.showLanding();if(null!==(A=this.voiceInterface)&&void 0!==A&&A.isActive)this.showBackButtonWarning();else if(window.innerWidth<=768){var n=this.shadowRoot.getElementById("text-chat-panel");n&&(n.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=yA(function*(){if(A.isStartingCall)console.log("⚠️ Call already starting, ignoring duplicate click");else{if("function"==typeof A.config.onVoiceCallButtonClick)try{A.config.onVoiceCallButtonClick({timestamp:Date.now(),widgetState:"start"})}catch(e){console.error("Error in onVoiceCallButtonClick callback:",e)}A.isStartingCall=!0;try{var e,t;if(A.showVoice(),null!==(e=A.voiceInterface)&&void 0!==e&&e.isMobile){var n,o,i,r,a,s=(null===(n=A.shadowRoot)||void 0===n?void 0:n.getElementById("text-chat-panel"))||document.getElementById("text-chat-panel");s&&(s.classList.remove("open"),s.style.display="none");var c=null===(o=A.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=A.shadowRoot)||void 0===i?void 0:i.getElementById("text-chat-button"))||document.getElementById("text-chat-button");l&&(l.style.display="none");var d,u,p,h,g=null===(r=A.shadowRoot)||void 0===r?void 0:r.querySelector(".ttp-mobile-fab");g&&(g.style.display="none"),null!==(a=A.voiceInterface)&&void 0!==a&&a.createMobileMinimizedBar&&(A.voiceInterface.createMobileMinimizedBar(),A.voiceInterface.updateMobileStatus("connecting"),null===(d=(u=A.voiceInterface).startWaveformAnimation)||void 0===d||d.call(u),null===(p=(h=A.voiceInterface).startMobileCallTimerEarly)||void 0===p||p.call(h),yield new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))))}else{var m;null!==(m=A.voiceInterface)&&void 0!==m&&m.showConnectingState&&A.voiceInterface.showConnectingState()}if(yield A.startVoiceCall(),null!==(t=A.voiceInterface)&&void 0!==t&&t.isActive)console.log("✅ Voice call started successfully");else{var f,B,v;console.warn("⚠️ startVoiceCall() returned but call is not active");var w=null===(f=A.voiceInterface)||void 0===f||null===(f=f.shadowRoot)||void 0===f?void 0:f.getElementById("voiceIdleState"),b=!1;if(w&&"none"!==w.style.display){var y=w.querySelector(".voice-status-title");if(y){var C,x=y.textContent.trim(),Q=null===(C=A.voiceInterface)||void 0===C?void 0:C.t("domainNotValidated");console.log("🔍 Checking for domain error - titleText:",x,"domainErrorTitle:",Q),(x===Q||x.includes("Domain not")||x.includes("not whitelisted"))&&(b=!0,console.log("🚫 Domain error detected - staying on voice interface, NOT returning to landing"))}}if(b)return A.currentView="voice",A.showVoice(),void console.log("✅ Staying on voice interface with domain error displayed");console.log("⚠️ Not a domain error - returning to landing screen"),null!==(B=A.voiceInterface)&&void 0!==B&&B.resetConnectingState&&A.voiceInterface.resetConnectingState(),"unified"===((null===(v=A.config.behavior)||void 0===v?void 0:v.mode)||"unified")&&A.showLanding()}}catch(e){var F,U,S,E;if(e.isServerRejection||"ServerRejected"===e.name)return void(null!==(E=A.voiceInterface)&&void 0!==E&&E.resetConnectingState&&A.voiceInterface.resetConnectingState());if(console.error("❌ Failed to start voice call:",e),null!==(F=A.voiceInterface)&&void 0!==F&&F.resetConnectingState&&A.voiceInterface.resetConnectingState(),null!==(U=A.voiceInterface)&&void 0!==U&&U.isMobile){var I,k,T;document.getElementById("mobile-voice-call-bar-container")&&null!==(I=A.voiceInterface)&&void 0!==I&&I.removeMobileMinimizedBar&&A.voiceInterface.removeMobileMinimizedBar();var H=(null===(k=A.shadowRoot)||void 0===k?void 0:k.getElementById("text-chat-button"))||document.getElementById("text-chat-button");H&&(H.style.display="");var D=null===(T=A.shadowRoot)||void 0===T?void 0:T.querySelector(".ttp-mobile-fab");D&&(D.style.display="")}"Call cancelled by user"!==e.message&&A.showErrorToast(e.message||"Failed to start voice call. Please try again.","error"),"unified"===((null===(S=A.config.behavior)||void 0===S?void 0:S.mode)||"unified")&&A.showLanding()}finally{A.isStartingCall=!1}}}),function(){return o.apply(this,arguments)}),onSelectText:()=>this.showText()}),"text"===this.currentView?(l&&l.classList.remove("active"),d&&d.classList.add("active"),u&&u.classList.remove("active"),c&&"unified"===i&&c.classList.add("visible"),p&&(p.style.display="")):"voice"===this.currentView?(l&&l.classList.remove("active"),d&&d.classList.remove("active"),u&&u.classList.add("active"),c&&"unified"===i&&c.classList.add("visible"),p&&(p.style.display="none")):(this.currentView="landing",l&&l.classList.add("active"),d&&d.classList.remove("active"),u&&u.classList.remove("active"),c&&"unified"===i&&c.classList.remove("visible"))):"voice-only"===i?(u&&u.classList.add("active"),d&&d.classList.remove("active"),l&&l.classList.remove("active")):"text-only"===i&&(d&&d.classList.add("active"),u&&u.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 p=this.shadowRoot.getElementById("newChatBtn");p&&(p.onclick=()=>this.textInterface.startNewChat(),r&&(p.style.display="none")),this.setupMobileWidgetEvents(),this.config.accessibility.keyboardNavigation&&this.setupKeyboardNavigation()}}startNewChat(){this.textInterface.startNewChat()}showLanding(){var e;if(this.shadowRoot){var A=null===(e=this.voiceInterface)||void 0===e||null===(e=e.shadowRoot)||void 0===e?void 0:e.getElementById("voiceIdleState");if(A&&"none"!==A.style.display){var t=A.querySelector(".voice-status-title");if(t){var n,o=t.textContent.trim();if(o===(null===(n=this.voiceInterface)||void 0===n?void 0:n.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"),A=this.shadowRoot.getElementById("voiceInterface"),t=this.shadowRoot.getElementById("backBtn"),n=this.shadowRoot.getElementById("newChatBtn");e&&e.classList.remove("active"),A&&A.classList.remove("active"),this.textInterface.show();var o=this.config.behavior.mode||"unified";t&&"unified"===o&&t.classList.add("visible"),n&&(n.style.display="")}}showVoice(){if(this.shadowRoot){this.currentView="voice";var e=this.shadowRoot.getElementById("landingScreen"),A=this.shadowRoot.getElementById("textInterface"),t=this.shadowRoot.getElementById("voiceInterface"),n=this.shadowRoot.getElementById("backBtn"),o=this.shadowRoot.getElementById("newChatBtn");e&&e.classList.remove("active"),A&&A.classList.remove("active"),t&&t.classList.add("active");var i=this.config.behavior.mode||"unified";n&&"unified"===i&&n.classList.add("visible"),o&&(o.style.display="none")}}setupMobileWidgetEvents(){if(this.shadowRoot){var e=this.shadowRoot.querySelector(".ttp-mobile-fab"),A=this.shadowRoot.getElementById("ttpMobileLanding");if(e&&A){var t=()=>{A.classList.remove("active"),e.style.display="",this.isMobileLandingOpen=!1};e.onclick=()=>{this.config.promptAnimation.hideAfterClick&&this.hidePrompt();var t=this.shadowRoot.getElementById("ttpMobileLandingError");t&&(t.style.display="none"),e.style.display="none",A.classList.add("active"),this.isMobileLandingOpen=!0};var n=A.querySelector(".ttp-mobile-landing__close");n&&(n.onclick=t);var o=this.shadowRoot.getElementById("ttpMobileCallBtn");o&&(o.onclick=()=>{t();var e=this.shadowRoot.getElementById("mode-card-voice");e?e.click():this.showVoice()});var i=this.shadowRoot.getElementById("ttpMobileChatBtn");i&&(i.onclick=()=>{t();var A=this.shadowRoot.getElementById("text-chat-panel");A&&(A.classList.add("open"),this.isOpen=!0),e.style.display="none",this.showText()}),document.addEventListener("click",n=>{if(this.isMobileLandingOpen){var o=n.composedPath();o.includes(A)||o.includes(e)||t()}}),document.addEventListener("keydown",e=>{"Escape"===e.key&&this.isMobileLandingOpen&&t()})}}}setupKeyboardNavigation(){document.addEventListener("keydown",e=>{"Escape"===e.key&&this.isOpen&&this.togglePanel()})}setupPromptAnimation(){var e=this;if(this.shadowRoot){var A=this.config.promptAnimation||{},t=!0===A.enabled;if(console.log("🎨 setupPromptAnimation called:",{hasPromptConfig:!!this.config.promptAnimation,promptConfig:A,enabled:A.enabled,isPromptEnabled:t,isOpen:this.isOpen}),!t)return console.log("❌ Prompt disabled, hiding"),void this.hidePrompt();if(this.isOpen?this.hidePrompt():this.showPrompt(),!this.isOpen&&null!==A.hideAfterSeconds&&A.hideAfterSeconds>0&&(this.promptAutoHideTimer=setTimeout(()=>{this.hidePrompt()},1e3*A.hideAfterSeconds)),this.voiceInterface&&this.voiceInterface.sdk){var n=this.config.onConversationStart;this.config.onConversationStart=function(){var A=e.shadowRoot.getElementById("prompt-pulse-rings");A&&(A.style.display="none"),n&&n(...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 A=this.shadowRoot.getElementById("prompt-pulse-rings");A||this.shadowRoot===document||(A=document.getElementById("prompt-pulse-rings")),A&&(A.style.display="none",A.style.visibility="hidden")}}showPrompt(){if(this.shadowRoot){var e=this.config.promptAnimation||{},A=!1!==e.enabled;if(console.log("👁️ showPrompt called:",{hasPromptConfig:!!this.config.promptAnimation,promptConfig:e,enabled:e.enabled,isPromptEnabled:A,shadowRoot:!!this.shadowRoot}),A){var t=()=>{var A=this.shadowRoot.getElementById("prompt-bubble");if(A||this.shadowRoot===document||(A=document.getElementById("prompt-bubble")),A?(A.style.display="block",A.style.visibility="visible",A.style.opacity="1",console.log("✅ Prompt bubble shown:",A)):console.warn("⚠️ Prompt bubble not found in shadowRoot or document"),!1!==e.showPulseRings){var t=this.shadowRoot.getElementById("prompt-pulse-rings");t||this.shadowRoot===document||(t=document.getElementById("prompt-pulse-rings")),t&&(t.style.display="block",t.style.visibility="visible",t.style.opacity="1")}};t();var n=this.shadowRoot.getElementById("prompt-bubble"),o=!1!==e.showPulseRings?this.shadowRoot.getElementById("prompt-pulse-rings"):null;n&&(!1===e.showPulseRings||o)||(setTimeout(()=>{t()},100),setTimeout(()=>{t()},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 A=this.shadowRoot.querySelector(".ttp-mobile-fab");A&&(A.style.display="")}this.showPrompt(),setTimeout(()=>{var e,A=this.shadowRoot.getElementById("prompt-bubble");A&&"none"===A.style.display&&(A.style.display="block");var t=this.shadowRoot.getElementById("prompt-pulse-rings");t&&!1!==(null===(e=this.config.promptAnimation)||void 0===e?void 0:e.showPulseRings)&&"none"===t.style.display&&(t.style.display="block")},100)}this.isOpen&&!this.isActive&&this.config.behavior.autoConnect&&this.startChat()}}showErrorToast(e){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"error",t=document.createElement("div");t.className="widget-toast widget-toast-".concat(A),t.textContent=e;var n="error"===A?"#ef4444":"warning"===A?"#f59e0b":"#3b82f6";if(Object.assign(t.style,{position:"fixed",bottom:"20px",left:"50%",transform:"translateX(-50%)",backgroundColor:n,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(t),setTimeout(()=>{t.style.animation="slideDown 0.3s ease-out",setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},300)},4e3)}showMobileLandingError(e){if(this.shadowRoot){var A=this.shadowRoot.getElementById("ttpMobileLanding"),t=this.shadowRoot.querySelector(".ttp-mobile-fab"),n=this.shadowRoot.getElementById("ttpMobileLandingError");if(A&&n){var o=n.querySelector(".ttp-mobile-landing__error-text");o&&(o.textContent=e),n.style.display="flex",A.classList.add("active"),t&&(t.style.display="none"),this.isMobileLandingOpen=!0}}}showConfirmModal(e){var{title:A="Confirm",message:t="Are you sure?",confirmText:n="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(A,'</h3>\n <p style="margin: 0 0 24px 0; color: #64748b; font-size: 14px; line-height: 1.5;">').concat(t,'</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(n,"\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 yA(function*(){e.isActive=!0,e.textInterface.setActive(!0)})()}sendMessage(){var e=this;return yA(function*(){yield e.textInterface.sendMessage()})()}updateSendButtonState(){this.textInterface.updateSendButtonState()}showBackButtonWarning(){var e,A;null!==(e=this.voiceInterface)&&void 0!==e&&e.isActive&&null!==(A=this.voiceInterface.desktop)&&void 0!==A&&A.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",A=new URL(e,"wss://placeholder.com"),t=A.searchParams;t.delete("signed_token"),t.has("agentId")||t.append("agentId",this.config.agentId),this.config.appId&&!t.has("appId")&&t.append("appId",this.config.appId),!1!==this.config.demo&&t.append("demo","true");var n="".concat(A.origin).concat(A.pathname,"?").concat(t.toString());return"undefined"!=typeof __DEV__&&__DEV__&&console.log("[TTPAgentSDK] WebSocket URL:",n),n}addMessage(e,A){this.textInterface.addMessage(e,A)}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 A,t,n,o,i,r,a,s,c,l,d=xA({},this.config);e.panel&&(d.panel=xA(xA({},this.config.panel),e.panel)),e.voice&&(d.voice=xA(xA({},this.config.voice),e.voice),e.voice.micButtonHint&&(d.voice.micButtonHint=xA(xA({},null===(c=this.config.voice)||void 0===c?void 0:c.micButtonHint),e.voice.micButtonHint))),e.text&&(d.text=xA(xA({},this.config.text),e.text),e.text.sendButtonHint&&(d.text.sendButtonHint=xA(xA({},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=xA(xA({},this.config.button),e.button)),e.header&&(d.header=xA(xA({},this.config.header),e.header)),e.icon&&(d.icon=xA(xA({},this.config.icon),e.icon)),e.messages&&(d.messages=xA(xA({},this.config.messages),e.messages)),e.animation&&(d.animation=xA(xA({},this.config.animation),e.animation)),e.behavior&&(d.behavior=xA(xA({},this.config.behavior),e.behavior)),e.accessibility&&(d.accessibility=xA(xA({},this.config.accessibility),e.accessibility)),e.tooltips&&(d.tooltips=xA(xA({},this.config.tooltips),e.tooltips)),e.landing&&(d.landing=xA(xA({},this.config.landing),e.landing)),e.footer&&(d.footer=xA(xA({},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(A=>{["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(A)||(d[A]=e[A])}),null===(A=this.config)||void 0===A||A.language;var u=!1!==(null===(t=this.config)||void 0===t?void 0:t.useShadowDOM);if(this.config=this.mergeWithDefaults(d),!1!==this.config.useShadowDOM===u&&this.container){var p=document.getElementById("ttp-widget-shadow-host");p&&!this.config.useShadowDOM&&p.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 B=document.getElementById("ttp-widget-container");if(B&&B.remove(),!1===u){var v=document.getElementById("ttp-widget-styles");v&&v.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=xA(xA(xA({},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===(n=this.config.voice)||void 0===n?void 0:n.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 gA(b);var y=xA(xA(xA({},this.config),this.config.text),{},{language:w,translations:this.translations,shadowRoot:this.shadowRoot});if(this.textInterface=new BA(y,this.sdk),"unified"===((null===(s=this.config.behavior)||void 0===s?void 0:s.mode)||"unified")){var C=xA(xA({},this.config),{},{translations:this.translations,shadowRoot:this.shadowRoot});this.landingScreen=new vA(C)}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 A=document.getElementById("ttp-widget-container");A&&A.remove();var t=document.getElementById("ttp-widget-styles");t&&t.remove(),this.sdk&&this.sdk.destroy(),this.voiceInterface&&this.voiceInterface.destroy()}startVoiceCall(){var e=this;return yA(function*(){yield e.voiceInterface.startVoiceCall(),e._flushPendingClientTools()})()}endVoiceCall(){this.voiceInterface.endVoiceCall()}toggleMute(){this.voiceInterface.toggleMute()}toggleSpeaker(){this.voiceInterface.toggleSpeaker()}injectData(e){var A=arguments,t=this;return yA(function*(){var n,o=A.length>1&&void 0!==A[1]?A[1]:{};if(!e||!e.trim())throw console.warn("TTPChatWidget: Cannot inject empty data"),new Error("Cannot inject empty data");if(!t.voiceInterface||!t.voiceInterface.isActive)throw console.warn("TTPChatWidget: Cannot inject data - voice call is not active"),new Error("Voice call is not active");var i=null===(n=t.voiceInterface)||void 0===n?void 0:n.getVoiceSDK();if(!i)throw console.warn("TTPChatWidget: VoiceSDK not available"),new Error("VoiceSDK not available");try{return yield i.injectData(e,xA(xA({},o),{},{source:o.source||"widget_programmatic"}))}catch(e){throw e}})()}registerToolHandler(e,A){var t;return null!==(t=this.voiceInterface)&&void 0!==t&&t.sdk?this.voiceInterface.sdk.registerToolHandler(e,A):(this._pendingClientTools=this._pendingClientTools||[],this._pendingClientTools.push({name:e,handler:A}),console.warn("TTPChatWidget: Tool handler queued - voice interface SDK not ready yet"),this._flushPendingClientTools(),this)}unregisterToolHandler(e){var A;return null!==(A=this.voiceInterface)&&void 0!==A&&A.sdk?this.voiceInterface.sdk.unregisterToolHandler(e):(this._pendingClientTools&&(this._pendingClientTools=this._pendingClientTools.filter(A=>A.name!==e)),this)}hasToolHandler(e){var A;return!(null===(A=this.voiceInterface)||void 0===A||!A.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:A,handler:t}=e;this.voiceInterface.sdk.registerToolHandler(A,t)}),this._pendingClientTools=null,console.log("TTPChatWidget: Flushed pending client tools"))}registerClientTool(e,A){return this.registerToolHandler(e,A)}unregisterClientTool(e){return this.unregisterToolHandler(e)}hasClientTool(e){return this.hasToolHandler(e)}getRegisteredClientTools(){return this.getRegisteredTools()}}class UA{showProducts(e,A,t){throw new Error("EcommercePresenter.showProducts() not implemented")}hideProducts(){throw new Error("EcommercePresenter.hideProducts() not implemented")}onProductAdded(e,A){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 SA(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function EA(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?SA(Object(t),!0).forEach(function(A){IA(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):SA(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}function IA(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}class kA{constructor(e){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.product=e,this.compact=A.compact||!1,this.onAdd=A.onAdd||(()=>{}),this.onAddDisabled=A.onAddDisabled||(()=>!1),this.element=null;var t=e.sellBy||e.sell_by||"quantity";this.sellBy=t,this.step="weight"===t?.5:1,this.min="weight"===t?.5:1,this.unit="weight"===t?"kg":"";var n=e.cartQuantity||e.cart_quantity||0;this.inCart=n>0,this.amount=this.inCart?n: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,A){"weight"===this.sellBy?e.textContent="".concat(this.amount.toFixed(1)," ").concat(this.unit):e.textContent="".concat(this.amount),A.disabled=this.amount<=this.min,A.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 A=this.product,t="ILS"===A.currency?"₪":"$",n=this.inCart?"Update":"Add",o=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(A.imageUrl,'" alt="').concat(A.name,'" onerror="this.style.display=\'none\'" />\n </div>\n <div class="ttp-product-info">\n <div class="ttp-product-name">').concat(A.name,'</div>\n <div class="ttp-product-meta">').concat(A.unit," · ").concat(A.brand,'</div>\n </div>\n <div class="ttp-product-action">\n <div class="ttp-product-price">').concat(t).concat(A.price.toFixed(2),"</div>\n ").concat(A.inStock?'<button class="'.concat(o,'">').concat(n,"</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(A.imageUrl,'" alt="').concat(A.name,'" onerror="this.style.display=\'none\'" />\n ').concat(A.inStock?"":'<div class="ttp-stock-badge">Out of stock</div>','\n </div>\n <div class="ttp-product-details">\n <div class="ttp-product-name">').concat(A.name,'</div>\n <div class="ttp-product-meta">').concat(A.unit,'</div>\n <div class="ttp-product-footer">\n <span class="ttp-product-price">').concat(t).concat(A.price.toFixed(2),"</span>\n ").concat(A.inStock?'<button class="'.concat(o,'">').concat(n,"</button>"):'<span class="ttp-out-of-stock">Out of stock</span>',"\n ").concat(this._generateStepperHTML(),"\n </div>\n </div>\n ");var i=e.querySelector(".ttp-add-btn");i&&i.addEventListener("click",A=>{if(A.stopPropagation(),!this.onAddDisabled()){i.textContent="✓",i.classList.add("ttp-added"),i.disabled=!0;var t=EA(EA({},this.product),{},{selectedAmount:this.amount,sellBy:this.sellBy});this.onAdd(e,t),this.inCart=!0,setTimeout(()=>{i.textContent="Update",i.classList.remove("ttp-added"),i.classList.add("ttp-update-btn"),i.disabled=!1},1500)}});var r=e.querySelector(".ttp-stepper-minus"),a=e.querySelector(".ttp-stepper-plus"),s=e.querySelector(".ttp-stepper-value");return r&&a&&s&&(r.addEventListener("click",e=>{e.stopPropagation(),this.amount>this.min&&(this.amount=Math.round(10*(this.amount-this.step))/10,this._updateStepperDisplay(s,r))}),a.addEventListener("click",e=>{e.stopPropagation(),this.amount=Math.round(10*(this.amount+this.step))/10,this._updateStepperDisplay(s,r)}),this._updateStepperDisplay(s,r)),this.element=e,e}}class TA{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.element=null}show(e,A,t){this.hide();var n=document.createElement("div");n.className="ttp-product-picker",n.setAttribute("data-layout",t);var o=document.createElement("div");o.className="ttp-picker-header",o.innerHTML='\n <span class="ttp-picker-title">'.concat(A,'</span>\n <button class="ttp-picker-close">✕</button>\n '),o.querySelector(".ttp-picker-close").addEventListener("click",()=>{this.hide(),this.onClose()}),n.appendChild(o);var i=document.createElement("div");return i.className="cards"===t?"ttp-products-horizontal":"ttp-products-vertical",e.forEach(e=>{var A=new kA(e,{compact:"list"===t,onAdd:(e,A)=>this.onProductAdd(e,A),onAddDisabled:()=>this.onAddDisabled()});i.appendChild(A.render())}),n.appendChild(i),this.element=n,n}hide(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null}}class HA{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.onUndo=e.onUndo||(()=>{}),this.element=null,this.dismissTimer=null}show(e){this.hide();var A=document.createElement("div");return A.className="ttp-cart-toast",A.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 '),A.querySelector(".ttp-toast-undo").addEventListener("click",()=>{this.onUndo(e),this.hide()}),this.element=A,this.dismissTimer=setTimeout(()=>this.hide(),3e3),A}hide(){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;setTimeout(()=>{e&&e.parentNode&&e.parentNode.removeChild(e)},300),this.element=null}}}class DA{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",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,A,t){this.itemCount=e,this.total=A,t&&(this.currency=t),this.element&&(this.element.style.display=e>0?"flex":"none",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(A.toFixed(2)))}}class MA{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"),A=()=>{this.canvas.width=window.innerWidth,this.canvas.height=window.innerHeight};A(),window.addEventListener("resize",A);var t=()=>{if(this.canvas&&e){for(var A of(e.clearRect(0,0,this.canvas.width,this.canvas.height),this.trailParticles=this.trailParticles.filter(e=>e.life>0),this.trailParticles))A.life-=.025,A.x+=A.vx,A.y+=A.vy,A.vx*=.96,A.vy*=.96,A.r*=.97,e.beginPath(),e.arc(A.x,A.y,A.r,0,2*Math.PI),e.fillStyle="rgba(".concat(A.color,", ").concat(.6*A.life,")"),e.fill();this.rafId=requestAnimationFrame(t)}};this.rafId=requestAnimationFrame(t)}}_emitTrailAt(e,A,t){for(var n=0;n<3;n++){var o=Math.random()*Math.PI*2,i=.5+2*Math.random(),r=3*(1-t);this.trailParticles.push({x:e+20*(Math.random()-.5)*r,y:A+10*(Math.random()-.5),vx:Math.cos(o)*i*r,vy:Math.sin(o)*i*.5,r:2+4*Math.random()*(1-t),life:.6+.4*Math.random(),color:Math.random()>.5?"139, 92, 246":"236, 72, 153"})}}_emitImpactBurst(e,A){for(var t=0;t<16;t++){var n=t/16*Math.PI*2,o=2+4*Math.random();this.trailParticles.push({x:e,y:A,vx:Math.cos(n)*o,vy:Math.sin(n)*o,r:2+3*Math.random(),life:.8+.2*Math.random(),color:t%3==0?"250, 204, 21":t%3==1?"74, 222, 128":"139, 92, 246"})}}triggerFly(e,A,t){var n;if(null===this.animatingId){var o=this.getCartTarget();if(e&&o){var i=e.getBoundingClientRect(),r=o.getBoundingClientRect(),a=r.left+r.width/2,s=r.top+r.height/2;this.animatingId=null!==(n=null==A?void 0:A.id)&&void 0!==n?n:"fly";var c=e=>{var A=document.createElement("div");A.style.cssText="\n position: fixed;\n z-index: 2147483647;\n left: ".concat(i.left,"px;\n top: ").concat(i.top,"px;\n width: ").concat(i.width,"px;\n height: ").concat(i.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 ",A.appendChild(e),document.body.appendChild(A);var n=i.left,o=i.top,r=i.width,c=i.height,l=n+r/2,d=o+c/2,u=performance.now(),p=n=>{var o=n-u,i=Math.min(o/680,1),h=i*i,g=l+(a-l)*h,m=d+i*i*i*(s-d),f=Math.max(1-.92*h,.08),B=r*f,v=c*f;A.style.left="".concat(g-B/2,"px"),A.style.top="".concat(m-v/2,"px"),A.style.width="".concat(B,"px"),A.style.height="".concat(v,"px");var w=55*h,b=1-.5*h,y=12*h,C=8*Math.sin(i*Math.PI*3)*h;e.style.transform="\n rotateX(".concat(w,"deg)\n rotateY(").concat(y,"deg)\n rotateZ(").concat(C,"deg)\n scaleX(").concat(b,")\n "),e.style.opacity="".concat(i<.7?1:1-(i-.7)/.3);var x=.4*(1-h);A.style.boxShadow="\n 0 ".concat(12*(1-h),"px ").concat(32*(1-h),"px rgba(0,0,0,").concat(x,"),\n 0 0 ").concat(20*h,"px rgba(139,92,246,").concat(.4*h,")\n "),i<.9&&this._emitTrailAt(g,m+.3*v,i),i<1?requestAnimationFrame(p):(A.remove(),this.animatingId=null,this.onCartBump(),this.onRipple(),this._emitImpactBurst(a,s),t&&t())};this._ensureCanvas(),requestAnimationFrame(p)};q()(e,{useCORS:!0,allowTaint:!1,backgroundColor:"#ffffff",scale:1,logging:!1}).then(A=>{e.style.opacity="0",e.style.transition="opacity 0.08s ease";var t=document.createElement("img");t.src=A.toDataURL("image/png"),t.alt="",c(t)}).catch(()=>{e.style.opacity="0",e.style.transition="opacity 0.08s ease";var A=e.cloneNode(!0);A.querySelectorAll("button").forEach(e=>{e.style.pointerEvents="none",e.style.cursor="default"}),c(A)})}else t&&t()}}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 LA extends UA{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 MA({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>this._triggerCartBump(),onRipple:()=>this._triggerRipple()}),this.productPicker=new TA({onProductAdd:(e,A)=>this._handleProductAddWithFly(e,A),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>this._handlePickerClose()}),this.cartToast=new HA({onUndo:e=>this.onProductUndo(e)}),this.cartSummary=new DA,this.container=document.createElement("div"),this.container.id="ttpEcommerceArea",this.container.className="ttp-ecommerce-area",this.container.appendChild(this.cartSummary.render());var A=document.createElement("div");A.id="ttpDesktopFlyTarget",A.className="ttp-desktop-fly-target",A.setAttribute("aria-hidden","true"),this.container.appendChild(A),this.voiceActiveState=null,this.isAttached=!1,this._cartBump=!1,this._ripple=!1}_getCartTarget(){var e,A,t=null===(e=this.cartSummary.element)||void 0===e?void 0:e.querySelector(".ttp-cart-icon");if(t){var n=t.getBoundingClientRect();if(n.width>0&&n.height>0)return t}return(null===(A=this.container)||void 0===A?void 0:A.querySelector("#ttpDesktopFlyTarget"))||null}_handleProductAddWithFly(e,A){var t;this.flyToCart.isAnimating||(null===(t=this.productPicker.element)||void 0===t||t.classList.add("ttp-products-animating"),this.flyToCart.triggerFly(e,A,()=>{var e;null===(e=this.productPicker.element)||void 0===e||e.classList.remove("ttp-products-animating"),this.onProductAdd(A)}))}_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=this._cartBump?"scale(1.15)":"scale(1)",e.style.transition="transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1)")}}_updateRippleStyles(){if(this.cartSummary.element&&this._ripple){var e=this.cartSummary.element.querySelector(".ttp-fly-ripple");e&&e.remove();var A=document.createElement("div");A.className="ttp-fly-ripple",this.cartSummary.element.style.position="relative",this.cartSummary.element.appendChild(A),setTimeout(()=>A.remove(),600)}}showProducts(e,A,t){this._ensureReady(),this._switchToCompactMode(),this._setContainerMode("products"),this.productPicker.hide();var n=t||(e.length<=4?"cards":"list"),o=this.productPicker.show(e,A,n);this.container.insertBefore(o,this.container.firstChild),this._expandPanelToFit(e.length,n)}hideProducts(){this.productPicker.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this._setContainerMode("summary")}onProductAdded(e,A){this._ensureReady(),this.cartSummary.update(A.itemCount,A.total,A.currency);var t=this.cartToast.show(e,"added");this.container.insertBefore(t,this.container.firstChild),setTimeout(()=>this.hideProducts(),500)}updateCart(e){this._ensureReady(),this.cartSummary.update(e.itemCount,e.total,e.currency)}destroy(){this.flyToCart&&this.flyToCart.destroy(),this.productPicker.hide(),this.cartToast.hide(),this._shrinkPanel(),this._restoreFullVoiceMode(),this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-products-visible"),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 * 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.desktop-conversation-panel {\n flex: 1 1 0 !important;\n min-height: 0 !important;\n display: flex !important;\n flex-direction: column !important;\n}\n\n.desktop-conversation-panel .live-transcript-collapsed {\n flex: 1 1 0 !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;\n flex-direction: column;\n width: 100%;\n flex: 1 1 0;\n min-height: 0;\n position: relative;\n overflow-x: hidden;\n overflow-y: auto;\n position: relative;\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 12px;\n overflow: hidden;\n animation: ttpSlideUp 0.25s ease;\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\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;\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;\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;\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n min-height: 0;\n}\n\n/* ═══════════════════════════════════════\n PRODUCT CARD (horizontal)\n ═══════════════════════════════════════ */\n\n.ttp-product-card {\n width: 140px;\n flex-shrink: 0;\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;\n background: #f8fafc;\n display: flex;\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-meta {\n font-size: 10px;\n color: #94a3b8;\n margin-top: 2px;\n}\n\n.ttp-product-footer {\n display: flex;\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;\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; height: 40px;\n border-radius: 8px;\n background: #f8fafc;\n display: flex;\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;\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.ttp-cart-toast {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n margin: 0 12px;\n background: #f0fdf4;\n border-radius: 12px;\n border: 1px solid #bbf7d0;\n animation: ttpToastIn 0.25s ease;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n z-index: 10;\n box-shadow: 0 4px 12px rgba(0,0,0,0.1);\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; height: 24px;\n border-radius: 50%;\n background: #10b981;\n color: #fff;\n display: flex;\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;\n justify-content: space-between;\n align-items: center;\n padding: 8px 14px;\n margin: 4px 12px 8px;\n background: #f8fafc;\n border-radius: 10px;\n border: 1px solid #e2e8f0;\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;\n align-items: center;\n gap: 2px;\n margin: 4px 0;\n}\n\n.ttp-stepper-btn {\n width: 24px;\n height: 24px;\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;\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;\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;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n ",A=this.shadowRoot.querySelector("style");if(A)A.textContent+="\n"+e;else{var t=document.createElement("style");t.textContent=e,this.shadowRoot.appendChild(t)}}}_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"),A=this.voiceActiveState.querySelector(".compact-voice-section")||e;A&&A.nextSibling?this.voiceActiveState.insertBefore(this.container,A.nextSibling):this.voiceActiveState.appendChild(this.container),this.isAttached=!0}else console.warn("[DesktopPresenter] #voiceActiveState not found — will retry on next message")}_setContainerMode(e){"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="0 0 auto",this.container.style.minHeight="",this.container.style.overflowY="",this.voiceActiveState&&this.voiceActiveState.classList.remove("ttp-products-visible")),this.cartSummary.element&&(this.cartSummary.element.style.display="summary"===e&&this.cartSummary.itemCount>0?"flex":"none")}_expandPanelToFit(e,A){if(this.shadowRoot){var t=this.shadowRoot.getElementById("text-chat-panel");if(t){var n;if(n="cards"===A?360:Math.min(64*e+20,500),e>2){var o=Math.ceil(224)+20;n=Math.max(n,o)}var i=272+n,r=e>2?700:450,a=Math.min(Math.max(i,r),850);t.classList.add("ttp-panel-expanded"),t.style.height="".concat(a,"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"),A=this.shadowRoot.getElementById("compactVoiceSection");e&&(e.style.display="none"),A&&(A.style.display="flex")}}_restoreFullVoiceMode(){if(this.shadowRoot){var e=this.shadowRoot.getElementById("desktopVoiceSection"),A=this.shadowRoot.getElementById("compactVoiceSection");e&&A&&(e.style.display="",A.style.display="none")}}_handlePickerClose(){this.hideProducts()}}function PA(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function KA(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?PA(Object(t),!0).forEach(function(A){_A(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):PA(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}function _A(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}class RA{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.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,A){this.hide(),e&&0!==e.length&&(this._normalizeProducts(e),this.current=0,this._injectStyles(),this._buildDOM(A),this._buildCards(),this._buildDots(),this._setupDragEvents(),this._updateWheel(),document.body.appendChild(this.container),this._positionAboveMobileBar())}hide(){if(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._removeEventListeners(),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null;var e=document.getElementById("ttpCarouselToast");e&&e.remove();var A=document.getElementById("ttp-mobile-carousel-styles");A&&A.remove()}showToast(e,A){var t=document.getElementById("ttpCarouselToast");t&&t.remove();var n=document.createElement("div");n.id="ttpCarouselToast",n.className="ttp-carousel-toast";var o=A?'<div class="ttp-carousel-toast__cart">'.concat(A.itemCount," item").concat(1!==A.itemCount?"s":""," · ").concat(A.currency).concat(A.total.toFixed(2),"</div>"):"";n.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 "),n.style.setProperty("--ttp-carousel-primary",this.primaryColor),document.body.appendChild(n);var i=document.getElementById("mobile-voice-call-bar-container"),r=document.getElementById("ttpMobileCartSummary");n.style.bottom=r?"".concat(parseInt(r.style.bottom)+r.offsetHeight+8,"px"):i?"".concat(i.offsetHeight+12,"px"):"100px",setTimeout(()=>{n.classList.add("ttp-carousel-toast--hiding"),setTimeout(()=>n.remove(),300)},3e3)}_normalizeProducts(e){this.products=e.map(e=>KA(KA({},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 A="weight"===e.sellBy?.5:1;return e.cartQuantity>0?e.cartQuantity:A}),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 A=document.createElement("div");A.className="ttp-carousel-header",A.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 '),A.querySelector(".ttp-carousel-close").addEventListener("click",()=>{this.hide(),this.onClose()});var t=document.createElement("div");t.className="ttp-carousel-area",this.wheel=document.createElement("div"),this.wheel.className="ttp-carousel-wheel",t.appendChild(this.wheel),this.dotsEl=document.createElement("div"),this.dotsEl.className="ttp-carousel-dots",this.container.appendChild(A),this.container.appendChild(t),this.container.appendChild(this.dotsEl)}_buildCards(){this.products.forEach((e,A)=>{var t=document.createElement("div");t.className="ttp-carousel-card"+(e.inStock?"":" ttp-carousel-card--oos"),t.dataset.index=A;var n="ILS"===e.currency?"₪":"$",o="weight"===this.sellByModes[A]?"".concat(this.amounts[A].toFixed(1)," kg"):"".concat(this.amounts[A]),i=e.cartQuantity>0;t.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(n).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(A,'" ').concat(e.inStock?"":"disabled",'>−</button>\n <span class="ttp-carousel-card__qty-val" id="ttpCQty').concat(A,'">').concat(o,'</span>\n <button class="ttp-carousel-card__qty-btn ttp-carousel-plus" data-idx="').concat(A,'" ').concat(e.inStock?"":"disabled",'>+</button>\n </div>\n <button class="ttp-carousel-card__add-btn').concat(i?" ttp-carousel-card__add-btn--update":"",'" data-idx="').concat(A,'" ').concat(e.inStock?"":"disabled",">\n ").concat(e.inStock?i?"Update":"Add to Cart":"Unavailable","\n </button>\n </div>\n "),t.style.transform="rotateY(".concat(A*this.anglePerCard,"deg) translateZ(").concat(this.radius,"px)"),this.wheel.appendChild(t)}),this._setupCardHandlers()}_setupCardHandlers(){var e=this.container.querySelector(".ttp-carousel-area");if(e){var A=null;e.addEventListener("touchstart",e=>{A={x:e.touches[0].clientX,y:e.touches[0].clientY}},{passive:!0}),e.addEventListener("touchend",e=>{if(A&&!this.swiped){var t=e.changedTouches[0],n=Math.abs(t.clientX-A.x),o=Math.abs(t.clientY-A.y);A=null,n>15||o>15||(e.preventDefault(),this._handleTapAt(t.clientX,t.clientY))}else A=null}),e.addEventListener("click",e=>{var A=e.target,t=A.closest(".ttp-carousel-card");if(t&&parseInt(t.dataset.index)===this.current){var n=A.closest(".ttp-carousel-minus"),o=A.closest(".ttp-carousel-plus"),i=A.closest(".ttp-carousel-card__add-btn");n&&!n.disabled?(e.stopPropagation(),this._handleMinus()):o&&!o.disabled?(e.stopPropagation(),this._handlePlus()):i&&!i.disabled&&(e.stopPropagation(),this._handleAdd())}})}}_handleTapAt(e,A){var t=this.wheel.querySelectorAll(".ttp-carousel-card")[this.current];if(t){var n=t.querySelector(".ttp-carousel-minus"),o=t.querySelector(".ttp-carousel-plus"),i=t.querySelector(".ttp-carousel-card__add-btn");!this._hitTest(e,A,n)||null!=n&&n.disabled?!this._hitTest(e,A,o)||null!=o&&o.disabled?!this._hitTest(e,A,i)||null!=i&&i.disabled||this._handleAdd():this._handlePlus():this._handleMinus()}}_hitTest(e,A,t){if(!t)return!1;var n=t.getBoundingClientRect();return e>=n.left&&e<=n.right&&A>=n.top&&A<=n.bottom}_handleMinus(){var e=this.current,A=this.sellByModes[e],t="weight"===A?.5:1,n="weight"===A?.5:1;this.amounts[e]>t&&(this.amounts[e]=Math.round(10*(this.amounts[e]-n))/10,this._refreshStepper(e))}_handlePlus(){var e=this.current,A="weight"===this.sellByModes[e]?.5:1;this.amounts[e]=Math.round(10*(this.amounts[e]+A))/10,this._refreshStepper(e)}_handleAdd(){var e=this.current,A=this.products[e];if(A.inStock&&!this.onAddDisabled()){var t=this.wheel.querySelectorAll(".ttp-carousel-card")[e],n=null==t?void 0:t.querySelector(".ttp-carousel-card__add-btn");n&&(n.textContent="✓ Added!",n.classList.add("ttp-carousel-card__add-btn--added"),n.disabled=!0);var o=KA(KA({},A),{},{selectedAmount:this.amounts[e],sellBy:this.sellByModes[e]});this.onProductAdd(t,o),setTimeout(()=>this.hide(),800)}}_refreshStepper(e){var A=this.sellByModes[e],t="weight"===A?.5:1,n=this.container.querySelector("#ttpCQty".concat(e)),o=this.container.querySelector('.ttp-carousel-minus[data-idx="'.concat(e,'"]'));n&&(n.textContent="weight"===A?"".concat(this.amounts[e].toFixed(1)," kg"):"".concat(this.amounts[e])),o&&(o.disabled=this.amounts[e]<=t)}_buildDots(){this.products.length<=1||this.products.forEach((e,A)=>{var t=document.createElement("div");t.className="ttp-carousel-dot",t.addEventListener("click",()=>this.goTo(A)),this.dotsEl.appendChild(t)})}_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((A,t)=>{for(var n=t*this.anglePerCard+e;n>180;)n-=360;for(;n<-180;)n+=360;Math.abs(n)>90?(A.style.visibility="hidden",A.style.opacity="0"):(A.style.visibility="visible",A.style.opacity=this.products[t].inStock?"1":"0.7")}),this.dotsEl.querySelectorAll(".ttp-carousel-dot").forEach((e,A)=>e.classList.toggle("ttp-carousel-dot--active",A===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 A=e.touches[0].clientX-this.startX;Math.abs(A)>this.dragThreshold&&(this.goTo(this.current+(A>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 A=e.clientX-this.startX;Math.abs(A)>this.dragThreshold&&(this.goTo(this.current+(A>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 A=e.getBoundingClientRect();this.container.style.bottom="".concat(window.innerHeight-A.top+8+50,"px")}}})}_hexToRgba(e,A){var t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return"rgba(".concat(t,", ").concat(n,", ").concat(o,", ").concat(A,")")}_darkenHex(e,A){var t=Math.max(0,parseInt(e.slice(1,3),16)-A),n=Math.max(0,parseInt(e.slice(3,5),16)-A),o=Math.max(0,parseInt(e.slice(5,7),16)-A);return"#".concat(t.toString(16).padStart(2,"0")).concat(n.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@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-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 OA extends UA{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 MA({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>this._triggerCartBump(),onRipple:()=>{}})}_getCartTarget(){var e=document.getElementById("mobile-voice-call-bar-container");if(!e)return null;var A=e.querySelector("[data-ttp-fly-target]");if(A){var t=A.getBoundingClientRect();if(t.width>0&&t.height>0)return A}var n=e.querySelector("#ttpFlyToCartTarget");if(n){var o=n.getBoundingClientRect();if(o.width>0&&o.height>0)return n}return null}_triggerCartBump(){var e=document.getElementById("mobileCartRow");e&&(e.style.transform="scale(1.08)",e.style.transition="transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1)",setTimeout(()=>{e.style.transform=""},450))}showProducts(e,A,t){this.carousel||(this.carousel=new RA({primaryColor:this.primaryColor,onProductAdd:(e,A)=>this._handleProductAddWithFly(e,A),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>{}})),this.carousel.show(e,A)}_handleProductAddWithFly(e,A){var t;this.flyToCart.isAnimating||(null===(t=this.carousel)||void 0===t||null===(t=t.container)||void 0===t||t.classList.add("ttp-products-animating"),this.flyToCart.triggerFly(e,A,()=>{var e;null===(e=this.carousel)||void 0===e||null===(e=e.container)||void 0===e||e.classList.remove("ttp-products-animating"),this.onProductAdd(A)}))}hideProducts(){this.carousel&&this.carousel.hide()}onProductAdded(e,A){this.carousel&&this.carousel.container&&this.carousel.showToast(e.name,A),this._updateMobileCartRow(A)}updateCart(e){this._updateMobileCartRow(e)}destroy(){this.flyToCart&&this.flyToCart.destroy(),this.carousel&&(this.carousel.destroy(),this.carousel=null)}_updateMobileCartRow(e){var{itemCount:A,total:t,currency:n}=e,o=document.getElementById("mobileCartRow"),i=document.getElementById("mobileCartText");if(o&&i)if(A<=0)o.style.display="none";else{var r="".concat(A," item").concat(1!==A?"s":"");i.textContent="".concat(r," · ").concat(n).concat(t.toFixed(2)),o.style.display="flex"}}}class VA{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 OA({primaryColor:this.primaryColor,onProductAdd:e=>this._handleProductAdd(e)}):new LA({shadowRoot:this.shadowRoot,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:A,title:t,layout:n}=e;A&&0!==A.length?(this.currencySymbol=this._resolveCurrency(A[0].currency),this.presenter.showProducts(A,t,n)):console.warn("[EcommerceManager] show_products with no products")}handleCartUpdated(e){var{product:A,action:t,cartTotal:n,cartItemCount:o}=e;if(void 0!==n&&void 0!==o){var i=this._resolveCurrency(e.currency||("₪"===this.currencySymbol?"ILS":"USD"));this.cartItemCount=o,this.cartTotal=n,this.currencySymbol=i,this.presenter.updateCart(this._buildCartInfo())}"added"===t&&A&&(this.presenter.onProductAdded(A,this._buildCartInfo()),setTimeout(()=>this.presenter.hideProducts(),500))}handleMessage(e){var A=e.t||e.type;"show_products"===A?this.handleShowProducts(e):"cart_updated"===A&&this.handleCartUpdated(e)}_handleProductAdd(e){var A=e.price||0,t=e.selectedAmount||1,n=this._resolveCurrency(e.currency);this.cartItemCount+=1,this.cartTotal+=A*t,this.currencySymbol=n,this.presenter.onProductAdded(e,this._buildCartInfo()),this.onProductSelected(e)}hideProducts(){this.presenter.hideProducts()}destroy(){this._presenter&&(this._presenter.destroy(),this._presenter=null)}}function NA(e,A){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);A&&(n=n.filter(function(A){return Object.getOwnPropertyDescriptor(e,A).enumerable})),t.push.apply(t,n)}return t}function GA(e,A,t){return(A=function(e){var A=function(e){if("object"!=typeof e||!e)return e;var A=e[Symbol.toPrimitive];if(void 0!==A){var t=A.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof A?A:A+""}(A))in e?Object.defineProperty(e,A,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[A]=t,e}function WA(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function jA(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){WA(i,n,o,r,a,"next",e)}function a(e){WA(i,n,o,r,a,"throw",e)}r(void 0)})}}class zA{constructor(){var e,A,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.partnerConfig=t.partner||{},this.cartConfig=t.cart||{},this.widget=new FA(t),this.ecommerce=new VA({shadowRoot:this.widget.shadowRoot,primaryColor:(null===(e=this.widget.config)||void 0===e||null===(e=e.colors)||void 0===e?void 0:e.primary)||(null===(A=t.colors)||void 0===A?void 0:A.primary)||"#3b82f6",onProductSelected:e=>this._handleProductSelected(e),onProductDeselected:e=>this._handleProductDeselected(e)}),this._hookIntoVoicePipeline(),this._hookCallEnd(),this._registerEcommerceTools(),this._exposeTestAPI()}_hookIntoVoicePipeline(){var e,A=null===(e=this.widget.voiceInterface)||void 0===e?void 0:e.sdk;if(A){A.onUnsupportedAction=null;var t=this,n=A.connect.bind(A);A.connect=jA(function*(){yield n(),this.voiceSDK&&(this.voiceSDK.on("message",e=>{var A=e.t||e.type;"show_products"===A?t.ecommerce.handleShowProducts(e):"cart_updated"===A?t._handleCartUpdatedFromServer(e):"add_to_store_cart"===A?t._handleAddToStoreCart(e):"get_store_cart"===A&&t._handleGetStoreCart()}),console.log("[TTPEcommerceWidget] E-commerce message listener attached"))})}else console.warn("[TTPEcommerceWidget] AgentSDK not available yet")}_hookCallEnd(){var e=this.widget.voiceInterface;if(e){var A=e.config.onCallEnd,t=this.ecommerce;e.config.onCallEnd=function(){t.hideProducts(),A&&A()}}}_registerEcommerceTools(){var e=this;this.cartConfig.addToCartFn&&this.widget.registerToolHandler("addToCart",function(){var A=jA(function*(A){try{var t=yield e.cartConfig.addToCartFn(A.productId,A.quantity||1);return function(e){for(var A=1;A<arguments.length;A++){var t=null!=arguments[A]?arguments[A]:{};A%2?NA(Object(t),!0).forEach(function(A){GA(e,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):NA(Object(t)).forEach(function(A){Object.defineProperty(e,A,Object.getOwnPropertyDescriptor(t,A))})}return e}({success:!0,productName:A.productName},t)}catch(e){return{success:!1,error:e.message}}});return function(e){return A.apply(this,arguments)}}()),this.cartConfig.getCartFn&&this.widget.registerToolHandler("getCart",jA(function*(){try{return yield e.cartConfig.getCartFn()}catch(e){return{items:[],total:0,count:0,error:e.message}}}))}_handleGetStoreCart(){var e=this;return jA(function*(){try{var A=yield fetch("/cart.js",{method:"GET",headers:{"Content-Type":"application/json"}});if(!A.ok)return console.error("[TTP Ecommerce] Failed to fetch /cart.js:",A.status),void e._sendToVoiceSDK({t:"cart_state_result",success:!1,error:"Failed to fetch cart: HTTP ".concat(A.status)});var t=yield A.json();e._sendToVoiceSDK({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("[TTP Ecommerce] Cart state sent: ".concat(t.item_count," items, ").concat(t.currency," ").concat((t.total_price/100).toFixed(2)))}catch(A){console.error("[TTP Ecommerce] Error fetching cart:",A),e._sendToVoiceSDK({t:"cart_state_result",success:!1,error:A.message||"Failed to fetch cart"})}})()}_handleAddToStoreCart(e){var A=this;return jA(function*(){var{variantId:t,quantity:n}=e,o="";try{var i=yield fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:parseInt(t),quantity:n||1}]})});if(!i.ok){var r=yield i.text();return console.error("[TTP Ecommerce] /cart/add.js failed:",i.status,r),void A._sendToVoiceSDK({t:"cart_add_result",success:!1,error:"Cart add failed: HTTP ".concat(i.status),productName:o||String(t),quantity:n||1})}var a=yield i.json();a.items&&a.items.length>0&&(o=a.items[0].title||"");var s=yield fetch("/cart.js"),c=yield s.json(),l=!1;try{l=A._refreshCartCount(c.item_count)}catch(e){console.warn("[TTP Ecommerce] Cart count refresh failed (non-critical):",e)}A._handleCartUpdatedFromServer({action:"added",product:{name:o,id:t},cartTotal:c.total_price/100,cartItemCount:c.item_count,currency:c.currency}),A._sendToVoiceSDK({t:"cart_add_result",success:!0,cartRefreshed:l,productName:o,quantity:n||1,cartTotal:c.total_price,cartItemCount:c.item_count,currency:c.currency}),console.log("[TTP Ecommerce] Cart add result sent: ".concat(o,", refreshed=").concat(l,", ").concat(c.item_count," items"))}catch(e){console.error("[TTP Ecommerce] Error in _handleAddToStoreCart:",e),A._sendToVoiceSDK({t:"cart_add_result",success:!1,error:e.message||"Failed to add to cart",productName:o||String(t),quantity:n||1})}})()}_refreshCartCount(e){var A=!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(t=>{document.querySelectorAll(t).forEach(t=>{t.textContent=e,A=!0})}),A}_handleProductSelected(e){var A=e.selectedAmount||1;try{var t,n=null===(t=this.widget.voiceInterface)||void 0===t||null===(t=t.sdk)||void 0===t?void 0:t.voiceSDK;null!=n&&n.stopAudioPlayback&&n.stopAudioPlayback()}catch(e){}this._sendToVoiceSDK({t:"product_selected",productId:e.id,productName:e.name,price:e.price,quantity:A,sellBy:e.sellBy||"quantity"})}_handleProductDeselected(e){this._sendToVoiceSDK({t:"product_deselected",productId:e.id,productName:e.name})}_handleCartUpdatedFromServer(e){this.ecommerce.handleCartUpdated(e)}_sendToVoiceSDK(e){try{var A,t=null===(A=this.widget.voiceInterface)||void 0===A||null===(A=A.sdk)||void 0===A?void 0:A.voiceSDK;t&&t.sendMessage&&t.sendMessage(e)}catch(e){console.warn("[TTPEcommerceWidget] Could not send to VoiceSDK:",e)}}_exposeTestAPI(){var e,A=this;window.__TTP_ECOMMERCE__={handleMessage:e=>{A.ecommerce.handleMessage(e)},showProducts:(e=jA(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",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(e),"&limit=").concat(t,"&sessionId=").concat(encodeURIComponent(n))),r=yield i.json();A.ecommerce.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("[TTPEcommerceWidget] showProducts failed:",e)}}),function(A){return e.apply(this,arguments)}),getCart:()=>({total:A.ecommerce.cartTotal,count:A.ecommerce.cartItemCount}),clearCart:()=>{A.ecommerce.cartItemCount=0,A.ecommerce.cartTotal=0,A.ecommerce.presenter.updateCart({itemCount:0,total:0,currency:A.ecommerce.currencySymbol})}}}open(){this.widget.open()}togglePanel(){this.widget.togglePanel()}updateConfig(e){this.widget.updateConfig(e)}destroy(){delete window.__TTP_ECOMMERCE__,this.ecommerce.destroy(),this.widget.destroy()}startVoiceCall(){return this.widget.startVoiceCall()}endVoiceCall(){this.widget.endVoiceCall()}toggleMute(){this.widget.toggleMute()}toggleSpeaker(){this.widget.toggleSpeaker()}registerToolHandler(e,A){return this.widget.registerToolHandler(e,A)}unregisterToolHandler(e){return this.widget.unregisterToolHandler(e)}hasToolHandler(e){return this.widget.hasToolHandler(e)}getRegisteredTools(){return this.widget.getRegisteredTools()}injectData(e,A){return this.widget.injectData(e,A)}}function qA(o){var[i,r]=n(!1),a=t(null);return A(()=>(a.current=new MA({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,A,t)=>{var n=a.current;n?n.isAnimating||(r(!0),n.triggerFly(e,A,()=>{r(n.isAnimating),t&&t()})):t&&t()},[]),isAnimating:i}}function XA(e,A,t,n,o,i,r){try{var a=e[i](r),s=a.value}catch(e){return void t(e)}a.done?A(s):Promise.resolve(s).then(n,o)}function JA(e){return function(){var A=this,t=arguments;return new Promise(function(n,o){var i=e.apply(A,t);function r(e){XA(i,n,o,r,a,"next",e)}function a(e){XA(i,n,o,r,a,"throw",e)}r(void 0)})}}class YA{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,A=this.config.visualAssistant||(null===(e=this.config.agentSettingsOverride)||void 0===e?void 0:e.visualAssistant),t=new Me({autoReconnect:!1,agentId:this.config.agentId,appId:this.config.appId,language:this.config.language||"en",visualAssistant:A,protocolVersion:2}).checkAndResume();return this._resumeChecked=!0,t?(console.log("🔄 [AGENT SDK] Found resume state before connect:",t),this._resumeInfo=t,t):(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 JA(function*(){try{var A;e.voiceSDK&&(console.log("🔌 AgentSDK: Cleaning up existing connection"),e.voiceSDK.destroy(),e.voiceSDK=null);var t=e.config.visualAssistant||(null===(A=e.config.agentSettingsOverride)||void 0===A?void 0:A.visualAssistant);if(e.voiceSDK=new Me({websocketUrl:e.config.websocketUrl,autoReconnect:!1,agentId:e.config.agentId,appId:e.config.appId,language:e.config.language||"en",agentSettingsOverride:e.config.agentSettingsOverride,visualAssistant:t,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}),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",A=>{if(e.isConnected=!1,A&&1008===A.code&&A.reason&&(A.reason.includes("Domain not whitelisted")||A.reason.includes("domain")||A.reason.includes("whitelist"))){var t=new Error("DOMAIN_NOT_WHITELISTED");t.reason=A.reason,t.code=A.code,e.onError(t)}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",A=>{e.onError(A)}),e.voiceSDK.on("error",A=>{e.onError(A)}),e.voiceSDK.on("message",A=>{e.handleWebSocketMessage(A)}),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 A=e.isListening;if(e.isListening=!1,A&&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",A=>{e.onBargeIn(A)}),e.voiceSDK.on("transcriptDisplay",A=>{console.log("📝 [AGENT SDK] transcriptDisplay event received:",A),A&&A.text&&(console.log("📝 [AGENT SDK] Calling onTranscript with text:",A.text),e.onTranscript&&"function"==typeof e.onTranscript?e.onTranscript(A.text):console.warn("📝 [AGENT SDK] ⚠️ onTranscript is not a function!",typeof e.onTranscript)),e.onSubtitleDisplay(A)}),e.voiceSDK.on("user_transcript",A=>{console.log("📝 [AGENT SDK] user_transcript event received:",A),e.onUserTranscript&&"function"==typeof e.onUserTranscript&&e.onUserTranscript(A.text,A.final)}),e._pendingToolHandlers&&e._pendingToolHandlers.size>0)for(var[n,o]of(console.log("🔧 AgentSDK: Registering ".concat(e._pendingToolHandlers.size," pending tool handlers")),e._pendingToolHandlers))e.voiceSDK.registerToolHandler(n,o);yield e.voiceSDK.connect()}catch(A){throw e.onError(A),A}})()}handleWebSocketMessage(e){var A=e.t||e.type;switch(A){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(A,e)}}startListening(){var e=arguments,A=this;return JA(function*(){var t=e.length>0&&void 0!==e[0]?e[0]:null;if(console.log("🎤 AgentSDK: startListening() called",t?"(with existing stream)":""),!A.voiceSDK)throw console.error("❌ AgentSDK: No voiceSDK instance available"),new Error("No voiceSDK instance available");try{console.log("🎤 AgentSDK: Starting recording..."),(yield A.voiceSDK.startRecording(t))&&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,A){if(this.voiceSDK)return this.voiceSDK.registerToolHandler(e,A);this._pendingToolHandlers||(this._pendingToolHandlers=new Map),this._pendingToolHandlers.set(e,A),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 A;return this.voiceSDK?this.voiceSDK.hasToolHandler(e):(null===(A=this._pendingToolHandlers)||void 0===A?void 0:A.has(e))||!1}getRegisteredTools(){return this.voiceSDK?this.voiceSDK.getRegisteredTools():this._pendingToolHandlers?Array.from(this._pendingToolHandlers.keys()):[]}}var ZA="2.38.4";console.log("%c TTP Agent SDK v".concat(ZA," "),"background: #4f46e5; color: white; font-size: 12px; font-weight: bold; padding: 2px 6px; border-radius: 4px;");const $A={VoiceSDK_v2:Me,TextChatSDK:Re,WebSocketManager:Ge,AudioRecorder:I,AudioPlayer:ze,EventEmitter:B,AgentSDK:YA,TTPChatWidget:FA,TTPEcommerceWidget:zA,FlyToCart:MA,useFlyToCart:qA,VERSION:ZA};export{YA as AgentSDK,ze as AudioPlayer,I as AudioRecorder,B as EventEmitter,MA as FlyToCart,s as MicPermissionModals,a as MicPermissionUtils,FA as TTPChatWidget,zA as TTPEcommerceWidget,Re as TextChatSDK,ZA as VERSION,Me as VoiceSDK_v2,Ge as WebSocketManager,$A as default,qA 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,z=[9001,65288],G="×",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 G;var i=A-1;if(Array.isArray(o)&&!0===o[i])return G;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 G;if(-1!==Y.indexOf(s))return"!";if(-1!==Y.indexOf(l))return G;if(-1!==J.indexOf(l))return G;if(8===At(i,e))return W;if(11===q.get(t[i]))return G;if((s===M||s===P)&&11===q.get(t[a]))return G;if(7===s||7===l)return G;if(9===s)return G;if(-1===[b,y,x].indexOf(s)&&9===l)return G;if(-1!==[C,Q,S,k,_].indexOf(l))return G;if(At(i,e)===E)return G;if(nt(23,E,i,e))return G;if(nt([C,Q],U,i,e))return G;if(nt(12,12,i,e))return G;if(s===b)return W;if(23===s||23===l)return G;if(16===l||16===s)return W;if(-1!==[y,x,U].indexOf(l)||14===s)return G;if(36===c&&-1!==et.indexOf(s))return G;if(s===_&&36===l)return G;if(l===F)return G;if(-1!==X.indexOf(l)&&s===I||-1!==X.indexOf(s)&&l===I)return G;if(s===H&&-1!==[K,M,P].indexOf(l)||-1!==[K,M,P].indexOf(s)&&l===T)return G;if(-1!==X.indexOf(s)&&-1!==Z.indexOf(l)||-1!==Z.indexOf(s)&&-1!==X.indexOf(l))return G;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 G;if(-1!==[I,_,k,C,Q].indexOf(l))for(var d=i;d>=0;){if((p=e[d])===I)return G;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 G;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 G;if(-1!==tt.indexOf(s)&&-1!==[F,T].indexOf(l)||-1!==tt.indexOf(l)&&s===H)return G;if(-1!==X.indexOf(s)&&-1!==X.indexOf(l))return G;if(s===k&&-1!==X.indexOf(l))return G;if(-1!==X.concat(I).indexOf(s)&&l===E&&-1===z.indexOf(t[a])||-1!==X.concat(I).indexOf(l)&&s===Q)return G;if(41===s&&41===l){for(var u=n[i],h=1;u>0&&41===e[--u];)h++;if(h%2!=0)return G}return s===M&&l===P?G: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},zt=function(t){return 20===t.type},Gt=function(t){return 0===t.type},Wt=function(t,e){return zt(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(zt).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(zt(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(zt(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(zt(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(zt(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(zt(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(zt(i)&&"linear"===i.value)return void(o=1);if(zt(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(zt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ze={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)}},Ge={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(t,e){return Yt(e).map(function(t){return t.filter(zt).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 zt(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(zt).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 zt(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(zt).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}},zn={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})}},Gn={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(zt).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:zt(e)&&"bold"===e.value?700:400}},sA={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.filter(zt).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(zt(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(Gt);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(zt).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,ze,e.backgroundPosition),this.backgroundRepeat=CA(t,Ge,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,zn,e.textShadow),this.textTransform=CA(t,Gn,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,zt(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"÷"},zA=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}}}},GA=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",GA(o)?qA(WA(n,n,0,0,r)):Promise.reject(!1)}).then(function(t){return A.drawImage(t,0,0),GA(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=zA(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=G;l<a&&(t=ot(n,i,o,++l,r))===G;);if(t!==G||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(zo(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},zo=function(t){return"SLOT"===t.tagName},Go=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")),Go(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)&&zo(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);Go(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(zt);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&&zt(c)){var d=o.counters.getCounterValue(c.value),p=l&&zt(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&&zt(c)){var g=o.counters.getCounterValues(c.value),m=l&&zt(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},zi=function(t){this.opacity=t,this.type=2,this.target=6},Gi=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 zi(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!Gi(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 zt(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(zt(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)),Gi(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:()=>$t,getDeviceInfo:()=>Zt,getPermissionInstructions:()=>ee,openSettings:()=>ne});var s={};r.r(s),r.d(s,{showBlockedModal:()=>ae,showNoMicrophoneModal:()=>se,showPrePromptModal:()=>re});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.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.mediaStreamSource=h,e.audioWorkletNode.port.onmessage=t=>{var{type:n,data:A}=t.data;"pcm_audio_data"===n&&e.emit("audioData",A)},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 g=l.message;if("NotAllowedError"===l.name||"PermissionDeniedError"===l.name){var m=yield e.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 v=new Error(g);throw v.name=l.name,v.originalError=l,e.emit("error",v),v}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")}}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}}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 z(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 G(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){z(i,A,o,r,a,"next",t)}function a(t){z(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}}G(W,"MAX_RESULT_SIZE",5e4),G(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.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.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-25T07:23:08.008Z",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":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===(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 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 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;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(e){var a,s,c="string"==typeof t.data?t.data:String(t.data),l=(null===(a=e.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:",e),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),v=m.charCodeAt(0);console.error('VoiceSDK v2: Problematic character: "'.concat(m,'" (charCode: ').concat(v,")")),v<32&&9!==v&&10!==v&&13!==v&&console.error("VoiceSDK v2: This is an unescaped control character. The backend should escape it in JSON strings.")}var f=c.includes("client_tool_call")||c.includes('"t":"client_tool_call"');if(f){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 w=c.match(/"toolName"\s*:\s*"([^"]+)"/);w&&console.error('⚠️ VoiceSDK v2: Attempted tool: "'.concat(w[1],'"'));var B=c.match(/"toolCallId"\s*:\s*"([^"]+)"/);B&&console.error('⚠️ VoiceSDK v2: Tool call ID: "'.concat(B[1],'"'))}if(null!==(s=e.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,(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 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(t){console.error("❌ VoiceSDK v2: Recovery attempt failed:",t)}}console.error("VoiceSDK v2: First 500 chars of raw message:",c.substring(0,500)),this.emit("error",{type:"json_parse_error",error:e,rawMessage:c.substring(0,1e3),position:d,wasToolCall:f})}}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.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}}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.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;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 o=new Error("Connection lost - server may have rejected the call");throw o.name="ServerRejected",o.isServerRejection=!0,o}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 i=new Error("Microphone permission denied. Please allow microphone access in your browser settings and try again.");i.name=A.name,i.originalError=A,e.emit("error",i)}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.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 zt=jt;function Gt(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;zt.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){Gt(i,A,o,r,a,"next",t)}function a(t){Gt(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)};zt.on("open",t),zt.on("close",e),zt.on("error",n),zt.on("message",A),this.eventHandlers={open:t,close:e,error:n,message:A}}}disconnect(){this.eventHandlers&&(zt.off("open",this.eventHandlers.open),zt.off("close",this.eventHandlers.close),zt.off("error",this.eventHandlers.error),zt.off("message",this.eventHandlers.message));var t=this.config.websocketUrl;t&&zt.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 zt.getAllConnections()}static clearAllConnections(){zt.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(){return te.apply(this,arguments)}function te(){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"},te=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)})},te.apply(this,arguments)}function ee(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 ne(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 Ae(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 oe(){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)))},oe=function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){Ae(i,A,o,r,a,"next",t)}function a(t){Ae(i,A,o,r,a,"throw",t)}r(void 0)})},oe.apply(this,arguments)}class ie{constructor(){this.overlay=null,this.modal=null}createOverlay(){var t=document.createElement("div");return t.className="mic-permission-overlay",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 .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(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 re(t,e){var n=new ie,A=n.createOverlay(),o=Zt(),i=function(){var t=Zt();return t.isIOS||t.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(),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 ae(t,e){var n,A,o,i=new ie,r=i.createOverlay(),a=Zt(),s=ee(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",()=>{ne(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 se(t){var e=new ie,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}class ce{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=this.config.headerTitle||this.config.agentName||"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();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="ttp-avatar">'.concat(i,'</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">\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">\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" 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(){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((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">').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 le{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||"#6d56f5",p=e.primaryBtnGradient2||"#9d8df8",u=e.startCallButtonTextColor||"#fff",h=e.secondaryBtnBg||"rgba(255,255,255,0.05)",g=e.secondaryBtnBorder||"rgba(255,255,255,0.09)",m=e.secondaryBtnTextColor||"rgba(255,255,255,0.6)",v=e.panelBackgroundColor||"#16161e",f=e.endCallButtonColor||"#ef4444",w=e.sendButtonColor||d;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(v,";\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 { display: flex").concat(t,'; }\n\n .voice-interface.active:has(#voiceIdleState:not([style*="display: none"]):not([style*="display:none"])) {\n background: transparent').concat(t,";\n }\n\n /* Footer stays transparent so parent panel gradient (incl. Powered by) shows through on idle */\n .voice-interface.active ~ .ttp-footer {\n background: transparent").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: #a78bfa").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-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(u,";\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(h,";\n border: 1px solid ").concat(g,";\n cursor: pointer").concat(t,"; font-size: 13px").concat(t,"; color: ").concat(m,";\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(h,"; }\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: linear-gradient(160deg, ").concat(n," 0%, ").concat(A," 100%);\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(f,"; 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(f,"59;\n transition: background 0.2s").concat(t,";\n }\n .ttp-end-btn:hover { background: ").concat(f,"; 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: linear-gradient(180deg, ").concat(n," 0%, ").concat(d,"14 100%);\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 { font-size: 12px").concat(t,"; color: #e2e0f0").concat(t,"; line-height: 1.55").concat(t,"; }\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-left: 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 }\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-left: 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 }\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(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 flex-shrink: 0").concat(t,"; transition: background 0.2s").concat(t,";\n }\n .ttp-send-btn:hover { background: ").concat(w,"; 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){return"\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: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #c084fc 100%)").concat(t,";\n border-radius: 24px 24px 0 0").concat(t,";\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)").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: #ef4444").concat(t,";\n box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5)").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: left").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 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 .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: flex").concat(t,";\n align-items: flex-end").concat(t,";\n padding: 12px").concat(t,";\n z-index: 2147483647").concat(t,";\n pointer-events: auto").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: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%)").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 }\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: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%)").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 }\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: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%)").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 de{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))}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">').concat(this.escapeHtml(t.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 pe{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 ue{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=document.getElementById("mobile-voice-call-bar-container");if(n&&l&&t.changedTouches.length){var A=t.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"),v=n.querySelector("#mobileTranscriptOverlay"),f=v&&("flex"===v.style.display||"flex"===getComputedStyle(v).display);c(o,i,p)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.endVoiceCall()):c(o,i,s)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.toggleMute()):c(o,i,d)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.toggleSpeaker()):f&&c(o,i,h)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.collapseMobileTranscript()):f&&c(o,i,g)&&null!=m&&null!==(e=m.value)&&void 0!==e&&e.trim()?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.voiceInterface.sendMobileTextMessage()):!f&&c(o,i,u)&&(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 he{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 ge{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");if(t&&t.remove(),!document.getElementById("mobile-voice-call-bar-styles")){var e=document.createElement("style");e.id="mobile-voice-call-bar-styles",e.textContent=this.voiceInterface.styles.generateMobileCSS(),document.head.appendChild(e)}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((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">').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 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.style.display="flex",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.style.display="none",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";i?(r=i,a=this.config.statusDotColor||"#10b981"):"connecting"===t?(r=this.t("connecting")||"Connecting...",a="#3b82f6"):"listening"===t||"recording"===t?(r=this.t("listening")||"Listening...",a="#22c55e"):"speaking"===t?(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"===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.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 me(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 ve(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){me(i,A,o,r,a,"next",t)}function a(t){me(i,A,o,r,a,"throw",t)}r(void 0)})}}class fe{constructor(t){var e;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(),this.isMobile=this.deviceInfo.isMobile,this.conversationExpanded=!1,this.isMicMuted=!1,this.isSpeakerMuted=!1;var n=t.visualAssistant||(null===(e=t.agentSettingsOverride)||void 0===e?void 0:e.visualAssistant);this.sdk=new pA({agentId:t.agentId,appId:t.appId,websocketUrl:t.websocketUrl,agentSettingsOverride:t.agentSettingsOverride,visualAssistant:n,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 ce(this),this.styles=new le(this),this.transcript=new de(this),this.textHandlers=new pe(this),this.handlers=new ue(this),this.desktop=new he(this),this.mobile=new ge(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=document.getElementById("mobile-voice-call-bar-container");if(e){var n=e.querySelector("#mobileTranscriptText");n&&(n.textContent="You: "+t,n.style.color="#fde68a")}else{var A=this.shadowRoot.getElementById("liveTextCollapsed");if(A){A.textContent="",A.classList.remove("muted"),A.style.color="#e8e4f0";var o=document.createElement("span");o.style.fontWeight="600",o.style.color="#c4b5fd",o.textContent="You: ",A.appendChild(o),A.appendChild(document.createTextNode(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=ve(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=ve(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)}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 ve(function*(){if(t.isActive)console.log("⚠️ Voice call already active");else{console.log("🎤 Starting voice call...");var e=yield $t();if(console.log("📋 Current permission state: ".concat(e)),"denied"===e)throw console.log("🚫 Permission is denied, showing blocked modal..."),t.resetConnectingState(),Zt(),ae(()=>{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");return n&&(n.style.display="none"),A&&(A.style.display="flex"),new Promise((e,o)=>{re(ve(function*(){console.log("✅ Pre-prompt accepted, proceeding with voice call...");try{yield t.proceedWithVoiceCall(),e()}catch(t){o(t)}}),()=>{console.log("❌ Pre-prompt cancelled"),n&&(n.style.display="flex"),A&&(A.style.display="none"),t.resetConnectingState(),o(new Error("Call cancelled by user"))})})}yield t.proceedWithVoiceCall()}})()}proceedWithVoiceCall(){var t=this;return ve(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)"))}console.log("📱 Mobile device - requesting mic permission before connecting...");var c=null;try{c=yield navigator.mediaDevices.getUserMedia({audio:!0}),t._preliminaryInputStream=c,console.log("✅ Mobile: Microphone permission granted - keeping stream alive (ElevenLabs pattern)");var l=t.shadowRoot.getElementById("text-chat-button");if(l)l.style.display="none",console.log("✅ Floating button hidden (permission granted)");else{var d=document.getElementById("text-chat-button");d&&(d.style.display="none",console.log("✅ Floating button hidden (permission granted, fallback)"))}var p=t.shadowRoot.querySelector(".ttp-mobile-fab");p&&(p.style.display="none")}catch(I){console.error("❌ Mobile: Permission denied before connecting:",I),t.resetConnectingState(),document.getElementById("mobile-voice-call-bar-container")&&t.removeMobileMinimizedBar();var u=t.shadowRoot.getElementById("text-chat-button");if(u)u.style.display="";else{var h=document.getElementById("text-chat-button");h&&(h.style.display="")}var g=t.shadowRoot.querySelector(".ttp-mobile-fab");g&&(g.style.display="");var m=t.shadowRoot.getElementById("voiceIdleState");m&&(m.style.display="flex");var v=t.shadowRoot.getElementById("text-chat-panel");if(v)v.style.display="";else{var f=document.getElementById("text-chat-panel");f&&(f.style.display="")}return Zt(),void ae(()=>{t.resetUIState()})}}else{t.resetConnectingState();var w=t.shadowRoot.getElementById("voiceIdleState"),B=t.shadowRoot.getElementById("voiceActiveState");w&&(w.style.display="none"),B&&(B.style.display="flex")}var b=t.shadowRoot.getElementById("voiceInterface");if(setTimeout(()=>t.adjustSizesForContainer(),50),b&&(b.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 y,x=null!==(y=t.config.connectionDelay)&&void 0!==y?y:{default:0,android:3e3,ios:0};yield function(){return oe.apply(this,arguments)}(x)}var C=yield t.sdk.connect();console.log("✅ Connected to WebSocket, connected:",C),t.setupTextInjectAckHandler();var Q=!1,S=t.sdk.onError,F=t.sdk.onDisconnected;t.sdk.onError=e=>{e&&("DOMAIN_NOT_WHITELISTED"===e.message||e.message&&e.message.includes("Domain not whitelisted"))&&(Q=!0,console.log("🚫 Server rejected connection before starting audio capture")),S&&S.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"))&&(Q=!0,console.log("🚫 Server disconnected due to domain error before starting audio capture")),F&&F.call(t.sdk,e)};for(var U=0;U<50;){if(Q)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.helloAckReceived&&t.sdk.voiceSDK.websocket&&t.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN)break;yield new Promise(t=>setTimeout(t,100)),U++}if(Q)throw t.sdk.onError=S,t.sdk.onDisconnected=F,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=S,t.sdk.onDisconnected=F,console.warn("⚠️ Connection lost before starting audio capture"),new Error("Connection lost before starting audio capture");if(t.sdk.onError=S,t.sdk.onDisconnected=F,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 E=t._preliminaryInputStream||null;if(E&&(t._preliminaryInputStream=null),yield t.sdk.startListening(E),!(t.sdk.isConnected&&t.sdk.voiceSDK&&t.sdk.voiceSDK.isConnected&&t.sdk.voiceSDK.websocket&&t.sdk.voiceSDK.websocket.readyState===WebSocket.OPEN)){var k;if(null!==(k=t.sdk.voiceSDK)&&void 0!==k&&k.isRecording)try{yield t.sdk.voiceSDK.stopRecording()}catch(t){}var I=new Error("Connection lost - server may have rejected the call");throw I.name="ServerRejected",I.isServerRejection=!0,I}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(I){if(I.isServerRejection||"ServerRejected"===I.name)throw t.resetConnectingState(),I;if(console.error("❌ Failed to start listening - permission denied or error:",I),t.resetConnectingState(),t.isMobile){document.getElementById("mobile-voice-call-bar-container")&&t.removeMobileMinimizedBar();var T=t.shadowRoot.getElementById("voiceIdleState");T&&(T.style.display="flex");var H=t.shadowRoot.getElementById("text-chat-panel");if(H)H.style.display="";else{var _=document.getElementById("text-chat-panel");_&&(_.style.display="")}var D=t.shadowRoot.getElementById("text-chat-button");if(D)D.style.display="";else{var M=document.getElementById("text-chat-button");M&&(M.style.display="")}}throw I}if(!t.isMobile&&!t.callStartTime){t.callStartTime=Date.now(),console.log("⏱️ Starting call timer at",new Date(t.callStartTime).toISOString());var P=()=>{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(()=>{P(),t.callTimerInterval=setInterval(P,1e3)},100)}}else{if(Q)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 L=t._preliminaryInputStream||null;L&&(t._preliminaryInputStream=null),yield t.sdk.startListening(L),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(I){if(I.isServerRejection||"ServerRejected"===I.name)throw t.resetConnectingState(),I;if(console.error("❌ Failed to start listening - permission denied or error:",I),t.resetConnectingState(),t.isMobile){document.getElementById("mobile-voice-call-bar-container")&&t.removeMobileMinimizedBar();var R=t.shadowRoot.getElementById("voiceIdleState");R&&(R.style.display="flex");var K=t.shadowRoot.getElementById("text-chat-panel");if(K)K.style.display="";else{var O=document.getElementById("text-chat-panel");O&&(O.style.display="")}var V=t.shadowRoot.getElementById("text-chat-button");if(V)V.style.display="";else{var N=document.getElementById("text-chat-button");N&&(N.style.display="")}}throw I}if(!t.isMobile&&!t.callStartTime){t.callStartTime=Date.now(),console.log("⏱️ Starting call timer at",new Date(t.callStartTime).toISOString());var j=()=>{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(()=>{j(),t.callTimerInterval=setInterval(j,1e3)},100)}}console.log("✅ Voice call started successfully")}catch(I){if(I.isServerRejection||"ServerRejected"===I.name||console.error("❌ Error starting voice call:",I),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"===I.name||"PermissionDeniedError"===I.name?(Zt(),ae(()=>{t.resetUIState()})):"NotFoundError"===I.name||"DevicesNotFoundError"===I.name?se(()=>{t.resetUIState()}):I&&("DOMAIN_NOT_WHITELISTED"===I.message||I.message&&I.message.includes("Domain not whitelisted"))?yield t.endCallOnServerRejection():(t.showError(I.message||I),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 ve(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()}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 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 Be(t){return 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)})}}class be{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=this.config.inputPlaceholder||(null===(t=this.config.panel)||void 0===t?void 0:t.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!==(e=this.config.sendButtonHint)&&void 0!==e&&e.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 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 /* 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 Be(function*(){t.isActive=!0,t.updateSendButtonState()})()}sendMessage(){var t=this;return Be(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()}}class ye{constructor(t){this.config=t,this.translations=t.translations||{},this.shadowRoot=t.shadowRoot}t(t){var e=this.config.language||"en";return(this.translations[e]||this.translations.en||{})[t]||t}generateHTML(){var t,e=this.config.landing||{};return t="image"===e.logoType&&e.logoImageUrl?'<img src="'.concat(e.logoImageUrl,'" alt="Logo" style="max-width: 44px; max-height: 44px; object-fit: contain; border: none; outline: none;">'):'<span class="landing-avatar-emoji">'.concat(e.logoIcon||e.logo||"🤖","</span>"),'\n <div class="landing-screen" id="landingScreen">\n \x3c!-- Avatar --\x3e\n <div class="landing-avatar">\n '.concat(t,'\n </div>\n\n \x3c!-- Title --\x3e\n <h2 class="landing-title">').concat(e.title||this.t("landingTitle"),'</h2>\n <p class="landing-subtitle">').concat(e.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(e.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(e.textCardTitle||this.t("textChat"),"</span>\n </button>\n </div>\n </div>\n ")}generateCSS(){var t=this.config.landing||{},e=(this.config.animation,!1===this.config.useShadowDOM?" !important":"");return"\n /* ===== LANDING SCREEN - New Design ===== */\n .landing-screen { \n display: none".concat(e,"; \n flex: 1").concat(e,"; \n padding: 32px 24px").concat(e,"; \n background: ").concat(t.backgroundColor||"linear-gradient(180deg, #ffffff 0%, rgba(168, 85, 247, 0.03) 100%)","; \n align-items: center").concat(e,"; \n justify-content: flex-start").concat(e,"; \n flex-direction: column").concat(e,"; \n gap: 0").concat(e,"; \n overflow-y: auto").concat(e,"; \n min-height: 0").concat(e,";\n text-align: center").concat(e,";\n }\n \n .landing-screen.active { \n display: flex").concat(e,"; \n }\n\n /* Avatar - Richer purple gradient */\n .landing-avatar {\n width: 88px").concat(e,";\n height: 88px").concat(e,";\n border-radius: 22px").concat(e,";\n margin-bottom: 20px").concat(e,";\n display: flex").concat(e,";\n align-items: center").concat(e,";\n justify-content: center").concat(e,";\n ").concat((()=>{if("image"===t.logoType){if(!1!==t.logoBackgroundEnabled){var e=t.logoBackgroundColor||t.avatarBackground||"linear-gradient(135deg, #667eea 0%, #764ba2 100%)";return"background: ".concat(e,"; 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=t.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").concat(e,";\n line-height: 1").concat(e,";\n }\n\n /* Title & Subtitle */\n .landing-title { \n font-size: 20px").concat(e,"; \n color: ").concat(t.titleColor||"#1e1b4b","; \n font-weight: 600").concat(e,"; \n margin-bottom: 6px").concat(e,"; \n text-align: center").concat(e,";\n line-height: 1.3").concat(e,";\n }\n\n .landing-subtitle {\n font-size: 14px").concat(e,";\n color: ").concat(t.subtitleColor||"#64748b",";\n margin-bottom: 28px").concat(e,";\n text-align: center").concat(e,";\n }\n\n /* Mode Selection - Side by Side */\n .mode-selection { \n display: flex").concat(e,"; \n gap: 12px").concat(e,"; \n width: 100%").concat(e,"; \n justify-content: center").concat(e,"; \n }\n\n .mode-card { \n flex: 1").concat(e,"; \n max-width: 160px").concat(e,"; \n padding: 20px 16px").concat(e,";\n background: ").concat(t.modeCardBackgroundColor||"#ffffff","; \n border: 1px solid ").concat(t.modeCardBorderColor||"rgba(0, 0, 0, 0.06)","; \n border-radius: 18px").concat(e,"; \n cursor: pointer").concat(e,"; \n display: flex").concat(e,"; \n flex-direction: column").concat(e,"; \n align-items: center").concat(e,"; \n gap: 12px").concat(e,"; \n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1)").concat(e,"; \n box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06)").concat(e,"; \n font-family: inherit").concat(e,";\n }\n\n .mode-card:hover { \n transform: translateY(-4px)").concat(e,"; \n box-shadow: 0 8px 24px rgba(124, 58, 237, 0.2)").concat(e,"; \n border-color: rgba(124, 58, 237, 0.3)").concat(e,"; \n }\n\n .mode-card:active {\n transform: translateY(-2px)").concat(e,";\n }\n\n /* Mode Card Icon - Vibrant purple gradient */\n .mode-card-icon { \n width: 56px").concat(e,"; \n height: 56px").concat(e,"; \n display: flex").concat(e,"; \n align-items: center").concat(e,"; \n justify-content: center").concat(e,"; \n border-radius: 16px").concat(e,"; \n background: ").concat(t.modeCardIconBackgroundColor||"linear-gradient(135deg, #7c3aed, #a855f7)","; \n color: #fff").concat(e,"; \n box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35)").concat(e,";\n }\n\n .mode-card-icon svg {\n width: 26px").concat(e,";\n height: 26px").concat(e,";\n stroke: white").concat(e,";\n fill: none").concat(e,";\n }\n\n .mode-card-title { \n color: ").concat(t.modeCardTitleColor||"#1e1b4b","; \n font-weight: 600").concat(e,"; \n font-size: 14px").concat(e,";\n text-align: center").concat(e,";\n }\n\n /* Mobile Responsive */\n @media (max-width: 768px) {\n .landing-screen {\n padding: 24px 16px").concat(e,";\n }\n\n .landing-avatar {\n width: 72px").concat(e,";\n height: 72px").concat(e,";\n border-radius: 18px").concat(e,";\n margin-bottom: 16px").concat(e,";\n }\n\n .landing-avatar-emoji {\n font-size: 36px").concat(e,";\n }\n\n .landing-title {\n font-size: 18px").concat(e,";\n }\n\n .landing-subtitle {\n font-size: 13px").concat(e,";\n margin-bottom: 20px").concat(e,";\n }\n\n .mode-selection {\n gap: 10px").concat(e,";\n }\n\n .mode-card {\n padding: 16px 12px").concat(e,";\n max-width: 140px").concat(e,";\n }\n\n .mode-card-icon {\n width: 48px").concat(e,";\n height: 48px").concat(e,";\n border-radius: 14px").concat(e,";\n }\n\n .mode-card-icon svg {\n width: 22px").concat(e,";\n height: 22px").concat(e,";\n }\n\n .mode-card-title {\n font-size: 13px").concat(e,";\n }\n }\n\n @media (max-width: 380px) {\n .mode-selection {\n flex-direction: column").concat(e,";\n align-items: center").concat(e,";\n }\n\n .mode-card {\n max-width: 100%").concat(e,";\n width: 100%").concat(e,";\n flex-direction: row").concat(e,";\n padding: 14px 18px").concat(e,";\n gap: 14px").concat(e,";\n }\n\n .mode-card-icon {\n flex-shrink: 0").concat(e,";\n }\n\n .mode-card-title {\n text-align: left").concat(e,";\n }\n }\n ")}show(){var t,e=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("landingScreen");e&&e.classList.add("active")}hide(){var t,e=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("landingScreen");e&&e.classList.remove("active")}setupEventHandlers(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},A=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("mode-card-voice"),o=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("mode-card-text");A&&n.onSelectVoice&&(A.onclick=n.onSelectVoice),o&&n.onSelectText&&(o.onclick=n.onSelectText)}}const xe={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."}};var Ce="ttp-gallery-handler-styles";function Qe(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(Ce)){var t=document.createElement("style");t.id=Ce,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 Se(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 Fe(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Se(Object(n),!0).forEach(function(e){Ue(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ue(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 Ee,ke,Ie,Te=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 He{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=Qe(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:Te.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:Te.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={[Te.SHOW_ITEMS]:t,show_products:t,[Te.CART_UPDATED]:t=>{this.manager.handleCartUpdated(t)},[Te.SHOW_MEDIA]:t=>{this.hideManagerUI(),this.galleryHandler.handleShowMedia(t)},[Te.DISMISS_MEDIA]:()=>{this.galleryHandler.dismissGallery()}},n=this.buildExtraMessageHandlers(),A=new Set(Object.values(Te));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 Fe(Fe({},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 _e{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 De(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 Me(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?De(Object(n),!0).forEach(function(e){Pe(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Pe(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 Le{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=Me(Me({},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 Re(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 Ke(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Re(Object(n),!0).forEach(function(e){Oe(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Oe(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 Ve(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 Ne(t){return!0===t.hasVariants&&(!!(Array.isArray(t.variants)&&t.variants.length>0)||Array.isArray(t.options)&&t.options.length>0)}function je(t){return ze.apply(this,arguments)}function ze(){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 Ke(Ke({},t),{},{variants:A})}catch(t){return console.error("[TTP] Failed to fetch product variants:",t),null}},ze=function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){Ve(i,A,o,r,a,"next",t)}function a(t){Ve(i,A,o,r,a,"throw",t)}r(void 0)})},ze.apply(this,arguments)}function Ge(t,e){return t.find(t=>e.every((e,n)=>t["option".concat(n+1)]===e))||null}function We(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 qe(t){return{USD:"$",ILS:"₪",EUR:"€",GBP:"£"}[t]||t}function Xe(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 Ye(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Xe(Object(n),!0).forEach(function(e){Je(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Je(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 Ze{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=We(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()}),je(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=We(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=qe(t.currency),n=Ge(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=We(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=qe(this.product.currency),n=Ge(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=qe(this.product.currency),e=Ge(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=Ge(this.product.variants,this.selectedValues);if(t&&t.available){var e=this.element.querySelector("#ttpVarAddBtn");e.textContent="✓ Added!",e.disabled=!0;var n=Ye(Ye({},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 $e{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 Le(t,{compact:"list"===n,primaryColor:a,onAdd:(t,e)=>s(t,e),onAddDisabled:()=>c(),hasVariants:Ne,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 Ze({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 tn{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 en{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 nn{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 An(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 on extends _e{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 nn({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>this._triggerCartBump(),onRipple:()=>this._triggerRipple()}),this.productPicker=new $e({primaryColor:t.primaryColor||"#7c3aed",onProductAdd:(t,e)=>this._handleProductAddWithFly(t,e),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>this._handlePickerClose()}),this.cartToast=new tn({onUndo:t=>this.onProductUndo(t),onHide:()=>this._restoreWaveform()}),this.cartSummary=new en,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(on.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,on.MIN_VISIBLE_LIST_ITEMS),p=on.PICKER_HEADER_HEIGHT+on.PICKER_PADDING+d*on.LIST_ITEM_HEIGHT+(d-1)*on.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 rn(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 an(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?rn(Object(n),!0).forEach(function(e){sn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function sn(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}An(on,"TOAST_HEIGHT_PX",510),An(on,"LIST_ITEM_HEIGHT",90),An(on,"LIST_GAP",6),An(on,"PICKER_HEADER_HEIGHT",44),An(on,"PICKER_PADDING",20),An(on,"MIN_VISIBLE_LIST_ITEMS",4);class cn{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 je(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=We(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=qe(t.currency),n=Ge(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=We(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=qe(this.product.currency),n=Ge(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=Ge(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=Ge(this.product.variants,this.selectedValues);if(t&&t.available){var e=this.container.querySelector("#ttpVpAddBtn");e.textContent="✓ Added!",e.disabled=!0;var n=an(an({},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 ln(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 dn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ln(Object(n),!0).forEach(function(e){pn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ln(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function pn(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 un{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=>dn(dn({},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=Ne(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(Ne(e)){var n=new cn({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=dn(dn({},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 hn extends _e{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 nn({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 un({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 gn{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 hn({primaryColor:this.primaryColor,onProductAdd:t=>this._handleProductAdd(t)}):new on({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 mn(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 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}function fn(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 wn(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){fn(i,A,o,r,a,"next",t)}function a(t){fn(i,A,o,r,a,"throw",t)}r(void 0)})}}class Bn extends He{createManager(t){var{shadowRoot:e,primaryColor:n}=t;return new gn({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=wn(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?mn(Object(n),!0).forEach(function(e){vn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mn(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=wn(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 wn(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 wn(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=wn(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 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){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?bn(Object(n),!0).forEach(function(e){xn(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}function xn(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 Cn{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,yn(yn({},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 Qn{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 Cn(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 Sn{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 Fn{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 Qn({primaryColor:this.primaryColor,onRoomBook:(t,e)=>this._handleRoomBook(t,e),onClose:()=>this._handlePickerClose()}),this.bookingSummary=new Sn,this.flyToCart=new nn({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 Un(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?Un(Object(n),!0).forEach(function(e){kn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Un(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function kn(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 In{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=>En(En({},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=En(En({},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 Tn{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 In({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 Hn{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 Tn({primaryColor:this.primaryColor,onRoomBook:t=>this._handleRoomBook(t)}):new Fn({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(_n);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(Dn);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 _n(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 Dn(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 Mn extends He{constructor(t,e){super(t,e,{buttonText:"Book this room",priceLabel:"per night"})}createManager(t){var{shadowRoot:e,primaryColor:n}=t;return new Hn({shadowRoot:e,primaryColor:n,onRoomSelected:t=>this.handleItemSelected(t)})}getManagerHideMethod(){return"hideRooms"}}class Pn{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 Ln{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 Pn(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 Rn{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 nn({getCartTarget:()=>this._getCartTarget(),onCartBump:()=>this._triggerCartBump(),onRipple:()=>this._triggerRipple()}),this.picker=new Ln({primaryColor:this.primaryColor,onItemSelect:(t,e)=>this._handleItemSelectWithFly(t,e),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>this._handlePickerClose()}),this.cartToast=new tn({onUndo:()=>{},onHide:()=>this._restoreWaveform()}),this.cartSummary=new en,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(Rn.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 Kn(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 On(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Kn(Object(n),!0).forEach(function(e){Vn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Kn(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}Ee=Rn,Ie=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)}(ke="TOAST_HEIGHT_PX"),(ke="symbol"==typeof Ie?Ie:Ie+"")in Ee?Object.defineProperty(Ee,ke,{value:510,enumerable:!0,configurable:!0,writable:!0}):Ee[ke]=510;class Nn{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 nn({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 un({primaryColor:this.primaryColor,onProductAdd:(t,e)=>this._handleAddWithFly(t,e),onAddDisabled:()=>this.flyToCart.isAnimating,onClose:()=>{}}));var n=t.map(t=>On(On({},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 jn{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 Nn({primaryColor:this.primaryColor,onItemSelect:t=>this._handleItemSelect(t)}):new Rn({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(zn);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 zn(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 Gn extends He{createManager(t){var{shadowRoot:e,primaryColor:n}=t;return new jn({shadowRoot:e,primaryColor:n,onItemSelected:t=>this.handleItemSelected(t)})}getManagerHideMethod(){return"hideMenuItems"}}class Wn extends He{createManager(t){var{shadowRoot:e,primaryColor:n}=t;return new jn({shadowRoot:e,primaryColor:n,onItemSelected:t=>this.handleItemSelected(t)})}getManagerHideMethod(){return"hideMenuItems"}}var qn={ecommerce:function(t){var e=new Bn(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return e._exposeTestAPI(),e},hotels:function(t){return new Mn(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},restaurants:function(t){return new Gn(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},tours:function(t){return new Wn(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}};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 Yn(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)})}}function Jn(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?Jn(Object(n),!0).forEach(function(e){$n(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function $n(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 tA{constructor(){var t,e,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 Vt(this.config),this.isOpen=!1,this.isActive=!1,this.translations=xe,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=Zn(Zn(Zn({},this.config),this.config.voice),{},{inputPlaceholder:(null===(t=this.config.text)||void 0===t?void 0:t.inputPlaceholder)||this.config.inputPlaceholder||"Type your message...",sendButtonColor:(null===(e=this.config.text)||void 0===e?void 0:e.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,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,onVoiceCallButtonClick:this.config.onVoiceCallButtonClick,onCallEnd:()=>{var t;if(this._isDomainErrorVisible())console.log("🚫 Domain error is displayed - NOT returning to landing screen 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 fe(l);var d=Zn(Zn(Zn({},this.config),this.config.text),{},{translations:this.translations,shadowRoot:this.shadowRoot});if(this.textInterface=new be(d,this.sdk),"unified"===((null===(s=this.config.behavior)||void 0===s?void 0:s.mode)||"unified")){var p=Zn(Zn({},this.config),{},{translations:this.translations,shadowRoot:this.shadowRoot});this.landingScreen=new ye(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 v,f=null===(v=this.shadowRoot)||void 0===v?void 0:v.getElementById("text-chat-panel");f&&(this.isOpen=!0,f.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 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=qn[t]||null;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=Yn(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.'))}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,z,G,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,zt,Gt,Wt,qt,Xt,Yt,Jt,Zt,$t,te,ee,ne,Ae,oe,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=t.position||"bottom-right";if("string"==typeof Te){var He=Te.split("-");Te={vertical:He[0]||"bottom",horizontal:He[1]||"right",offset:t.positionOffset||{x:20,y:20}}}var _e=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",De={};t.landing&&Object.keys(t.landing).forEach(e=>{var n=t.landing[e];null!=n&&""!==n&&(De[e]=n)});var Me={};return t.header&&Object.keys(t.header).forEach(e=>{var n=t.header[e];null!=n&&""!==n&&(Me[e]=n)}),Zn({agentId:t.agentId,appId:t.appId,websocketUrl:t.websocketUrl||t.signedUrl,agentSettingsOverride:t.agentSettingsOverride,demo:!1!==t.demo,direction:t.direction||"ltr",language:t.language||"en",icon:Zn({type:(null===(A=t.icon)||void 0===A?void 0:A.type)||"custom",customImage:(null===(o=t.icon)||void 0===o?void 0:o.customImage)||"https://talktopc.com/logo192.png",emoji:(null===(i=t.icon)||void 0===i?void 0:i.emoji)||"🎤",text:(null===(r=t.icon)||void 0===r?void 0:r.text)||"AI",size:(null===(a=t.icon)||void 0===a?void 0:a.size)||"medium",backgroundColor:(null===(s=t.icon)||void 0===s?void 0:s.backgroundColor)||"#FFFFFF"},t.icon),position:Zn({vertical:Te.vertical||"bottom",horizontal:Te.horizontal||"right",offset:Te.offset||{x:20,y:20}},"object"==typeof t.position?t.position:{}),button:Zn({size:(null===(c=t.button)||void 0===c?void 0:c.size)||"medium",shape:(null===(l=t.button)||void 0===l?void 0:l.shape)||"circle",backgroundColor:(null===(d=t.button)||void 0===d?void 0:d.backgroundColor)||(null===(p=t.icon)||void 0===p?void 0:p.backgroundColor)||"#FFFFFF",hoverColor:(null===(u=t.button)||void 0===u?void 0:u.hoverColor)||"#D3D3D3",shadow:!1!==(null===(h=t.button)||void 0===h?void 0:h.shadow),shadowColor:(null===(g=t.button)||void 0===g?void 0:g.shadowColor)||"rgba(0,0,0,0.15)",primaryColor:(null===(m=t.button)||void 0===m?void 0:m.backgroundColor)||(null===(v=t.icon)||void 0===v?void 0:v.backgroundColor)||"#FFFFFF"},t.button),panel:Zn({width:(null===(f=t.panel)||void 0===f?void 0:f.width)||360,height:(null===(w=t.panel)||void 0===w?void 0:w.height)||500,borderRadius:(null===(B=t.panel)||void 0===B?void 0:B.borderRadius)||24,backgroundColor:(null===(b=t.panel)||void 0===b?void 0:b.backgroundColor)||"#FFFFFF",backdropFilter:(null===(y=t.panel)||void 0===y?void 0:y.backdropFilter)||null,border:(null===(x=t.panel)||void 0===x?void 0:x.border)||"1px solid #E5E7EB"},t.panel),voice:Zn({micButtonColor:(null===(C=t.voice)||void 0===C?void 0:C.micButtonColor)||(null===(Q=t.panel)||void 0===Q?void 0:Q.micButtonColor)||_e,micButtonActiveColor:(null===(S=t.voice)||void 0===S?void 0:S.micButtonActiveColor)||(null===(F=t.panel)||void 0===F?void 0:F.micButtonActiveColor)||"#EF4444",micButtonHint:Zn(Zn({text:(null===(U=t.voice)||void 0===U||null===(U=U.micButtonHint)||void 0===U?void 0:U.text)||(null===(E=t.panel)||void 0===E||null===(E=E.micButtonHint)||void 0===E?void 0:E.text)||"Click the button to start voice conversation",color:(null===(k=t.voice)||void 0===k||null===(k=k.micButtonHint)||void 0===k?void 0:k.color)||(null===(I=t.panel)||void 0===I||null===(I=I.micButtonHint)||void 0===I?void 0:I.color)||"#6B7280",fontSize:(null===(T=t.voice)||void 0===T||null===(T=T.micButtonHint)||void 0===T?void 0:T.fontSize)||(null===(H=t.panel)||void 0===H||null===(H=H.micButtonHint)||void 0===H?void 0:H.fontSize)||"12px"},null===(_=t.voice)||void 0===_?void 0:_.micButtonHint),null===(D=t.panel)||void 0===D?void 0:D.micButtonHint),avatarBackgroundColor:(null===(M=t.voice)||void 0===M?void 0:M.avatarBackgroundColor)||"#667eea",avatarActiveBackgroundColor:(null===(P=t.voice)||void 0===P?void 0:P.avatarActiveBackgroundColor)||"#667eea",statusTitleColor:(null===(L=t.voice)||void 0===L?void 0:L.statusTitleColor)||"#1e293b",statusSubtitleColor:(null===(R=t.voice)||void 0===R?void 0:R.statusSubtitleColor)||"#64748b",statusDotColor:(null===(K=t.voice)||void 0===K?void 0:K.statusDotColor)||"#10b981",statusText:(null===(O=t.voice)||void 0===O?void 0:O.statusText)||null,startCallButtonColor:(null===(V=t.voice)||void 0===V?void 0:V.startCallButtonColor)||"#667eea",startCallButtonTextColor:(null===(N=t.voice)||void 0===N?void 0:N.startCallButtonTextColor)||"#FFFFFF",startCallTitle:(null===(j=t.voice)||void 0===j?void 0:j.startCallTitle)||null,startCallSubtitle:(null===(z=t.voice)||void 0===z?void 0:z.startCallSubtitle)||null,startCallButtonText:(null===(G=t.voice)||void 0===G?void 0:G.startCallButtonText)||null,transcriptBackgroundColor:(null===(W=t.voice)||void 0===W?void 0:W.transcriptBackgroundColor)||"#FFFFFF",transcriptTextColor:(null===(q=t.voice)||void 0===q?void 0:q.transcriptTextColor)||"#1e293b",transcriptLabelColor:(null===(X=t.voice)||void 0===X?void 0:X.transcriptLabelColor)||"#94a3b8",controlButtonColor:(null===(Y=t.voice)||void 0===Y?void 0:Y.controlButtonColor)||"#FFFFFF",controlButtonSecondaryColor:(null===(J=t.voice)||void 0===J?void 0:J.controlButtonSecondaryColor)||"#64748b",endCallButtonColor:(null===(Z=t.voice)||void 0===Z?void 0:Z.endCallButtonColor)||"#ef4444",language:(null===($=t.voice)||void 0===$?void 0:$.language)||t.language||"en"},t.voice),text:Zn({sendButtonColor:(null===(tt=t.text)||void 0===tt?void 0:tt.sendButtonColor)||(null===(et=t.panel)||void 0===et?void 0:et.sendButtonColor)||"#7C3AED",sendButtonHoverColor:(null===(nt=t.text)||void 0===nt?void 0:nt.sendButtonHoverColor)||(null===(At=t.panel)||void 0===At?void 0:At.sendButtonHoverColor)||"#6D28D9",sendButtonActiveColor:(null===(ot=t.text)||void 0===ot?void 0:ot.sendButtonActiveColor)||(null===(it=t.panel)||void 0===it?void 0:it.sendButtonActiveColor)||"#6D28D9",sendButtonText:(null===(rt=t.text)||void 0===rt?void 0:rt.sendButtonText)||(null===(at=t.panel)||void 0===at?void 0:at.sendButtonText)||"➤",sendButtonTextColor:(null===(st=t.text)||void 0===st?void 0:st.sendButtonTextColor)||(null===(ct=t.panel)||void 0===ct?void 0:ct.sendButtonTextColor)||"#FFFFFF",sendButtonFontSize:(null===(lt=t.text)||void 0===lt?void 0:lt.sendButtonFontSize)||(null===(dt=t.panel)||void 0===dt?void 0:dt.sendButtonFontSize)||"18px",sendButtonFontWeight:(null===(pt=t.text)||void 0===pt?void 0:pt.sendButtonFontWeight)||(null===(ut=t.panel)||void 0===ut?void 0:ut.sendButtonFontWeight)||"500",sendButtonHint:Zn(Zn({text:(null===(ht=t.text)||void 0===ht||null===(ht=ht.sendButtonHint)||void 0===ht?void 0:ht.text)||(null===(gt=t.panel)||void 0===gt||null===(gt=gt.sendButtonHint)||void 0===gt?void 0:gt.text)||"",color:(null===(mt=t.text)||void 0===mt||null===(mt=mt.sendButtonHint)||void 0===mt?void 0:mt.color)||(null===(vt=t.panel)||void 0===vt||null===(vt=vt.sendButtonHint)||void 0===vt?void 0:vt.color)||"#6B7280",fontSize:(null===(ft=t.text)||void 0===ft||null===(ft=ft.sendButtonHint)||void 0===ft?void 0:ft.fontSize)||(null===(wt=t.panel)||void 0===wt||null===(wt=wt.sendButtonHint)||void 0===wt?void 0:wt.fontSize)||"12px"},null===(Bt=t.text)||void 0===Bt?void 0:Bt.sendButtonHint),null===(bt=t.panel)||void 0===bt?void 0:bt.sendButtonHint),inputPlaceholder:(null===(yt=t.text)||void 0===yt?void 0:yt.inputPlaceholder)||(null===(xt=t.panel)||void 0===xt?void 0:xt.inputPlaceholder)||"Type your message...",inputBorderColor:(null===(Ct=t.text)||void 0===Ct?void 0:Ct.inputBorderColor)||(null===(Qt=t.panel)||void 0===Qt?void 0:Qt.inputBorderColor)||"#E5E7EB",inputFocusColor:(null===(St=t.text)||void 0===St?void 0:St.inputFocusColor)||(null===(Ft=t.panel)||void 0===Ft?void 0:Ft.inputFocusColor)||"#7C3AED",inputBackgroundColor:(null===(Ut=t.text)||void 0===Ut?void 0:Ut.inputBackgroundColor)||(null===(Et=t.panel)||void 0===Et?void 0:Et.inputBackgroundColor)||"#FFFFFF",inputTextColor:(null===(kt=t.text)||void 0===kt?void 0:kt.inputTextColor)||(null===(It=t.panel)||void 0===It?void 0:It.inputTextColor)||"#1F2937",inputFontSize:(null===(Tt=t.text)||void 0===Tt?void 0:Tt.inputFontSize)||(null===(Ht=t.panel)||void 0===Ht?void 0:Ht.inputFontSize)||"14px",inputBorderRadius:(null===(_t=t.text)||void 0===_t?void 0:_t.inputBorderRadius)||(null===(Dt=t.panel)||void 0===Dt?void 0:Dt.inputBorderRadius)||20,inputPadding:(null===(Mt=t.text)||void 0===Mt?void 0:Mt.inputPadding)||(null===(Pt=t.panel)||void 0===Pt?void 0:Pt.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)}),Zn({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)}),Zn({title:e.title||"Chat Assistant",showTitle:!1!==e.showTitle,backgroundColor:e.backgroundColor||"#7C3AED",textColor:e.textColor||"#FFFFFF",showCloseButton:!1!==e.showCloseButton,mobileLabel:e.mobileLabel||"Chat"},e)})(),footer:Zn({show:!1!==(null===(Lt=t.footer)||void 0===Lt?void 0:Lt.show),backgroundColor:(null===(Rt=t.footer)||void 0===Rt?void 0:Rt.backgroundColor)||"#f9fafb",textColor:(null===(Kt=t.footer)||void 0===Kt?void 0:Kt.textColor)||"#9ca3af",hoverColor:(null===(Ot=t.footer)||void 0===Ot?void 0:Ot.hoverColor)||"#7C3AED"},t.footer),tooltips:Zn({newChat:(null===(Vt=t.tooltips)||void 0===Vt?void 0:Vt.newChat)||null,back:(null===(Nt=t.tooltips)||void 0===Nt?void 0:Nt.back)||null,close:(null===(jt=t.tooltips)||void 0===jt?void 0:jt.close)||null,mute:(null===(zt=t.tooltips)||void 0===zt?void 0:zt.mute)||null,speaker:(null===(Gt=t.tooltips)||void 0===Gt?void 0:Gt.speaker)||null,endCall:(null===(Wt=t.tooltips)||void 0===Wt?void 0:Wt.endCall)||null},t.tooltips),messages:Zn({userBackgroundColor:(null===(qt=t.messages)||void 0===qt?void 0:qt.userBackgroundColor)||"#E5E7EB",agentBackgroundColor:(null===(Xt=t.messages)||void 0===Xt?void 0:Xt.agentBackgroundColor)||"#F3F4F6",systemBackgroundColor:(null===(Yt=t.messages)||void 0===Yt?void 0:Yt.systemBackgroundColor)||"#DCFCE7",errorBackgroundColor:(null===(Jt=t.messages)||void 0===Jt?void 0:Jt.errorBackgroundColor)||"#FEE2E2",textColor:(null===(Zt=t.messages)||void 0===Zt?void 0:Zt.textColor)||"#1F2937",userTextColor:(null===($t=t.messages)||void 0===$t?void 0:$t.userTextColor)||(null===(te=t.messages)||void 0===te?void 0:te.textColor)||"#1F2937",agentTextColor:(null===(ee=t.messages)||void 0===ee?void 0:ee.agentTextColor)||(null===(ne=t.messages)||void 0===ne?void 0:ne.textColor)||"#1F2937",userAvatarIcon:(null===(Ae=t.messages)||void 0===Ae?void 0:Ae.userAvatarIcon)||"👤",agentAvatarIcon:(null===(oe=t.messages)||void 0===oe?void 0:oe.agentAvatarIcon)||"🤖",fontSize:(null===(ie=t.messages)||void 0===ie?void 0:ie.fontSize)||"14px",borderRadius:(null===(re=t.messages)||void 0===re?void 0:re.borderRadius)||16},t.messages),animation:Zn({enableHover:!1!==(null===(ae=t.animation)||void 0===ae?void 0:ae.enableHover),enablePulse:!1!==(null===(se=t.animation)||void 0===se?void 0:se.enablePulse),enableSlide:!1!==(null===(ce=t.animation)||void 0===ce?void 0:ce.enableSlide),duration:(null===(le=t.animation)||void 0===le?void 0:le.duration)||.3},t.animation),promptAnimation:Zn({enabled:!0===(null===(de=t.promptAnimation)||void 0===de?void 0:de.enabled),text:(null===(pe=t.promptAnimation)||void 0===pe?void 0:pe.text)||"Try me!",backgroundColor:(null===(ue=t.promptAnimation)||void 0===ue?void 0:ue.backgroundColor)||"linear-gradient(135deg, #7c3aed, #4f46e5)",textColor:(null===(he=t.promptAnimation)||void 0===he?void 0:he.textColor)||"#ffffff",animationType:(null===(ge=t.promptAnimation)||void 0===ge?void 0:ge.animationType)||"bounce",showShimmer:!1!==(null===(me=t.promptAnimation)||void 0===me?void 0:me.showShimmer),showPulseRings:!1!==(null===(ve=t.promptAnimation)||void 0===ve?void 0:ve.showPulseRings),hideAfterClick:!1!==(null===(fe=t.promptAnimation)||void 0===fe?void 0:fe.hideAfterClick),hideAfterSeconds:void 0!==(null===(we=t.promptAnimation)||void 0===we?void 0:we.hideAfterSeconds)?t.promptAnimation.hideAfterSeconds:null,position:(null===(Be=t.promptAnimation)||void 0===Be?void 0:Be.position)||"top"},t.promptAnimation),behavior:Zn({autoOpen:(null===(be=t.behavior)||void 0===be?void 0:be.autoOpen)||!1,startOpen:(null===(ye=t.behavior)||void 0===ye?void 0:ye.startOpen)||!1,hidden:(null===(xe=t.behavior)||void 0===xe?void 0:xe.hidden)||!1,autoConnect:(null===(Ce=t.behavior)||void 0===Ce?void 0:Ce.autoConnect)||!1,showWelcomeMessage:!1!==(null===(Qe=t.behavior)||void 0===Qe?void 0:Qe.showWelcomeMessage),welcomeMessage:(null===(Se=t.behavior)||void 0===Se?void 0:Se.welcomeMessage)||"Hello! How can I help you today?",enableVoiceMode:void 0===(null===(Fe=t.behavior)||void 0===Fe?void 0:Fe.enableVoiceMode)||t.behavior.enableVoiceMode,mode:(null===(Ue=t.behavior)||void 0===Ue?void 0:Ue.mode)||"unified"},t.behavior),accessibility:Zn({ariaLabel:(null===(Ee=t.accessibility)||void 0===Ee?void 0:Ee.ariaLabel)||"Chat Assistant",ariaDescription:(null===(ke=t.accessibility)||void 0===ke?void 0:ke.ariaDescription)||"Click to open chat assistant",keyboardNavigation:!1!==(null===(Ie=t.accessibility)||void 0===Ie?void 0:Ie.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:_e},"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;",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;",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 .landing-screen /\n .voice-interface / .text-interface: #text-chat-panel + class beats\n component rules and keeps all three 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 #text-chat-panel .mode-selection {\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 #text-chat-panel .mode-selection {\n flex-direction: row").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&&"landing"===this.currentView){var o,i=(null===(o=this.config.behavior)||void 0===o?void 0:o.mode)||"unified";("unified"===i||"voice-only"===i)&&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,n=this.config.button,A=this.config.icon,o=(this.config.panel,this.config.header),i=(this.config.animation,{small:50,medium:60,large:70,xl:80}[n.size]||60),r={small:20,medium:28,large:36,xl:44}[A.size]||28,a=this.generatePositionStyles(),s=(this.generateIconHTML(r),(null===(t=this.config.behavior)||void 0===t?void 0:t.mode)||"unified"),c="unified"===s,l="unified"===s||"voice-only"===s,d="unified"===s||"text-only"===s,p=t=>{var e=this.config.language||"en";return(this.translations[e]||this.translations.en)[t]||t},u=this.config.useShadowDOM?"\n <style>\n ".concat(this.generateCSS(a,i,r),"\n ").concat(this.config.customStyles,"\n </style>\n "):"",h=this.config.promptAnimation||{},g=!0===h.enabled,m=g?this.generatePromptBubbleHTML(h,i):"";return console.log("📝 generateWidgetHTML - promptAnimation:",{hasConfig:!!this.config.promptAnimation,promptConfig:h,enabled:h.enabled,isPromptEnabled:g,willGenerateHTML:!!m}),"\n ".concat(u,"\n \n ").concat(this.config.behavior.hidden?"":'\n <div id="text-chat-button-container">\n '.concat(m,"\n ").concat(g&&!1!==h.showPulseRings?this.generatePulseRingsHTML(h):"",'\n \x3c!-- Desktop pill launcher (hidden on mobile) --\x3e\n <button type="button" id="text-chat-button" aria-label="Open chat with ').concat(o.title||"Assistant",'">\n <div class="ttp-pill-icon">\n <img class="ttp-launcher-logo" src="').concat((null===(e=this.config.icon)||void 0===e?void 0:e.customImage)||"https://talktopc.com/logo192.png",'" alt="" />\n </div>\n <div class="ttp-pill-text">\n <span class="ttp-pill-title">').concat(o.title||"Assistant",'</span>\n <span class="ttp-pill-status">\n <span class="ttp-launcher-dot"></span>\n ').concat(void 0!==o.onlineIndicatorText&&null!==o.onlineIndicatorText?o.onlineIndicatorText:p("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(o.mobileLabel||"Chat",'</span>\n <span class="ttp-mobile-fab__status">\n <span class="ttp-mobile-fab__dot"></span>\n ').concat(void 0!==o.onlineIndicatorText&&null!==o.onlineIndicatorText?o.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(o.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\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 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'<img src="'.concat(e.customImage,'" alt="Chat Assistant" style="width: ').concat(t,"px; height: ").concat(t,'px; object-fit: contain;" />');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,u="unified"===d||"voice-only"===d,h="unified"===d||"text-only"===d,g=!1===this.config.useShadowDOM?" !important":"",m=this.config.voice||{},v=m.pillGradient||"linear-gradient(135deg, #581c87, #312e81, #1e1b4b)",f=m.pillTextColor||"#ffffff",w=m.pillDotColor||"#4ade80",B=s.backgroundColor||"#16161e",b=!(!B||"#"!==B.charAt(0))&&(299*parseInt(B.substr(1,2),16)+587*parseInt(B.substr(3,2),16)+114*parseInt(B.substr(5,2),16))/1e3>160,y=b?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.35)",x=b?m.primaryBtnGradient1||"#7C3AED":"#a78bfa",C=b?"rgba(0,0,0,0.08)":"rgba(255,255,255,0.06)",Q=m.heroGradient1||"#2a2550",S=m.heroGradient2||"#1a1a2e",F='#voiceInterface.active #voiceIdleState: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(g,';\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif').concat(g,";\n /* Mobile defaults */\n right: 10px").concat(g,";\n bottom: 10px").concat(g,";\n left: auto").concat(g,";\n top: auto").concat(g,";\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(g,";\n left: ").concat("left"===this.config.position.horizontal?"20px":"auto").concat(g,";\n bottom: ").concat("bottom"===this.config.position.vertical?"20px":"auto").concat(g,";\n top: ").concat("top"===this.config.position.vertical?"20px":"auto").concat(g,";\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(g,";\n display: flex").concat(g,";\n align-items: center").concat(g,";\n gap: 10px").concat(g,";\n padding: 7px 16px 7px 7px").concat(g,";\n z-index: 1").concat(g,";\n background: ").concat(v,";\n border: 1px solid rgba(139,92,246,0.15)").concat(g,";\n border-radius: 999px").concat(g,";\n box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.15)").concat(g,";\n cursor: pointer").concat(g,";\n transition: box-shadow 0.25s, transform 0.2s, padding 0.3s, gap 0.3s").concat(g,";\n font-family: inherit").concat(g,";\n color: ").concat(f,";\n overflow: hidden").concat(g,";\n }\n #text-chat-button:hover {\n transform: translateY(-1px)").concat(g,";\n box-shadow: 0 10px 40px rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.2)").concat(g,";\n }\n #text-chat-button.open {\n gap: 0px").concat(g,";\n padding: 7px").concat(g,";\n }\n\n .ttp-pill-icon {\n width: 36px").concat(g,"; height: 36px").concat(g,"; border-radius: 50%").concat(g,";\n background: #ffffff").concat(g,";\n display: flex").concat(g,"; align-items: center").concat(g,"; justify-content: center").concat(g,";\n flex-shrink: 0").concat(g,";\n }\n .ttp-launcher-logo {\n width: 22px").concat(g,"; height: 22px").concat(g,"; border-radius: 50%").concat(g,";\n object-fit: cover").concat(g,";\n }\n\n .ttp-pill-text {\n display: flex").concat(g,"; flex-direction: column").concat(g,"; gap: 1px").concat(g,";\n max-width: 120px").concat(g,";\n opacity: 1").concat(g,";\n overflow: hidden").concat(g,";\n white-space: nowrap").concat(g,";\n transition: max-width 0.3s, opacity 0.2s").concat(g,";\n }\n #text-chat-button.open .ttp-pill-text {\n max-width: 0").concat(g,";\n opacity: 0").concat(g,";\n }\n .ttp-pill-title {\n font-size: 13px").concat(g,"; font-weight: 600").concat(g,"; color: ").concat(f,";\n line-height: 1.2").concat(g,";\n }\n .ttp-pill-status {\n display: flex").concat(g,"; align-items: center").concat(g,"; gap: 5px").concat(g,";\n font-size: 11px").concat(g,"; color: ").concat(f,"8c;\n line-height: 1.2").concat(g,";\n }\n\n /* Online dot (inside pill status) */\n .ttp-launcher-dot {\n width: 7px").concat(g,"; height: 7px").concat(g,"; border-radius: 50%").concat(g,";\n background: ").concat(w,";\n flex-shrink: 0").concat(g,";\n animation: ttp-dot-pulse 2s ease-in-out infinite").concat(g,";\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(g,";\n min-height: 56px").concat(g,";\n }\n \n #text-chat-panel .header-title {\n font-size: 15px").concat(g,";\n }\n \n #text-chat-panel .header-icon {\n width: 40px").concat(g,";\n height: 40px").concat(g,";\n min-width: 40px").concat(g,";\n min-height: 40px").concat(g,";\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").concat(g,";\n }\n \n .landing-logo {\n font-size: 40px").concat(g,";\n }\n \n .landing-title {\n font-size: 18px").concat(g,";\n margin-bottom: 16px").concat(g,";\n }\n \n .mode-selection {\n flex-direction: column").concat(g,";\n gap: 12px").concat(g,";\n align-items: center").concat(g,";\n }\n \n .mode-card {\n max-width: 100%").concat(g,";\n width: 100%").concat(g,";\n padding: 16px").concat(g,";\n }\n \n .mode-card-icon {\n width: 50px").concat(g,";\n height: 50px").concat(g,";\n font-size: 28px").concat(g,";\n }\n \n .mode-card-title {\n font-size: 14px").concat(g,";\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(g,";\n min-height: 52px").concat(g,";\n }\n \n #text-chat-panel .header-title {\n font-size: 14px").concat(g,";\n }\n \n .landing-logo {\n font-size: 36px").concat(g,";\n }\n \n .landing-title {\n font-size: 16px").concat(g,";\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(g,";\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(g,";\n height: auto").concat(g,";\n z-index: 10001").concat(g,";\n display: flex").concat(g,";\n align-items: center").concat(g,";\n justify-content: center").concat(g,";\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(g,";\n z-index: 10002").concat(g,";\n pointer-events: none").concat(g,";\n white-space: nowrap").concat(g,";\n }\n \n .prompt-bubble.top {\n bottom: calc(100% + 18px)").concat(g,";\n left: 50%").concat(g,";\n transform: translateX(-50%)").concat(g,";\n }\n \n .prompt-bubble.left {\n right: calc(100% + 12px)").concat(g,";\n top: 50%").concat(g,";\n transform: translateY(-50%)").concat(g,";\n }\n \n .prompt-bubble.right {\n left: calc(100% + 12px)").concat(g,";\n top: 50%").concat(g,";\n transform: translateY(-50%)").concat(g,";\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(g,";\n transform: translateX(-50%)").concat(g,"; /* Keep centering */\n }\n \n .prompt-bubble.top.animation-float {\n animation: widget-float 2s ease-in-out infinite").concat(g,";\n transform: translateX(-50%)").concat(g,"; /* Keep centering */\n }\n \n .prompt-bubble.top.animation-pulse {\n animation: pulse 2s ease-in-out infinite").concat(g,";\n transform: translateX(-50%)").concat(g,"; /* Keep centering */\n }\n \n .prompt-bubble-content {\n position: relative").concat(g,";\n padding: 8px 16px").concat(g,";\n border-radius: 20px").concat(g,";\n font-weight: 500").concat(g,";\n font-size: 14px").concat(g,";\n box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3)").concat(g,";\n overflow: hidden").concat(g,";\n }\n \n .prompt-bubble-shimmer {\n position: absolute").concat(g,";\n inset: 0").concat(g,";\n background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent)").concat(g,";\n animation: widget-shimmer 2s infinite").concat(g,";\n }\n \n .prompt-bubble.animation-bounce {\n animation: widget-bounce 1s ease-in-out infinite").concat(g,";\n }\n \n .prompt-bubble.animation-pulse {\n animation: pulse 2s ease-in-out infinite").concat(g,";\n }\n \n .prompt-bubble.animation-float {\n animation: widget-float 2s ease-in-out infinite").concat(g,";\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(g,";\n width: 0").concat(g,";\n height: 0").concat(g,";\n border: 8px solid transparent").concat(g,";\n }\n \n .prompt-bubble.top .prompt-bubble-arrow {\n top: 100%").concat(g,";\n left: 50%").concat(g,";\n transform: translateX(-50%)").concat(g,";\n border-top-color: var(--prompt-bubble-bg-color, #7c3aed)").concat(g,";\n border-bottom: none").concat(g,";\n margin-left: 0").concat(g,";\n }\n \n .prompt-bubble.left .prompt-bubble-arrow {\n left: 100%").concat(g,";\n top: 50%").concat(g,";\n transform: translateY(-50%)").concat(g,";\n border-left-color: var(--prompt-bubble-bg-color, #7c3aed)").concat(g,";\n border-right: none").concat(g,";\n }\n \n .prompt-bubble.right .prompt-bubble-arrow {\n right: 100%").concat(g,";\n top: 50%").concat(g,";\n transform: translateY(-50%)").concat(g,";\n border-right-color: var(--prompt-bubble-bg-color, #7c3aed)").concat(g,";\n border-left: none").concat(g,";\n }\n \n /* Pulse Rings */\n .prompt-pulse-rings {\n position: absolute").concat(g,";\n inset: 0").concat(g,";\n border-radius: 50%").concat(g,";\n pointer-events: none").concat(g,";\n }\n \n .prompt-pulse-ring {\n position: absolute").concat(g,";\n inset: 0").concat(g,";\n border-radius: 50%").concat(g,";\n animation: widget-pulse-ring 2s ease-out infinite").concat(g,";\n }\n \n .prompt-pulse-ring:nth-child(2) {\n animation-delay: 0.5s").concat(g,";\n }\n \n /* Mobile adjustments for prompt bubble */\n @media (max-width: 768px) {\n .prompt-bubble-content {\n font-size: 12px").concat(g,";\n padding: 6px 12px").concat(g,";\n }\n \n .prompt-bubble.top {\n bottom: calc(100% + 14px)").concat(g,";\n }\n \n .prompt-bubble.left,\n .prompt-bubble.right {\n display: none").concat(g,"; /* Hide side prompts on mobile */\n }\n }\n \n #text-chat-panel {\n display: none").concat(g,";\n position: fixed").concat(g,";\n bottom: calc(54px + 24px)").concat(g,"; /* launcher pill + gap */\n ").concat("right"===this.config.position.horizontal?"right: 20px;":"left: 20px;","\n width: 340px").concat(g,";\n max-width: calc(100vw - 40px)").concat(g,";\n height: auto").concat(g,";\n max-height: calc(100vh - 100px)").concat(g,";\n background: ").concat(B,";\n border-radius: 20px").concat(g,";\n border: ").concat(s.border||"1px solid rgba(255,255,255,0.08)",";\n flex-direction: column").concat(g,";\n overflow: hidden").concat(g,";\n box-shadow: 0 24px 60px rgba(0,0,0,0.6)").concat(g,";\n transform-origin: bottom right").concat(g,";\n opacity: 0").concat(g,";\n pointer-events: none").concat(g,";\n box-sizing: border-box").concat(g,";\n }\n \n #text-chat-panel.open {\n display: flex").concat(g,";\n opacity: 1").concat(g,";\n pointer-events: auto").concat(g,";\n }\n\n /* Shell for panel inner */\n .widget-shell { width: 100%").concat(g,"; padding: 0").concat(g,"; border-radius: 20px").concat(g,"; background: transparent").concat(g,"; overflow: hidden").concat(g,"; display: flex").concat(g,"; flex-direction: column").concat(g,"; box-sizing: border-box").concat(g,"; flex: 1").concat(g,"; min-height: 0").concat(g,"; }\n .panel-inner { width: 100%").concat(g,"; background: ").concat(B,"; border-radius: 20px").concat(g,"; border: none").concat(g,"; overflow: hidden").concat(g,"; display:flex").concat(g,"; flex-direction: column").concat(g,"; padding: 0").concat(g,"; box-sizing: border-box").concat(g,"; max-width: 100%").concat(g,"; flex: 1").concat(g,"; min-height: 0").concat(g,"; }\n\n #text-chat-panel .widget-container {\n width: 100%").concat(g,"; background: ").concat(B,"; overflow: visible").concat(g,"; display: flex").concat(g,"; flex-direction: column").concat(g,"; border-radius: 20px").concat(g,"; flex: 1").concat(g,"; min-height: 0").concat(g,";\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(Q," 0%, ").concat(S," 100%)").concat(g,";\n }\n #text-chat-panel .widget-container:has(").concat(F,") {\n background: linear-gradient(160deg, ").concat(Q," 0%, ").concat(S," 100%)").concat(g,";\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").concat(g,";\n overflow-y: auto").concat(g,";\n overflow-x: visible").concat(g,"; /* 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(g,"; }\n\n ").concat(p&&this.landingScreen?this.landingScreen.generateCSS():"","\n\n ").concat(u?this.voiceInterface.generateCSS():"","\n ").concat(h?this.textInterface.generateCSS():"","\n \n /* Footer Branding */\n .ttp-footer {\n padding: 6px 18px 10px").concat(g,";\n border-top: 1px solid ").concat(C,";\n display: flex").concat(g,";\n justify-content: center").concat(g,";\n flex-shrink: 0").concat(g,";\n box-sizing: border-box").concat(g,";\n background: transparent").concat(g,";\n }\n .ttp-footer span { font-size: 10px").concat(g,"; color: ").concat(y,"; }\n .ttp-footer a { color: ").concat(x,"; text-decoration: none").concat(g,"; font-weight: 600").concat(g,"; }\n .ttp-footer a:hover { opacity: 0.85").concat(g,"; }\n .ttp-footer a b { font-weight: 700").concat(g,"; }\n \n #text-chat-send-hint {\n text-align: center").concat(g,";\n line-height: 1.4").concat(g,";\n }\n \n .agent-thinking {\n font-style: italic").concat(g,";\n color: #6B7280").concat(g,";\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(g,";\n }\n\n .ttp-mobile-landing {\n display: none").concat(g,";\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(g,";\n align-items: center").concat(g,";\n gap: 10px").concat(g,";\n padding: 10px 16px 10px 12px").concat(g,";\n background: ").concat(v,";\n border: none").concat(g,";\n border-radius: 24px").concat(g,";\n cursor: pointer").concat(g,";\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3)").concat(g,";\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1)").concat(g,";\n z-index: 1").concat(g,";\n font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif").concat(g,";\n touch-action: manipulation").concat(g,";\n -webkit-tap-highlight-color: transparent").concat(g,";\n }\n\n .ttp-mobile-fab:hover {\n transform: translateY(-3px)").concat(g,";\n box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4)").concat(g,";\n }\n\n .ttp-mobile-fab__icon-wrap {\n width: 36px").concat(g,";\n height: 36px").concat(g,";\n border-radius: 50%").concat(g,";\n background: rgba(255, 255, 255, 0.15)").concat(g,";\n display: flex").concat(g,";\n align-items: center").concat(g,";\n justify-content: center").concat(g,";\n flex-shrink: 0").concat(g,";\n }\n\n .ttp-mobile-fab__waveform {\n display: flex").concat(g,";\n align-items: center").concat(g,";\n gap: 2px").concat(g,";\n height: 16px").concat(g,";\n }\n\n .ttp-mobile-fab__waveform .bar {\n width: 2px").concat(g,";\n background: #fff").concat(g,";\n border-radius: 1px").concat(g,";\n animation: ttpWaveAnimation 0.8s ease-in-out infinite").concat(g,";\n }\n\n .ttp-mobile-fab__waveform .bar:nth-child(1) { height: 5px").concat(g,"; animation-delay: 0s").concat(g,"; }\n .ttp-mobile-fab__waveform .bar:nth-child(2) { height: 10px").concat(g,"; animation-delay: 0.1s").concat(g,"; }\n .ttp-mobile-fab__waveform .bar:nth-child(3) { height: 16px").concat(g,"; animation-delay: 0.2s").concat(g,"; }\n .ttp-mobile-fab__waveform .bar:nth-child(4) { height: 8px").concat(g,"; animation-delay: 0.3s").concat(g,"; }\n .ttp-mobile-fab__waveform .bar:nth-child(5) { height: 12px").concat(g,"; animation-delay: 0.4s").concat(g,"; }\n\n .ttp-mobile-fab__label-wrap {\n display: flex").concat(g,";\n flex-direction: column").concat(g,";\n align-items: flex-start").concat(g,";\n gap: 1px").concat(g,";\n }\n\n .ttp-mobile-fab__label {\n color: ").concat(f,";\n font-size: 14px").concat(g,";\n font-weight: 600").concat(g,";\n line-height: 1.2").concat(g,";\n }\n\n .ttp-mobile-fab__status {\n display: flex").concat(g,";\n align-items: center").concat(g,";\n gap: 4px").concat(g,";\n font-size: 11px").concat(g,";\n color: ").concat(f,"b3;\n line-height: 1.2").concat(g,";\n }\n\n .ttp-mobile-fab__dot {\n width: 6px").concat(g,";\n height: 6px").concat(g,";\n background: ").concat(w,";\n border-radius: 50%").concat(g,";\n box-shadow: 0 0 6px ").concat(w,"99;\n }\n\n /* ---- Mobile Landing Overlay ---- */\n .ttp-mobile-landing.active {\n display: block").concat(g,";\n position: fixed").concat(g,";\n bottom: 16px").concat(g,";\n left: 12px").concat(g,";\n right: 12px").concat(g,";\n background: ").concat(v,";\n border-radius: 20px").concat(g,";\n overflow: hidden").concat(g,";\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(g,";\n z-index: 10002").concat(g,";\n font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif").concat(g,";\n }\n\n .ttp-mobile-landing::before {\n content: ''").concat(g,";\n position: absolute").concat(g,";\n top: 0").concat(g,";\n left: 0").concat(g,";\n right: 0").concat(g,";\n height: 1px").concat(g,";\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(g,";\n display: flex").concat(g,";\n align-items: center").concat(g,";\n gap: 12px").concat(g,";\n }\n\n .ttp-mobile-landing__avatar {\n width: 44px").concat(g,";\n height: 44px").concat(g,";\n border-radius: 12px").concat(g,";\n background: rgba(255, 255, 255, 0.15)").concat(g,";\n display: flex").concat(g,";\n align-items: center").concat(g,";\n justify-content: center").concat(g,";\n flex-shrink: 0").concat(g,";\n }\n\n .ttp-mobile-landing__waveform {\n display: flex").concat(g,";\n align-items: center").concat(g,";\n gap: 3px").concat(g,";\n height: 20px").concat(g,";\n }\n\n .ttp-mobile-landing__waveform .bar {\n width: 3px").concat(g,";\n background: rgba(255, 255, 255, 0.9)").concat(g,";\n border-radius: 2px").concat(g,";\n animation: ttpWaveAnimation 0.8s ease-in-out infinite").concat(g,";\n }\n\n .ttp-mobile-landing__waveform .bar:nth-child(1) { height: 6px").concat(g,"; animation-delay: 0s").concat(g,"; }\n .ttp-mobile-landing__waveform .bar:nth-child(2) { height: 12px").concat(g,"; animation-delay: 0.1s").concat(g,"; }\n .ttp-mobile-landing__waveform .bar:nth-child(3) { height: 20px").concat(g,"; animation-delay: 0.2s").concat(g,"; }\n .ttp-mobile-landing__waveform .bar:nth-child(4) { height: 10px").concat(g,"; animation-delay: 0.3s").concat(g,"; }\n .ttp-mobile-landing__waveform .bar:nth-child(5) { height: 16px").concat(g,"; animation-delay: 0.4s").concat(g,"; }\n\n .ttp-mobile-landing__info {\n flex: 1").concat(g,";\n min-width: 0").concat(g,";\n }\n\n .ttp-mobile-landing__name {\n color: #fff").concat(g,";\n font-size: 15px").concat(g,";\n font-weight: 600").concat(g,";\n margin-bottom: 2px").concat(g,";\n }\n\n .ttp-mobile-landing__status {\n color: rgba(255, 255, 255, 0.7)").concat(g,";\n font-size: 12px").concat(g,";\n display: flex").concat(g,";\n align-items: center").concat(g,";\n gap: 5px").concat(g,";\n }\n\n .ttp-mobile-landing__dot {\n width: 6px").concat(g,";\n height: 6px").concat(g,";\n background: ").concat(c.onlineIndicatorDotColor||"#10b981",";\n border-radius: 50%").concat(g,";\n animation: ttpPulseAnimation 2s ease-in-out infinite").concat(g,";\n }\n\n .ttp-mobile-landing__close {\n width: 32px").concat(g,";\n height: 32px").concat(g,";\n border-radius: 10px").concat(g,";\n background: rgba(255, 255, 255, 0.1)").concat(g,";\n border: none").concat(g,";\n color: rgba(255, 255, 255, 0.7)").concat(g,";\n display: flex").concat(g,";\n align-items: center").concat(g,";\n justify-content: center").concat(g,";\n cursor: pointer").concat(g,";\n transition: all 0.2s").concat(g,";\n flex-shrink: 0").concat(g,";\n }\n\n .ttp-mobile-landing__close:hover {\n background: rgba(255, 255, 255, 0.2)").concat(g,";\n color: #fff").concat(g,";\n }\n\n .ttp-mobile-landing__error {\n margin: 0 14px 10px").concat(g,";\n padding: 10px 12px").concat(g,";\n background: #fef2f2").concat(g,";\n border: 1px solid #fecaca").concat(g,";\n border-radius: 10px").concat(g,";\n display: flex").concat(g,";\n align-items: flex-start").concat(g,";\n gap: 8px").concat(g,";\n color: #b91c1c").concat(g,";\n font-size: 13px").concat(g,";\n line-height: 1.4").concat(g,";\n }\n .ttp-mobile-landing__error svg {\n flex-shrink: 0").concat(g,";\n margin-top: 1px").concat(g,";\n stroke: #dc2626").concat(g,";\n }\n\n .ttp-mobile-landing__actions {\n padding: 0 14px 14px").concat(g,";\n display: flex").concat(g,";\n gap: 10px").concat(g,";\n }\n\n .ttp-mobile-landing__btn {\n flex: 1").concat(g,";\n padding: 14px").concat(g,";\n border-radius: 12px").concat(g,";\n border: none").concat(g,";\n cursor: pointer").concat(g,";\n font-family: inherit").concat(g,";\n font-size: 14px").concat(g,";\n font-weight: 600").concat(g,";\n display: flex").concat(g,";\n align-items: center").concat(g,";\n justify-content: center").concat(g,";\n gap: 10px").concat(g,";\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1)").concat(g,";\n touch-action: manipulation").concat(g,";\n -webkit-tap-highlight-color: transparent").concat(g,";\n }\n\n .ttp-mobile-landing__btn svg {\n width: 20px").concat(g,";\n height: 20px").concat(g,";\n flex-shrink: 0").concat(g,";\n }\n\n .ttp-mobile-landing__btn--call {\n background: #fff").concat(g,";\n color: ").concat(c.backgroundColor||"#7C3AED",";\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15)").concat(g,";\n }\n\n .ttp-mobile-landing__btn--call:hover {\n transform: translateY(-2px)").concat(g,";\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2)").concat(g,";\n }\n\n .ttp-mobile-landing__btn--text {\n background: rgba(255, 255, 255, 0.15)").concat(g,";\n color: #fff").concat(g,";\n border: 1px solid rgba(255, 255, 255, 0.1)").concat(g,";\n }\n\n .ttp-mobile-landing__btn--text:hover {\n background: rgba(255, 255, 255, 0.2)").concat(g,";\n border-color: rgba(255, 255, 255, 0.2)").concat(g,";\n }\n\n .ttp-mobile-landing__footer {\n padding: 10px 16px").concat(g,";\n display: flex").concat(g,";\n justify-content: center").concat(g,";\n border-top: 1px solid rgba(255, 255, 255, 0.08)").concat(g,";\n }\n\n .ttp-mobile-landing__powered {\n color: rgba(255, 255, 255, 0.4)").concat(g,";\n font-size: 11px").concat(g,";\n display: flex").concat(g,";\n align-items: center").concat(g,";\n gap: 4px").concat(g,";\n }\n\n .ttp-mobile-landing__powered svg {\n width: 10px").concat(g,";\n height: 10px").concat(g,";\n color: #f59e0b").concat(g,";\n }\n\n .ttp-mobile-landing__powered a {\n color: rgba(255, 255, 255, 0.6)").concat(g,";\n text-decoration: none").concat(g,";\n }\n\n .ttp-mobile-landing__powered a:hover {\n color: #fff").concat(g,";\n }\n }\n ")}setupWidgetEvents(){var t,e=this;if(this.shadowRoot){this.setupPromptAnimation();var n=this.shadowRoot.getElementById("text-chat-button");n&&(n.onclick=t=>{t.stopPropagation(),this.config.promptAnimation.hideAfterClick&&this.hidePrompt(),this.togglePanel()});var A=this.shadowRoot.getElementById("closeBtn");A&&(A.onclick=()=>{this._doTogglePanel()});var o=this.shadowRoot.getElementById("ttpCloseIdle");o&&(o.onclick=()=>this._doTogglePanel());var i=this.shadowRoot.getElementById("ttpCloseActive");i&&(i.onclick=()=>this._doTogglePanel());var r=this.shadowRoot.getElementById("startTextBtn");r&&(r.onclick=()=>this.showText());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,l=(null===(t=this.config.behavior)||void 0===t?void 0:t.mode)||"unified",d="unified"===l,p="unified"===l||"voice-only"===l,u="unified"===l||"text-only"===l,h=this.shadowRoot.getElementById("backBtn"),g=this.shadowRoot.getElementById("landingScreen"),m=this.shadowRoot.getElementById("textInterface"),v=this.shadowRoot.getElementById("voiceInterface");h&&(h.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 landing"),this.voiceInterface.isShowingDomainError=!1,null!==(n=this.voiceInterface)&&void 0!==n&&n.resetConnectingState&&this.voiceInterface.resetConnectingState(),void this.showLanding();if(null!==(e=this.voiceInterface)&&void 0!==e&&e.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()}),d&&this.landingScreen?(this.landingScreen.setupEventHandlers({onSelectVoice:(c=Yn(function*(){if(e.isStartingCall)console.log("⚠️ Call already starting, ignoring duplicate click");else{if("function"==typeof e.config.onVoiceCallButtonClick)try{e.config.onVoiceCallButtonClick({timestamp:Date.now(),widgetState:"start"})}catch(t){console.error("Error in onVoiceCallButtonClick callback:",t)}e.isStartingCall=!0;try{var t,n;if(e.showVoice(),null!==(t=e.voiceInterface)&&void 0!==t&&t.isMobile){var A,o,i,r,a,s=(null===(A=e.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=e.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=e.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=e.shadowRoot)||void 0===r?void 0:r.querySelector(".ttp-mobile-fab");u&&(u.style.display="none"),null!==(a=e.voiceInterface)&&void 0!==a&&a.createMobileMinimizedBar&&(e.voiceInterface.createMobileMinimizedBar(),e.voiceInterface.updateMobileStatus("connecting"),null===(d=(p=e.voiceInterface).startWaveformAnimation)||void 0===d||d.call(p),yield new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t))))}else{var h;null!==(h=e.voiceInterface)&&void 0!==h&&h.showConnectingState&&e.voiceInterface.showConnectingState()}if(yield e.startVoiceCall(),null!==(n=e.voiceInterface)&&void 0!==n&&n.isActive)console.log("✅ Voice call started successfully");else{var g,m;if(console.warn("⚠️ startVoiceCall() returned but call is not active"),e._isDomainErrorVisible())return e.currentView="voice",e.showVoice(),void console.log("✅ Staying on voice interface with domain error displayed");console.log("⚠️ Not a domain error - returning to landing screen"),null!==(g=e.voiceInterface)&&void 0!==g&&g.resetConnectingState&&e.voiceInterface.resetConnectingState(),"unified"===((null===(m=e.config.behavior)||void 0===m?void 0:m.mode)||"unified")&&e.showLanding()}}catch(t){var v,f,w,B;if(t.isServerRejection||"ServerRejected"===t.name)return void(null!==(B=e.voiceInterface)&&void 0!==B&&B.resetConnectingState&&e.voiceInterface.resetConnectingState());if(console.error("❌ Failed to start voice call:",t),null!==(v=e.voiceInterface)&&void 0!==v&&v.resetConnectingState&&e.voiceInterface.resetConnectingState(),null!==(f=e.voiceInterface)&&void 0!==f&&f.isMobile){var b,y,x;document.getElementById("mobile-voice-call-bar-container")&&null!==(b=e.voiceInterface)&&void 0!==b&&b.removeMobileMinimizedBar&&e.voiceInterface.removeMobileMinimizedBar();var C=(null===(y=e.shadowRoot)||void 0===y?void 0:y.getElementById("text-chat-button"))||document.getElementById("text-chat-button");C&&(C.style.display="");var Q=null===(x=e.shadowRoot)||void 0===x?void 0:x.querySelector(".ttp-mobile-fab");Q&&(Q.style.display="")}"Call cancelled by user"!==t.message&&e.showErrorToast(t.message||"Failed to start voice call. Please try again.","error"),"unified"===((null===(w=e.config.behavior)||void 0===w?void 0:w.mode)||"unified")&&e.showLanding()}finally{e.isStartingCall=!1}}}),function(){return c.apply(this,arguments)}),onSelectText:()=>this.showText()}),"text"===this.currentView?(g&&g.classList.remove("active"),m&&m.classList.add("active"),v&&v.classList.remove("active"),h&&"unified"===l&&h.classList.add("visible"),f&&(f.style.display="")):"voice"===this.currentView?(g&&g.classList.remove("active"),m&&m.classList.remove("active"),v&&v.classList.add("active"),h&&"unified"===l&&h.classList.add("visible"),f&&(f.style.display="none")):(this.currentView="landing",g&&g.classList.add("active"),m&&m.classList.remove("active"),v&&v.classList.remove("active"),h&&"unified"===l&&h.classList.remove("visible"))):"voice-only"===l?(v&&v.classList.add("active"),m&&m.classList.remove("active"),g&&g.classList.remove("active")):"text-only"===l&&(m&&m.classList.add("active"),v&&v.classList.remove("active"),g&&g.classList.remove("active")),p&&(console.log("⚙️ Setting up voice interface event handlers"),this.voiceInterface.setupEventHandlers()),u&&(console.log("⚙️ Setting up text interface event handlers"),this.textInterface.setupEventHandlers());var f=this.shadowRoot.getElementById("newChatBtn");f&&(f.onclick=()=>this.textInterface.startNewChat(),d&&(f.style.display="none")),this.setupMobileWidgetEvents(),this.config.accessibility.keyboardNavigation&&this.setupKeyboardNavigation()}}startNewChat(){this.textInterface.startNewChat()}showLanding(){if(this.shadowRoot)if(window.innerWidth>768)this.showVoice();else if(!this._isDomainErrorVisible()&&"unified"===(this.config.behavior.mode||"unified")){this.currentView="landing";var t=this.shadowRoot.getElementById("landingScreen"),e=this.shadowRoot.getElementById("textInterface"),n=this.shadowRoot.getElementById("voiceInterface"),A=this.shadowRoot.getElementById("backBtn"),o=this.shadowRoot.getElementById("newChatBtn");t&&t.classList.add("active"),e&&e.classList.remove("active"),n&&n.classList.remove("active"),A&&A.classList.remove("visible"),o&&(o.style.display="none")}}showText(){if(this.shadowRoot){this.currentView="text";var t=this.shadowRoot.getElementById("landingScreen"),e=this.shadowRoot.getElementById("voiceInterface"),n=this.shadowRoot.getElementById("backBtn"),A=this.shadowRoot.getElementById("newChatBtn");t&&t.classList.remove("active"),e&&e.classList.remove("active"),this.textInterface.show();var o=this.config.behavior.mode||"unified";n&&"unified"===o&&n.classList.add("visible"),A&&(A.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("landingScreen"),e=this.shadowRoot.getElementById("textInterface"),n=this.shadowRoot.getElementById("voiceInterface"),A=this.shadowRoot.getElementById("backBtn"),o=this.shadowRoot.getElementById("newChatBtn");t&&t.classList.remove("active"),e&&e.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 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.config.promptAnimation.hideAfterClick&&this.hidePrompt();var n=this.shadowRoot.getElementById("ttpMobileLandingError");n&&(n.style.display="none"),t.style.display="none",e.classList.add("active"),this.isMobileLandingOpen=!0};var A=e.querySelector(".ttp-mobile-landing__close");A&&(A.onclick=n);var o=this.shadowRoot.getElementById("ttpMobileCallBtn");o&&(o.onclick=()=>{n();var t=this.shadowRoot.getElementById("mode-card-voice");t?t.click():this.showVoice()});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 Yn(function*(){t.isActive=!0,t.textInterface.setActive(!0)})()}sendMessage(){var t=this;return Yn(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,l,d=Zn({},this.config);t.panel&&(d.panel=Zn(Zn({},this.config.panel),t.panel)),t.voice&&(d.voice=Zn(Zn({},this.config.voice),t.voice),t.voice.micButtonHint&&(d.voice.micButtonHint=Zn(Zn({},null===(c=this.config.voice)||void 0===c?void 0:c.micButtonHint),t.voice.micButtonHint))),t.text&&(d.text=Zn(Zn({},this.config.text),t.text),t.text.sendButtonHint&&(d.text.sendButtonHint=Zn(Zn({},null===(l=this.config.text)||void 0===l?void 0:l.sendButtonHint),t.text.sendButtonHint))),void 0!==t.language&&(d.language=t.language),void 0!==t.language&&(["he","ar"].includes(t.language)?d.direction="rtl":void 0===t.direction&&(d.direction="ltr")),t.translations&&(d.translations=t.translations,this.translations=t.translations),t.button&&(d.button=Zn(Zn({},this.config.button),t.button)),t.header&&(d.header=Zn(Zn({},this.config.header),t.header)),t.icon&&(d.icon=Zn(Zn({},this.config.icon),t.icon)),t.messages&&(d.messages=Zn(Zn({},this.config.messages),t.messages)),t.animation&&(d.animation=Zn(Zn({},this.config.animation),t.animation)),t.behavior&&(d.behavior=Zn(Zn({},this.config.behavior),t.behavior)),t.accessibility&&(d.accessibility=Zn(Zn({},this.config.accessibility),t.accessibility)),t.tooltips&&(d.tooltips=Zn(Zn({},this.config.tooltips),t.tooltips)),t.landing&&(d.landing=Zn(Zn({},this.config.landing),t.landing)),t.footer&&(d.footer=Zn(Zn({},this.config.footer),t.footer)),void 0!==t.direction&&void 0===d.direction&&(d.direction=t.direction),void 0!==t.primaryColor&&(d.primaryColor=t.primaryColor),d.onConversationStart=void 0!==t.onConversationStart?t.onConversationStart:this.config.onConversationStart,d.onConversationEnd=void 0!==t.onConversationEnd?t.onConversationEnd:this.config.onConversationEnd,d.onBargeIn=void 0!==t.onBargeIn?t.onBargeIn:this.config.onBargeIn,d.onAudioStartPlaying=void 0!==t.onAudioStartPlaying?t.onAudioStartPlaying:this.config.onAudioStartPlaying,d.onAudioStoppedPlaying=void 0!==t.onAudioStoppedPlaying?t.onAudioStoppedPlaying:this.config.onAudioStoppedPlaying,d.onSubtitleDisplay=void 0!==t.onSubtitleDisplay?t.onSubtitleDisplay:this.config.onSubtitleDisplay,d.onVoiceCallButtonClick=void 0!==t.onVoiceCallButtonClick?t.onVoiceCallButtonClick:this.config.onVoiceCallButtonClick,void 0!==t.useShadowDOM&&(d.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)||(d[e]=t[e])}),null===(e=this.config)||void 0===e||e.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 v=document.getElementById("ttp-widget-shadow-host");v&&v.remove();var f=document.getElementById("ttp-widget-container");if(f&&f.remove(),!1===p){var w=document.getElementById("ttp-widget-styles");w&&w.remove()}this.config.useShadowDOM?(this.createShadowHost(),this.container=this.shadowRoot):(this.createRegularContainer(),this.container=this.regularContainer,this.shadowRoot=document)}var B=this.config.language||"en",b=Zn(Zn(Zn({},this.config),this.config.voice),{},{language:B,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 fe(b);var y=Zn(Zn(Zn({},this.config),this.config.text),{},{language:B,translations:this.translations,shadowRoot:this.shadowRoot});if(this.textInterface=new be(y,this.sdk),"unified"===((null===(s=this.config.behavior)||void 0===s?void 0:s.mode)||"unified")){var x=Zn(Zn({},this.config),{},{translations:this.translations,shadowRoot:this.shadowRoot});this.landingScreen=new ye(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 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 Yn(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 Yn(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,Zn(Zn({},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 eA(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 nA(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?eA(Object(n),!0).forEach(function(e){AA(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eA(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function AA(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 oA extends tA{constructor(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(nA(nA({},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 iA{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(!iA._stylesInjected.has(t)){iA._stylesInjected.add(t);var e=iA.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=iA.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=iA.generateCSS()+"\n"+iA.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 rA(o){var[i,r]=A(!1),a=n(null);return e(()=>(a.current=new nn({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 aA(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 sA(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?aA(Object(n),!0).forEach(function(e){cA(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):aA(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function cA(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 lA(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 dA(t){return function(){var e=this,n=arguments;return new Promise(function(A,o){var i=t.apply(e,n);function r(t){lA(i,A,o,r,a,"next",t)}function a(t){lA(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}(iA,"_stylesInjected",new WeakSet);class pA{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 dA(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(sA(sA({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_products":case"cart_updated":case"add_to_store_cart":"function"==typeof this.onUnsupportedAction&&this.onUnsupportedAction(e,t)}}startListening(){var t=arguments,e=this;return dA(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 uA="2.40.0",hA="2026-03-25T07:23:08.008Z";console.log("%c TTP Agent SDK v".concat(uA," (").concat(hA,") "),"background: #4f46e5; color: white; font-size: 12px; font-weight: bold; padding: 2px 6px; border-radius: 4px;");const gA={VoiceSDK_v2:Pt,TextChatSDK:Vt,WebSocketManager:Wt,AudioRecorder:k,AudioPlayer:Yt,EventEmitter:f,AgentSDK:pA,TTPChatWidget:tA,TTPEcommerceWidget:oA,ItemCard:Le,GalleryViewer:iA,FlyToCart:nn,useFlyToCart:rA,VERSION:uA};export{pA as AgentSDK,Yt as AudioPlayer,k as AudioRecorder,hA as BUILD_TIME,f as EventEmitter,nn as FlyToCart,iA as GalleryViewer,Le as ItemCard,s as MicPermissionModals,a as MicPermissionUtils,tA as TTPChatWidget,oA as TTPEcommerceWidget,Vt as TextChatSDK,uA as VERSION,Pt as VoiceSDK_v2,Wt as WebSocketManager,gA as default,rA as useFlyToCart};
|
|
3
3
|
//# sourceMappingURL=agent-widget.esm.js.map
|