shopify-chatbot-widget 0.7.9 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/jaweb-chatbot.css +1 -1
  2. package/dist/jaweb-chatbot.iife.js +3 -3
  3. package/package.json +1 -1
  4. package/src/App.css +42 -0
  5. package/src/App.tsx +13 -0
  6. package/src/Chatbot/Chatbot.css +270 -0
  7. package/src/Chatbot/Chatbot.tsx +214 -0
  8. package/src/Chatbot/ChatbotTransition.css +19 -0
  9. package/src/Chatbot/OLDCHAT.tsx +259 -0
  10. package/src/Chatbot/components/ChatInput.css +127 -0
  11. package/src/Chatbot/components/ChatInput.tsx +354 -0
  12. package/src/Chatbot/components/Messages/Addcart.tsx +70 -0
  13. package/src/Chatbot/components/Messages/AgentStatus.tsx +37 -0
  14. package/src/Chatbot/components/Messages/AssistantMesage.tsx +206 -0
  15. package/src/Chatbot/components/Messages/AudioMessage.tsx +123 -0
  16. package/src/Chatbot/components/Messages/CalendlyEmbeds.tsx +66 -0
  17. package/src/Chatbot/components/Messages/CardSwiper.tsx +194 -0
  18. package/src/Chatbot/components/Messages/Carousel/CardSwiper.tsx +264 -0
  19. package/src/Chatbot/components/Messages/Carousel/CardSwiperSalla.tsx +208 -0
  20. package/src/Chatbot/components/Messages/Carousel/CardSwiperZid.tsx +208 -0
  21. package/src/Chatbot/components/Messages/Carousel/SallaSwiper.css +245 -0
  22. package/src/Chatbot/components/Messages/Carousel/TryOn.tsx +111 -0
  23. package/src/Chatbot/components/Messages/CartWidget.tsx +151 -0
  24. package/src/Chatbot/components/Messages/ChatImage.tsx +46 -0
  25. package/src/Chatbot/components/Messages/ChatImageText.tsx +74 -0
  26. package/src/Chatbot/components/Messages/ChatImageTextAssis.tsx +72 -0
  27. package/src/Chatbot/components/Messages/ChatMessages.css +31 -0
  28. package/src/Chatbot/components/Messages/ChatMessages.tsx +334 -0
  29. package/src/Chatbot/components/Messages/ProductCard.css +149 -0
  30. package/src/Chatbot/components/Messages/SallaAssistantMessage.tsx +196 -0
  31. package/src/Chatbot/components/Messages/Support.tsx +177 -0
  32. package/src/Chatbot/components/Messages/Typing.css +31 -0
  33. package/src/Chatbot/components/Messages/Typing.tsx +19 -0
  34. package/src/Chatbot/components/Messages/ZidAssistantMesage.tsx +196 -0
  35. package/src/Chatbot/components/Messages/cartwidget.css +123 -0
  36. package/src/Chatbot/components/Messenger/Messenger.tsx +531 -0
  37. package/src/Chatbot/components/Notification.tsx +28 -0
  38. package/src/Chatbot/components/Powered.css +29 -0
  39. package/src/Chatbot/components/Powered.tsx +12 -0
  40. package/src/Chatbot/components/Sessions/CreateSession.tsx +201 -0
  41. package/src/Chatbot/components/Sessions/RenderList.tsx +212 -0
  42. package/src/Chatbot/components/Suggestions.css +35 -0
  43. package/src/Chatbot/components/Suggestions.tsx +57 -0
  44. package/src/Chatbot/notification.css +17 -0
  45. package/src/assets/react.svg +1 -0
  46. package/src/chatbot-widget/index.tsx +14 -0
  47. package/src/hooks/config.tsx +13 -0
  48. package/src/hooks/useCart.tsx +107 -0
  49. package/src/hooks/useChatbotAPI.tsx +167 -0
  50. package/src/hooks/useChatbotData.tsx +132 -0
  51. package/src/hooks/useSessionMessages.tsx +50 -0
  52. package/src/hooks/useWebsocke.tsx +45 -0
  53. package/src/i18n.tsx +30 -0
  54. package/src/index.css +2 -0
  55. package/src/main.tsx +10 -0
  56. package/src/types/chatbot.ts +40 -0
  57. package/src/utils/cookies.tsx +14 -0
  58. package/src/vite-env.d.ts +1 -0
@@ -321,7 +321,7 @@ You might need to use a local HTTP server (instead of file://): https://react.de
321
321
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...a){const r=new this(t);return a.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[YM]=this[YM]={accessors:{}}).accessors,o=this.prototype;function c(f){const m=Av(f);r[m]||(AV(o,f),r[m]=!0)}return Ge.isArray(t)?t.forEach(c):c(t),this}};vo.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ge.reduceDescriptors(vo.prototype,({value:e},t)=>{let a=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[a]=r}}}),Ge.freezeMethods(vo);function SE(e,t){const a=this||Rv,r=t||a,o=vo.from(r.headers);let c=r.data;return Ge.forEach(e,function(m){c=m.call(a,c,o.normalize(),t?t.status:void 0)}),o.normalize(),c}function WM(e){return!!(e&&e.__CANCEL__)}function Sm(e,t,a){Cn.call(this,e??"canceled",Cn.ERR_CANCELED,t,a),this.name="CanceledError"}Ge.inherits(Sm,Cn,{__CANCEL__:!0});function ZM(e,t,a){const r=a.config.validateStatus;!a.status||!r||r(a.status)?e(a):t(new Cn("Request failed with status code "+a.status,[Cn.ERR_BAD_REQUEST,Cn.ERR_BAD_RESPONSE][Math.floor(a.status/100)-4],a.config,a.request,a))}function MV(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function _V(e,t){e=e||10;const a=new Array(e),r=new Array(e);let o=0,c=0,f;return t=t!==void 0?t:1e3,function(g){const p=Date.now(),y=r[c];f||(f=p),a[o]=g,r[o]=p;let S=c,E=0;for(;S!==o;)E+=a[S++],S=S%e;if(o=(o+1)%e,o===c&&(c=(c+1)%e),p-f<t)return;const T=y&&p-y;return T?Math.round(E*1e3/T):void 0}}function DV(e,t){let a=0,r=1e3/t,o,c;const f=(p,y=Date.now())=>{a=y,o=null,c&&(clearTimeout(c),c=null),e.apply(null,p)};return[(...p)=>{const y=Date.now(),S=y-a;S>=r?f(p,y):(o=p,c||(c=setTimeout(()=>{c=null,f(o)},r-S)))},()=>o&&f(o)]}const zS=(e,t,a=3)=>{let r=0;const o=_V(50,250);return DV(c=>{const f=c.loaded,m=c.lengthComputable?c.total:void 0,g=f-r,p=o(g),y=f<=m;r=f;const S={loaded:f,total:m,progress:m?f/m:void 0,bytes:g,rate:p||void 0,estimated:p&&m&&y?(m-f)/p:void 0,event:c,lengthComputable:m!=null,[t?"download":"upload"]:!0};e(S)},a)},KM=(e,t)=>{const a=e!=null;return[r=>t[0]({lengthComputable:a,total:e,loaded:r}),t[1]]},QM=e=>(...t)=>Ge.asap(()=>e(...t)),NV=Si.hasStandardBrowserEnv?((e,t)=>a=>(a=new URL(a,Si.origin),e.protocol===a.protocol&&e.host===a.host&&(t||e.port===a.port)))(new URL(Si.origin),Si.navigator&&/(msie|trident)/i.test(Si.navigator.userAgent)):()=>!0,$V=Si.hasStandardBrowserEnv?{write(e,t,a,r,o,c){const f=[e+"="+encodeURIComponent(t)];Ge.isNumber(a)&&f.push("expires="+new Date(a).toGMTString()),Ge.isString(r)&&f.push("path="+r),Ge.isString(o)&&f.push("domain="+o),c===!0&&f.push("secure"),document.cookie=f.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function zV(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function jV(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function JM(e,t,a){let r=!zV(t);return e&&(r||a==!1)?jV(e,t):t}const e_=e=>e instanceof vo?{...e}:e;function Td(e,t){t=t||{};const a={};function r(p,y,S,E){return Ge.isPlainObject(p)&&Ge.isPlainObject(y)?Ge.merge.call({caseless:E},p,y):Ge.isPlainObject(y)?Ge.merge({},y):Ge.isArray(y)?y.slice():y}function o(p,y,S,E){if(Ge.isUndefined(y)){if(!Ge.isUndefined(p))return r(void 0,p,S,E)}else return r(p,y,S,E)}function c(p,y){if(!Ge.isUndefined(y))return r(void 0,y)}function f(p,y){if(Ge.isUndefined(y)){if(!Ge.isUndefined(p))return r(void 0,p)}else return r(void 0,y)}function m(p,y,S){if(S in t)return r(p,y);if(S in e)return r(void 0,p)}const g={url:c,method:c,data:c,baseURL:f,transformRequest:f,transformResponse:f,paramsSerializer:f,timeout:f,timeoutMessage:f,withCredentials:f,withXSRFToken:f,adapter:f,responseType:f,xsrfCookieName:f,xsrfHeaderName:f,onUploadProgress:f,onDownloadProgress:f,decompress:f,maxContentLength:f,maxBodyLength:f,beforeRedirect:f,transport:f,httpAgent:f,httpsAgent:f,cancelToken:f,socketPath:f,responseEncoding:f,validateStatus:m,headers:(p,y,S)=>o(e_(p),e_(y),S,!0)};return Ge.forEach(Object.keys(Object.assign({},e,t)),function(y){const S=g[y]||o,E=S(e[y],t[y],y);Ge.isUndefined(E)&&S!==m||(a[y]=E)}),a}const t_=e=>{const t=Td({},e);let{data:a,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:c,headers:f,auth:m}=t;t.headers=f=vo.from(f),t.url=FM(JM(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),m&&f.set("Authorization","Basic "+btoa((m.username||"")+":"+(m.password?unescape(encodeURIComponent(m.password)):"")));let g;if(Ge.isFormData(a)){if(Si.hasStandardBrowserEnv||Si.hasStandardBrowserWebWorkerEnv)f.setContentType(void 0);else if((g=f.getContentType())!==!1){const[p,...y]=g?g.split(";").map(S=>S.trim()).filter(Boolean):[];f.setContentType([p||"multipart/form-data",...y].join("; "))}}if(Si.hasStandardBrowserEnv&&(r&&Ge.isFunction(r)&&(r=r(t)),r||r!==!1&&NV(t.url))){const p=o&&c&&$V.read(c);p&&f.set(o,p)}return t},LV=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(a,r){const o=t_(e);let c=o.data;const f=vo.from(o.headers).normalize();let{responseType:m,onUploadProgress:g,onDownloadProgress:p}=o,y,S,E,T,O;function M(){T&&T(),O&&O(),o.cancelToken&&o.cancelToken.unsubscribe(y),o.signal&&o.signal.removeEventListener("abort",y)}let A=new XMLHttpRequest;A.open(o.method.toUpperCase(),o.url,!0),A.timeout=o.timeout;function D(){if(!A)return;const j=vo.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),N={data:!m||m==="text"||m==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:j,config:e,request:A};ZM(function(B){a(B),M()},function(B){r(B),M()},N),A=null}"onloadend"in A?A.onloadend=D:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(D)},A.onabort=function(){A&&(r(new Cn("Request aborted",Cn.ECONNABORTED,e,A)),A=null)},A.onerror=function(){r(new Cn("Network Error",Cn.ERR_NETWORK,e,A)),A=null},A.ontimeout=function(){let L=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const N=o.transitional||GM;o.timeoutErrorMessage&&(L=o.timeoutErrorMessage),r(new Cn(L,N.clarifyTimeoutError?Cn.ETIMEDOUT:Cn.ECONNABORTED,e,A)),A=null},c===void 0&&f.setContentType(null),"setRequestHeader"in A&&Ge.forEach(f.toJSON(),function(L,N){A.setRequestHeader(N,L)}),Ge.isUndefined(o.withCredentials)||(A.withCredentials=!!o.withCredentials),m&&m!=="json"&&(A.responseType=o.responseType),p&&([E,O]=zS(p,!0),A.addEventListener("progress",E)),g&&A.upload&&([S,T]=zS(g),A.upload.addEventListener("progress",S),A.upload.addEventListener("loadend",T)),(o.cancelToken||o.signal)&&(y=j=>{A&&(r(!j||j.type?new Sm(null,e,A):j),A.abort(),A=null)},o.cancelToken&&o.cancelToken.subscribe(y),o.signal&&(o.signal.aborted?y():o.signal.addEventListener("abort",y)));const _=MV(o.url);if(_&&Si.protocols.indexOf(_)===-1){r(new Cn("Unsupported protocol "+_+":",Cn.ERR_BAD_REQUEST,e));return}A.send(c||null)})},VV=(e,t)=>{const{length:a}=e=e?e.filter(Boolean):[];if(t||a){let r=new AbortController,o;const c=function(p){if(!o){o=!0,m();const y=p instanceof Error?p:this.reason;r.abort(y instanceof Cn?y:new Sm(y instanceof Error?y.message:y))}};let f=t&&setTimeout(()=>{f=null,c(new Cn(`timeout ${t} of ms exceeded`,Cn.ETIMEDOUT))},t);const m=()=>{e&&(f&&clearTimeout(f),f=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(c):p.removeEventListener("abort",c)}),e=null)};e.forEach(p=>p.addEventListener("abort",c));const{signal:g}=r;return g.unsubscribe=()=>Ge.asap(m),g}},HV=function*(e,t){let a=e.byteLength;if(a<t){yield e;return}let r=0,o;for(;r<a;)o=r+t,yield e.slice(r,o),r=o},BV=async function*(e,t){for await(const a of PV(e))yield*HV(a,t)},PV=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:a,value:r}=await t.read();if(a)break;yield r}}finally{await t.cancel()}},n_=(e,t,a,r)=>{const o=BV(e,t);let c=0,f,m=g=>{f||(f=!0,r&&r(g))};return new ReadableStream({async pull(g){try{const{done:p,value:y}=await o.next();if(p){m(),g.close();return}let S=y.byteLength;if(a){let E=c+=S;a(E)}g.enqueue(new Uint8Array(y))}catch(p){throw m(p),p}},cancel(g){return m(g),o.return()}},{highWaterMark:2})},jS=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",a_=jS&&typeof ReadableStream=="function",UV=jS&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),r_=(e,...t)=>{try{return!!e(...t)}catch{return!1}},IV=a_&&r_(()=>{let e=!1;const t=new Request(Si.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),i_=64*1024,xE=a_&&r_(()=>Ge.isReadableStream(new Response("").body)),LS={stream:xE&&(e=>e.body)};jS&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!LS[t]&&(LS[t]=Ge.isFunction(e[t])?a=>a[t]():(a,r)=>{throw new Cn(`Response type '${t}' is not supported`,Cn.ERR_NOT_SUPPORT,r)})})})(new Response);const kV=async e=>{if(e==null)return 0;if(Ge.isBlob(e))return e.size;if(Ge.isSpecCompliantForm(e))return(await new Request(Si.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(Ge.isArrayBufferView(e)||Ge.isArrayBuffer(e))return e.byteLength;if(Ge.isURLSearchParams(e)&&(e=e+""),Ge.isString(e))return(await UV(e)).byteLength},FV=async(e,t)=>{const a=Ge.toFiniteNumber(e.getContentLength());return a??kV(t)},CE={http:fV,xhr:LV,fetch:jS&&(async e=>{let{url:t,method:a,data:r,signal:o,cancelToken:c,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:p,headers:y,withCredentials:S="same-origin",fetchOptions:E}=t_(e);p=p?(p+"").toLowerCase():"text";let T=VV([o,c&&c.toAbortSignal()],f),O;const M=T&&T.unsubscribe&&(()=>{T.unsubscribe()});let A;try{if(g&&IV&&a!=="get"&&a!=="head"&&(A=await FV(y,r))!==0){let N=new Request(t,{method:"POST",body:r,duplex:"half"}),V;if(Ge.isFormData(r)&&(V=N.headers.get("content-type"))&&y.setContentType(V),N.body){const[B,z]=KM(A,zS(QM(g)));r=n_(N.body,i_,B,z)}}Ge.isString(S)||(S=S?"include":"omit");const D="credentials"in Request.prototype;O=new Request(t,{...E,signal:T,method:a.toUpperCase(),headers:y.normalize().toJSON(),body:r,duplex:"half",credentials:D?S:void 0});let _=await fetch(O,E);const j=xE&&(p==="stream"||p==="response");if(xE&&(m||j&&M)){const N={};["status","statusText","headers"].forEach(U=>{N[U]=_[U]});const V=Ge.toFiniteNumber(_.headers.get("content-length")),[B,z]=m&&KM(V,zS(QM(m),!0))||[];_=new Response(n_(_.body,i_,B,()=>{z&&z(),M&&M()}),N)}p=p||"text";let L=await LS[Ge.findKey(LS,p)||"text"](_,e);return!j&&M&&M(),await new Promise((N,V)=>{ZM(N,V,{data:L,headers:vo.from(_.headers),status:_.status,statusText:_.statusText,config:e,request:O})})}catch(D){throw M&&M(),D&&D.name==="TypeError"&&/Load failed|fetch/i.test(D.message)?Object.assign(new Cn("Network Error",Cn.ERR_NETWORK,e,O),{cause:D.cause||D}):Cn.from(D,D&&D.code,e,O)}})};Ge.forEach(CE,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const o_=e=>`- ${e}`,qV=e=>Ge.isFunction(e)||e===null||e===!1,l_={getAdapter:e=>{e=Ge.isArray(e)?e:[e];const{length:t}=e;let a,r;const o={};for(let c=0;c<t;c++){a=e[c];let f;if(r=a,!qV(a)&&(r=CE[(f=String(a)).toLowerCase()],r===void 0))throw new Cn(`Unknown adapter '${f}'`);if(r)break;o[f||"#"+c]=r}if(!r){const c=Object.entries(o).map(([m,g])=>`adapter ${m} `+(g===!1?"is not supported by the environment":"is not available in the build"));let f=t?c.length>1?`since :
322
322
  `+c.map(o_).join(`
323
323
  `):" "+o_(c[0]):"as no adapter specified";throw new Cn("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return r},adapters:CE};function EE(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Sm(null,e)}function s_(e){return EE(e),e.headers=vo.from(e.headers),e.data=SE.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),l_.getAdapter(e.adapter||Rv.adapter)(e).then(function(r){return EE(e),r.data=SE.call(e,e.transformResponse,r),r.headers=vo.from(r.headers),r},function(r){return WM(r)||(EE(e),r&&r.response&&(r.response.data=SE.call(e,e.transformResponse,r.response),r.response.headers=vo.from(r.response.headers))),Promise.reject(r)})}const u_="1.10.0",VS={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{VS[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const c_={};VS.transitional=function(t,a,r){function o(c,f){return"[Axios v"+u_+"] Transitional option '"+c+"'"+f+(r?". "+r:"")}return(c,f,m)=>{if(t===!1)throw new Cn(o(f," has been removed"+(a?" in "+a:"")),Cn.ERR_DEPRECATED);return a&&!c_[f]&&(c_[f]=!0,console.warn(o(f," has been deprecated since v"+a+" and will be removed in the near future"))),t?t(c,f,m):!0}},VS.spelling=function(t){return(a,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function GV(e,t,a){if(typeof e!="object")throw new Cn("options must be an object",Cn.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const c=r[o],f=t[c];if(f){const m=e[c],g=m===void 0||f(m,c,e);if(g!==!0)throw new Cn("option "+c+" must be "+g,Cn.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new Cn("Unknown option "+c,Cn.ERR_BAD_OPTION)}}const HS={assertOptions:GV,validators:VS},qs=HS.validators;let Od=class{constructor(t){this.defaults=t||{},this.interceptors={request:new qM,response:new qM}}async request(t,a){try{return await this._request(t,a)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const c=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?c&&!String(r.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(r.stack+=`
324
- `+c):r.stack=c}catch{}}throw r}}_request(t,a){typeof t=="string"?(a=a||{},a.url=t):a=t||{},a=Td(this.defaults,a);const{transitional:r,paramsSerializer:o,headers:c}=a;r!==void 0&&HS.assertOptions(r,{silentJSONParsing:qs.transitional(qs.boolean),forcedJSONParsing:qs.transitional(qs.boolean),clarifyTimeoutError:qs.transitional(qs.boolean)},!1),o!=null&&(Ge.isFunction(o)?a.paramsSerializer={serialize:o}:HS.assertOptions(o,{encode:qs.function,serialize:qs.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),HS.assertOptions(a,{baseUrl:qs.spelling("baseURL"),withXsrfToken:qs.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let f=c&&Ge.merge(c.common,c[a.method]);c&&Ge.forEach(["delete","get","head","post","put","patch","common"],O=>{delete c[O]}),a.headers=vo.concat(f,c);const m=[];let g=!0;this.interceptors.request.forEach(function(M){typeof M.runWhen=="function"&&M.runWhen(a)===!1||(g=g&&M.synchronous,m.unshift(M.fulfilled,M.rejected))});const p=[];this.interceptors.response.forEach(function(M){p.push(M.fulfilled,M.rejected)});let y,S=0,E;if(!g){const O=[s_.bind(this),void 0];for(O.unshift.apply(O,m),O.push.apply(O,p),E=O.length,y=Promise.resolve(a);S<E;)y=y.then(O[S++],O[S++]);return y}E=m.length;let T=a;for(S=0;S<E;){const O=m[S++],M=m[S++];try{T=O(T)}catch(A){M.call(this,A);break}}try{y=s_.call(this,T)}catch(O){return Promise.reject(O)}for(S=0,E=p.length;S<E;)y=y.then(p[S++],p[S++]);return y}getUri(t){t=Td(this.defaults,t);const a=JM(t.baseURL,t.url,t.allowAbsoluteUrls);return FM(a,t.params,t.paramsSerializer)}};Ge.forEach(["delete","get","head","options"],function(t){Od.prototype[t]=function(a,r){return this.request(Td(r||{},{method:t,url:a,data:(r||{}).data}))}}),Ge.forEach(["post","put","patch"],function(t){function a(r){return function(c,f,m){return this.request(Td(m||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:f}))}}Od.prototype[t]=a(),Od.prototype[t+"Form"]=a(!0)});let XV=class d8{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(c){a=c});const r=this;this.promise.then(o=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](o);r._listeners=null}),this.promise.then=o=>{let c;const f=new Promise(m=>{r.subscribe(m),c=m}).then(o);return f.cancel=function(){r.unsubscribe(c)},f},t(function(c,f,m){r.reason||(r.reason=new Sm(c,f,m),a(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const a=this._listeners.indexOf(t);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const t=new AbortController,a=r=>{t.abort(r)};return this.subscribe(a),t.signal.unsubscribe=()=>this.unsubscribe(a),t.signal}static source(){let t;return{token:new d8(function(o){t=o}),cancel:t}}};function YV(e){return function(a){return e.apply(null,a)}}function WV(e){return Ge.isObject(e)&&e.isAxiosError===!0}const wE={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(wE).forEach(([e,t])=>{wE[t]=e});function f_(e){const t=new Od(e),a=MM(Od.prototype.request,t);return Ge.extend(a,Od.prototype,t,{allOwnKeys:!0}),Ge.extend(a,t,null,{allOwnKeys:!0}),a.create=function(o){return f_(Td(e,o))},a}const $a=f_(Rv);$a.Axios=Od,$a.CanceledError=Sm,$a.CancelToken=XV,$a.isCancel=WM,$a.VERSION=u_,$a.toFormData=NS,$a.AxiosError=Cn,$a.Cancel=$a.CanceledError,$a.all=function(t){return Promise.all(t)},$a.spread=YV,$a.isAxiosError=WV,$a.mergeConfig=Td,$a.AxiosHeaders=vo,$a.formToJSON=e=>XM(Ge.isHTMLForm(e)?new FormData(e):e),$a.getAdapter=l_.getAdapter,$a.HttpStatusCode=wE,$a.default=$a;const{Axios:Gie,AxiosError:Xie,CanceledError:Yie,isCancel:Wie,CancelToken:Zie,VERSION:Kie,all:Qie,Cancel:Jie,isAxiosError:eoe,spread:toe,toFormData:noe,AxiosHeaders:aoe,HttpStatusCode:roe,formToJSON:ioe,getAdapter:ooe,mergeConfig:loe}=$a,ii={apiUrl:"https://jawebcrm.onrender.com/api/",websocketUrl:"wss://jawebcrm.onrender.com/ws"},sn=e=>typeof e=="string",Mv=()=>{let e,t;const a=new Promise((r,o)=>{e=r,t=o});return a.resolve=e,a.reject=t,a},d_=e=>e==null?"":""+e,ZV=(e,t,a)=>{e.forEach(r=>{t[r]&&(a[r]=t[r])})},KV=/###/g,h_=e=>e&&e.indexOf("###")>-1?e.replace(KV,"."):e,m_=e=>!e||sn(e),_v=(e,t,a)=>{const r=sn(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(m_(e))return{};const c=h_(r[o]);!e[c]&&a&&(e[c]=new a),Object.prototype.hasOwnProperty.call(e,c)?e=e[c]:e={},++o}return m_(e)?{}:{obj:e,k:h_(r[o])}},p_=(e,t,a)=>{const{obj:r,k:o}=_v(e,t,Object);if(r!==void 0||t.length===1){r[o]=a;return}let c=t[t.length-1],f=t.slice(0,t.length-1),m=_v(e,f,Object);for(;m.obj===void 0&&f.length;)c=`${f[f.length-1]}.${c}`,f=f.slice(0,f.length-1),m=_v(e,f,Object),m?.obj&&typeof m.obj[`${m.k}.${c}`]<"u"&&(m.obj=void 0);m.obj[`${m.k}.${c}`]=a},QV=(e,t,a,r)=>{const{obj:o,k:c}=_v(e,t,Object);o[c]=o[c]||[],o[c].push(a)},BS=(e,t)=>{const{obj:a,k:r}=_v(e,t);if(a&&Object.prototype.hasOwnProperty.call(a,r))return a[r]},JV=(e,t,a)=>{const r=BS(e,a);return r!==void 0?r:BS(t,a)},g_=(e,t,a)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?sn(e[r])||e[r]instanceof String||sn(t[r])||t[r]instanceof String?a&&(e[r]=t[r]):g_(e[r],t[r],a):e[r]=t[r]);return e},xm=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var eH={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const tH=e=>sn(e)?e.replace(/[&<>"'\/]/g,t=>eH[t]):e;class nH{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const a=this.regExpMap.get(t);if(a!==void 0)return a;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const aH=[" ",",","?","!",";"],rH=new nH(20),iH=(e,t,a)=>{t=t||"",a=a||"";const r=aH.filter(f=>t.indexOf(f)<0&&a.indexOf(f)<0);if(r.length===0)return!0;const o=rH.getRegExp(`(${r.map(f=>f==="?"?"\\?":f).join("|")})`);let c=!o.test(e);if(!c){const f=e.indexOf(a);f>0&&!o.test(e.substring(0,f))&&(c=!0)}return c},TE=(e,t,a=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(a);let o=e;for(let c=0;c<r.length;){if(!o||typeof o!="object")return;let f,m="";for(let g=c;g<r.length;++g)if(g!==c&&(m+=a),m+=r[g],f=o[m],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&g<r.length-1)continue;c+=g-c+1;break}o=f}return o},Dv=e=>e?.replace("_","-"),oH={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class PS{constructor(t,a={}){this.init(t,a)}init(t,a={}){this.prefix=a.prefix||"i18next:",this.logger=t||oH,this.options=a,this.debug=a.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,a,r,o){return o&&!this.debug?null:(sn(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[a](t))}create(t){return new PS(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new PS(this.logger,t)}}var Gs=new PS;class US{constructor(){this.observers={}}on(t,a){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(a)||0;this.observers[r].set(a,o+1)}),this}off(t,a){if(this.observers[t]){if(!a){delete this.observers[t];return}this.observers[t].delete(a)}}emit(t,...a){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o.apply(o,[t,...a])})}}class v_ extends US{constructor(t,a={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const a=this.options.ns.indexOf(t);a>-1&&this.options.ns.splice(a,1)}getResource(t,a,r,o={}){const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,f=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let m;t.indexOf(".")>-1?m=t.split("."):(m=[t,a],r&&(Array.isArray(r)?m.push(...r):sn(r)&&c?m.push(...r.split(c)):m.push(r)));const g=BS(this.data,m);return!g&&!a&&!r&&t.indexOf(".")>-1&&(t=m[0],a=m[1],r=m.slice(2).join(".")),g||!f||!sn(r)?g:TE(this.data?.[t]?.[a],r,c)}addResource(t,a,r,o,c={silent:!1}){const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let m=[t,a];r&&(m=m.concat(f?r.split(f):r)),t.indexOf(".")>-1&&(m=t.split("."),o=a,a=m[1]),this.addNamespaces(a),p_(this.data,m,o),c.silent||this.emit("added",t,a,r,o)}addResources(t,a,r,o={silent:!1}){for(const c in r)(sn(r[c])||Array.isArray(r[c]))&&this.addResource(t,a,c,r[c],{silent:!0});o.silent||this.emit("added",t,a,r)}addResourceBundle(t,a,r,o,c,f={silent:!1,skipCopy:!1}){let m=[t,a];t.indexOf(".")>-1&&(m=t.split("."),o=r,r=a,a=m[1]),this.addNamespaces(a);let g=BS(this.data,m)||{};f.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?g_(g,r,c):g={...g,...r},p_(this.data,m,g),f.silent||this.emit("added",t,a,r)}removeResourceBundle(t,a){this.hasResourceBundle(t,a)&&delete this.data[t][a],this.removeNamespaces(a),this.emit("removed",t,a)}hasResourceBundle(t,a){return this.getResource(t,a)!==void 0}getResourceBundle(t,a){return a||(a=this.options.defaultNS),this.getResource(t,a)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const a=this.getDataByLanguage(t);return!!(a&&Object.keys(a)||[]).find(o=>a[o]&&Object.keys(a[o]).length>0)}toJSON(){return this.data}}var y_={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,r,o){return e.forEach(c=>{t=this.processors[c]?.process(t,a,r,o)??t}),t}};const b_={},S_=e=>!sn(e)&&typeof e!="boolean"&&typeof e!="number";class IS extends US{constructor(t,a={}){super(),ZV(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Gs.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,a={interpolation:{}}){const r={...a};return t==null?!1:this.resolve(t,r)?.res!==void 0}extractFromKey(t,a){let r=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let c=a.ns||this.options.defaultNS||[];const f=r&&t.indexOf(r)>-1,m=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!iH(t,r,o);if(f&&!m){const g=t.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:t,namespaces:sn(c)?[c]:c};const p=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(p[0])>-1)&&(c=p.shift()),t=p.join(o)}return{key:t,namespaces:sn(c)?[c]:c}}translate(t,a,r){let o=typeof a=="object"?{...a}:a;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(o={...o}),o||(o={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const c=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,f=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:m,namespaces:g}=this.extractFromKey(t[t.length-1],o),p=g[g.length-1];let y=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const S=o.lng||this.language,E=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(S?.toLowerCase()==="cimode")return E?c?{res:`${p}${y}${m}`,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:`${p}${y}${m}`:c?{res:m,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:m;const T=this.resolve(t,o);let O=T?.res;const M=T?.usedKey||m,A=T?.exactUsedKey||m,D=["[object Number]","[object Function]","[object RegExp]"],_=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,L=o.count!==void 0&&!sn(o.count),N=IS.hasDefaultValue(o),V=L?this.pluralResolver.getSuffix(S,o.count,o):"",B=o.ordinal&&L?this.pluralResolver.getSuffix(S,o.count,{ordinal:!1}):"",z=L&&!o.ordinal&&o.count===0,U=z&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${V}`]||o[`defaultValue${B}`]||o.defaultValue;let H=O;j&&!O&&N&&(H=U);const ee=S_(H),Y=Object.prototype.toString.apply(H);if(j&&H&&ee&&D.indexOf(Y)<0&&!(sn(_)&&Array.isArray(H))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Z=this.options.returnedObjectHandler?this.options.returnedObjectHandler(M,H,{...o,ns:g}):`key '${m} (${this.language})' returned an object instead of string.`;return c?(T.res=Z,T.usedParams=this.getUsedParamsDetails(o),T):Z}if(f){const Z=Array.isArray(H),W=Z?[]:{},ie=Z?A:M;for(const G in H)if(Object.prototype.hasOwnProperty.call(H,G)){const k=`${ie}${f}${G}`;N&&!O?W[G]=this.translate(k,{...o,defaultValue:S_(U)?U[G]:void 0,joinArrays:!1,ns:g}):W[G]=this.translate(k,{...o,joinArrays:!1,ns:g}),W[G]===k&&(W[G]=H[G])}O=W}}else if(j&&sn(_)&&Array.isArray(O))O=O.join(_),O&&(O=this.extendTranslation(O,t,o,r));else{let Z=!1,W=!1;!this.isValidLookup(O)&&N&&(Z=!0,O=U),this.isValidLookup(O)||(W=!0,O=m);const G=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&W?void 0:O,k=N&&U!==O&&this.options.updateMissing;if(W||Z||k){if(this.logger.log(k?"updateKey":"missingKey",S,p,m,k?U:O),f){const F=this.resolve(m,{...o,keySeparator:!1});F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Q=[];const se=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&se&&se[0])for(let F=0;F<se.length;F++)Q.push(se[F]);else this.options.saveMissingTo==="all"?Q=this.languageUtils.toResolveHierarchy(o.lng||this.language):Q.push(o.lng||this.language);const q=(F,te,ae)=>{const oe=N&&ae!==O?ae:G;this.options.missingKeyHandler?this.options.missingKeyHandler(F,p,te,oe,k,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(F,p,te,oe,k,o),this.emit("missingKey",F,p,te,O)};this.options.saveMissing&&(this.options.saveMissingPlurals&&L?Q.forEach(F=>{const te=this.pluralResolver.getSuffixes(F,o);z&&o[`defaultValue${this.options.pluralSeparator}zero`]&&te.indexOf(`${this.options.pluralSeparator}zero`)<0&&te.push(`${this.options.pluralSeparator}zero`),te.forEach(ae=>{q([F],m+ae,o[`defaultValue${ae}`]||U)})}):q(Q,m,U))}O=this.extendTranslation(O,t,o,T,r),W&&O===m&&this.options.appendNamespaceToMissingKey&&(O=`${p}${y}${m}`),(W||Z)&&this.options.parseMissingKeyHandler&&(O=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${y}${m}`:m,Z?O:void 0,o))}return c?(T.res=O,T.usedParams=this.getUsedParamsDetails(o),T):O}extendTranslation(t,a,r,o,c){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const g=sn(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(g){const S=t.match(this.interpolator.nestingRegexp);p=S&&S.length}let y=r.replace&&!sn(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(y={...this.options.interpolation.defaultVariables,...y}),t=this.interpolator.interpolate(t,y,r.lng||this.language||o.usedLng,r),g){const S=t.match(this.interpolator.nestingRegexp),E=S&&S.length;p<E&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...S)=>c?.[0]===S[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${S[0]} in key: ${a[0]}`),null):this.translate(...S,a),r)),r.interpolation&&this.interpolator.reset()}const f=r.postProcess||this.options.postProcess,m=sn(f)?[f]:f;return t!=null&&m?.length&&r.applyPostProcessor!==!1&&(t=y_.handle(m,t,a,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,a={}){let r,o,c,f,m;return sn(t)&&(t=[t]),t.forEach(g=>{if(this.isValidLookup(r))return;const p=this.extractFromKey(g,a),y=p.key;o=y;let S=p.namespaces;this.options.fallbackNS&&(S=S.concat(this.options.fallbackNS));const E=a.count!==void 0&&!sn(a.count),T=E&&!a.ordinal&&a.count===0,O=a.context!==void 0&&(sn(a.context)||typeof a.context=="number")&&a.context!=="",M=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);S.forEach(A=>{this.isValidLookup(r)||(m=A,!b_[`${M[0]}-${A}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(m)&&(b_[`${M[0]}-${A}`]=!0,this.logger.warn(`key "${o}" for languages "${M.join(", ")}" won't get resolved as namespace "${m}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),M.forEach(D=>{if(this.isValidLookup(r))return;f=D;const _=[y];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(_,y,D,A,a);else{let L;E&&(L=this.pluralResolver.getSuffix(D,a.count,a));const N=`${this.options.pluralSeparator}zero`,V=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(E&&(_.push(y+L),a.ordinal&&L.indexOf(V)===0&&_.push(y+L.replace(V,this.options.pluralSeparator)),T&&_.push(y+N)),O){const B=`${y}${this.options.contextSeparator}${a.context}`;_.push(B),E&&(_.push(B+L),a.ordinal&&L.indexOf(V)===0&&_.push(B+L.replace(V,this.options.pluralSeparator)),T&&_.push(B+N))}}let j;for(;j=_.pop();)this.isValidLookup(r)||(c=j,r=this.getResource(D,A,j,a))}))})}),{res:r,usedKey:o,exactUsedKey:c,usedLng:f,usedNS:m}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,a,r,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,a,r,o):this.resourceStore.getResource(t,a,r,o)}getUsedParamsDetails(t={}){const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!sn(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const c of a)delete o[c]}return o}static hasDefaultValue(t){const a="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&a===r.substring(0,a.length)&&t[r]!==void 0)return!0;return!1}}class x_{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Gs.create("languageUtils")}getScriptPartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return null;const a=t.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return t;const a=t.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(t){if(sn(t)&&t.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(t)[0]}catch{}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let a;return t.forEach(r=>{if(a)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(a=o)}),!a&&this.options.supportedLngs&&t.forEach(r=>{if(a)return;const o=this.getScriptPartFromCode(r);if(this.isSupportedCode(o))return a=o;const c=this.getLanguagePartFromCode(r);if(this.isSupportedCode(c))return a=c;a=this.options.supportedLngs.find(f=>{if(f===c)return f;if(!(f.indexOf("-")<0&&c.indexOf("-")<0)&&(f.indexOf("-")>0&&c.indexOf("-")<0&&f.substring(0,f.indexOf("-"))===c||f.indexOf(c)===0&&c.length>1))return f})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(t,a){if(!t)return[];if(typeof t=="function"&&(t=t(a)),sn(t)&&(t=[t]),Array.isArray(t))return t;if(!a)return t.default||[];let r=t[a];return r||(r=t[this.getScriptPartFromCode(a)]),r||(r=t[this.formatLanguageCode(a)]),r||(r=t[this.getLanguagePartFromCode(a)]),r||(r=t.default),r||[]}toResolveHierarchy(t,a){const r=this.getFallbackCodes((a===!1?[]:a)||this.options.fallbackLng||[],t),o=[],c=f=>{f&&(this.isSupportedCode(f)?o.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return sn(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(t))):sn(t)&&c(this.formatLanguageCode(t)),r.forEach(f=>{o.indexOf(f)<0&&c(this.formatLanguageCode(f))}),o}}const C_={zero:0,one:1,two:2,few:3,many:4,other:5},E_={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class lH{constructor(t,a={}){this.languageUtils=t,this.options=a,this.logger=Gs.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,a){this.rules[t]=a}clearCache(){this.pluralRulesCache={}}getRule(t,a={}){const r=Dv(t==="dev"?"en":t),o=a.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:r,type:o});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let f;try{f=new Intl.PluralRules(r,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),E_;if(!t.match(/-|_/))return E_;const g=this.languageUtils.getLanguagePartFromCode(t);f=this.getRule(g,a)}return this.pluralRulesCache[c]=f,f}needsPlural(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,a,r={}){return this.getSuffixes(t,r).map(o=>`${a}${o}`)}getSuffixes(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?r.resolvedOptions().pluralCategories.sort((o,c)=>C_[o]-C_[c]).map(o=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,a,r={}){const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(a)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",a,r))}}const w_=(e,t,a,r=".",o=!0)=>{let c=JV(e,t,a);return!c&&o&&sn(a)&&(c=TE(e,a,r),c===void 0&&(c=TE(t,a,r))),c},OE=e=>e.replace(/\$/g,"$$$$");class sH{constructor(t={}){this.logger=Gs.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(a=>a),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:a,escapeValue:r,useRawValueToEscape:o,prefix:c,prefixEscaped:f,suffix:m,suffixEscaped:g,formatSeparator:p,unescapeSuffix:y,unescapePrefix:S,nestingPrefix:E,nestingPrefixEscaped:T,nestingSuffix:O,nestingSuffixEscaped:M,nestingOptionsSeparator:A,maxReplaces:D,alwaysFormat:_}=t.interpolation;this.escape=a!==void 0?a:tH,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=c?xm(c):f||"{{",this.suffix=m?xm(m):g||"}}",this.formatSeparator=p||",",this.unescapePrefix=y?"":S||"-",this.unescapeSuffix=this.unescapePrefix?"":y||"",this.nestingPrefix=E?xm(E):T||xm("$t("),this.nestingSuffix=O?xm(O):M||xm(")"),this.nestingOptionsSeparator=A||",",this.maxReplaces=D||1e3,this.alwaysFormat=_!==void 0?_:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(a,r)=>a?.source===r?(a.lastIndex=0,a):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,a,r,o){let c,f,m;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=T=>{if(T.indexOf(this.formatSeparator)<0){const D=w_(a,g,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(D,void 0,r,{...o,...a,interpolationkey:T}):D}const O=T.split(this.formatSeparator),M=O.shift().trim(),A=O.join(this.formatSeparator).trim();return this.format(w_(a,g,M,this.options.keySeparator,this.options.ignoreJSONStructure),A,r,{...o,...a,interpolationkey:M})};this.resetRegExp();const y=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,S=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>OE(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?OE(this.escape(T)):OE(T)}].forEach(T=>{for(m=0;c=T.regex.exec(t);){const O=c[1].trim();if(f=p(O),f===void 0)if(typeof y=="function"){const A=y(t,c,o);f=sn(A)?A:""}else if(o&&Object.prototype.hasOwnProperty.call(o,O))f="";else if(S){f=c[0];continue}else this.logger.warn(`missed to pass in variable ${O} for interpolating ${t}`),f="";else!sn(f)&&!this.useRawValueToEscape&&(f=d_(f));const M=T.safeValue(f);if(t=t.replace(c[0],M),S?(T.regex.lastIndex+=f.length,T.regex.lastIndex-=c[0].length):T.regex.lastIndex=0,m++,m>=this.maxReplaces)break}}),t}nest(t,a,r={}){let o,c,f;const m=(g,p)=>{const y=this.nestingOptionsSeparator;if(g.indexOf(y)<0)return g;const S=g.split(new RegExp(`${y}[ ]*{`));let E=`{${S[1]}`;g=S[0],E=this.interpolate(E,f);const T=E.match(/'/g),O=E.match(/"/g);((T?.length??0)%2===0&&!O||O.length%2!==0)&&(E=E.replace(/'/g,'"'));try{f=JSON.parse(E),p&&(f={...p,...f})}catch(M){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,M),`${g}${y}${E}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,g};for(;o=this.nestingRegexp.exec(t);){let g=[];f={...r},f=f.replace&&!sn(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;const p=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(p!==-1&&(g=o[1].slice(p).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),o[1]=o[1].slice(0,p)),c=a(m.call(this,o[1].trim(),f),f),c&&o[0]===t&&!sn(c))return c;sn(c)||(c=d_(c)),c||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),c=""),g.length&&(c=g.reduce((y,S)=>this.format(y,S,r.lng,{...r,interpolationkey:o[1].trim()}),c.trim())),t=t.replace(o[0],c),this.regexp.lastIndex=0}return t}}const uH=e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?a.currency||(a.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?a.range||(a.range=o.trim()):o.split(";").forEach(f=>{if(f){const[m,...g]=f.split(":"),p=g.join(":").trim().replace(/^'+|'+$/g,""),y=m.trim();a[y]||(a[y]=p),p==="false"&&(a[y]=!1),p==="true"&&(a[y]=!0),isNaN(p)||(a[y]=parseInt(p,10))}})}return{formatName:t,formatOptions:a}},T_=e=>{const t={};return(a,r,o)=>{let c=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(c={...c,[o.interpolationkey]:void 0});const f=r+JSON.stringify(c);let m=t[f];return m||(m=e(Dv(r),o),t[f]=m),m(a)}},cH=e=>(t,a,r)=>e(Dv(a),r)(t);class fH{constructor(t={}){this.logger=Gs.create("formatter"),this.options=t,this.init(t)}init(t,a={interpolation:{}}){this.formatSeparator=a.interpolation.formatSeparator||",";const r=a.cacheInBuiltFormats?T_:cH;this.formats={number:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c});return m=>f.format(m)}),currency:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c,style:"currency"});return m=>f.format(m)}),datetime:r((o,c)=>{const f=new Intl.DateTimeFormat(o,{...c});return m=>f.format(m)}),relativetime:r((o,c)=>{const f=new Intl.RelativeTimeFormat(o,{...c});return m=>f.format(m,c.range||"day")}),list:r((o,c)=>{const f=new Intl.ListFormat(o,{...c});return m=>f.format(m)})}}add(t,a){this.formats[t.toLowerCase().trim()]=a}addCached(t,a){this.formats[t.toLowerCase().trim()]=T_(a)}format(t,a,r,o={}){const c=a.split(this.formatSeparator);if(c.length>1&&c[0].indexOf("(")>1&&c[0].indexOf(")")<0&&c.find(m=>m.indexOf(")")>-1)){const m=c.findIndex(g=>g.indexOf(")")>-1);c[0]=[c[0],...c.splice(1,m)].join(this.formatSeparator)}return c.reduce((m,g)=>{const{formatName:p,formatOptions:y}=uH(g);if(this.formats[p]){let S=m;try{const E=o?.formatParams?.[o.interpolationkey]||{},T=E.locale||E.lng||o.locale||o.lng||r;S=this.formats[p](m,T,{...y,...o,...E})}catch(E){this.logger.warn(E)}return S}else this.logger.warn(`there was no format function for ${p}`);return m},t)}}const dH=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class hH extends US{constructor(t,a,r,o={}){super(),this.backend=t,this.store=a,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=Gs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,o.backend,o)}queueLoad(t,a,r,o){const c={},f={},m={},g={};return t.forEach(p=>{let y=!0;a.forEach(S=>{const E=`${p}|${S}`;!r.reload&&this.store.hasResourceBundle(p,S)?this.state[E]=2:this.state[E]<0||(this.state[E]===1?f[E]===void 0&&(f[E]=!0):(this.state[E]=1,y=!1,f[E]===void 0&&(f[E]=!0),c[E]===void 0&&(c[E]=!0),g[S]===void 0&&(g[S]=!0)))}),y||(m[p]=!0)}),(Object.keys(c).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(c),pending:Object.keys(f),toLoadLanguages:Object.keys(m),toLoadNamespaces:Object.keys(g)}}loaded(t,a,r){const o=t.split("|"),c=o[0],f=o[1];a&&this.emit("failedLoading",c,f,a),!a&&r&&this.store.addResourceBundle(c,f,r,void 0,void 0,{skipCopy:!0}),this.state[t]=a?-1:2,a&&r&&(this.state[t]=0);const m={};this.queue.forEach(g=>{QV(g.loaded,[c],f),dH(g,t),a&&g.errors.push(a),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(p=>{m[p]||(m[p]={});const y=g.loaded[p];y.length&&y.forEach(S=>{m[p][S]===void 0&&(m[p][S]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",m),this.queue=this.queue.filter(g=>!g.done)}read(t,a,r,o=0,c=this.retryTimeout,f){if(!t.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:a,fcName:r,tried:o,wait:c,callback:f});return}this.readingCalls++;const m=(p,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const S=this.waitingReads.shift();this.read(S.lng,S.ns,S.fcName,S.tried,S.wait,S.callback)}if(p&&y&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,a,r,o+1,c*2,f)},c);return}f(p,y)},g=this.backend[r].bind(this.backend);if(g.length===2){try{const p=g(t,a);p&&typeof p.then=="function"?p.then(y=>m(null,y)).catch(m):m(null,p)}catch(p){m(p)}return}return g(t,a,m)}prepareLoading(t,a,r={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();sn(t)&&(t=this.languageUtils.toResolveHierarchy(t)),sn(a)&&(a=[a]);const c=this.queueLoad(t,a,r,o);if(!c.toLoad.length)return c.pending.length||o(),null;c.toLoad.forEach(f=>{this.loadOne(f)})}load(t,a,r){this.prepareLoading(t,a,{},r)}reload(t,a,r){this.prepareLoading(t,a,{reload:!0},r)}loadOne(t,a=""){const r=t.split("|"),o=r[0],c=r[1];this.read(o,c,"read",void 0,void 0,(f,m)=>{f&&this.logger.warn(`${a}loading namespace ${c} for language ${o} failed`,f),!f&&m&&this.logger.log(`${a}loaded namespace ${c} for language ${o}`,m),this.loaded(t,f,m)})}saveMissing(t,a,r,o,c,f={},m=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(a)){this.logger.warn(`did not save key "${r}" as the namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const g={...f,isUpdate:c},p=this.backend.create.bind(this.backend);if(p.length<6)try{let y;p.length===5?y=p(t,a,r,o,g):y=p(t,a,r,o),y&&typeof y.then=="function"?y.then(S=>m(null,S)).catch(m):m(null,y)}catch(y){m(y)}else p(t,a,r,o,m,g)}!t||!t[0]||this.store.addResource(t[0],a,r,o)}}}const O_=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),sn(e[1])&&(t.defaultValue=e[1]),sn(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const a=e[3]||e[2];Object.keys(a).forEach(r=>{t[r]=a[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),R_=e=>(sn(e.ns)&&(e.ns=[e.ns]),sn(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),sn(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),kS=()=>{},mH=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(a=>{typeof e[a]=="function"&&(e[a]=e[a].bind(e))})};class Nv extends US{constructor(t={},a){if(super(),this.options=R_(t),this.services={},this.logger=Gs,this.modules={external:[]},mH(this),a&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,a),this;setTimeout(()=>{this.init(t,a)},0)}}init(t={},a){this.isInitializing=!0,typeof t=="function"&&(a=t,t={}),t.defaultNS==null&&t.ns&&(sn(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=O_();this.options={...r,...this.options,...R_(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?Gs.init(o(this.modules.logger),this.options):Gs.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=fH;const y=new x_(this.options);this.store=new v_(this.options.resources,this.options);const S=this.services;S.logger=Gs,S.resourceStore=this.store,S.languageUtils=y,S.pluralResolver=new lH(y,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(S.formatter=o(p),S.formatter.init&&S.formatter.init(S,this.options),this.options.interpolation.format=S.formatter.format.bind(S.formatter)),S.interpolator=new sH(this.options),S.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},S.backendConnector=new hH(o(this.modules.backend),S.resourceStore,S,this.options),S.backendConnector.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.languageDetector&&(S.languageDetector=o(this.modules.languageDetector),S.languageDetector.init&&S.languageDetector.init(S,this.options.detection,this.options)),this.modules.i18nFormat&&(S.i18nFormat=o(this.modules.i18nFormat),S.i18nFormat.init&&S.i18nFormat.init(this)),this.translator=new IS(this.services,this.options),this.translator.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.external.forEach(T=>{T.init&&T.init(this)})}if(this.format=this.options.interpolation.format,a||(a=kS),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=(...y)=>this.store[p](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...y)=>(this.store[p](...y),this)});const m=Mv(),g=()=>{const p=(y,S)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),m.resolve(S),a(y,S)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?g():setTimeout(g,0),m}loadResources(t,a=kS){let r=a;const o=sn(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const c=[],f=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(p=>{p!=="cimode"&&c.indexOf(p)<0&&c.push(p)})};o?f(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(g=>f(g)),this.options.preload?.forEach?.(m=>f(m)),this.services.backendConnector.load(c,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(m)})}else r(null)}reloadResources(t,a,r){const o=Mv();return typeof t=="function"&&(r=t,t=void 0),typeof a=="function"&&(r=a,a=void 0),t||(t=this.languages),a||(a=this.options.ns),r||(r=kS),this.services.backendConnector.reload(t,a,c=>{o.resolve(),r(c)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&y_.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let a=0;a<this.languages.length;a++){const r=this.languages[a];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,a){this.isLanguageChangingTo=t;const r=Mv();this.emit("languageChanging",t);const o=m=>{this.language=m,this.languages=this.services.languageUtils.toResolveHierarchy(m),this.resolvedLanguage=void 0,this.setResolvedLanguage(m)},c=(m,g)=>{g?this.isLanguageChangingTo===t&&(o(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,r.resolve((...p)=>this.t(...p)),a&&a(m,(...p)=>this.t(...p))},f=m=>{!t&&!m&&this.services.languageDetector&&(m=[]);const g=sn(m)?m:m&&m[0],p=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(sn(m)?[m]:m);p&&(this.language||o(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector?.cacheUserLanguage?.(p)),this.loadResources(p,y=>{c(y,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(t),r}getFixedT(t,a,r){const o=(c,f,...m)=>{let g;typeof f!="object"?g=this.options.overloadTranslationOptionHandler([c,f].concat(m)):g={...f},g.lng=g.lng||o.lng,g.lngs=g.lngs||o.lngs,g.ns=g.ns||o.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||r||o.keyPrefix);const p=this.options.keySeparator||".";let y;return g.keyPrefix&&Array.isArray(c)?y=c.map(S=>`${g.keyPrefix}${p}${S}`):y=g.keyPrefix?`${g.keyPrefix}${p}${c}`:c,this.t(y,g)};return sn(t)?o.lng=t:o.lngs=t,o.ns=a,o.keyPrefix=r,o}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,a={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=a.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const f=(m,g)=>{const p=this.services.backendConnector.state[`${m}|${g}`];return p===-1||p===0||p===2};if(a.precheck){const m=a.precheck(this,f);if(m!==void 0)return m}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(r,t)&&(!o||f(c,t)))}loadNamespaces(t,a){const r=Mv();return this.options.ns?(sn(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),a&&a(o)}),r):(a&&a(),Promise.resolve())}loadLanguages(t,a){const r=Mv();sn(t)&&(t=[t]);const o=this.options.preload||[],c=t.filter(f=>o.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return c.length?(this.options.preload=o.concat(c),this.loadResources(f=>{r.resolve(),a&&a(f)}),r):(a&&a(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const o=new Intl.Locale(t);if(o&&o.getTextInfo){const c=o.getTextInfo();if(c&&c.direction)return c.direction}}catch{}const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new x_(O_());return t.toLowerCase().indexOf("-latn")>1?"ltr":a.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},a){return new Nv(t,a)}cloneInstance(t={},a=kS){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},c=new Nv(o);if((t.debug!==void 0||t.prefix!==void 0)&&(c.logger=c.logger.clone(t)),["store","services","language"].forEach(m=>{c[m]=this[m]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},r){const m=Object.keys(this.store.data).reduce((g,p)=>(g[p]={...this.store.data[p]},g[p]=Object.keys(g[p]).reduce((y,S)=>(y[S]={...g[p][S]},y),g[p]),g),{});c.store=new v_(m,o),c.services.resourceStore=c.store}return c.translator=new IS(c.services,o),c.translator.on("*",(m,...g)=>{c.emit(m,...g)}),c.init(o,a),c.translator.options=o,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Wr=Nv.createInstance();Wr.createInstance=Nv.createInstance,Wr.createInstance,Wr.dir,Wr.init,Wr.loadResources,Wr.reloadResources,Wr.use,Wr.changeLanguage,Wr.getFixedT,Wr.t,Wr.exists,Wr.setDefaultNamespace,Wr.hasLoadedNamespace,Wr.loadNamespaces,Wr.loadLanguages;const pH=(e,t,a,r)=>{const o=[a,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Rd(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...o):console?.warn&&console.warn(...o)},A_={},RE=(e,t,a,r)=>{Rd(a)&&A_[a]||(Rd(a)&&(A_[a]=new Date),pH(e,t,a,r))},M_=(e,t)=>()=>{if(e.isInitialized)t();else{const a=()=>{setTimeout(()=>{e.off("initialized",a)},0),t()};e.on("initialized",a)}},AE=(e,t,a)=>{e.loadNamespaces(t,M_(e,a))},__=(e,t,a,r)=>{if(Rd(a)&&(a=[a]),e.options.preload&&e.options.preload.indexOf(t)>-1)return AE(e,a,r);a.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,M_(e,r))},gH=(e,t,a={})=>!t.languages||!t.languages.length?(RE(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:a.lng,precheck:(r,o)=>{if(a.bindI18n?.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e))return!1}}),Rd=e=>typeof e=="string",vH=e=>typeof e=="object"&&e!==null,yH=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,bH={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},SH=e=>bH[e];let ME={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(yH,SH)};const xH=(e={})=>{ME={...ME,...e}},CH=()=>ME;let D_;const EH=e=>{D_=e},wH=()=>D_,TH={type:"3rdParty",init(e){xH(e.options.react),EH(e)}},OH=x.createContext();class RH{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(a=>{this.usedNamespaces[a]||(this.usedNamespaces[a]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const AH=(e,t)=>{const a=x.useRef();return x.useEffect(()=>{a.current=e},[e,t]),a.current},N_=(e,t,a,r)=>e.getFixedT(t,a,r),MH=(e,t,a,r)=>x.useCallback(N_(e,t,a,r),[e,t,a,r]),_H=(e,t={})=>{const{i18n:a}=t,{i18n:r,defaultNS:o}=x.useContext(OH)||{},c=a||r||wH();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new RH),!c){RE(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const L=(V,B)=>Rd(B)?B:vH(B)&&Rd(B.defaultValue)?B.defaultValue:Array.isArray(V)?V[V.length-1]:V,N=[L,{},!1];return N.t=L,N.i18n={},N.ready=!1,N}c.options.react?.wait&&RE(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const f={...CH(),...c.options.react,...t},{useSuspense:m,keyPrefix:g}=f;let p=o||c.options?.defaultNS;p=Rd(p)?[p]:p||["translation"],c.reportNamespaces.addUsedNamespaces?.(p);const y=(c.isInitialized||c.initializedStoreOnce)&&p.every(L=>gH(L,c,f)),S=MH(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),E=()=>S,T=()=>N_(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),[O,M]=x.useState(E);let A=p.join();t.lng&&(A=`${t.lng}${A}`);const D=AH(A),_=x.useRef(!0);x.useEffect(()=>{const{bindI18n:L,bindI18nStore:N}=f;_.current=!0,!y&&!m&&(t.lng?__(c,t.lng,p,()=>{_.current&&M(T)}):AE(c,p,()=>{_.current&&M(T)})),y&&D&&D!==A&&_.current&&M(T);const V=()=>{_.current&&M(T)};return L&&c?.on(L,V),N&&c?.store.on(N,V),()=>{_.current=!1,c&&L?.split(" ").forEach(B=>c.off(B,V)),N&&c&&N.split(" ").forEach(B=>c.store.off(B,V))}},[c,A]),x.useEffect(()=>{_.current&&y&&M(E)},[c,g,y]);const j=[O,c,y];if(j.t=O,j.i18n=c,j.ready=y,y||!y&&!m)return j;throw new Promise(L=>{t.lng?__(c,t.lng,p,()=>L()):AE(c,p,()=>L())})},DH={en:{translation:{welcome:"Hi there, you’re speaking with Jaweb AI Assistant."}},ar:{translation:{welcome:"مرحبًا، أنت تتحدث إلى مساعد Jaweb AI."}}};Wr.use(TH).init({resources:DH,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const NH=3,$H=3e3,zH=()=>{const[e,t]=x.useState(!0),[a,r]=x.useState(!1),[o,c]=x.useState(""),[f,m]=x.useState(""),[g,p]=x.useState(!1),[y,S]=x.useState(!1),[E,T]=x.useState(""),[O,M]=x.useState(""),[A,D]=x.useState(null),[_,j]=x.useState(""),[L,N]=x.useState([]),[V,B]=x.useState([]),[z,U]=x.useState(""),[H,ee]=x.useState(!1),Y=async(Z=0)=>{const W=localStorage.getItem("company_username");t(!0);const ie={headers:{"Content-Type":"application/json",Accept:"application/json"},params:{username:W}};try{const k=(await $a.get(`${ii.apiUrl}chatbot-details/`,ie)).data.data;k.language==="Arabic"?Wr.changeLanguage("ar"):Wr.changeLanguage("en"),r(k.chatbot_form),c(k.chatbot_color),m(k.chatbot_logo),p(k.disable_chatbot_globally),S(k.remove_powered_by_jaweb),T(k.chatbot_initial_msg),M(k.status),U(k.mode),D(k.calendly_link??null),ee(k.disable_checkout),k.calendly_link&&D(k.calendly_link),k.phone_number_id&&j(`+${k.phone_number_id}`);const Q=await $a.get(`${ii.apiUrl}chatbot-plugin-suggestions/`,ie);let se=[];Array.isArray(Q.data.data)?se=Q.data.data:Array.isArray(Q.data.user_questions)&&(se=Q.data.user_questions),se.length>0?(N(se.slice(0,3)),B(se.slice(3))):(N([]),B([])),t(!1)}catch(G){console.error("Error fetching data:",G),Z<NH?setTimeout(()=>Y(Z+1),$H):console.error("Max retries reached. Could not fetch data.")}};return x.useEffect(()=>{Y()},[]),{isFetchingDetails:e,disableForm:a,colorCode:o,chatbotLogo:f,disableChatbotGlobally:g,removePoweredByJaweb:y,initialMessageText:E,subscription:O,calendly:A,merchantPhone:_,messagesSuggestions:L,restSuggestions:V,userType:z,disbleCheckout:H}};var _E={exports:{}};/*!
324
+ `+c):r.stack=c}catch{}}throw r}}_request(t,a){typeof t=="string"?(a=a||{},a.url=t):a=t||{},a=Td(this.defaults,a);const{transitional:r,paramsSerializer:o,headers:c}=a;r!==void 0&&HS.assertOptions(r,{silentJSONParsing:qs.transitional(qs.boolean),forcedJSONParsing:qs.transitional(qs.boolean),clarifyTimeoutError:qs.transitional(qs.boolean)},!1),o!=null&&(Ge.isFunction(o)?a.paramsSerializer={serialize:o}:HS.assertOptions(o,{encode:qs.function,serialize:qs.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),HS.assertOptions(a,{baseUrl:qs.spelling("baseURL"),withXsrfToken:qs.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let f=c&&Ge.merge(c.common,c[a.method]);c&&Ge.forEach(["delete","get","head","post","put","patch","common"],O=>{delete c[O]}),a.headers=vo.concat(f,c);const m=[];let g=!0;this.interceptors.request.forEach(function(M){typeof M.runWhen=="function"&&M.runWhen(a)===!1||(g=g&&M.synchronous,m.unshift(M.fulfilled,M.rejected))});const p=[];this.interceptors.response.forEach(function(M){p.push(M.fulfilled,M.rejected)});let y,S=0,E;if(!g){const O=[s_.bind(this),void 0];for(O.unshift.apply(O,m),O.push.apply(O,p),E=O.length,y=Promise.resolve(a);S<E;)y=y.then(O[S++],O[S++]);return y}E=m.length;let T=a;for(S=0;S<E;){const O=m[S++],M=m[S++];try{T=O(T)}catch(A){M.call(this,A);break}}try{y=s_.call(this,T)}catch(O){return Promise.reject(O)}for(S=0,E=p.length;S<E;)y=y.then(p[S++],p[S++]);return y}getUri(t){t=Td(this.defaults,t);const a=JM(t.baseURL,t.url,t.allowAbsoluteUrls);return FM(a,t.params,t.paramsSerializer)}};Ge.forEach(["delete","get","head","options"],function(t){Od.prototype[t]=function(a,r){return this.request(Td(r||{},{method:t,url:a,data:(r||{}).data}))}}),Ge.forEach(["post","put","patch"],function(t){function a(r){return function(c,f,m){return this.request(Td(m||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:f}))}}Od.prototype[t]=a(),Od.prototype[t+"Form"]=a(!0)});let XV=class d8{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(c){a=c});const r=this;this.promise.then(o=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](o);r._listeners=null}),this.promise.then=o=>{let c;const f=new Promise(m=>{r.subscribe(m),c=m}).then(o);return f.cancel=function(){r.unsubscribe(c)},f},t(function(c,f,m){r.reason||(r.reason=new Sm(c,f,m),a(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const a=this._listeners.indexOf(t);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const t=new AbortController,a=r=>{t.abort(r)};return this.subscribe(a),t.signal.unsubscribe=()=>this.unsubscribe(a),t.signal}static source(){let t;return{token:new d8(function(o){t=o}),cancel:t}}};function YV(e){return function(a){return e.apply(null,a)}}function WV(e){return Ge.isObject(e)&&e.isAxiosError===!0}const wE={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(wE).forEach(([e,t])=>{wE[t]=e});function f_(e){const t=new Od(e),a=MM(Od.prototype.request,t);return Ge.extend(a,Od.prototype,t,{allOwnKeys:!0}),Ge.extend(a,t,null,{allOwnKeys:!0}),a.create=function(o){return f_(Td(e,o))},a}const $a=f_(Rv);$a.Axios=Od,$a.CanceledError=Sm,$a.CancelToken=XV,$a.isCancel=WM,$a.VERSION=u_,$a.toFormData=NS,$a.AxiosError=Cn,$a.Cancel=$a.CanceledError,$a.all=function(t){return Promise.all(t)},$a.spread=YV,$a.isAxiosError=WV,$a.mergeConfig=Td,$a.AxiosHeaders=vo,$a.formToJSON=e=>XM(Ge.isHTMLForm(e)?new FormData(e):e),$a.getAdapter=l_.getAdapter,$a.HttpStatusCode=wE,$a.default=$a;const{Axios:Gie,AxiosError:Xie,CanceledError:Yie,isCancel:Wie,CancelToken:Zie,VERSION:Kie,all:Qie,Cancel:Jie,isAxiosError:eoe,spread:toe,toFormData:noe,AxiosHeaders:aoe,HttpStatusCode:roe,formToJSON:ioe,getAdapter:ooe,mergeConfig:loe}=$a,ii={apiUrl:"https://crmtest-3lct.onrender.com/api/",websocketUrl:"wss://crmtest-3lct.onrender.com/ws"},sn=e=>typeof e=="string",Mv=()=>{let e,t;const a=new Promise((r,o)=>{e=r,t=o});return a.resolve=e,a.reject=t,a},d_=e=>e==null?"":""+e,ZV=(e,t,a)=>{e.forEach(r=>{t[r]&&(a[r]=t[r])})},KV=/###/g,h_=e=>e&&e.indexOf("###")>-1?e.replace(KV,"."):e,m_=e=>!e||sn(e),_v=(e,t,a)=>{const r=sn(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(m_(e))return{};const c=h_(r[o]);!e[c]&&a&&(e[c]=new a),Object.prototype.hasOwnProperty.call(e,c)?e=e[c]:e={},++o}return m_(e)?{}:{obj:e,k:h_(r[o])}},p_=(e,t,a)=>{const{obj:r,k:o}=_v(e,t,Object);if(r!==void 0||t.length===1){r[o]=a;return}let c=t[t.length-1],f=t.slice(0,t.length-1),m=_v(e,f,Object);for(;m.obj===void 0&&f.length;)c=`${f[f.length-1]}.${c}`,f=f.slice(0,f.length-1),m=_v(e,f,Object),m?.obj&&typeof m.obj[`${m.k}.${c}`]<"u"&&(m.obj=void 0);m.obj[`${m.k}.${c}`]=a},QV=(e,t,a,r)=>{const{obj:o,k:c}=_v(e,t,Object);o[c]=o[c]||[],o[c].push(a)},BS=(e,t)=>{const{obj:a,k:r}=_v(e,t);if(a&&Object.prototype.hasOwnProperty.call(a,r))return a[r]},JV=(e,t,a)=>{const r=BS(e,a);return r!==void 0?r:BS(t,a)},g_=(e,t,a)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?sn(e[r])||e[r]instanceof String||sn(t[r])||t[r]instanceof String?a&&(e[r]=t[r]):g_(e[r],t[r],a):e[r]=t[r]);return e},xm=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var eH={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const tH=e=>sn(e)?e.replace(/[&<>"'\/]/g,t=>eH[t]):e;class nH{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const a=this.regExpMap.get(t);if(a!==void 0)return a;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const aH=[" ",",","?","!",";"],rH=new nH(20),iH=(e,t,a)=>{t=t||"",a=a||"";const r=aH.filter(f=>t.indexOf(f)<0&&a.indexOf(f)<0);if(r.length===0)return!0;const o=rH.getRegExp(`(${r.map(f=>f==="?"?"\\?":f).join("|")})`);let c=!o.test(e);if(!c){const f=e.indexOf(a);f>0&&!o.test(e.substring(0,f))&&(c=!0)}return c},TE=(e,t,a=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(a);let o=e;for(let c=0;c<r.length;){if(!o||typeof o!="object")return;let f,m="";for(let g=c;g<r.length;++g)if(g!==c&&(m+=a),m+=r[g],f=o[m],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&g<r.length-1)continue;c+=g-c+1;break}o=f}return o},Dv=e=>e?.replace("_","-"),oH={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class PS{constructor(t,a={}){this.init(t,a)}init(t,a={}){this.prefix=a.prefix||"i18next:",this.logger=t||oH,this.options=a,this.debug=a.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,a,r,o){return o&&!this.debug?null:(sn(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[a](t))}create(t){return new PS(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new PS(this.logger,t)}}var Gs=new PS;class US{constructor(){this.observers={}}on(t,a){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(a)||0;this.observers[r].set(a,o+1)}),this}off(t,a){if(this.observers[t]){if(!a){delete this.observers[t];return}this.observers[t].delete(a)}}emit(t,...a){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o.apply(o,[t,...a])})}}class v_ extends US{constructor(t,a={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const a=this.options.ns.indexOf(t);a>-1&&this.options.ns.splice(a,1)}getResource(t,a,r,o={}){const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,f=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let m;t.indexOf(".")>-1?m=t.split("."):(m=[t,a],r&&(Array.isArray(r)?m.push(...r):sn(r)&&c?m.push(...r.split(c)):m.push(r)));const g=BS(this.data,m);return!g&&!a&&!r&&t.indexOf(".")>-1&&(t=m[0],a=m[1],r=m.slice(2).join(".")),g||!f||!sn(r)?g:TE(this.data?.[t]?.[a],r,c)}addResource(t,a,r,o,c={silent:!1}){const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let m=[t,a];r&&(m=m.concat(f?r.split(f):r)),t.indexOf(".")>-1&&(m=t.split("."),o=a,a=m[1]),this.addNamespaces(a),p_(this.data,m,o),c.silent||this.emit("added",t,a,r,o)}addResources(t,a,r,o={silent:!1}){for(const c in r)(sn(r[c])||Array.isArray(r[c]))&&this.addResource(t,a,c,r[c],{silent:!0});o.silent||this.emit("added",t,a,r)}addResourceBundle(t,a,r,o,c,f={silent:!1,skipCopy:!1}){let m=[t,a];t.indexOf(".")>-1&&(m=t.split("."),o=r,r=a,a=m[1]),this.addNamespaces(a);let g=BS(this.data,m)||{};f.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?g_(g,r,c):g={...g,...r},p_(this.data,m,g),f.silent||this.emit("added",t,a,r)}removeResourceBundle(t,a){this.hasResourceBundle(t,a)&&delete this.data[t][a],this.removeNamespaces(a),this.emit("removed",t,a)}hasResourceBundle(t,a){return this.getResource(t,a)!==void 0}getResourceBundle(t,a){return a||(a=this.options.defaultNS),this.getResource(t,a)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const a=this.getDataByLanguage(t);return!!(a&&Object.keys(a)||[]).find(o=>a[o]&&Object.keys(a[o]).length>0)}toJSON(){return this.data}}var y_={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,r,o){return e.forEach(c=>{t=this.processors[c]?.process(t,a,r,o)??t}),t}};const b_={},S_=e=>!sn(e)&&typeof e!="boolean"&&typeof e!="number";class IS extends US{constructor(t,a={}){super(),ZV(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Gs.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,a={interpolation:{}}){const r={...a};return t==null?!1:this.resolve(t,r)?.res!==void 0}extractFromKey(t,a){let r=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let c=a.ns||this.options.defaultNS||[];const f=r&&t.indexOf(r)>-1,m=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!iH(t,r,o);if(f&&!m){const g=t.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:t,namespaces:sn(c)?[c]:c};const p=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(p[0])>-1)&&(c=p.shift()),t=p.join(o)}return{key:t,namespaces:sn(c)?[c]:c}}translate(t,a,r){let o=typeof a=="object"?{...a}:a;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(o={...o}),o||(o={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const c=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,f=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:m,namespaces:g}=this.extractFromKey(t[t.length-1],o),p=g[g.length-1];let y=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const S=o.lng||this.language,E=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(S?.toLowerCase()==="cimode")return E?c?{res:`${p}${y}${m}`,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:`${p}${y}${m}`:c?{res:m,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:m;const T=this.resolve(t,o);let O=T?.res;const M=T?.usedKey||m,A=T?.exactUsedKey||m,D=["[object Number]","[object Function]","[object RegExp]"],_=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,L=o.count!==void 0&&!sn(o.count),N=IS.hasDefaultValue(o),V=L?this.pluralResolver.getSuffix(S,o.count,o):"",B=o.ordinal&&L?this.pluralResolver.getSuffix(S,o.count,{ordinal:!1}):"",z=L&&!o.ordinal&&o.count===0,U=z&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${V}`]||o[`defaultValue${B}`]||o.defaultValue;let H=O;j&&!O&&N&&(H=U);const ee=S_(H),Y=Object.prototype.toString.apply(H);if(j&&H&&ee&&D.indexOf(Y)<0&&!(sn(_)&&Array.isArray(H))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Z=this.options.returnedObjectHandler?this.options.returnedObjectHandler(M,H,{...o,ns:g}):`key '${m} (${this.language})' returned an object instead of string.`;return c?(T.res=Z,T.usedParams=this.getUsedParamsDetails(o),T):Z}if(f){const Z=Array.isArray(H),W=Z?[]:{},ie=Z?A:M;for(const G in H)if(Object.prototype.hasOwnProperty.call(H,G)){const k=`${ie}${f}${G}`;N&&!O?W[G]=this.translate(k,{...o,defaultValue:S_(U)?U[G]:void 0,joinArrays:!1,ns:g}):W[G]=this.translate(k,{...o,joinArrays:!1,ns:g}),W[G]===k&&(W[G]=H[G])}O=W}}else if(j&&sn(_)&&Array.isArray(O))O=O.join(_),O&&(O=this.extendTranslation(O,t,o,r));else{let Z=!1,W=!1;!this.isValidLookup(O)&&N&&(Z=!0,O=U),this.isValidLookup(O)||(W=!0,O=m);const G=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&W?void 0:O,k=N&&U!==O&&this.options.updateMissing;if(W||Z||k){if(this.logger.log(k?"updateKey":"missingKey",S,p,m,k?U:O),f){const F=this.resolve(m,{...o,keySeparator:!1});F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Q=[];const se=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&se&&se[0])for(let F=0;F<se.length;F++)Q.push(se[F]);else this.options.saveMissingTo==="all"?Q=this.languageUtils.toResolveHierarchy(o.lng||this.language):Q.push(o.lng||this.language);const q=(F,te,ae)=>{const oe=N&&ae!==O?ae:G;this.options.missingKeyHandler?this.options.missingKeyHandler(F,p,te,oe,k,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(F,p,te,oe,k,o),this.emit("missingKey",F,p,te,O)};this.options.saveMissing&&(this.options.saveMissingPlurals&&L?Q.forEach(F=>{const te=this.pluralResolver.getSuffixes(F,o);z&&o[`defaultValue${this.options.pluralSeparator}zero`]&&te.indexOf(`${this.options.pluralSeparator}zero`)<0&&te.push(`${this.options.pluralSeparator}zero`),te.forEach(ae=>{q([F],m+ae,o[`defaultValue${ae}`]||U)})}):q(Q,m,U))}O=this.extendTranslation(O,t,o,T,r),W&&O===m&&this.options.appendNamespaceToMissingKey&&(O=`${p}${y}${m}`),(W||Z)&&this.options.parseMissingKeyHandler&&(O=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${y}${m}`:m,Z?O:void 0,o))}return c?(T.res=O,T.usedParams=this.getUsedParamsDetails(o),T):O}extendTranslation(t,a,r,o,c){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const g=sn(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(g){const S=t.match(this.interpolator.nestingRegexp);p=S&&S.length}let y=r.replace&&!sn(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(y={...this.options.interpolation.defaultVariables,...y}),t=this.interpolator.interpolate(t,y,r.lng||this.language||o.usedLng,r),g){const S=t.match(this.interpolator.nestingRegexp),E=S&&S.length;p<E&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...S)=>c?.[0]===S[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${S[0]} in key: ${a[0]}`),null):this.translate(...S,a),r)),r.interpolation&&this.interpolator.reset()}const f=r.postProcess||this.options.postProcess,m=sn(f)?[f]:f;return t!=null&&m?.length&&r.applyPostProcessor!==!1&&(t=y_.handle(m,t,a,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,a={}){let r,o,c,f,m;return sn(t)&&(t=[t]),t.forEach(g=>{if(this.isValidLookup(r))return;const p=this.extractFromKey(g,a),y=p.key;o=y;let S=p.namespaces;this.options.fallbackNS&&(S=S.concat(this.options.fallbackNS));const E=a.count!==void 0&&!sn(a.count),T=E&&!a.ordinal&&a.count===0,O=a.context!==void 0&&(sn(a.context)||typeof a.context=="number")&&a.context!=="",M=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);S.forEach(A=>{this.isValidLookup(r)||(m=A,!b_[`${M[0]}-${A}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(m)&&(b_[`${M[0]}-${A}`]=!0,this.logger.warn(`key "${o}" for languages "${M.join(", ")}" won't get resolved as namespace "${m}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),M.forEach(D=>{if(this.isValidLookup(r))return;f=D;const _=[y];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(_,y,D,A,a);else{let L;E&&(L=this.pluralResolver.getSuffix(D,a.count,a));const N=`${this.options.pluralSeparator}zero`,V=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(E&&(_.push(y+L),a.ordinal&&L.indexOf(V)===0&&_.push(y+L.replace(V,this.options.pluralSeparator)),T&&_.push(y+N)),O){const B=`${y}${this.options.contextSeparator}${a.context}`;_.push(B),E&&(_.push(B+L),a.ordinal&&L.indexOf(V)===0&&_.push(B+L.replace(V,this.options.pluralSeparator)),T&&_.push(B+N))}}let j;for(;j=_.pop();)this.isValidLookup(r)||(c=j,r=this.getResource(D,A,j,a))}))})}),{res:r,usedKey:o,exactUsedKey:c,usedLng:f,usedNS:m}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,a,r,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,a,r,o):this.resourceStore.getResource(t,a,r,o)}getUsedParamsDetails(t={}){const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!sn(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const c of a)delete o[c]}return o}static hasDefaultValue(t){const a="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&a===r.substring(0,a.length)&&t[r]!==void 0)return!0;return!1}}class x_{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Gs.create("languageUtils")}getScriptPartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return null;const a=t.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return t;const a=t.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(t){if(sn(t)&&t.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(t)[0]}catch{}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let a;return t.forEach(r=>{if(a)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(a=o)}),!a&&this.options.supportedLngs&&t.forEach(r=>{if(a)return;const o=this.getScriptPartFromCode(r);if(this.isSupportedCode(o))return a=o;const c=this.getLanguagePartFromCode(r);if(this.isSupportedCode(c))return a=c;a=this.options.supportedLngs.find(f=>{if(f===c)return f;if(!(f.indexOf("-")<0&&c.indexOf("-")<0)&&(f.indexOf("-")>0&&c.indexOf("-")<0&&f.substring(0,f.indexOf("-"))===c||f.indexOf(c)===0&&c.length>1))return f})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(t,a){if(!t)return[];if(typeof t=="function"&&(t=t(a)),sn(t)&&(t=[t]),Array.isArray(t))return t;if(!a)return t.default||[];let r=t[a];return r||(r=t[this.getScriptPartFromCode(a)]),r||(r=t[this.formatLanguageCode(a)]),r||(r=t[this.getLanguagePartFromCode(a)]),r||(r=t.default),r||[]}toResolveHierarchy(t,a){const r=this.getFallbackCodes((a===!1?[]:a)||this.options.fallbackLng||[],t),o=[],c=f=>{f&&(this.isSupportedCode(f)?o.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return sn(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(t))):sn(t)&&c(this.formatLanguageCode(t)),r.forEach(f=>{o.indexOf(f)<0&&c(this.formatLanguageCode(f))}),o}}const C_={zero:0,one:1,two:2,few:3,many:4,other:5},E_={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class lH{constructor(t,a={}){this.languageUtils=t,this.options=a,this.logger=Gs.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,a){this.rules[t]=a}clearCache(){this.pluralRulesCache={}}getRule(t,a={}){const r=Dv(t==="dev"?"en":t),o=a.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:r,type:o});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let f;try{f=new Intl.PluralRules(r,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),E_;if(!t.match(/-|_/))return E_;const g=this.languageUtils.getLanguagePartFromCode(t);f=this.getRule(g,a)}return this.pluralRulesCache[c]=f,f}needsPlural(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,a,r={}){return this.getSuffixes(t,r).map(o=>`${a}${o}`)}getSuffixes(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?r.resolvedOptions().pluralCategories.sort((o,c)=>C_[o]-C_[c]).map(o=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,a,r={}){const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(a)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",a,r))}}const w_=(e,t,a,r=".",o=!0)=>{let c=JV(e,t,a);return!c&&o&&sn(a)&&(c=TE(e,a,r),c===void 0&&(c=TE(t,a,r))),c},OE=e=>e.replace(/\$/g,"$$$$");class sH{constructor(t={}){this.logger=Gs.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(a=>a),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:a,escapeValue:r,useRawValueToEscape:o,prefix:c,prefixEscaped:f,suffix:m,suffixEscaped:g,formatSeparator:p,unescapeSuffix:y,unescapePrefix:S,nestingPrefix:E,nestingPrefixEscaped:T,nestingSuffix:O,nestingSuffixEscaped:M,nestingOptionsSeparator:A,maxReplaces:D,alwaysFormat:_}=t.interpolation;this.escape=a!==void 0?a:tH,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=c?xm(c):f||"{{",this.suffix=m?xm(m):g||"}}",this.formatSeparator=p||",",this.unescapePrefix=y?"":S||"-",this.unescapeSuffix=this.unescapePrefix?"":y||"",this.nestingPrefix=E?xm(E):T||xm("$t("),this.nestingSuffix=O?xm(O):M||xm(")"),this.nestingOptionsSeparator=A||",",this.maxReplaces=D||1e3,this.alwaysFormat=_!==void 0?_:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(a,r)=>a?.source===r?(a.lastIndex=0,a):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,a,r,o){let c,f,m;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=T=>{if(T.indexOf(this.formatSeparator)<0){const D=w_(a,g,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(D,void 0,r,{...o,...a,interpolationkey:T}):D}const O=T.split(this.formatSeparator),M=O.shift().trim(),A=O.join(this.formatSeparator).trim();return this.format(w_(a,g,M,this.options.keySeparator,this.options.ignoreJSONStructure),A,r,{...o,...a,interpolationkey:M})};this.resetRegExp();const y=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,S=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>OE(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?OE(this.escape(T)):OE(T)}].forEach(T=>{for(m=0;c=T.regex.exec(t);){const O=c[1].trim();if(f=p(O),f===void 0)if(typeof y=="function"){const A=y(t,c,o);f=sn(A)?A:""}else if(o&&Object.prototype.hasOwnProperty.call(o,O))f="";else if(S){f=c[0];continue}else this.logger.warn(`missed to pass in variable ${O} for interpolating ${t}`),f="";else!sn(f)&&!this.useRawValueToEscape&&(f=d_(f));const M=T.safeValue(f);if(t=t.replace(c[0],M),S?(T.regex.lastIndex+=f.length,T.regex.lastIndex-=c[0].length):T.regex.lastIndex=0,m++,m>=this.maxReplaces)break}}),t}nest(t,a,r={}){let o,c,f;const m=(g,p)=>{const y=this.nestingOptionsSeparator;if(g.indexOf(y)<0)return g;const S=g.split(new RegExp(`${y}[ ]*{`));let E=`{${S[1]}`;g=S[0],E=this.interpolate(E,f);const T=E.match(/'/g),O=E.match(/"/g);((T?.length??0)%2===0&&!O||O.length%2!==0)&&(E=E.replace(/'/g,'"'));try{f=JSON.parse(E),p&&(f={...p,...f})}catch(M){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,M),`${g}${y}${E}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,g};for(;o=this.nestingRegexp.exec(t);){let g=[];f={...r},f=f.replace&&!sn(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;const p=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(p!==-1&&(g=o[1].slice(p).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),o[1]=o[1].slice(0,p)),c=a(m.call(this,o[1].trim(),f),f),c&&o[0]===t&&!sn(c))return c;sn(c)||(c=d_(c)),c||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),c=""),g.length&&(c=g.reduce((y,S)=>this.format(y,S,r.lng,{...r,interpolationkey:o[1].trim()}),c.trim())),t=t.replace(o[0],c),this.regexp.lastIndex=0}return t}}const uH=e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?a.currency||(a.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?a.range||(a.range=o.trim()):o.split(";").forEach(f=>{if(f){const[m,...g]=f.split(":"),p=g.join(":").trim().replace(/^'+|'+$/g,""),y=m.trim();a[y]||(a[y]=p),p==="false"&&(a[y]=!1),p==="true"&&(a[y]=!0),isNaN(p)||(a[y]=parseInt(p,10))}})}return{formatName:t,formatOptions:a}},T_=e=>{const t={};return(a,r,o)=>{let c=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(c={...c,[o.interpolationkey]:void 0});const f=r+JSON.stringify(c);let m=t[f];return m||(m=e(Dv(r),o),t[f]=m),m(a)}},cH=e=>(t,a,r)=>e(Dv(a),r)(t);class fH{constructor(t={}){this.logger=Gs.create("formatter"),this.options=t,this.init(t)}init(t,a={interpolation:{}}){this.formatSeparator=a.interpolation.formatSeparator||",";const r=a.cacheInBuiltFormats?T_:cH;this.formats={number:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c});return m=>f.format(m)}),currency:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c,style:"currency"});return m=>f.format(m)}),datetime:r((o,c)=>{const f=new Intl.DateTimeFormat(o,{...c});return m=>f.format(m)}),relativetime:r((o,c)=>{const f=new Intl.RelativeTimeFormat(o,{...c});return m=>f.format(m,c.range||"day")}),list:r((o,c)=>{const f=new Intl.ListFormat(o,{...c});return m=>f.format(m)})}}add(t,a){this.formats[t.toLowerCase().trim()]=a}addCached(t,a){this.formats[t.toLowerCase().trim()]=T_(a)}format(t,a,r,o={}){const c=a.split(this.formatSeparator);if(c.length>1&&c[0].indexOf("(")>1&&c[0].indexOf(")")<0&&c.find(m=>m.indexOf(")")>-1)){const m=c.findIndex(g=>g.indexOf(")")>-1);c[0]=[c[0],...c.splice(1,m)].join(this.formatSeparator)}return c.reduce((m,g)=>{const{formatName:p,formatOptions:y}=uH(g);if(this.formats[p]){let S=m;try{const E=o?.formatParams?.[o.interpolationkey]||{},T=E.locale||E.lng||o.locale||o.lng||r;S=this.formats[p](m,T,{...y,...o,...E})}catch(E){this.logger.warn(E)}return S}else this.logger.warn(`there was no format function for ${p}`);return m},t)}}const dH=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class hH extends US{constructor(t,a,r,o={}){super(),this.backend=t,this.store=a,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=Gs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,o.backend,o)}queueLoad(t,a,r,o){const c={},f={},m={},g={};return t.forEach(p=>{let y=!0;a.forEach(S=>{const E=`${p}|${S}`;!r.reload&&this.store.hasResourceBundle(p,S)?this.state[E]=2:this.state[E]<0||(this.state[E]===1?f[E]===void 0&&(f[E]=!0):(this.state[E]=1,y=!1,f[E]===void 0&&(f[E]=!0),c[E]===void 0&&(c[E]=!0),g[S]===void 0&&(g[S]=!0)))}),y||(m[p]=!0)}),(Object.keys(c).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(c),pending:Object.keys(f),toLoadLanguages:Object.keys(m),toLoadNamespaces:Object.keys(g)}}loaded(t,a,r){const o=t.split("|"),c=o[0],f=o[1];a&&this.emit("failedLoading",c,f,a),!a&&r&&this.store.addResourceBundle(c,f,r,void 0,void 0,{skipCopy:!0}),this.state[t]=a?-1:2,a&&r&&(this.state[t]=0);const m={};this.queue.forEach(g=>{QV(g.loaded,[c],f),dH(g,t),a&&g.errors.push(a),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(p=>{m[p]||(m[p]={});const y=g.loaded[p];y.length&&y.forEach(S=>{m[p][S]===void 0&&(m[p][S]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",m),this.queue=this.queue.filter(g=>!g.done)}read(t,a,r,o=0,c=this.retryTimeout,f){if(!t.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:a,fcName:r,tried:o,wait:c,callback:f});return}this.readingCalls++;const m=(p,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const S=this.waitingReads.shift();this.read(S.lng,S.ns,S.fcName,S.tried,S.wait,S.callback)}if(p&&y&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,a,r,o+1,c*2,f)},c);return}f(p,y)},g=this.backend[r].bind(this.backend);if(g.length===2){try{const p=g(t,a);p&&typeof p.then=="function"?p.then(y=>m(null,y)).catch(m):m(null,p)}catch(p){m(p)}return}return g(t,a,m)}prepareLoading(t,a,r={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();sn(t)&&(t=this.languageUtils.toResolveHierarchy(t)),sn(a)&&(a=[a]);const c=this.queueLoad(t,a,r,o);if(!c.toLoad.length)return c.pending.length||o(),null;c.toLoad.forEach(f=>{this.loadOne(f)})}load(t,a,r){this.prepareLoading(t,a,{},r)}reload(t,a,r){this.prepareLoading(t,a,{reload:!0},r)}loadOne(t,a=""){const r=t.split("|"),o=r[0],c=r[1];this.read(o,c,"read",void 0,void 0,(f,m)=>{f&&this.logger.warn(`${a}loading namespace ${c} for language ${o} failed`,f),!f&&m&&this.logger.log(`${a}loaded namespace ${c} for language ${o}`,m),this.loaded(t,f,m)})}saveMissing(t,a,r,o,c,f={},m=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(a)){this.logger.warn(`did not save key "${r}" as the namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const g={...f,isUpdate:c},p=this.backend.create.bind(this.backend);if(p.length<6)try{let y;p.length===5?y=p(t,a,r,o,g):y=p(t,a,r,o),y&&typeof y.then=="function"?y.then(S=>m(null,S)).catch(m):m(null,y)}catch(y){m(y)}else p(t,a,r,o,m,g)}!t||!t[0]||this.store.addResource(t[0],a,r,o)}}}const O_=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),sn(e[1])&&(t.defaultValue=e[1]),sn(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const a=e[3]||e[2];Object.keys(a).forEach(r=>{t[r]=a[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),R_=e=>(sn(e.ns)&&(e.ns=[e.ns]),sn(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),sn(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),kS=()=>{},mH=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(a=>{typeof e[a]=="function"&&(e[a]=e[a].bind(e))})};class Nv extends US{constructor(t={},a){if(super(),this.options=R_(t),this.services={},this.logger=Gs,this.modules={external:[]},mH(this),a&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,a),this;setTimeout(()=>{this.init(t,a)},0)}}init(t={},a){this.isInitializing=!0,typeof t=="function"&&(a=t,t={}),t.defaultNS==null&&t.ns&&(sn(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=O_();this.options={...r,...this.options,...R_(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?Gs.init(o(this.modules.logger),this.options):Gs.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=fH;const y=new x_(this.options);this.store=new v_(this.options.resources,this.options);const S=this.services;S.logger=Gs,S.resourceStore=this.store,S.languageUtils=y,S.pluralResolver=new lH(y,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(S.formatter=o(p),S.formatter.init&&S.formatter.init(S,this.options),this.options.interpolation.format=S.formatter.format.bind(S.formatter)),S.interpolator=new sH(this.options),S.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},S.backendConnector=new hH(o(this.modules.backend),S.resourceStore,S,this.options),S.backendConnector.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.languageDetector&&(S.languageDetector=o(this.modules.languageDetector),S.languageDetector.init&&S.languageDetector.init(S,this.options.detection,this.options)),this.modules.i18nFormat&&(S.i18nFormat=o(this.modules.i18nFormat),S.i18nFormat.init&&S.i18nFormat.init(this)),this.translator=new IS(this.services,this.options),this.translator.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.external.forEach(T=>{T.init&&T.init(this)})}if(this.format=this.options.interpolation.format,a||(a=kS),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=(...y)=>this.store[p](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...y)=>(this.store[p](...y),this)});const m=Mv(),g=()=>{const p=(y,S)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),m.resolve(S),a(y,S)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?g():setTimeout(g,0),m}loadResources(t,a=kS){let r=a;const o=sn(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const c=[],f=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(p=>{p!=="cimode"&&c.indexOf(p)<0&&c.push(p)})};o?f(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(g=>f(g)),this.options.preload?.forEach?.(m=>f(m)),this.services.backendConnector.load(c,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(m)})}else r(null)}reloadResources(t,a,r){const o=Mv();return typeof t=="function"&&(r=t,t=void 0),typeof a=="function"&&(r=a,a=void 0),t||(t=this.languages),a||(a=this.options.ns),r||(r=kS),this.services.backendConnector.reload(t,a,c=>{o.resolve(),r(c)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&y_.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let a=0;a<this.languages.length;a++){const r=this.languages[a];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,a){this.isLanguageChangingTo=t;const r=Mv();this.emit("languageChanging",t);const o=m=>{this.language=m,this.languages=this.services.languageUtils.toResolveHierarchy(m),this.resolvedLanguage=void 0,this.setResolvedLanguage(m)},c=(m,g)=>{g?this.isLanguageChangingTo===t&&(o(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,r.resolve((...p)=>this.t(...p)),a&&a(m,(...p)=>this.t(...p))},f=m=>{!t&&!m&&this.services.languageDetector&&(m=[]);const g=sn(m)?m:m&&m[0],p=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(sn(m)?[m]:m);p&&(this.language||o(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector?.cacheUserLanguage?.(p)),this.loadResources(p,y=>{c(y,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(t),r}getFixedT(t,a,r){const o=(c,f,...m)=>{let g;typeof f!="object"?g=this.options.overloadTranslationOptionHandler([c,f].concat(m)):g={...f},g.lng=g.lng||o.lng,g.lngs=g.lngs||o.lngs,g.ns=g.ns||o.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||r||o.keyPrefix);const p=this.options.keySeparator||".";let y;return g.keyPrefix&&Array.isArray(c)?y=c.map(S=>`${g.keyPrefix}${p}${S}`):y=g.keyPrefix?`${g.keyPrefix}${p}${c}`:c,this.t(y,g)};return sn(t)?o.lng=t:o.lngs=t,o.ns=a,o.keyPrefix=r,o}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,a={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=a.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const f=(m,g)=>{const p=this.services.backendConnector.state[`${m}|${g}`];return p===-1||p===0||p===2};if(a.precheck){const m=a.precheck(this,f);if(m!==void 0)return m}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(r,t)&&(!o||f(c,t)))}loadNamespaces(t,a){const r=Mv();return this.options.ns?(sn(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),a&&a(o)}),r):(a&&a(),Promise.resolve())}loadLanguages(t,a){const r=Mv();sn(t)&&(t=[t]);const o=this.options.preload||[],c=t.filter(f=>o.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return c.length?(this.options.preload=o.concat(c),this.loadResources(f=>{r.resolve(),a&&a(f)}),r):(a&&a(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const o=new Intl.Locale(t);if(o&&o.getTextInfo){const c=o.getTextInfo();if(c&&c.direction)return c.direction}}catch{}const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new x_(O_());return t.toLowerCase().indexOf("-latn")>1?"ltr":a.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},a){return new Nv(t,a)}cloneInstance(t={},a=kS){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},c=new Nv(o);if((t.debug!==void 0||t.prefix!==void 0)&&(c.logger=c.logger.clone(t)),["store","services","language"].forEach(m=>{c[m]=this[m]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},r){const m=Object.keys(this.store.data).reduce((g,p)=>(g[p]={...this.store.data[p]},g[p]=Object.keys(g[p]).reduce((y,S)=>(y[S]={...g[p][S]},y),g[p]),g),{});c.store=new v_(m,o),c.services.resourceStore=c.store}return c.translator=new IS(c.services,o),c.translator.on("*",(m,...g)=>{c.emit(m,...g)}),c.init(o,a),c.translator.options=o,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Wr=Nv.createInstance();Wr.createInstance=Nv.createInstance,Wr.createInstance,Wr.dir,Wr.init,Wr.loadResources,Wr.reloadResources,Wr.use,Wr.changeLanguage,Wr.getFixedT,Wr.t,Wr.exists,Wr.setDefaultNamespace,Wr.hasLoadedNamespace,Wr.loadNamespaces,Wr.loadLanguages;const pH=(e,t,a,r)=>{const o=[a,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Rd(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...o):console?.warn&&console.warn(...o)},A_={},RE=(e,t,a,r)=>{Rd(a)&&A_[a]||(Rd(a)&&(A_[a]=new Date),pH(e,t,a,r))},M_=(e,t)=>()=>{if(e.isInitialized)t();else{const a=()=>{setTimeout(()=>{e.off("initialized",a)},0),t()};e.on("initialized",a)}},AE=(e,t,a)=>{e.loadNamespaces(t,M_(e,a))},__=(e,t,a,r)=>{if(Rd(a)&&(a=[a]),e.options.preload&&e.options.preload.indexOf(t)>-1)return AE(e,a,r);a.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,M_(e,r))},gH=(e,t,a={})=>!t.languages||!t.languages.length?(RE(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:a.lng,precheck:(r,o)=>{if(a.bindI18n?.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e))return!1}}),Rd=e=>typeof e=="string",vH=e=>typeof e=="object"&&e!==null,yH=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,bH={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},SH=e=>bH[e];let ME={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(yH,SH)};const xH=(e={})=>{ME={...ME,...e}},CH=()=>ME;let D_;const EH=e=>{D_=e},wH=()=>D_,TH={type:"3rdParty",init(e){xH(e.options.react),EH(e)}},OH=x.createContext();class RH{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(a=>{this.usedNamespaces[a]||(this.usedNamespaces[a]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const AH=(e,t)=>{const a=x.useRef();return x.useEffect(()=>{a.current=e},[e,t]),a.current},N_=(e,t,a,r)=>e.getFixedT(t,a,r),MH=(e,t,a,r)=>x.useCallback(N_(e,t,a,r),[e,t,a,r]),_H=(e,t={})=>{const{i18n:a}=t,{i18n:r,defaultNS:o}=x.useContext(OH)||{},c=a||r||wH();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new RH),!c){RE(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const L=(V,B)=>Rd(B)?B:vH(B)&&Rd(B.defaultValue)?B.defaultValue:Array.isArray(V)?V[V.length-1]:V,N=[L,{},!1];return N.t=L,N.i18n={},N.ready=!1,N}c.options.react?.wait&&RE(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const f={...CH(),...c.options.react,...t},{useSuspense:m,keyPrefix:g}=f;let p=o||c.options?.defaultNS;p=Rd(p)?[p]:p||["translation"],c.reportNamespaces.addUsedNamespaces?.(p);const y=(c.isInitialized||c.initializedStoreOnce)&&p.every(L=>gH(L,c,f)),S=MH(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),E=()=>S,T=()=>N_(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),[O,M]=x.useState(E);let A=p.join();t.lng&&(A=`${t.lng}${A}`);const D=AH(A),_=x.useRef(!0);x.useEffect(()=>{const{bindI18n:L,bindI18nStore:N}=f;_.current=!0,!y&&!m&&(t.lng?__(c,t.lng,p,()=>{_.current&&M(T)}):AE(c,p,()=>{_.current&&M(T)})),y&&D&&D!==A&&_.current&&M(T);const V=()=>{_.current&&M(T)};return L&&c?.on(L,V),N&&c?.store.on(N,V),()=>{_.current=!1,c&&L?.split(" ").forEach(B=>c.off(B,V)),N&&c&&N.split(" ").forEach(B=>c.store.off(B,V))}},[c,A]),x.useEffect(()=>{_.current&&y&&M(E)},[c,g,y]);const j=[O,c,y];if(j.t=O,j.i18n=c,j.ready=y,y||!y&&!m)return j;throw new Promise(L=>{t.lng?__(c,t.lng,p,()=>L()):AE(c,p,()=>L())})},DH={en:{translation:{welcome:"Hi there, you’re speaking with Jaweb AI Assistant."}},ar:{translation:{welcome:"مرحبًا، أنت تتحدث إلى مساعد Jaweb AI."}}};Wr.use(TH).init({resources:DH,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const NH=3,$H=3e3,zH=()=>{const[e,t]=x.useState(!0),[a,r]=x.useState(!1),[o,c]=x.useState(""),[f,m]=x.useState(""),[g,p]=x.useState(!1),[y,S]=x.useState(!1),[E,T]=x.useState(""),[O,M]=x.useState(""),[A,D]=x.useState(null),[_,j]=x.useState(""),[L,N]=x.useState([]),[V,B]=x.useState([]),[z,U]=x.useState(""),[H,ee]=x.useState(!1),Y=async(Z=0)=>{const W=localStorage.getItem("company_username");t(!0);const ie={headers:{"Content-Type":"application/json",Accept:"application/json"},params:{username:W}};try{const k=(await $a.get(`${ii.apiUrl}chatbot-details/`,ie)).data.data;k.language==="Arabic"?Wr.changeLanguage("ar"):Wr.changeLanguage("en"),r(k.chatbot_form),c(k.chatbot_color),m(k.chatbot_logo),p(k.disable_chatbot_globally),S(k.remove_powered_by_jaweb),T(k.chatbot_initial_msg),M(k.status),U(k.mode),D(k.calendly_link??null),ee(k.disable_checkout),k.calendly_link&&D(k.calendly_link),k.phone_number_id&&j(`+${k.phone_number_id}`);const Q=await $a.get(`${ii.apiUrl}chatbot-plugin-suggestions/`,ie);let se=[];Array.isArray(Q.data.data)?se=Q.data.data:Array.isArray(Q.data.user_questions)&&(se=Q.data.user_questions),se.length>0?(N(se.slice(0,3)),B(se.slice(3))):(N([]),B([])),t(!1)}catch(G){console.error("Error fetching data:",G),Z<NH?setTimeout(()=>Y(Z+1),$H):console.error("Max retries reached. Could not fetch data.")}};return x.useEffect(()=>{Y()},[]),{isFetchingDetails:e,disableForm:a,colorCode:o,chatbotLogo:f,disableChatbotGlobally:g,removePoweredByJaweb:y,initialMessageText:E,subscription:O,calendly:A,merchantPhone:_,messagesSuggestions:L,restSuggestions:V,userType:z,disbleCheckout:H}};var _E={exports:{}};/*!
325
325
  Copyright (c) 2018 Jed Watson.
326
326
  Licensed under the MIT License (MIT), see
327
327
  http://jedwatson.github.io/classnames
@@ -649,7 +649,7 @@ html body {
649
649
  <div class="cursor" part="cursor"></div>
650
650
  </div>
651
651
  </div>
652
- `,[t,a]}setOptions(t){if(this.options.container!==t.container){const a=this.parentFromOptionsContainer(t.container);a.appendChild(this.container),this.parent=a}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:a}=this.scrollContainer,r=a*t;this.setScroll(r)}destroy(){var t,a;this.subscriptions.forEach(r=>r()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(a=this.unsubscribeOnScroll)===null||a===void 0||a.forEach(r=>r()),this.unsubscribeOnScroll=[]}createDelay(t=10){let a,r;const o=()=>{a&&clearTimeout(a),r&&r()};return this.timeouts.push(o),()=>new Promise((c,f)=>{o(),r=f,a=setTimeout(()=>{a=void 0,r=void 0,c()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const a=document.createElement("canvas"),r=a.getContext("2d"),o=a.height*(window.devicePixelRatio||1),c=r.createLinearGradient(0,0,0,o),f=1/(t.length-1);return t.forEach((m,g)=>{const p=g*f;c.addColorStop(p,m)}),c}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,a,r,o){const c=t[0],f=t[1]||t[0],m=c.length,{width:g,height:p}=r.canvas,y=p/2,S=this.getPixelRatio(),E=a.barWidth?a.barWidth*S:1,T=a.barGap?a.barGap*S:a.barWidth?E/2:0,O=a.barRadius||0,M=g/(E+T)/m,A=O&&"roundRect"in r?"roundRect":"rect";r.beginPath();let D=0,_=0,j=0;for(let L=0;L<=m;L++){const N=Math.round(L*M);if(N>D){const z=Math.round(_*y*o),U=z+Math.round(j*y*o)||1;let H=y-z;a.barAlign==="top"?H=0:a.barAlign==="bottom"&&(H=p-U),r[A](D*(E+T),H,E,U,O),D=N,_=0,j=0}const V=Math.abs(c[L]||0),B=Math.abs(f[L]||0);V>_&&(_=V),B>j&&(j=B)}r.fill(),r.closePath()}renderLineWaveform(t,a,r,o){const c=f=>{const m=t[f]||t[0],g=m.length,{height:p}=r.canvas,y=p/2,S=r.canvas.width/g;r.moveTo(0,y);let E=0,T=0;for(let O=0;O<=g;O++){const M=Math.round(O*S);if(M>E){const D=y+(Math.round(T*y*o)||1)*(f===0?-1:1);r.lineTo(E,D),E=M,T=0}const A=Math.abs(m[O]||0);A>T&&(T=A)}r.lineTo(E,y)};r.beginPath(),c(0),c(1),r.fill(),r.closePath()}renderWaveform(t,a,r){if(r.fillStyle=this.convertColorValues(a.waveColor),a.renderFunction)return void a.renderFunction(t,r);let o=a.barHeight||1;if(a.normalize){const c=Array.from(t[0]).reduce((f,m)=>Math.max(f,Math.abs(m)),0);o=c?1/c:1}a.barWidth||a.barGap||a.barAlign?this.renderBarWaveform(t,a,r,o):this.renderLineWaveform(t,a,r,o)}renderSingleCanvas(t,a,r,o,c,f,m){const g=this.getPixelRatio(),p=document.createElement("canvas");p.width=Math.round(r*g),p.height=Math.round(o*g),p.style.width=`${r}px`,p.style.height=`${o}px`,p.style.left=`${Math.round(c)}px`,f.appendChild(p);const y=p.getContext("2d");if(this.renderWaveform(t,a,y),p.width>0&&p.height>0){const S=p.cloneNode(),E=S.getContext("2d");E.drawImage(p,0,0),E.globalCompositeOperation="source-in",E.fillStyle=this.convertColorValues(a.progressColor),E.fillRect(0,0,p.width,p.height),m.appendChild(S)}}renderMultiCanvas(t,a,r,o,c,f){const m=this.getPixelRatio(),{clientWidth:g}=this.scrollContainer,p=r/m;let y=Math.min(lp.MAX_CANVAS_WIDTH,g,p),S={};if(a.barWidth||a.barGap){const A=a.barWidth||.5,D=A+(a.barGap||A/2);y%D!=0&&(y=Math.floor(y/D)*D)}if(y===0)return;const E=A=>{if(A<0||A>=T||S[A])return;S[A]=!0;const D=A*y;let _=Math.min(p-D,y);if(a.barWidth||a.barGap){const L=a.barWidth||.5,N=L+(a.barGap||L/2);_=Math.floor(_/N)*N}if(_<=0)return;const j=t.map(L=>{const N=Math.floor(D/p*L.length),V=Math.floor((D+_)/p*L.length);return L.slice(N,V)});this.renderSingleCanvas(j,a,_,o,D,c,f)},T=Math.ceil(p/y);if(!this.isScrollable){for(let A=0;A<T;A++)E(A);return}const O=this.scrollContainer.scrollLeft/p,M=Math.floor(O*T);if(E(M-1),E(M),E(M+1),T>1){const A=this.on("scroll",()=>{const{scrollLeft:D}=this.scrollContainer,_=Math.floor(D/p*T);Object.keys(S).length>lp.MAX_NODES&&(c.innerHTML="",f.innerHTML="",S={}),E(_-1),E(_),E(_+1)});this.unsubscribeOnScroll.push(A)}}renderChannel(t,a,r,o){var{overlay:c}=a,f=function(y,S){var E={};for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&S.indexOf(T)<0&&(E[T]=y[T]);if(y!=null&&typeof Object.getOwnPropertySymbols=="function"){var O=0;for(T=Object.getOwnPropertySymbols(y);O<T.length;O++)S.indexOf(T[O])<0&&Object.prototype.propertyIsEnumerable.call(y,T[O])&&(E[T[O]]=y[T[O]])}return E}(a,["overlay"]);const m=document.createElement("div"),g=this.getHeight(f.height,f.splitChannels);m.style.height=`${g}px`,c&&o>0&&(m.style.marginTop=`-${g}px`),this.canvasWrapper.style.minHeight=`${g}px`,this.canvasWrapper.appendChild(m);const p=m.cloneNode();this.progressWrapper.appendChild(p),this.renderMultiCanvas(t,f,r,g,m,p)}render(t){return li(this,void 0,void 0,function*(){var a;this.timeouts.forEach(g=>g()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const r=this.getPixelRatio(),o=this.scrollContainer.clientWidth,c=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=c>o;const f=this.options.fillParent&&!this.isScrollable,m=(f?o:c)*r;if(this.wrapper.style.width=f?"100%":`${c}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let g=0;g<t.numberOfChannels;g++){const p=Object.assign(Object.assign({},this.options),(a=this.options.splitChannels)===null||a===void 0?void 0:a[g]);this.renderChannel([t.getChannelData(g)],p,m,g)}else{const g=[t.getChannelData(0)];t.numberOfChannels>1&&g.push(t.getChannelData(1)),this.renderChannel(g,this.options,m,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(r=>r()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:a}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:r}=this.progressWrapper.getBoundingClientRect();let o=r-a;o*=2,o=o<0?Math.floor(o):Math.ceil(o),o/=2,this.scrollContainer.scrollLeft+=o}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,a=!1){const{scrollLeft:r,scrollWidth:o,clientWidth:c}=this.scrollContainer,f=t*o,m=r,g=r+c,p=c/2;if(this.isDragging)f+30>g?this.scrollContainer.scrollLeft+=30:f-30<m&&(this.scrollContainer.scrollLeft-=30);else{(f<m||f>g)&&(this.scrollContainer.scrollLeft=f-(this.options.autoCenter?p:0));const y=f-r-p;a&&this.options.autoCenter&&y>0&&(this.scrollContainer.scrollLeft+=Math.min(y,10))}{const y=this.scrollContainer.scrollLeft,S=y/o,E=(y+c)/o;this.emit("scroll",S,E,y,y+c)}}renderProgress(t,a){if(isNaN(t))return;const r=100*t;this.canvasWrapper.style.clipPath=`polygon(${r}% 0%, 100% 0%, 100% 100%, ${r}% 100%)`,this.progressWrapper.style.width=`${r}%`,this.cursor.style.left=`${r}%`,this.cursor.style.transform=`translateX(-${Math.round(r)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,a)}exportImage(t,a,r){return li(this,void 0,void 0,function*(){const o=this.canvasWrapper.querySelectorAll("canvas");if(!o.length)throw new Error("No waveform data");if(r==="dataURL"){const c=Array.from(o).map(f=>f.toDataURL(t,a));return Promise.resolve(c)}return Promise.all(Array.from(o).map(c=>new Promise((f,m)=>{c.toBlob(g=>{g?f(g):m(new Error("Could not export image"))},t,a)})))})}}lp.MAX_CANVAS_WIDTH=8e3,lp.MAX_NODES=10;class Vte extends L0{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class VR extends L0{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return li(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(a=>{if(a.status>=400)throw new Error(`Failed to fetch ${t}: ${a.status} (${a.statusText})`);return a.arrayBuffer()}).then(a=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(a)).then(a=>{this.currentSrc===t&&(this.buffer=a,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let a=this.playedDuration*this._playbackRate;(a>=this.duration||a<0)&&(a=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,a),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return li(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const a=t-this.currentTime,r=this.bufferNode;r?.stop(this.audioContext.currentTime+a),r?.addEventListener("ended",()=>{r===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return li(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const a=!this.paused;a&&this._pause(),this.playedDuration=t/this._playbackRate,a&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,a;return(t=this._duration)!==null&&t!==void 0?t:((a=this.buffer)===null||a===void 0?void 0:a.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const a=this.buffer.numberOfChannels;for(let r=0;r<a;r++)t.push(this.buffer.getChannelData(r));return t}}const Hte={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class sp extends Lte{static create(t){return new sp(t)}constructor(t){const a=t.media||(t.backend==="WebAudio"?new VR:void 0);super({media:a,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},Hte,t),this.timer=new Vte;const r=a?void 0:this.getMediaElement();this.renderer=new lp(this.options,r),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const o=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:c,duration:f}=this.options;(o||c&&f)&&this.load(o,c,f).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,a)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,a))}),this.renderer.on("dblclick",(t,a)=>{this.emit("dblclick",t,a)}),this.renderer.on("scroll",(t,a,r,o)=>{const c=this.getDuration();this.emit("scroll",t*c,a*c,r,o)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",a=>{if(!this.options.interact)return;let r;this.renderer.renderProgress(a),clearTimeout(t),this.isPlaying()?r=0:this.options.dragToSeek===!0?r=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(r=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(a)},r),this.emit("interaction",a*this.getDuration()),this.emit("drag",a)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(a=>{this.registerPlugin(a)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=yx.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=yx.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){t._init(this),this.plugins.push(t);const a=t.once("destroy",()=>{this.plugins=this.plugins.filter(r=>r!==t),this.subscriptions=this.subscriptions.filter(r=>r!==a)});return this.subscriptions.push(a),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const a=t/this.getDuration();this.renderer.setScrollPercentage(a)}getActivePlugins(){return this.plugins}loadAudio(t,a,r,o){return li(this,void 0,void 0,function*(){var c;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!a&&!r){const m=this.options.fetchParams||{};window.AbortController&&!m.signal&&(this.abortController=new AbortController,m.signal=(c=this.abortController)===null||c===void 0?void 0:c.signal);const g=y=>this.emit("loading",y);a=yield jte.fetchBlob(t,g,m);const p=this.options.blobMimeType;p&&(a=new Blob([a],{type:p}))}this.setSrc(t,a);const f=yield new Promise(m=>{const g=o||this.getDuration();g?m(g):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>m(this.getDuration()),{once:!0}))});if(!t&&!a){const m=this.getMediaElement();m instanceof VR&&(m.duration=f)}if(r)this.decodedData=yx.createBuffer(r,f||0);else if(a){const m=yield a.arrayBuffer();this.decodedData=yield yx.decode(m,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,a,r){return li(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,a,r)}catch(o){throw this.emit("error",o),o}})}loadBlob(t,a,r){return li(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,a,r)}catch(o){throw this.emit("error",o),o}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:a=8e3,precision:r=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const o=Math.min(t,this.decodedData.numberOfChannels),c=[];for(let f=0;f<o;f++){const m=this.decodedData.getChannelData(f),g=[],p=m.length/a;for(let y=0;y<a;y++){const S=m.slice(Math.floor(y*p),Math.ceil((y+1)*p));let E=0;for(let T=0;T<S.length;T++){const O=S[T];Math.abs(O)>Math.abs(E)&&(E=O)}g.push(Math.round(E*r)/r)}c.push(g)}return c}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const a=this.getDuration()*t;this.setTime(a)}play(t,a){const r=Object.create(null,{play:{get:()=>super.play}});return li(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const o=yield r.play.call(this);return a!=null&&(this.media instanceof VR?this.media.stopAt(a):this.stopAtPosition=a),o})}playPause(){return li(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return li(this,arguments,void 0,function*(t="image/png",a=1,r="dataURL"){return this.renderer.exportImage(t,a,r)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(a=>a.destroy()),this.subscriptions.forEach(a=>a()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}sp.BasePlugin=class extends L0{constructor(e){super(),this.subscriptions=[],this.options=e}onInit(){}_init(e){this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(e=>e())}},sp.dom=zte;const Bte=({userMessage:e,setUserMessage:t,handleSendMessage:a,handleSendImage:r,handleSendVoice:o,selectedImage:c,setSelectedImage:f,audioBlob:m,setAudioBlob:g,isSending:p})=>{const{t:y}=_H(),[S,E]=x.useState(!1),[T,O]=x.useState(!1),M=x.useRef(null),A=x.useRef(null),D=x.useRef([]),_=x.useRef(null),j=x.useRef(null),L=U=>{const H=U.target.files?.[0];H&&f(H)},N=()=>{f(null)},V=async()=>{if(!navigator.mediaDevices?.getUserMedia){alert(y("chatInput.voice.notSupported"));return}if(S)M.current?.stop();else try{const U=await navigator.mediaDevices.getUserMedia({audio:!0}),H=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",ee=new MediaRecorder(U,{mimeType:H});M.current=ee,D.current=[],ee.ondataavailable=Y=>{Y.data.size>0&&D.current.push(Y.data)},ee.onstop=()=>{const Y=new Blob(D.current,{type:H});g(Y),E(!1),U.getTracks().forEach(Z=>Z.stop())},ee.start(),E(!0)}catch(U){console.error(U),alert(y("chatInput.voice.permissionError"))}};x.useEffect(()=>{if(m&&_.current){j.current?.destroy();const U=URL.createObjectURL(m);j.current=sp.create({container:_.current,waveColor:"#ccc",progressColor:"#7F28F8",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),j.current.load(U),j.current.on("finish",()=>O(!1))}},[m]);const B=()=>{j.current&&(j.current.playPause(),O(U=>!U))},z=()=>{E(!1),g(null),j.current?.destroy()};return J.jsxs("div",{style:{display:"flex",alignItems:"center",backgroundColor:"white",border:"1px solid #d1d5db",borderRadius:"9999px",padding:"0.5rem 0.75rem",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",width:"95%",height:"56px"},children:[J.jsx("button",{style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},onClick:()=>A.current?.click(),children:c?J.jsxs("div",{style:{position:"relative"},children:[J.jsx("img",{src:URL.createObjectURL(c),alt:y("chatInput.image.selectedAlt"),style:{width:"2rem",height:"2rem",borderRadius:"9999px",objectFit:"cover",padding:"0"}}),J.jsx(y0,{style:{position:"absolute",top:"-0.5rem",right:"-0.5rem",fontSize:"14px",color:"#ef4444",background:"white",borderRadius:"9999px",cursor:"pointer"},onClick:U=>{U.stopPropagation(),N()}})]}):J.jsx(S6,{style:{fontSize:"20px"}})}),J.jsx("input",{disabled:p,type:"file",accept:"image/*",ref:A,onChange:L,style:{display:"none",padding:"0"}}),J.jsx(Ld,{title:S?"Stop Recording":"Send Audio",children:J.jsx("button",{onClick:V,style:{color:S?"#ef4444":"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:S?J.jsx(E6,{style:{fontSize:"20px"}}):J.jsx(p6,{style:{fontSize:"20px"}})})}),J.jsx("div",{style:{flex:1,margin:"0 0.5rem",minWidth:0,maxWidth:"100%",display:"flex",alignItems:"center"},children:m?J.jsxs("div",{style:{display:"flex",alignItems:"center",width:"100%",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem"},children:[J.jsx("button",{style:{background:"none",border:"none",marginRight:"0.75rem",color:"#7f28f8",cursor:"pointer",padding:"0"},onClick:B,children:T?J.jsx(uO,{style:{fontSize:"24px"}}):J.jsx(cO,{style:{fontSize:"24px"}})}),J.jsx("div",{ref:_,style:{width:"100%",height:"2rem"}}),J.jsx(y0,{style:{fontSize:"18px",color:"#ef4444",marginLeft:"0.75rem",cursor:"pointer"},onClick:z})]}):S?J.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem",animation:"pulse 2s infinite"},children:J.jsx("span",{children:"Recording"})}):J.jsx(Vd,{type:"text",value:e,onChange:U=>t(U.target.value),placeholder:"Message...",style:{width:"100%",border:"none",fontSize:"16px",margin:0,lineHeight:1.5,color:"#374151",padding:"0"},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),c?(r(c,e),N(),t("")):e.trim()&&(a(),t("")))}})}),J.jsx("button",{disabled:p,onClick:()=>{const U=!!c,H=!!e.trim();U?(r(c,e),N(),t("")):!!m?(o(m),z()):H&&(a(),t(""))},"aria-label":y("chatInput.send"),style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:J.jsx(x6,{style:{fontSize:"20px"}})})]})};function Pte({suggestions:e,colorCode:t,sendMessageSuggestion:a}){return J.jsx("div",{style:{overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",paddingTop:"4px",paddingBottom:"8px",width:"100%",boxSizing:"border-box",marginLeft:"4%",marginTop:"4px",marginBottom:"4px"},children:J.jsx("div",{style:{display:"inline-flex",gap:"0.5rem"},children:e?.map((r,o)=>J.jsx("button",{onClick:()=>a(r),style:{whiteSpace:"nowrap",padding:"0.5rem 1rem",border:`1px solid ${t}`,borderRadius:"9999px",backgroundColor:"white",cursor:"pointer",fontSize:"14px",color:t,flexShrink:0},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="#f3f3f3"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="white"},children:r},o))})})}function Ute(){return J.jsxs("div",{className:"jawebcss-powered-container",children:[J.jsx("span",{className:"jawebcss-powered-label",children:"Powered by"}),J.jsx("a",{href:"https://jaweb.me/",target:"_blank",className:"jawebcss-powered-link",rel:"noopener noreferrer",children:"Jaweb"})]})}const Ite=({color:e,size:t=5})=>J.jsxs("div",{className:"typing-boxes",children:[J.jsx("span",{style:{backgroundColor:e,width:t,height:t}}),J.jsx("span",{style:{backgroundColor:e,width:t,height:t}}),J.jsx("span",{style:{backgroundColor:e,width:t,height:t}})]}),kte=({productImage:e})=>{const[t,a]=x.useState(null),[r,o]=x.useState(null),[c,f]=x.useState(!1),m=async p=>{f(!0),o(null);const y=new FileReader;y.onload=async()=>{const S=y.result;try{const T=await(await fetch(`${ii.apiUrl}ark-tryon/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userImageUrl:S,productImageUrl:e})})).json();T.resultImage?o(T.resultImage):console.error("Ark API error:",T)}catch(E){console.error("Error calling Ark API:",E)}finally{f(!1)}},y.readAsDataURL(p)},g=p=>{p.target.files&&p.target.files[0]&&(a(URL.createObjectURL(p.target.files[0])),m(p.target.files[0]))};return J.jsxs("div",{className:"mt-4 border rounded-lg p-4 bg-gray-50",children:[!t&&!r&&!c&&J.jsxs("label",{className:"flex flex-col items-center justify-center border-2 border-dashed border-gray-400 rounded-lg w-full h-40 cursor-pointer hover:bg-gray-100 transition",children:[J.jsx(g6,{style:{fontSize:28,marginBottom:8}}),J.jsx("span",{className:"text-gray-500",children:"Click or Drop your photo here"}),J.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:g})]}),c&&J.jsxs("div",{className:"flex flex-col items-center justify-center h-40",children:[J.jsx(Wu,{indicator:J.jsx(Ks,{style:{fontSize:32},spin:!0})}),J.jsx("p",{className:"mt-2 text-gray-600",children:"Generating your try-on..."})]}),!c&&r&&J.jsxs("div",{className:"flex flex-col items-center",children:[J.jsx("p",{className:"mb-2 text-sm font-medium",children:"✨ Try-On Result"}),J.jsx("img",{src:r,alt:"Result",className:"max-h-64 object-contain rounded-md border"}),J.jsx(Kr,{style:{margin:"4px"},type:"default",className:"mt-3",onClick:()=>{a(null),o(null)},children:"Try Another"})]})]})},Fte=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y,disableCheckout:S=!1})=>{if(!y||y===0)return null;const[E,T]=x.useState(null);return J.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:J.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([O,M])=>{const A=t[O]||(M.length>0?M[0].variant_id:""),D=M.find(H=>H.variant_id===A)||M[0];if(!D)return null;const _=r[D.variant_id]||0,j=Array.from(new Set(M.map(H=>H.option?.trim()??"").filter(H=>H&&H.toLowerCase()!=="none"))),L=H=>{const ee=M.find(Y=>Y.option===H);ee&&a(Y=>({...Y,[O]:ee.variant_id}))},N=D.option??j[0]??"",V=async()=>{o(H=>({...H,[D.variant_id]:(H[D.variant_id]||0)+1})),await c(D.variant_id,D.name,1)},B=async()=>{_!==0&&(o(H=>({...H,[D.variant_id]:Math.max(0,(H[D.variant_id]||0)-1)})),await f(D.variant_id,1))},z=E===D.variant_id,U=D.tag?D.tag.toLowerCase()==="clothing":!0;return J.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[J.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(D.link,"_blank"),children:[J.jsx("img",{src:D.image,alt:D.name,className:"sallaX-img",loading:"lazy"}),J.jsx("a",{href:D.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:H=>H.stopPropagation(),children:"View"})]}),J.jsxs("div",{className:"sallaX-body",children:[J.jsx("a",{href:D.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:D.name,children:g(D.name)}),J.jsx("div",{className:"sallaX-row",children:J.jsx("span",{className:"sallaX-price","aria-label":"Price",children:D.price})}),j.length>1&&J.jsxs("div",{className:"sallaX-selectWrap",children:[J.jsx("label",{htmlFor:`sallaX-select-${O}`,className:"sallaX-selectLabel",children:"Choose an option"}),J.jsx("select",{id:`sallaX-select-${O}`,className:"sallaX-select","aria-label":"Choose an option",value:N,onChange:H=>L(H.target.value),children:j.map(H=>J.jsx("option",{value:H,children:H},H))})]}),J.jsxs("div",{className:"flex items-center justify-between w-full space-x-4",children:[!S&&J.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:B,"aria-label":"Decrease quantity",disabled:_===0,children:"–"}),J.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:_}),J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:V,"aria-label":"Increase quantity",children:"+"})]}),U&&J.jsx(Kr,{style:{backgroundColor:m,color:"white"},className:"px-6 py-2 rounded-lg shadow-md transition",onClick:()=>T(z?null:D.variant_id),children:z?"Close Try On":"Try On"})]}),U&&z&&J.jsx("div",{className:"mt-4",children:J.jsx(kte,{productImage:D.image})})]})]},O)})})})};var bx={},j5;function qte(){if(j5)return bx;j5=1,Object.defineProperty(bx,"__esModule",{value:!0});var e=Ed();function t(z){return Array.prototype.slice.call(z)}function a(z,U){var H=Math.floor(z);return H===U||H+1===U?z:U}function r(){return Date.now()}function o(z,U,H){if(U="data-keen-slider-"+U,H===null)return z.removeAttribute(U);z.setAttribute(U,H||"")}function c(z,U){return U=U||document,typeof z=="function"&&(z=z(U)),Array.isArray(z)?z:typeof z=="string"?t(U.querySelectorAll(z)):z instanceof HTMLElement?[z]:z instanceof NodeList?t(z):[]}function f(z){z.raw&&(z=z.raw),z.cancelable&&!z.defaultPrevented&&z.preventDefault()}function m(z){z.raw&&(z=z.raw),z.stopPropagation&&z.stopPropagation()}function g(){var z=[];return{add:function(U,H,ee,Y){U.addListener?U.addListener(ee):U.addEventListener(H,ee,Y),z.push([U,H,ee,Y])},input:function(U,H,ee,Y){this.add(U,H,function(Z){return function(W){W.nativeEvent&&(W=W.nativeEvent);var ie=W.changedTouches||[],G=W.targetTouches||[],k=W.detail&&W.detail.x?W.detail:null;return Z({id:k?k.identifier?k.identifier:"i":G[0]?G[0]?G[0].identifier:"e":"d",idChanged:k?k.identifier?k.identifier:"i":ie[0]?ie[0]?ie[0].identifier:"e":"d",raw:W,x:k&&k.x?k.x:G[0]?G[0].screenX:k?k.x:W.pageX,y:k&&k.y?k.y:G[0]?G[0].screenY:k?k.y:W.pageY})}}(ee),Y)},purge:function(){z.forEach(function(U){U[0].removeListener?U[0].removeListener(U[2]):U[0].removeEventListener(U[1],U[2],U[3])}),z=[]}}}function p(z,U,H){return Math.min(Math.max(z,U),H)}function y(z){return(z>0?1:0)-(z<0?1:0)||+z}function S(z){var U=z.getBoundingClientRect();return{height:a(U.height,z.offsetHeight),width:a(U.width,z.offsetWidth)}}function E(z,U,H,ee){var Y=z&&z[U];return Y==null?H:ee&&typeof Y=="function"?Y():Y}function T(z){return Math.round(1e6*z)/1e6}function O(z,U){if(z===U)return!0;var H=typeof z;if(H!==typeof U)return!1;if(H!=="object"||z===null||U===null)return H==="function"&&z.toString()===U.toString();if(z.length!==U.length||Object.getOwnPropertyNames(z).length!==Object.getOwnPropertyNames(U).length)return!1;for(var ee in z)if(!O(z[ee],U[ee]))return!1;return!0}var M=function(){return M=Object.assign||function(z){for(var U,H=1,ee=arguments.length;H<ee;H++)for(var Y in U=arguments[H])Object.prototype.hasOwnProperty.call(U,Y)&&(z[Y]=U[Y]);return z},M.apply(this,arguments)};function A(z,U,H){for(var ee,Y=0,Z=U.length;Y<Z;Y++)!ee&&Y in U||(ee||(ee=Array.prototype.slice.call(U,0,Y)),ee[Y]=U[Y]);return z.concat(ee||Array.prototype.slice.call(U))}function D(z){var U,H,ee,Y,Z,W;function ie(q){W||(W=q),G(!0);var F=q-W;F>ee&&(F=ee);var te=Y[H];if(te[3]<F)return H++,ie(q);var ae=te[2],oe=te[4],le=te[0],ue=te[1]*(0,te[5])(oe===0?1:(F-ae)/oe);if(ue&&z.track.to(le+ue),F<ee)return Q();W=null,G(!1),k(null),z.emit("animationEnded")}function G(q){U.active=q}function k(q){U.targetIdx=q}function Q(){var q;q=ie,Z=window.requestAnimationFrame(q)}function se(){var q;q=Z,window.cancelAnimationFrame(q),G(!1),k(null),W&&z.emit("animationStopped"),W=null}return U={active:!1,start:function(q){if(se(),z.track.details){var F=0,te=z.track.details.position;H=0,ee=0,Y=q.map(function(ae){var oe,le=Number(te),ue=(oe=ae.earlyExit)!==null&&oe!==void 0?oe:ae.duration,Ee=ae.easing,je=ae.distance*Ee(ue/ae.duration)||0;te+=je;var Ne=ee;return ee+=ue,F+=je,[le,ae.distance,Ne,ee,ae.duration,Ee]}),k(z.track.distToIdx(F)),Q(),z.emit("animationStarted")}},stop:se,targetIdx:null}}function _(z){var U,H,ee,Y,Z,W,ie,G,k,Q,se,q,F,te,ae=1/0,oe=[],le=null,ue=0;function Ee(Oe){Se(ue+Oe)}function je(Oe){var Re=Ne(ue+Oe).abs;return me(Re)?Re:null}function Ne(Oe){var Re=Math.floor(Math.abs(T(Oe/H))),Ae=T((Oe%H+H)%H);Ae===H&&(Ae=0);var we=y(Oe),_e=ie.indexOf(A([],ie).reduce(function(ze,it){return Math.abs(it-Ae)<Math.abs(ze-Ae)?it:ze})),Ve=_e;return we<0&&Re++,_e===W&&(Ve=0,Re+=we>0?1:-1),{abs:Ve+Re*W*we,origin:_e,rel:Ve}}function ke(Oe,Re,Ae){var we;if(Re||!Qe())return ye(Oe,Ae);if(!me(Oe))return null;var _e=Ne(Ae??ue),Ve=_e.abs,ze=Oe-_e.rel,it=Ve+ze;we=ye(it);var ut=ye(it-W*y(ze));return(ut!==null&&Math.abs(ut)<Math.abs(we)||we===null)&&(we=ut),T(we)}function ye(Oe,Re){if(Re==null&&(Re=T(ue)),!me(Oe)||Oe===null)return null;Oe=Math.round(Oe);var Ae=Ne(Re),we=Ae.abs,_e=Ae.rel,Ve=Ae.origin,ze=he(Oe),it=(Re%H+H)%H,ut=ie[Ve],vt=Math.floor((Oe-(we-_e))/W)*H;return T(ut-it-ut+ie[ze]+vt+(Ve===W?H:0))}function me(Oe){return Le(Oe)===Oe}function Le(Oe){return p(Oe,k,Q)}function Qe(){return Y.loop}function he(Oe){return(Oe%W+W)%W}function Se(Oe){var Re;Re=Oe-ue,oe.push({distance:Re,timestamp:r()}),oe.length>6&&(oe=oe.slice(-6)),ue=T(Oe);var Ae=ve().abs;if(Ae!==le){var we=le!==null;le=Ae,we&&z.emit("slideChanged")}}function ve(Oe){var Re=Oe?null:function(){if(W){var Ae=Qe(),we=Ae?(ue%H+H)%H:ue,_e=(Ae?ue%H:ue)-Z[0][2],Ve=0-(_e<0&&Ae?H-Math.abs(_e):_e),ze=0,it=Ne(ue),ut=it.abs,vt=it.rel,At=Z[vt][2],ht=Z.map(function(Lt,Vt){var _t=Ve+ze;(_t<0-Lt[0]||_t>1)&&(_t+=(Math.abs(_t)>H-1&&Ae?H:0)*y(-_t));var Tt=Vt-vt,ct=y(Tt),gt=Tt+ut;Ae&&(ct===-1&&_t>At&&(gt+=W),ct===1&&_t<At&&(gt-=W),se!==null&&gt<se&&(_t+=H),q!==null&&gt>q&&(_t-=H));var at=_t+Lt[0]+Lt[1],lt=Math.max(_t>=0&&at<=1?1:at<0||_t>1?0:_t<0?Math.min(1,(Lt[0]+_t)/Lt[0]):(1-_t)/Lt[0],0);return ze+=Lt[0]+Lt[1],{abs:gt,distance:Y.rtl?-1*_t+1-Lt[0]:_t,portion:lt,size:Lt[0]}});return ut=Le(ut),vt=he(ut),{abs:Le(ut),length:ee,max:te,maxIdx:Q,min:F,minIdx:k,position:ue,progress:Ae?we/H:ue/ee,rel:vt,slides:ht,slidesLength:H}}}();return U.details=Re,z.emit("detailsChanged"),Re}return U={absToRel:he,add:Ee,details:null,distToIdx:je,idxToDist:ke,init:function(Oe){if(function(){if(Y=z.options,Z=(Y.trackConfig||[]).map(function(_e){return[E(_e,"size",1),E(_e,"spacing",0),E(_e,"origin",0)]}),W=Z.length){H=T(Z.reduce(function(_e,Ve){return _e+Ve[0]+Ve[1]},0));var Ae,we=W-1;ee=T(H+Z[0][2]-Z[we][0]-Z[we][2]-Z[we][1]),ie=Z.reduce(function(_e,Ve){if(!_e)return[0];var ze=Z[_e.length-1],it=_e[_e.length-1]+(ze[0]+ze[2])+ze[1];return it-=Ve[2],_e[_e.length-1]>it&&(it=_e[_e.length-1]),it=T(it),_e.push(it),(!Ae||Ae<it)&&(G=_e.length-1),Ae=it,_e},null),ee===0&&(G=0),ie.push(T(H))}}(),!W)return ve(!0);var Re;(function(){var Ae=z.options.range,we=z.options.loop;se=k=we?E(we,"min",-1/0):0,q=Q=we?E(we,"max",ae):G;var _e=E(Ae,"min",null),Ve=E(Ae,"max",null);_e!==null&&(k=_e),Ve!==null&&(Q=Ve),F=k===-1/0?k:z.track.idxToDist(k||0,!0,0),te=Q===ae?Q:ke(Q,!0,0),Ve===null&&(q=Q),E(Ae,"align",!1)&&Q!==ae&&Z[he(Q)][2]===0&&(te-=1-Z[he(Q)][0],Q=je(te-ue)),F=T(F),te=T(te)})(),Re=Oe,Number(Re)===Re?Ee(ye(Le(Oe))):ve()},to:Se,velocity:function(){var Oe=r(),Re=oe.reduce(function(Ae,we){var _e=we.distance,Ve=we.timestamp;return Oe-Ve>200||(y(_e)!==y(Ae.distance)&&Ae.distance&&(Ae={distance:0,lastTimestamp:0,time:0}),Ae.time&&(Ae.distance+=_e),Ae.lastTimestamp&&(Ae.time+=Ve-Ae.lastTimestamp),Ae.lastTimestamp=Ve),Ae},{distance:0,lastTimestamp:0,time:0});return Re.distance/Re.time||0}}}function j(z){var U,H,ee,Y,Z,W,ie,G;function k(le){return 2*le}function Q(le){return p(le,ie,G)}function se(le){return 1-Math.pow(1-le,3)}function q(){return ee?z.track.velocity():0}function F(){oe();var le=z.options.mode==="free-snap",ue=z.track,Ee=q();Y=y(Ee);var je=z.track.details,Ne=[];if(Ee||!le){var ke=te(Ee),ye=ke.dist,me=ke.dur;if(me=k(me),ye*=Y,le){var Le=ue.idxToDist(ue.distToIdx(ye),!0);Le&&(ye=Le)}Ne.push({distance:ye,duration:me,easing:se});var Qe=je.position,he=Qe+ye;if(he<Z||he>W){var Se=he<Z?Z-Qe:W-Qe,ve=0,Oe=Ee;if(y(Se)===Y){var Re=Math.min(Math.abs(Se)/Math.abs(ye),1),Ae=function(Ve){return 1-Math.pow(1-Ve,1/3)}(Re)*me;Ne[0].earlyExit=Ae,Oe=Ee*(1-Re)}else Ne[0].earlyExit=0,ve+=Se;var we=te(Oe,100),_e=we.dist*Y;z.options.rubberband&&(Ne.push({distance:_e,duration:k(we.dur),easing:se}),Ne.push({distance:-_e+ve,duration:500,easing:se}))}z.animator.start(Ne)}else z.moveToIdx(Q(je.abs),!0,{duration:500,easing:function(Ve){return 1+--Ve*Ve*Ve*Ve*Ve}})}function te(le,ue){ue===void 0&&(ue=1e3);var Ee=147e-9+(le=Math.abs(le))/ue;return{dist:Math.pow(le,2)/Ee,dur:le/Ee}}function ae(){var le=z.track.details;le&&(Z=le.min,W=le.max,ie=le.minIdx,G=le.maxIdx)}function oe(){z.animator.stop()}z.on("updated",ae),z.on("optionsChanged",ae),z.on("created",ae),z.on("dragStarted",function(){ee=!1,oe(),U=H=z.track.details.abs}),z.on("dragChecked",function(){ee=!0}),z.on("dragEnded",function(){var le=z.options.mode;le==="snap"&&function(){var ue=z.track,Ee=z.track.details,je=Ee.position,Ne=y(q());(je>W||je<Z)&&(Ne=0);var ke=U+Ne;Ee.slides[ue.absToRel(ke)].portion===0&&(ke-=Ne),U!==H&&(ke=H),y(ue.idxToDist(ke,!0))!==Ne&&(ke+=Ne),ke=Q(ke);var ye=ue.idxToDist(ke,!0);z.animator.start([{distance:ye,duration:500,easing:function(me){return 1+--me*me*me*me*me}}])}(),le!=="free"&&le!=="free-snap"||F()}),z.on("dragged",function(){H=z.track.details.abs})}function L(z){var U,H,ee,Y,Z,W,ie,G,k,Q,se,q,F,te,ae,oe,le,ue,Ee=g();function je(ve){if(W&&G===ve.id){var Oe=me(ve);if(k){if(!ye(ve))return ke(ve);Q=Oe,k=!1,z.emit("dragChecked")}if(oe)return Q=Oe;f(ve);var Re=function(we){if(le===-1/0&&ue===1/0)return we;var _e=z.track.details,Ve=_e.length,ze=_e.position,it=p(we,le-ze,ue-ze);if(Ve===0)return 0;if(!z.options.rubberband)return it;if(ze<=ue&&ze>=le||ze<le&&H>0||ze>ue&&H<0)return we;var ut=(ze<le?ze-le:ze-ue)/Ve,vt=Y*Ve,At=Math.abs(ut*vt),ht=Math.max(0,1-At/Z*2);return ht*ht*we}(ie(Q-Oe)/Y*ee);H=y(Re);var Ae=z.track.details.position;(Ae>le&&Ae<ue||Ae===le&&H>0||Ae===ue&&H<0)&&m(ve),se+=Re,!q&&Math.abs(se*Y)>5&&(q=!0),z.track.add(Re),Q=Oe,z.emit("dragged")}}function Ne(ve){!W&&z.track.details&&z.track.details.length&&(se=0,W=!0,q=!1,k=!0,G=ve.id,ye(ve),Q=me(ve),z.emit("dragStarted"))}function ke(ve){W&&G===ve.idChanged&&(W=!1,z.emit("dragEnded"))}function ye(ve){var Oe=Le(),Re=Oe?ve.y:ve.x,Ae=Oe?ve.x:ve.y,we=F!==void 0&&te!==void 0&&Math.abs(te-Ae)<=Math.abs(F-Re);return F=Re,te=Ae,we}function me(ve){return Le()?ve.y:ve.x}function Le(){return z.options.vertical}function Qe(){Y=z.size,Z=Le()?window.innerHeight:window.innerWidth;var ve=z.track.details;ve&&(le=ve.min,ue=ve.max)}function he(ve){q&&(m(ve),f(ve))}function Se(){if(Ee.purge(),z.options.drag&&!z.options.disabled){var ve;ve=z.options.dragSpeed||1,ie=typeof ve=="function"?ve:function(Re){return Re*ve},ee=z.options.rtl?-1:1,Qe(),U=z.container,function(){var Re="data-keen-slider-clickable";c("[".concat(Re,"]:not([").concat(Re,"=false])"),U).map(function(Ae){Ee.add(Ae,"dragstart",m),Ee.add(Ae,"mousedown",m),Ee.add(Ae,"touchstart",m)})}(),Ee.add(U,"dragstart",function(Re){f(Re)}),Ee.add(U,"click",he,{capture:!0}),Ee.input(U,"ksDragStart",Ne),Ee.input(U,"ksDrag",je),Ee.input(U,"ksDragEnd",ke),Ee.input(U,"mousedown",Ne),Ee.input(U,"mousemove",je),Ee.input(U,"mouseleave",ke),Ee.input(U,"mouseup",ke),Ee.input(U,"touchstart",Ne,{passive:!0}),Ee.input(U,"touchmove",je,{passive:!1}),Ee.input(U,"touchend",ke),Ee.input(U,"touchcancel",ke),Ee.add(window,"wheel",function(Re){W&&f(Re)});var Oe="data-keen-slider-scrollable";c("[".concat(Oe,"]:not([").concat(Oe,"=false])"),z.container).map(function(Re){return function(Ae){var we;Ee.input(Ae,"touchstart",function(_e){we=me(_e),oe=!0,ae=!0},{passive:!0}),Ee.input(Ae,"touchmove",function(_e){var Ve=Le(),ze=Ve?Ae.scrollHeight-Ae.clientHeight:Ae.scrollWidth-Ae.clientWidth,it=we-me(_e),ut=Ve?Ae.scrollTop:Ae.scrollLeft,vt=Ve&&Ae.style.overflowY==="scroll"||!Ve&&Ae.style.overflowX==="scroll";if(we=me(_e),(it<0&&ut>0||it>0&&ut<ze)&&ae&&vt)return oe=!0;ae=!1,f(_e),oe=!1}),Ee.input(Ae,"touchend",function(){oe=!1})}(Re)})}}z.on("updated",Qe),z.on("optionsChanged",Se),z.on("created",Se),z.on("destroyed",Ee.purge)}function N(z){var U,H,ee=null;function Y(F,te,ae){z.animator.active?W(F,te,ae):requestAnimationFrame(function(){return W(F,te,ae)})}function Z(){Y(!1,!1,H)}function W(F,te,ae){var oe=0,le=z.size,ue=z.track.details;if(ue&&U){var Ee=ue.slides;U.forEach(function(je,Ne){if(F)!ee&&te&&G(je,null,ae),k(je,null,ae);else{if(!Ee[Ne])return;var ke=Ee[Ne].size*le;!ee&&te&&G(je,ke,ae),k(je,Ee[Ne].distance*le-oe,ae),oe+=ke}})}}function ie(F){return z.options.renderMode==="performance"?Math.round(F):F}function G(F,te,ae){var oe=ae?"height":"width";te!==null&&(te=ie(te)+"px"),F.style["min-"+oe]=te,F.style["max-"+oe]=te}function k(F,te,ae){if(te!==null){te=ie(te);var oe=ae?te:0;te="translate3d(".concat(ae?0:te,"px, ").concat(oe,"px, 0)")}F.style.transform=te,F.style["-webkit-transform"]=te}function Q(){U&&(W(!0,!0,H),U=null),z.on("detailsChanged",Z,!0)}function se(){Y(!1,!0,H)}function q(){Q(),H=z.options.vertical,z.options.disabled||z.options.renderMode==="custom"||(ee=E(z.options.slides,"perView",null)==="auto",z.on("detailsChanged",Z),(U=z.slides).length&&se())}z.on("created",q),z.on("optionsChanged",q),z.on("beforeOptionsChanged",function(){Q()}),z.on("updated",se),z.on("destroyed",Q)}function V(z,U){return function(H){var ee,Y,Z,W,ie,G=g();function k(ye){var me;o(H.container,"reverse",(me=H.container,window.getComputedStyle(me,null).getPropertyValue("direction")!=="rtl"||ye?null:"")),o(H.container,"v",H.options.vertical&&!ye?"":null),o(H.container,"disabled",H.options.disabled&&!ye?"":null)}function Q(){se()&&oe()}function se(){var ye=null;if(W.forEach(function(Le){Le.matches&&(ye=Le.__media)}),ye===ee)return!1;ee||H.emit("beforeOptionsChanged"),ee=ye;var me=ye?Z.breakpoints[ye]:Z;return H.options=M(M({},Z),me),k(),Ne(),ke(),ue(),!0}function q(ye){var me=S(ye);return(H.options.vertical?me.height:me.width)/H.size||1}function F(){return H.options.trackConfig.length}function te(ye){for(var me in ee=!1,Z=M(M({},U),ye),G.purge(),Y=H.size,W=[],Z.breakpoints||[]){var Le=window.matchMedia(me);Le.__media=me,W.push(Le),G.add(Le,"change",Q)}G.add(window,"orientationchange",je),G.add(window,"resize",Ee),se()}function ae(ye){H.animator.stop();var me=H.track.details;H.track.init(ye??(me?me.abs:0))}function oe(ye){ae(ye),H.emit("optionsChanged")}function le(ye,me){if(ye)return te(ye),void oe(me);Ne(),ke();var Le=F();ue(),F()!==Le?oe(me):ae(me),H.emit("updated")}function ue(){var ye=H.options.slides;if(typeof ye=="function")return H.options.trackConfig=ye(H.size,H.slides);for(var me=H.slides,Le=me.length,Qe=typeof ye=="number"?ye:E(ye,"number",Le,!0),he=[],Se=E(ye,"perView",1,!0),ve=E(ye,"spacing",0,!0)/H.size||0,Oe=Se==="auto"?ve:ve/Se,Re=E(ye,"origin","auto"),Ae=0,we=0;we<Qe;we++){var _e=Se==="auto"?q(me[we]):1/Se-ve+Oe,Ve=Re==="center"?.5-_e/2:Re==="auto"?0:Re;he.push({origin:Ve,size:_e,spacing:ve}),Ae+=_e}if(Ae+=ve*(Qe-1),Re==="auto"&&!H.options.loop&&Se!==1){var ze=0;he.map(function(it){var ut=Ae-ze;return ze+=it.size+ve,ut>=1||(it.origin=1-ut-(Ae>1?0:1-Ae)),it})}H.options.trackConfig=he}function Ee(){Ne();var ye=H.size;H.options.disabled||ye===Y||(Y=ye,le())}function je(){Ee(),setTimeout(Ee,500),setTimeout(Ee,2e3)}function Ne(){var ye=S(H.container);H.size=(H.options.vertical?ye.height:ye.width)||1}function ke(){H.slides=c(H.options.selector,H.container)}H.container=(ie=c(z,document)).length?ie[0]:null,H.destroy=function(){G.purge(),H.emit("destroyed"),k(!0)},H.prev=function(){H.moveToIdx(H.track.details.abs-1,!0)},H.next=function(){H.moveToIdx(H.track.details.abs+1,!0)},H.update=le,te(H.options)}}var B=function(z,U,H){try{return function(ee,Y){var Z,W={};return Z={emit:function(ie){W[ie]&&W[ie].forEach(function(k){k(Z)});var G=Z.options&&Z.options[ie];G&&G(Z)},moveToIdx:function(ie,G,k){var Q=Z.track.idxToDist(ie,G);if(Q){var se=Z.options.defaultAnimation;Z.animator.start([{distance:Q,duration:E(k||se,"duration",500),easing:E(k||se,"easing",function(q){return 1+--q*q*q*q*q})}])}},on:function(ie,G,k){k===void 0&&(k=!1),W[ie]||(W[ie]=[]);var Q=W[ie].indexOf(G);Q>-1?k&&delete W[ie][Q]:k||W[ie].push(G)},options:ee},function(){if(Z.track=_(Z),Z.animator=D(Z),Y)for(var ie=0,G=Y;ie<G.length;ie++)(0,G[ie])(Z);Z.track.init(Z.options.initial||0),Z.emit("created")}(),Z}(U,A([V(z,{drag:!0,mode:"snap",renderMode:"precision",rubberband:!0,selector:".keen-slider__slide"}),N,L,j],H||[],!0))}catch(ee){console.error(ee)}};return bx.useKeenSlider=function(z,U){var H=e.useRef(null),ee=e.useRef(!1),Y=e.useRef(z),Z=e.useCallback(function(W){W?(Y.current=z,H.current=new B(W,z,U),ee.current=!1):(H.current&&H.current.destroy&&H.current.destroy(),H.current=null)},[]);return e.useEffect(function(){O(Y.current,z)||(Y.current=z,H.current&&H.current.update(Y.current))},[z]),[Z,H]},bx}var HR=qte();const Gte=({message:e,colorCode:t,disableCheckout:a,handleAddToCart:r,handleRemoveFromCart:o})=>{const[c,f]=x.useState({}),[m,g]=x.useState({}),p=j=>{const L=/(https?:\/\/[^\s]+)/g;return j.split(L).map((N,V)=>L.test(N)?J.jsx("a",{href:N.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:N},V):J.jsx("span",{children:N},V))},y=j=>{const L=j.trim();if(!L.includes("Name:")||!L.includes("VariantId"))return null;const N=L.match(/Name\s*[:\-]\s*(.+)/i),V=L.match(/Price\s*[:\-]\s*(.+)/i),B=L.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),z=L.match(/VariantId\s*[:\-]\s*(.+)/i),U=L.match(/variant_tag_name\s*[:\-]\s*(.+)/i),H=L.match(/options\s*[:\-]\s*([^|\r\n]+)/i),ee=L.match(/tag\s*[:\-]\s*(.+)/i);return!N||!V||!B||!z||!U?null:{name:N[1].trim(),price:V[1].trim(),link:B[1].trim(),image:"",variant_id:z[1].trim(),variant_tag_name:U[1].trim(),option:H?.[1]?.trim(),tag:ee?.[1]?.trim()}},S=x.useMemo(()=>{const j=e.split("|||").map(V=>V.trim()).filter(Boolean),L=[];let N=null;return j.forEach(V=>{if(V.startsWith("img - ")){const B=V.replace(/^img\s*[-:]\s*/,"").trim();if(N)N.image=B;else{const z=[...L].reverse().find(U=>U.type==="product");z&&(z.data.image=B)}}else if(V.includes("Name:")&&V.includes("VariantId")){const B=y(V);B&&(L.push({type:"product",data:B}),N=B)}else L.push({type:"text",data:V}),N=null}),L},[e]),E=x.useMemo(()=>{const j={};return S.forEach(L=>{if(L.type==="product"){const N=L.data;j[N.variant_tag_name]=j[N.variant_tag_name]||[],j[N.variant_tag_name].push(N)}}),j},[S]),T=(j,L=22)=>j.length>L?j.slice(0,L)+"...":j,[O,M]=x.useState(0),A=Object.keys(E).length,[D,_]=HR.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(j){M(j.track.details.rel)}});return J.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[S.filter(j=>j.type==="text").map((j,L)=>J.jsx("p",{className:"whitespace-pre-wrap break-words",children:p(j.data)},L)),Object.keys(E).length>0&&J.jsxs(J.Fragment,{children:[Object.keys(E).length>1&&J.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[J.jsx(Kr,{shape:"circle",icon:J.jsx(Xm,{}),onClick:()=>_.current?.prev(),disabled:O===0}),J.jsx(Kr,{shape:"circle",icon:J.jsx(K1,{}),onClick:()=>_.current?.next(),disabled:O===A-1})]}),J.jsx("div",{ref:D,className:"keen-slider",children:J.jsx(Fte,{groupedProducts:E,selectedVariants:m,setSelectedVariants:g,counts:c,setCounts:f,handleAddToCart:r,handleRemoveFromCart:o,colorCode:t,shortenName:T,sliderInstance:_,currentSlide:O,totalSlides:A,sliderRef:D,disableCheckout:a})})]})]})},L5=({message:e})=>{const t=e.find(r=>r.type==="image_url")?.image_url?.url,a=e?.isBusiness;return J.jsx("div",{children:J.jsx("div",{children:t&&J.jsx("div",{className:"mb-2 bg-transparent text-white ",children:J.jsx("img",{src:t,alt:"Chat image",style:{width:200},className:`rounded-md bg-transparent mt-2 max-w-xs ${a?"border border-gray-300 shadow-sm":""}`})})})})},Xte=({message:e,colorCode:t})=>{const a=e.find(o=>o.type==="text")?.text,r=o=>{const c=/(https?:\/\/[^\s]+)/g;return o.split(c).map((f,m)=>c.test(f)?J.jsx("a",{href:f.trim(),style:{color:t},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:f},m):J.jsx("span",{children:f},m))};return J.jsx(J.Fragment,{children:a&&J.jsx("div",{style:{color:"white",border:1,backgroundColor:t,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word"},children:J.jsx("p",{children:r(a)})})})},Yte=({link:e,colorCode:t,transcription:a})=>{const r=x.useRef(null),o=x.useRef(null),[c,f]=x.useState(!1),[m,g]=x.useState(!1);x.useEffect(()=>{if(r.current)return o.current?.destroy(),o.current=sp.create({container:r.current,waveColor:"white",progressColor:"white",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),o.current.load(e),o.current.on("finish",()=>f(!1)),()=>{o.current?.destroy()}},[e,t]);const p=()=>{o.current&&(o.current.playPause(),f(y=>!y))};return J.jsxs("div",{style:{backgroundColor:t,padding:"12px",borderRadius:"20px",color:"white",maxWidth:"350px",marginBottom:"16px"},children:[J.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[J.jsx("button",{onClick:p,style:{background:"transparent",border:"none",color:"white",marginRight:"12px",cursor:"pointer"},children:c?J.jsx(uO,{style:{fontSize:"24px"}}):J.jsx(cO,{style:{fontSize:"24px"}})}),J.jsx("div",{ref:r,style:{width:"130px",height:"40px",overflow:"hidden",color:"white"}})]}),a&&J.jsxs("div",{style:{marginTop:"12px",fontSize:"14px",color:"rgba(255,255,255,0.85)"},children:[J.jsx("button",{onClick:()=>g(!m),style:{background:"none",border:"none",color:"white",textDecoration:"underline",fontSize:"13px",cursor:"pointer",padding:0},children:m?"Hide transcript":"Show transcript"}),m&&J.jsx("p",{style:{marginTop:"6px",lineHeight:"1.4"},children:a})]})]})},Wte=({status:e,user:t})=>{if(!e||!t)return null;let a=`${t} is ${e}`;return e==="typing"?a=`${t} is typing...`:a="",J.jsx(J.Fragment,{children:a&&J.jsx("div",{className:"flex justify-center mb-2",children:J.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-500 text-sm rounded-full",children:a})})})},Zte=({message:e})=>{const t=r=>{const o=/(https?:\/\/[^\s]+)/g;return r?.split(o).map((c,f)=>o.test(c)?J.jsx("a",{href:c.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:c},f):J.jsx("span",{children:c},f))};if(e?.startsWith("Add this to cart for me")&&e?.includes("name:")){const o=e?.match(/name:([^,]+)/i)?.[1]?.trim()||"Product";return J.jsxs("div",{style:{backgroundColor:"#E8F5E9",border:"1px solid #C8E6C9",borderRadius:"12px",padding:"12px 16px",color:"#2E7D32",fontWeight:500,fontSize:"15px",maxWidth:"360px",margin:"0 auto",textAlign:"center"},children:["✅ ",J.jsx("strong",{children:o})," has been added to your cart."]})}return J.jsx("p",{style:{color:"white"},children:t(e)})};/**
652
+ `,[t,a]}setOptions(t){if(this.options.container!==t.container){const a=this.parentFromOptionsContainer(t.container);a.appendChild(this.container),this.parent=a}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:a}=this.scrollContainer,r=a*t;this.setScroll(r)}destroy(){var t,a;this.subscriptions.forEach(r=>r()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(a=this.unsubscribeOnScroll)===null||a===void 0||a.forEach(r=>r()),this.unsubscribeOnScroll=[]}createDelay(t=10){let a,r;const o=()=>{a&&clearTimeout(a),r&&r()};return this.timeouts.push(o),()=>new Promise((c,f)=>{o(),r=f,a=setTimeout(()=>{a=void 0,r=void 0,c()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const a=document.createElement("canvas"),r=a.getContext("2d"),o=a.height*(window.devicePixelRatio||1),c=r.createLinearGradient(0,0,0,o),f=1/(t.length-1);return t.forEach((m,g)=>{const p=g*f;c.addColorStop(p,m)}),c}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,a,r,o){const c=t[0],f=t[1]||t[0],m=c.length,{width:g,height:p}=r.canvas,y=p/2,S=this.getPixelRatio(),E=a.barWidth?a.barWidth*S:1,T=a.barGap?a.barGap*S:a.barWidth?E/2:0,O=a.barRadius||0,M=g/(E+T)/m,A=O&&"roundRect"in r?"roundRect":"rect";r.beginPath();let D=0,_=0,j=0;for(let L=0;L<=m;L++){const N=Math.round(L*M);if(N>D){const z=Math.round(_*y*o),U=z+Math.round(j*y*o)||1;let H=y-z;a.barAlign==="top"?H=0:a.barAlign==="bottom"&&(H=p-U),r[A](D*(E+T),H,E,U,O),D=N,_=0,j=0}const V=Math.abs(c[L]||0),B=Math.abs(f[L]||0);V>_&&(_=V),B>j&&(j=B)}r.fill(),r.closePath()}renderLineWaveform(t,a,r,o){const c=f=>{const m=t[f]||t[0],g=m.length,{height:p}=r.canvas,y=p/2,S=r.canvas.width/g;r.moveTo(0,y);let E=0,T=0;for(let O=0;O<=g;O++){const M=Math.round(O*S);if(M>E){const D=y+(Math.round(T*y*o)||1)*(f===0?-1:1);r.lineTo(E,D),E=M,T=0}const A=Math.abs(m[O]||0);A>T&&(T=A)}r.lineTo(E,y)};r.beginPath(),c(0),c(1),r.fill(),r.closePath()}renderWaveform(t,a,r){if(r.fillStyle=this.convertColorValues(a.waveColor),a.renderFunction)return void a.renderFunction(t,r);let o=a.barHeight||1;if(a.normalize){const c=Array.from(t[0]).reduce((f,m)=>Math.max(f,Math.abs(m)),0);o=c?1/c:1}a.barWidth||a.barGap||a.barAlign?this.renderBarWaveform(t,a,r,o):this.renderLineWaveform(t,a,r,o)}renderSingleCanvas(t,a,r,o,c,f,m){const g=this.getPixelRatio(),p=document.createElement("canvas");p.width=Math.round(r*g),p.height=Math.round(o*g),p.style.width=`${r}px`,p.style.height=`${o}px`,p.style.left=`${Math.round(c)}px`,f.appendChild(p);const y=p.getContext("2d");if(this.renderWaveform(t,a,y),p.width>0&&p.height>0){const S=p.cloneNode(),E=S.getContext("2d");E.drawImage(p,0,0),E.globalCompositeOperation="source-in",E.fillStyle=this.convertColorValues(a.progressColor),E.fillRect(0,0,p.width,p.height),m.appendChild(S)}}renderMultiCanvas(t,a,r,o,c,f){const m=this.getPixelRatio(),{clientWidth:g}=this.scrollContainer,p=r/m;let y=Math.min(lp.MAX_CANVAS_WIDTH,g,p),S={};if(a.barWidth||a.barGap){const A=a.barWidth||.5,D=A+(a.barGap||A/2);y%D!=0&&(y=Math.floor(y/D)*D)}if(y===0)return;const E=A=>{if(A<0||A>=T||S[A])return;S[A]=!0;const D=A*y;let _=Math.min(p-D,y);if(a.barWidth||a.barGap){const L=a.barWidth||.5,N=L+(a.barGap||L/2);_=Math.floor(_/N)*N}if(_<=0)return;const j=t.map(L=>{const N=Math.floor(D/p*L.length),V=Math.floor((D+_)/p*L.length);return L.slice(N,V)});this.renderSingleCanvas(j,a,_,o,D,c,f)},T=Math.ceil(p/y);if(!this.isScrollable){for(let A=0;A<T;A++)E(A);return}const O=this.scrollContainer.scrollLeft/p,M=Math.floor(O*T);if(E(M-1),E(M),E(M+1),T>1){const A=this.on("scroll",()=>{const{scrollLeft:D}=this.scrollContainer,_=Math.floor(D/p*T);Object.keys(S).length>lp.MAX_NODES&&(c.innerHTML="",f.innerHTML="",S={}),E(_-1),E(_),E(_+1)});this.unsubscribeOnScroll.push(A)}}renderChannel(t,a,r,o){var{overlay:c}=a,f=function(y,S){var E={};for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&S.indexOf(T)<0&&(E[T]=y[T]);if(y!=null&&typeof Object.getOwnPropertySymbols=="function"){var O=0;for(T=Object.getOwnPropertySymbols(y);O<T.length;O++)S.indexOf(T[O])<0&&Object.prototype.propertyIsEnumerable.call(y,T[O])&&(E[T[O]]=y[T[O]])}return E}(a,["overlay"]);const m=document.createElement("div"),g=this.getHeight(f.height,f.splitChannels);m.style.height=`${g}px`,c&&o>0&&(m.style.marginTop=`-${g}px`),this.canvasWrapper.style.minHeight=`${g}px`,this.canvasWrapper.appendChild(m);const p=m.cloneNode();this.progressWrapper.appendChild(p),this.renderMultiCanvas(t,f,r,g,m,p)}render(t){return li(this,void 0,void 0,function*(){var a;this.timeouts.forEach(g=>g()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const r=this.getPixelRatio(),o=this.scrollContainer.clientWidth,c=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=c>o;const f=this.options.fillParent&&!this.isScrollable,m=(f?o:c)*r;if(this.wrapper.style.width=f?"100%":`${c}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let g=0;g<t.numberOfChannels;g++){const p=Object.assign(Object.assign({},this.options),(a=this.options.splitChannels)===null||a===void 0?void 0:a[g]);this.renderChannel([t.getChannelData(g)],p,m,g)}else{const g=[t.getChannelData(0)];t.numberOfChannels>1&&g.push(t.getChannelData(1)),this.renderChannel(g,this.options,m,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(r=>r()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:a}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:r}=this.progressWrapper.getBoundingClientRect();let o=r-a;o*=2,o=o<0?Math.floor(o):Math.ceil(o),o/=2,this.scrollContainer.scrollLeft+=o}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,a=!1){const{scrollLeft:r,scrollWidth:o,clientWidth:c}=this.scrollContainer,f=t*o,m=r,g=r+c,p=c/2;if(this.isDragging)f+30>g?this.scrollContainer.scrollLeft+=30:f-30<m&&(this.scrollContainer.scrollLeft-=30);else{(f<m||f>g)&&(this.scrollContainer.scrollLeft=f-(this.options.autoCenter?p:0));const y=f-r-p;a&&this.options.autoCenter&&y>0&&(this.scrollContainer.scrollLeft+=Math.min(y,10))}{const y=this.scrollContainer.scrollLeft,S=y/o,E=(y+c)/o;this.emit("scroll",S,E,y,y+c)}}renderProgress(t,a){if(isNaN(t))return;const r=100*t;this.canvasWrapper.style.clipPath=`polygon(${r}% 0%, 100% 0%, 100% 100%, ${r}% 100%)`,this.progressWrapper.style.width=`${r}%`,this.cursor.style.left=`${r}%`,this.cursor.style.transform=`translateX(-${Math.round(r)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,a)}exportImage(t,a,r){return li(this,void 0,void 0,function*(){const o=this.canvasWrapper.querySelectorAll("canvas");if(!o.length)throw new Error("No waveform data");if(r==="dataURL"){const c=Array.from(o).map(f=>f.toDataURL(t,a));return Promise.resolve(c)}return Promise.all(Array.from(o).map(c=>new Promise((f,m)=>{c.toBlob(g=>{g?f(g):m(new Error("Could not export image"))},t,a)})))})}}lp.MAX_CANVAS_WIDTH=8e3,lp.MAX_NODES=10;class Vte extends L0{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class VR extends L0{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return li(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(a=>{if(a.status>=400)throw new Error(`Failed to fetch ${t}: ${a.status} (${a.statusText})`);return a.arrayBuffer()}).then(a=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(a)).then(a=>{this.currentSrc===t&&(this.buffer=a,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let a=this.playedDuration*this._playbackRate;(a>=this.duration||a<0)&&(a=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,a),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return li(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const a=t-this.currentTime,r=this.bufferNode;r?.stop(this.audioContext.currentTime+a),r?.addEventListener("ended",()=>{r===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return li(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const a=!this.paused;a&&this._pause(),this.playedDuration=t/this._playbackRate,a&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,a;return(t=this._duration)!==null&&t!==void 0?t:((a=this.buffer)===null||a===void 0?void 0:a.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const a=this.buffer.numberOfChannels;for(let r=0;r<a;r++)t.push(this.buffer.getChannelData(r));return t}}const Hte={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class sp extends Lte{static create(t){return new sp(t)}constructor(t){const a=t.media||(t.backend==="WebAudio"?new VR:void 0);super({media:a,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},Hte,t),this.timer=new Vte;const r=a?void 0:this.getMediaElement();this.renderer=new lp(this.options,r),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const o=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:c,duration:f}=this.options;(o||c&&f)&&this.load(o,c,f).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,a)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,a))}),this.renderer.on("dblclick",(t,a)=>{this.emit("dblclick",t,a)}),this.renderer.on("scroll",(t,a,r,o)=>{const c=this.getDuration();this.emit("scroll",t*c,a*c,r,o)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",a=>{if(!this.options.interact)return;let r;this.renderer.renderProgress(a),clearTimeout(t),this.isPlaying()?r=0:this.options.dragToSeek===!0?r=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(r=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(a)},r),this.emit("interaction",a*this.getDuration()),this.emit("drag",a)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(a=>{this.registerPlugin(a)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=yx.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=yx.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){t._init(this),this.plugins.push(t);const a=t.once("destroy",()=>{this.plugins=this.plugins.filter(r=>r!==t),this.subscriptions=this.subscriptions.filter(r=>r!==a)});return this.subscriptions.push(a),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const a=t/this.getDuration();this.renderer.setScrollPercentage(a)}getActivePlugins(){return this.plugins}loadAudio(t,a,r,o){return li(this,void 0,void 0,function*(){var c;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!a&&!r){const m=this.options.fetchParams||{};window.AbortController&&!m.signal&&(this.abortController=new AbortController,m.signal=(c=this.abortController)===null||c===void 0?void 0:c.signal);const g=y=>this.emit("loading",y);a=yield jte.fetchBlob(t,g,m);const p=this.options.blobMimeType;p&&(a=new Blob([a],{type:p}))}this.setSrc(t,a);const f=yield new Promise(m=>{const g=o||this.getDuration();g?m(g):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>m(this.getDuration()),{once:!0}))});if(!t&&!a){const m=this.getMediaElement();m instanceof VR&&(m.duration=f)}if(r)this.decodedData=yx.createBuffer(r,f||0);else if(a){const m=yield a.arrayBuffer();this.decodedData=yield yx.decode(m,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,a,r){return li(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,a,r)}catch(o){throw this.emit("error",o),o}})}loadBlob(t,a,r){return li(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,a,r)}catch(o){throw this.emit("error",o),o}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:a=8e3,precision:r=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const o=Math.min(t,this.decodedData.numberOfChannels),c=[];for(let f=0;f<o;f++){const m=this.decodedData.getChannelData(f),g=[],p=m.length/a;for(let y=0;y<a;y++){const S=m.slice(Math.floor(y*p),Math.ceil((y+1)*p));let E=0;for(let T=0;T<S.length;T++){const O=S[T];Math.abs(O)>Math.abs(E)&&(E=O)}g.push(Math.round(E*r)/r)}c.push(g)}return c}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const a=this.getDuration()*t;this.setTime(a)}play(t,a){const r=Object.create(null,{play:{get:()=>super.play}});return li(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const o=yield r.play.call(this);return a!=null&&(this.media instanceof VR?this.media.stopAt(a):this.stopAtPosition=a),o})}playPause(){return li(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return li(this,arguments,void 0,function*(t="image/png",a=1,r="dataURL"){return this.renderer.exportImage(t,a,r)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(a=>a.destroy()),this.subscriptions.forEach(a=>a()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}sp.BasePlugin=class extends L0{constructor(e){super(),this.subscriptions=[],this.options=e}onInit(){}_init(e){this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(e=>e())}},sp.dom=zte;const Bte=({userMessage:e,setUserMessage:t,handleSendMessage:a,handleSendImage:r,handleSendVoice:o,selectedImage:c,setSelectedImage:f,audioBlob:m,setAudioBlob:g,isSending:p})=>{const{t:y}=_H(),[S,E]=x.useState(!1),[T,O]=x.useState(!1),M=x.useRef(null),A=x.useRef(null),D=x.useRef([]),_=x.useRef(null),j=x.useRef(null),L=U=>{const H=U.target.files?.[0];H&&f(H)},N=()=>{f(null)},V=async()=>{if(!navigator.mediaDevices?.getUserMedia){alert(y("chatInput.voice.notSupported"));return}if(S)M.current?.stop();else try{const U=await navigator.mediaDevices.getUserMedia({audio:!0}),H=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",ee=new MediaRecorder(U,{mimeType:H});M.current=ee,D.current=[],ee.ondataavailable=Y=>{Y.data.size>0&&D.current.push(Y.data)},ee.onstop=()=>{const Y=new Blob(D.current,{type:H});g(Y),E(!1),U.getTracks().forEach(Z=>Z.stop())},ee.start(),E(!0)}catch(U){console.error(U),alert(y("chatInput.voice.permissionError"))}};x.useEffect(()=>{if(m&&_.current){j.current?.destroy();const U=URL.createObjectURL(m);j.current=sp.create({container:_.current,waveColor:"#ccc",progressColor:"#7F28F8",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),j.current.load(U),j.current.on("finish",()=>O(!1))}},[m]);const B=()=>{j.current&&(j.current.playPause(),O(U=>!U))},z=()=>{E(!1),g(null),j.current?.destroy()};return J.jsxs("div",{style:{display:"flex",alignItems:"center",backgroundColor:"white",border:"1px solid #d1d5db",borderRadius:"9999px",padding:"0.5rem 0.75rem",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",width:"95%",height:"56px"},children:[J.jsx("button",{style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},onClick:()=>A.current?.click(),children:c?J.jsxs("div",{style:{position:"relative"},children:[J.jsx("img",{src:URL.createObjectURL(c),alt:y("chatInput.image.selectedAlt"),style:{width:"2rem",height:"2rem",borderRadius:"9999px",objectFit:"cover",padding:"0"}}),J.jsx(y0,{style:{position:"absolute",top:"-0.5rem",right:"-0.5rem",fontSize:"14px",color:"#ef4444",background:"white",borderRadius:"9999px",cursor:"pointer"},onClick:U=>{U.stopPropagation(),N()}})]}):J.jsx(S6,{style:{fontSize:"20px"}})}),J.jsx("input",{disabled:p,type:"file",accept:"image/*",ref:A,onChange:L,style:{display:"none",padding:"0"}}),J.jsx(Ld,{title:S?"Stop Recording":"Send Audio",children:J.jsx("button",{onClick:V,style:{color:S?"#ef4444":"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:S?J.jsx(E6,{style:{fontSize:"20px"}}):J.jsx(p6,{style:{fontSize:"20px"}})})}),J.jsx("div",{style:{flex:1,margin:"0 0.5rem",minWidth:0,maxWidth:"100%",display:"flex",alignItems:"center"},children:m?J.jsxs("div",{style:{display:"flex",alignItems:"center",width:"100%",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem"},children:[J.jsx("button",{style:{background:"none",border:"none",marginRight:"0.75rem",color:"#7f28f8",cursor:"pointer",padding:"0"},onClick:B,children:T?J.jsx(uO,{style:{fontSize:"24px"}}):J.jsx(cO,{style:{fontSize:"24px"}})}),J.jsx("div",{ref:_,style:{width:"100%",height:"2rem"}}),J.jsx(y0,{style:{fontSize:"18px",color:"#ef4444",marginLeft:"0.75rem",cursor:"pointer"},onClick:z})]}):S?J.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem",animation:"pulse 2s infinite"},children:J.jsx("span",{children:"Recording"})}):J.jsx(Vd,{type:"text",value:e,onChange:U=>t(U.target.value),placeholder:"Message...",style:{width:"100%",border:"none",fontSize:"16px",margin:0,lineHeight:1.5,color:"#374151",padding:"0"},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),c?(r(c,e),N(),t("")):e.trim()&&(a(),t("")))}})}),J.jsx("button",{disabled:p,onClick:()=>{const U=!!c,H=!!e.trim();U?(r(c,e),N(),t("")):!!m?(o(m),z()):H&&(a(),t(""))},"aria-label":y("chatInput.send"),style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:J.jsx(x6,{style:{fontSize:"20px"}})})]})};function Pte({suggestions:e,colorCode:t,sendMessageSuggestion:a}){return J.jsx("div",{style:{overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",paddingTop:"4px",paddingBottom:"8px",width:"100%",boxSizing:"border-box",marginLeft:"4%",marginTop:"4px",marginBottom:"4px"},children:J.jsx("div",{style:{display:"inline-flex",gap:"0.5rem"},children:e?.map((r,o)=>J.jsx("button",{onClick:()=>a(r),style:{whiteSpace:"nowrap",padding:"0.5rem 1rem",border:`1px solid ${t}`,borderRadius:"9999px",backgroundColor:"white",cursor:"pointer",fontSize:"14px",color:t,flexShrink:0},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="#f3f3f3"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="white"},children:r},o))})})}function Ute(){return J.jsxs("div",{className:"jawebcss-powered-container",children:[J.jsx("span",{className:"jawebcss-powered-label",children:"Powered by"}),J.jsx("a",{href:"https://jaweb.me/",target:"_blank",className:"jawebcss-powered-link",rel:"noopener noreferrer",children:"Jaweb"})]})}const Ite=({color:e,size:t=5})=>J.jsxs("div",{className:"typing-boxes",children:[J.jsx("span",{style:{backgroundColor:e,width:t,height:t}}),J.jsx("span",{style:{backgroundColor:e,width:t,height:t}}),J.jsx("span",{style:{backgroundColor:e,width:t,height:t}})]}),kte=({productImage:e,productID:t})=>{const[a,r]=x.useState(null),[o,c]=x.useState(null),[f,m]=x.useState(!1),g=async y=>{m(!0),c(null);const S=new FileReader;S.onload=async()=>{const E=S.result;try{const O=await(await fetch(`${ii.apiUrl}ark-tryon/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userImageUrl:E,productImageUrl:e,productId:t,username:localStorage.getItem("company_username")})})).json();O.resultImage?c(O.resultImage):console.error("Ark API error:",O)}catch(T){console.error("Error calling Ark API:",T)}finally{m(!1)}},S.readAsDataURL(y)},p=y=>{y.target.files&&y.target.files[0]&&(r(URL.createObjectURL(y.target.files[0])),g(y.target.files[0]))};return J.jsxs("div",{className:"mt-4 border rounded-lg p-4 bg-gray-50",children:[!a&&!o&&!f&&J.jsxs("label",{className:"flex flex-col items-center justify-center border-2 border-dashed border-gray-400 rounded-lg w-full h-40 cursor-pointer hover:bg-gray-100 transition",children:[J.jsx(g6,{style:{fontSize:28,marginBottom:8}}),J.jsx("span",{className:"text-gray-500",children:"Click or Drop your photo here"}),J.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:p})]}),f&&J.jsxs("div",{className:"flex flex-col items-center justify-center h-40",children:[J.jsx(Wu,{indicator:J.jsx(Ks,{style:{fontSize:32},spin:!0})}),J.jsx("p",{className:"mt-2 text-gray-600",children:"Generating your try-on..."})]}),!f&&o&&J.jsxs("div",{className:"flex flex-col items-center",children:[J.jsx("p",{className:"mb-2 text-sm font-medium",children:"✨ Try-On Result"}),J.jsx("img",{src:o,alt:"Result",className:"max-h-64 object-contain rounded-md border"}),J.jsx(Kr,{style:{margin:"4px"},type:"default",className:"mt-3",onClick:()=>{r(null),c(null)},children:"Try Another"})]})]})},Fte=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y,disableCheckout:S=!1})=>{if(!y||y===0)return null;const[E,T]=x.useState(null);return J.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:J.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([O,M])=>{const A=t[O]||(M.length>0?M[0].variant_id:""),D=M.find(H=>H.variant_id===A)||M[0];if(!D)return null;const _=r[D.variant_id]||0,j=Array.from(new Set(M.map(H=>H.option?.trim()??"").filter(H=>H&&H.toLowerCase()!=="none"))),L=H=>{const ee=M.find(Y=>Y.option===H);ee&&a(Y=>({...Y,[O]:ee.variant_id}))},N=D.option??j[0]??"",V=async()=>{o(H=>({...H,[D.variant_id]:(H[D.variant_id]||0)+1}));try{await c(D.variant_id,D.name,1)}catch(H){console.warn("Add to cart failed:",H.message),o(ee=>({...ee,[D.variant_id]:(ee[D.variant_id]||0)-1}))}},B=async()=>{_!==0&&(o(H=>({...H,[D.variant_id]:Math.max(0,(H[D.variant_id]||0)-1)})),await f(D.variant_id,1))},z=E===D.variant_id,U=D.tag?D.tag.toLowerCase()==="clothing":!0;return J.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[J.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(D.link,"_blank"),children:[J.jsx("img",{src:D.image,alt:D.name,className:"sallaX-img",loading:"lazy"}),J.jsx("a",{href:D.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:H=>H.stopPropagation(),children:"View"})]}),J.jsxs("div",{className:"sallaX-body",children:[J.jsx("a",{href:D.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:D.name,children:g(D.name)}),J.jsx("div",{className:"sallaX-row",children:J.jsx("span",{className:"sallaX-price","aria-label":"Price",children:D.price})}),j.length>1&&J.jsxs("div",{className:"sallaX-selectWrap",children:[J.jsx("label",{htmlFor:`sallaX-select-${O}`,className:"sallaX-selectLabel",children:"Choose an option"}),J.jsx("select",{id:`sallaX-select-${O}`,className:"sallaX-select","aria-label":"Choose an option",value:N,onChange:H=>L(H.target.value),children:j.map(H=>J.jsx("option",{value:H,children:H},H))})]}),J.jsxs("div",{className:"flex items-center justify-between w-full space-x-4",children:[!S&&J.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:B,"aria-label":"Decrease quantity",disabled:_===0,children:"–"}),J.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:_}),J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:V,"aria-label":"Increase quantity",children:"+"})]}),U&&J.jsx(Kr,{style:{backgroundColor:m,color:"white"},className:"px-6 py-2 rounded-lg shadow-md transition",onClick:()=>T(z?null:D.variant_id),children:z?"Close Try On":"Try On"})]}),U&&z&&J.jsx("div",{className:"mt-4",children:J.jsx(kte,{productID:D.variant_id,productImage:D.image})})]})]},O)})})})};var bx={},j5;function qte(){if(j5)return bx;j5=1,Object.defineProperty(bx,"__esModule",{value:!0});var e=Ed();function t(z){return Array.prototype.slice.call(z)}function a(z,U){var H=Math.floor(z);return H===U||H+1===U?z:U}function r(){return Date.now()}function o(z,U,H){if(U="data-keen-slider-"+U,H===null)return z.removeAttribute(U);z.setAttribute(U,H||"")}function c(z,U){return U=U||document,typeof z=="function"&&(z=z(U)),Array.isArray(z)?z:typeof z=="string"?t(U.querySelectorAll(z)):z instanceof HTMLElement?[z]:z instanceof NodeList?t(z):[]}function f(z){z.raw&&(z=z.raw),z.cancelable&&!z.defaultPrevented&&z.preventDefault()}function m(z){z.raw&&(z=z.raw),z.stopPropagation&&z.stopPropagation()}function g(){var z=[];return{add:function(U,H,ee,Y){U.addListener?U.addListener(ee):U.addEventListener(H,ee,Y),z.push([U,H,ee,Y])},input:function(U,H,ee,Y){this.add(U,H,function(Z){return function(W){W.nativeEvent&&(W=W.nativeEvent);var ie=W.changedTouches||[],G=W.targetTouches||[],k=W.detail&&W.detail.x?W.detail:null;return Z({id:k?k.identifier?k.identifier:"i":G[0]?G[0]?G[0].identifier:"e":"d",idChanged:k?k.identifier?k.identifier:"i":ie[0]?ie[0]?ie[0].identifier:"e":"d",raw:W,x:k&&k.x?k.x:G[0]?G[0].screenX:k?k.x:W.pageX,y:k&&k.y?k.y:G[0]?G[0].screenY:k?k.y:W.pageY})}}(ee),Y)},purge:function(){z.forEach(function(U){U[0].removeListener?U[0].removeListener(U[2]):U[0].removeEventListener(U[1],U[2],U[3])}),z=[]}}}function p(z,U,H){return Math.min(Math.max(z,U),H)}function y(z){return(z>0?1:0)-(z<0?1:0)||+z}function S(z){var U=z.getBoundingClientRect();return{height:a(U.height,z.offsetHeight),width:a(U.width,z.offsetWidth)}}function E(z,U,H,ee){var Y=z&&z[U];return Y==null?H:ee&&typeof Y=="function"?Y():Y}function T(z){return Math.round(1e6*z)/1e6}function O(z,U){if(z===U)return!0;var H=typeof z;if(H!==typeof U)return!1;if(H!=="object"||z===null||U===null)return H==="function"&&z.toString()===U.toString();if(z.length!==U.length||Object.getOwnPropertyNames(z).length!==Object.getOwnPropertyNames(U).length)return!1;for(var ee in z)if(!O(z[ee],U[ee]))return!1;return!0}var M=function(){return M=Object.assign||function(z){for(var U,H=1,ee=arguments.length;H<ee;H++)for(var Y in U=arguments[H])Object.prototype.hasOwnProperty.call(U,Y)&&(z[Y]=U[Y]);return z},M.apply(this,arguments)};function A(z,U,H){for(var ee,Y=0,Z=U.length;Y<Z;Y++)!ee&&Y in U||(ee||(ee=Array.prototype.slice.call(U,0,Y)),ee[Y]=U[Y]);return z.concat(ee||Array.prototype.slice.call(U))}function D(z){var U,H,ee,Y,Z,W;function ie(q){W||(W=q),G(!0);var F=q-W;F>ee&&(F=ee);var te=Y[H];if(te[3]<F)return H++,ie(q);var ae=te[2],oe=te[4],le=te[0],ue=te[1]*(0,te[5])(oe===0?1:(F-ae)/oe);if(ue&&z.track.to(le+ue),F<ee)return Q();W=null,G(!1),k(null),z.emit("animationEnded")}function G(q){U.active=q}function k(q){U.targetIdx=q}function Q(){var q;q=ie,Z=window.requestAnimationFrame(q)}function se(){var q;q=Z,window.cancelAnimationFrame(q),G(!1),k(null),W&&z.emit("animationStopped"),W=null}return U={active:!1,start:function(q){if(se(),z.track.details){var F=0,te=z.track.details.position;H=0,ee=0,Y=q.map(function(ae){var oe,le=Number(te),ue=(oe=ae.earlyExit)!==null&&oe!==void 0?oe:ae.duration,Ee=ae.easing,je=ae.distance*Ee(ue/ae.duration)||0;te+=je;var Ne=ee;return ee+=ue,F+=je,[le,ae.distance,Ne,ee,ae.duration,Ee]}),k(z.track.distToIdx(F)),Q(),z.emit("animationStarted")}},stop:se,targetIdx:null}}function _(z){var U,H,ee,Y,Z,W,ie,G,k,Q,se,q,F,te,ae=1/0,oe=[],le=null,ue=0;function Ee(Oe){Se(ue+Oe)}function je(Oe){var Re=Ne(ue+Oe).abs;return me(Re)?Re:null}function Ne(Oe){var Re=Math.floor(Math.abs(T(Oe/H))),Ae=T((Oe%H+H)%H);Ae===H&&(Ae=0);var we=y(Oe),_e=ie.indexOf(A([],ie).reduce(function(ze,it){return Math.abs(it-Ae)<Math.abs(ze-Ae)?it:ze})),Ve=_e;return we<0&&Re++,_e===W&&(Ve=0,Re+=we>0?1:-1),{abs:Ve+Re*W*we,origin:_e,rel:Ve}}function ke(Oe,Re,Ae){var we;if(Re||!Qe())return ye(Oe,Ae);if(!me(Oe))return null;var _e=Ne(Ae??ue),Ve=_e.abs,ze=Oe-_e.rel,it=Ve+ze;we=ye(it);var ut=ye(it-W*y(ze));return(ut!==null&&Math.abs(ut)<Math.abs(we)||we===null)&&(we=ut),T(we)}function ye(Oe,Re){if(Re==null&&(Re=T(ue)),!me(Oe)||Oe===null)return null;Oe=Math.round(Oe);var Ae=Ne(Re),we=Ae.abs,_e=Ae.rel,Ve=Ae.origin,ze=he(Oe),it=(Re%H+H)%H,ut=ie[Ve],vt=Math.floor((Oe-(we-_e))/W)*H;return T(ut-it-ut+ie[ze]+vt+(Ve===W?H:0))}function me(Oe){return Le(Oe)===Oe}function Le(Oe){return p(Oe,k,Q)}function Qe(){return Y.loop}function he(Oe){return(Oe%W+W)%W}function Se(Oe){var Re;Re=Oe-ue,oe.push({distance:Re,timestamp:r()}),oe.length>6&&(oe=oe.slice(-6)),ue=T(Oe);var Ae=ve().abs;if(Ae!==le){var we=le!==null;le=Ae,we&&z.emit("slideChanged")}}function ve(Oe){var Re=Oe?null:function(){if(W){var Ae=Qe(),we=Ae?(ue%H+H)%H:ue,_e=(Ae?ue%H:ue)-Z[0][2],Ve=0-(_e<0&&Ae?H-Math.abs(_e):_e),ze=0,it=Ne(ue),ut=it.abs,vt=it.rel,At=Z[vt][2],ht=Z.map(function(Lt,Vt){var _t=Ve+ze;(_t<0-Lt[0]||_t>1)&&(_t+=(Math.abs(_t)>H-1&&Ae?H:0)*y(-_t));var Tt=Vt-vt,ct=y(Tt),gt=Tt+ut;Ae&&(ct===-1&&_t>At&&(gt+=W),ct===1&&_t<At&&(gt-=W),se!==null&&gt<se&&(_t+=H),q!==null&&gt>q&&(_t-=H));var at=_t+Lt[0]+Lt[1],lt=Math.max(_t>=0&&at<=1?1:at<0||_t>1?0:_t<0?Math.min(1,(Lt[0]+_t)/Lt[0]):(1-_t)/Lt[0],0);return ze+=Lt[0]+Lt[1],{abs:gt,distance:Y.rtl?-1*_t+1-Lt[0]:_t,portion:lt,size:Lt[0]}});return ut=Le(ut),vt=he(ut),{abs:Le(ut),length:ee,max:te,maxIdx:Q,min:F,minIdx:k,position:ue,progress:Ae?we/H:ue/ee,rel:vt,slides:ht,slidesLength:H}}}();return U.details=Re,z.emit("detailsChanged"),Re}return U={absToRel:he,add:Ee,details:null,distToIdx:je,idxToDist:ke,init:function(Oe){if(function(){if(Y=z.options,Z=(Y.trackConfig||[]).map(function(_e){return[E(_e,"size",1),E(_e,"spacing",0),E(_e,"origin",0)]}),W=Z.length){H=T(Z.reduce(function(_e,Ve){return _e+Ve[0]+Ve[1]},0));var Ae,we=W-1;ee=T(H+Z[0][2]-Z[we][0]-Z[we][2]-Z[we][1]),ie=Z.reduce(function(_e,Ve){if(!_e)return[0];var ze=Z[_e.length-1],it=_e[_e.length-1]+(ze[0]+ze[2])+ze[1];return it-=Ve[2],_e[_e.length-1]>it&&(it=_e[_e.length-1]),it=T(it),_e.push(it),(!Ae||Ae<it)&&(G=_e.length-1),Ae=it,_e},null),ee===0&&(G=0),ie.push(T(H))}}(),!W)return ve(!0);var Re;(function(){var Ae=z.options.range,we=z.options.loop;se=k=we?E(we,"min",-1/0):0,q=Q=we?E(we,"max",ae):G;var _e=E(Ae,"min",null),Ve=E(Ae,"max",null);_e!==null&&(k=_e),Ve!==null&&(Q=Ve),F=k===-1/0?k:z.track.idxToDist(k||0,!0,0),te=Q===ae?Q:ke(Q,!0,0),Ve===null&&(q=Q),E(Ae,"align",!1)&&Q!==ae&&Z[he(Q)][2]===0&&(te-=1-Z[he(Q)][0],Q=je(te-ue)),F=T(F),te=T(te)})(),Re=Oe,Number(Re)===Re?Ee(ye(Le(Oe))):ve()},to:Se,velocity:function(){var Oe=r(),Re=oe.reduce(function(Ae,we){var _e=we.distance,Ve=we.timestamp;return Oe-Ve>200||(y(_e)!==y(Ae.distance)&&Ae.distance&&(Ae={distance:0,lastTimestamp:0,time:0}),Ae.time&&(Ae.distance+=_e),Ae.lastTimestamp&&(Ae.time+=Ve-Ae.lastTimestamp),Ae.lastTimestamp=Ve),Ae},{distance:0,lastTimestamp:0,time:0});return Re.distance/Re.time||0}}}function j(z){var U,H,ee,Y,Z,W,ie,G;function k(le){return 2*le}function Q(le){return p(le,ie,G)}function se(le){return 1-Math.pow(1-le,3)}function q(){return ee?z.track.velocity():0}function F(){oe();var le=z.options.mode==="free-snap",ue=z.track,Ee=q();Y=y(Ee);var je=z.track.details,Ne=[];if(Ee||!le){var ke=te(Ee),ye=ke.dist,me=ke.dur;if(me=k(me),ye*=Y,le){var Le=ue.idxToDist(ue.distToIdx(ye),!0);Le&&(ye=Le)}Ne.push({distance:ye,duration:me,easing:se});var Qe=je.position,he=Qe+ye;if(he<Z||he>W){var Se=he<Z?Z-Qe:W-Qe,ve=0,Oe=Ee;if(y(Se)===Y){var Re=Math.min(Math.abs(Se)/Math.abs(ye),1),Ae=function(Ve){return 1-Math.pow(1-Ve,1/3)}(Re)*me;Ne[0].earlyExit=Ae,Oe=Ee*(1-Re)}else Ne[0].earlyExit=0,ve+=Se;var we=te(Oe,100),_e=we.dist*Y;z.options.rubberband&&(Ne.push({distance:_e,duration:k(we.dur),easing:se}),Ne.push({distance:-_e+ve,duration:500,easing:se}))}z.animator.start(Ne)}else z.moveToIdx(Q(je.abs),!0,{duration:500,easing:function(Ve){return 1+--Ve*Ve*Ve*Ve*Ve}})}function te(le,ue){ue===void 0&&(ue=1e3);var Ee=147e-9+(le=Math.abs(le))/ue;return{dist:Math.pow(le,2)/Ee,dur:le/Ee}}function ae(){var le=z.track.details;le&&(Z=le.min,W=le.max,ie=le.minIdx,G=le.maxIdx)}function oe(){z.animator.stop()}z.on("updated",ae),z.on("optionsChanged",ae),z.on("created",ae),z.on("dragStarted",function(){ee=!1,oe(),U=H=z.track.details.abs}),z.on("dragChecked",function(){ee=!0}),z.on("dragEnded",function(){var le=z.options.mode;le==="snap"&&function(){var ue=z.track,Ee=z.track.details,je=Ee.position,Ne=y(q());(je>W||je<Z)&&(Ne=0);var ke=U+Ne;Ee.slides[ue.absToRel(ke)].portion===0&&(ke-=Ne),U!==H&&(ke=H),y(ue.idxToDist(ke,!0))!==Ne&&(ke+=Ne),ke=Q(ke);var ye=ue.idxToDist(ke,!0);z.animator.start([{distance:ye,duration:500,easing:function(me){return 1+--me*me*me*me*me}}])}(),le!=="free"&&le!=="free-snap"||F()}),z.on("dragged",function(){H=z.track.details.abs})}function L(z){var U,H,ee,Y,Z,W,ie,G,k,Q,se,q,F,te,ae,oe,le,ue,Ee=g();function je(ve){if(W&&G===ve.id){var Oe=me(ve);if(k){if(!ye(ve))return ke(ve);Q=Oe,k=!1,z.emit("dragChecked")}if(oe)return Q=Oe;f(ve);var Re=function(we){if(le===-1/0&&ue===1/0)return we;var _e=z.track.details,Ve=_e.length,ze=_e.position,it=p(we,le-ze,ue-ze);if(Ve===0)return 0;if(!z.options.rubberband)return it;if(ze<=ue&&ze>=le||ze<le&&H>0||ze>ue&&H<0)return we;var ut=(ze<le?ze-le:ze-ue)/Ve,vt=Y*Ve,At=Math.abs(ut*vt),ht=Math.max(0,1-At/Z*2);return ht*ht*we}(ie(Q-Oe)/Y*ee);H=y(Re);var Ae=z.track.details.position;(Ae>le&&Ae<ue||Ae===le&&H>0||Ae===ue&&H<0)&&m(ve),se+=Re,!q&&Math.abs(se*Y)>5&&(q=!0),z.track.add(Re),Q=Oe,z.emit("dragged")}}function Ne(ve){!W&&z.track.details&&z.track.details.length&&(se=0,W=!0,q=!1,k=!0,G=ve.id,ye(ve),Q=me(ve),z.emit("dragStarted"))}function ke(ve){W&&G===ve.idChanged&&(W=!1,z.emit("dragEnded"))}function ye(ve){var Oe=Le(),Re=Oe?ve.y:ve.x,Ae=Oe?ve.x:ve.y,we=F!==void 0&&te!==void 0&&Math.abs(te-Ae)<=Math.abs(F-Re);return F=Re,te=Ae,we}function me(ve){return Le()?ve.y:ve.x}function Le(){return z.options.vertical}function Qe(){Y=z.size,Z=Le()?window.innerHeight:window.innerWidth;var ve=z.track.details;ve&&(le=ve.min,ue=ve.max)}function he(ve){q&&(m(ve),f(ve))}function Se(){if(Ee.purge(),z.options.drag&&!z.options.disabled){var ve;ve=z.options.dragSpeed||1,ie=typeof ve=="function"?ve:function(Re){return Re*ve},ee=z.options.rtl?-1:1,Qe(),U=z.container,function(){var Re="data-keen-slider-clickable";c("[".concat(Re,"]:not([").concat(Re,"=false])"),U).map(function(Ae){Ee.add(Ae,"dragstart",m),Ee.add(Ae,"mousedown",m),Ee.add(Ae,"touchstart",m)})}(),Ee.add(U,"dragstart",function(Re){f(Re)}),Ee.add(U,"click",he,{capture:!0}),Ee.input(U,"ksDragStart",Ne),Ee.input(U,"ksDrag",je),Ee.input(U,"ksDragEnd",ke),Ee.input(U,"mousedown",Ne),Ee.input(U,"mousemove",je),Ee.input(U,"mouseleave",ke),Ee.input(U,"mouseup",ke),Ee.input(U,"touchstart",Ne,{passive:!0}),Ee.input(U,"touchmove",je,{passive:!1}),Ee.input(U,"touchend",ke),Ee.input(U,"touchcancel",ke),Ee.add(window,"wheel",function(Re){W&&f(Re)});var Oe="data-keen-slider-scrollable";c("[".concat(Oe,"]:not([").concat(Oe,"=false])"),z.container).map(function(Re){return function(Ae){var we;Ee.input(Ae,"touchstart",function(_e){we=me(_e),oe=!0,ae=!0},{passive:!0}),Ee.input(Ae,"touchmove",function(_e){var Ve=Le(),ze=Ve?Ae.scrollHeight-Ae.clientHeight:Ae.scrollWidth-Ae.clientWidth,it=we-me(_e),ut=Ve?Ae.scrollTop:Ae.scrollLeft,vt=Ve&&Ae.style.overflowY==="scroll"||!Ve&&Ae.style.overflowX==="scroll";if(we=me(_e),(it<0&&ut>0||it>0&&ut<ze)&&ae&&vt)return oe=!0;ae=!1,f(_e),oe=!1}),Ee.input(Ae,"touchend",function(){oe=!1})}(Re)})}}z.on("updated",Qe),z.on("optionsChanged",Se),z.on("created",Se),z.on("destroyed",Ee.purge)}function N(z){var U,H,ee=null;function Y(F,te,ae){z.animator.active?W(F,te,ae):requestAnimationFrame(function(){return W(F,te,ae)})}function Z(){Y(!1,!1,H)}function W(F,te,ae){var oe=0,le=z.size,ue=z.track.details;if(ue&&U){var Ee=ue.slides;U.forEach(function(je,Ne){if(F)!ee&&te&&G(je,null,ae),k(je,null,ae);else{if(!Ee[Ne])return;var ke=Ee[Ne].size*le;!ee&&te&&G(je,ke,ae),k(je,Ee[Ne].distance*le-oe,ae),oe+=ke}})}}function ie(F){return z.options.renderMode==="performance"?Math.round(F):F}function G(F,te,ae){var oe=ae?"height":"width";te!==null&&(te=ie(te)+"px"),F.style["min-"+oe]=te,F.style["max-"+oe]=te}function k(F,te,ae){if(te!==null){te=ie(te);var oe=ae?te:0;te="translate3d(".concat(ae?0:te,"px, ").concat(oe,"px, 0)")}F.style.transform=te,F.style["-webkit-transform"]=te}function Q(){U&&(W(!0,!0,H),U=null),z.on("detailsChanged",Z,!0)}function se(){Y(!1,!0,H)}function q(){Q(),H=z.options.vertical,z.options.disabled||z.options.renderMode==="custom"||(ee=E(z.options.slides,"perView",null)==="auto",z.on("detailsChanged",Z),(U=z.slides).length&&se())}z.on("created",q),z.on("optionsChanged",q),z.on("beforeOptionsChanged",function(){Q()}),z.on("updated",se),z.on("destroyed",Q)}function V(z,U){return function(H){var ee,Y,Z,W,ie,G=g();function k(ye){var me;o(H.container,"reverse",(me=H.container,window.getComputedStyle(me,null).getPropertyValue("direction")!=="rtl"||ye?null:"")),o(H.container,"v",H.options.vertical&&!ye?"":null),o(H.container,"disabled",H.options.disabled&&!ye?"":null)}function Q(){se()&&oe()}function se(){var ye=null;if(W.forEach(function(Le){Le.matches&&(ye=Le.__media)}),ye===ee)return!1;ee||H.emit("beforeOptionsChanged"),ee=ye;var me=ye?Z.breakpoints[ye]:Z;return H.options=M(M({},Z),me),k(),Ne(),ke(),ue(),!0}function q(ye){var me=S(ye);return(H.options.vertical?me.height:me.width)/H.size||1}function F(){return H.options.trackConfig.length}function te(ye){for(var me in ee=!1,Z=M(M({},U),ye),G.purge(),Y=H.size,W=[],Z.breakpoints||[]){var Le=window.matchMedia(me);Le.__media=me,W.push(Le),G.add(Le,"change",Q)}G.add(window,"orientationchange",je),G.add(window,"resize",Ee),se()}function ae(ye){H.animator.stop();var me=H.track.details;H.track.init(ye??(me?me.abs:0))}function oe(ye){ae(ye),H.emit("optionsChanged")}function le(ye,me){if(ye)return te(ye),void oe(me);Ne(),ke();var Le=F();ue(),F()!==Le?oe(me):ae(me),H.emit("updated")}function ue(){var ye=H.options.slides;if(typeof ye=="function")return H.options.trackConfig=ye(H.size,H.slides);for(var me=H.slides,Le=me.length,Qe=typeof ye=="number"?ye:E(ye,"number",Le,!0),he=[],Se=E(ye,"perView",1,!0),ve=E(ye,"spacing",0,!0)/H.size||0,Oe=Se==="auto"?ve:ve/Se,Re=E(ye,"origin","auto"),Ae=0,we=0;we<Qe;we++){var _e=Se==="auto"?q(me[we]):1/Se-ve+Oe,Ve=Re==="center"?.5-_e/2:Re==="auto"?0:Re;he.push({origin:Ve,size:_e,spacing:ve}),Ae+=_e}if(Ae+=ve*(Qe-1),Re==="auto"&&!H.options.loop&&Se!==1){var ze=0;he.map(function(it){var ut=Ae-ze;return ze+=it.size+ve,ut>=1||(it.origin=1-ut-(Ae>1?0:1-Ae)),it})}H.options.trackConfig=he}function Ee(){Ne();var ye=H.size;H.options.disabled||ye===Y||(Y=ye,le())}function je(){Ee(),setTimeout(Ee,500),setTimeout(Ee,2e3)}function Ne(){var ye=S(H.container);H.size=(H.options.vertical?ye.height:ye.width)||1}function ke(){H.slides=c(H.options.selector,H.container)}H.container=(ie=c(z,document)).length?ie[0]:null,H.destroy=function(){G.purge(),H.emit("destroyed"),k(!0)},H.prev=function(){H.moveToIdx(H.track.details.abs-1,!0)},H.next=function(){H.moveToIdx(H.track.details.abs+1,!0)},H.update=le,te(H.options)}}var B=function(z,U,H){try{return function(ee,Y){var Z,W={};return Z={emit:function(ie){W[ie]&&W[ie].forEach(function(k){k(Z)});var G=Z.options&&Z.options[ie];G&&G(Z)},moveToIdx:function(ie,G,k){var Q=Z.track.idxToDist(ie,G);if(Q){var se=Z.options.defaultAnimation;Z.animator.start([{distance:Q,duration:E(k||se,"duration",500),easing:E(k||se,"easing",function(q){return 1+--q*q*q*q*q})}])}},on:function(ie,G,k){k===void 0&&(k=!1),W[ie]||(W[ie]=[]);var Q=W[ie].indexOf(G);Q>-1?k&&delete W[ie][Q]:k||W[ie].push(G)},options:ee},function(){if(Z.track=_(Z),Z.animator=D(Z),Y)for(var ie=0,G=Y;ie<G.length;ie++)(0,G[ie])(Z);Z.track.init(Z.options.initial||0),Z.emit("created")}(),Z}(U,A([V(z,{drag:!0,mode:"snap",renderMode:"precision",rubberband:!0,selector:".keen-slider__slide"}),N,L,j],H||[],!0))}catch(ee){console.error(ee)}};return bx.useKeenSlider=function(z,U){var H=e.useRef(null),ee=e.useRef(!1),Y=e.useRef(z),Z=e.useCallback(function(W){W?(Y.current=z,H.current=new B(W,z,U),ee.current=!1):(H.current&&H.current.destroy&&H.current.destroy(),H.current=null)},[]);return e.useEffect(function(){O(Y.current,z)||(Y.current=z,H.current&&H.current.update(Y.current))},[z]),[Z,H]},bx}var HR=qte();const Gte=({message:e,colorCode:t,disableCheckout:a,handleAddToCart:r,handleRemoveFromCart:o})=>{const[c,f]=x.useState({}),[m,g]=x.useState({}),p=j=>{const L=/(https?:\/\/[^\s]+)/g;return j.split(L).map((N,V)=>L.test(N)?J.jsx("a",{href:N.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:N},V):J.jsx("span",{children:N},V))},y=j=>{const L=j.trim();if(!L.includes("Name:")||!L.includes("VariantId"))return null;const N=L.match(/Name\s*[:\-]\s*(.+)/i),V=L.match(/Price\s*[:\-]\s*(.+)/i),B=L.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),z=L.match(/VariantId\s*[:\-]\s*(.+)/i),U=L.match(/variant_tag_name\s*[:\-]\s*(.+)/i),H=L.match(/options\s*[:\-]\s*([^|\r\n]+)/i),ee=L.match(/tag\s*[:\-]\s*(.+)/i);return!N||!V||!B||!z||!U?null:{name:N[1].trim(),price:V[1].trim(),link:B[1].trim(),image:"",variant_id:z[1].trim(),variant_tag_name:U[1].trim(),option:H?.[1]?.trim(),tag:ee?.[1]?.trim()}},S=x.useMemo(()=>{const j=e.split("|||").map(V=>V.trim()).filter(Boolean),L=[];let N=null;return j.forEach(V=>{if(V.startsWith("img - ")){const B=V.replace(/^img\s*[-:]\s*/,"").trim();if(N)N.image=B;else{const z=[...L].reverse().find(U=>U.type==="product");z&&(z.data.image=B)}}else if(V.includes("Name:")&&V.includes("VariantId")){const B=y(V);B&&(L.push({type:"product",data:B}),N=B)}else L.push({type:"text",data:V}),N=null}),L},[e]),E=x.useMemo(()=>{const j={};return S.forEach(L=>{if(L.type==="product"){const N=L.data;j[N.variant_tag_name]=j[N.variant_tag_name]||[],j[N.variant_tag_name].push(N)}}),j},[S]),T=(j,L=22)=>j.length>L?j.slice(0,L)+"...":j,[O,M]=x.useState(0),A=Object.keys(E).length,[D,_]=HR.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(j){M(j.track.details.rel)}});return J.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[S.filter(j=>j.type==="text").map((j,L)=>J.jsx("p",{className:"whitespace-pre-wrap break-words",children:p(j.data)},L)),Object.keys(E).length>0&&J.jsxs(J.Fragment,{children:[Object.keys(E).length>1&&J.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[J.jsx(Kr,{shape:"circle",icon:J.jsx(Xm,{}),onClick:()=>_.current?.prev(),disabled:O===0}),J.jsx(Kr,{shape:"circle",icon:J.jsx(K1,{}),onClick:()=>_.current?.next(),disabled:O===A-1})]}),J.jsx("div",{ref:D,className:"keen-slider",children:J.jsx(Fte,{groupedProducts:E,selectedVariants:m,setSelectedVariants:g,counts:c,setCounts:f,handleAddToCart:r,handleRemoveFromCart:o,colorCode:t,shortenName:T,sliderInstance:_,currentSlide:O,totalSlides:A,sliderRef:D,disableCheckout:a})})]})]})},L5=({message:e})=>{const t=e.find(r=>r.type==="image_url")?.image_url?.url,a=e?.isBusiness;return J.jsx("div",{children:J.jsx("div",{children:t&&J.jsx("div",{className:"mb-2 bg-transparent text-white ",children:J.jsx("img",{src:t,alt:"Chat image",style:{width:200},className:`rounded-md bg-transparent mt-2 max-w-xs ${a?"border border-gray-300 shadow-sm":""}`})})})})},Xte=({message:e,colorCode:t})=>{const a=e.find(o=>o.type==="text")?.text,r=o=>{const c=/(https?:\/\/[^\s]+)/g;return o.split(c).map((f,m)=>c.test(f)?J.jsx("a",{href:f.trim(),style:{color:t},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:f},m):J.jsx("span",{children:f},m))};return J.jsx(J.Fragment,{children:a&&J.jsx("div",{style:{color:"white",border:1,backgroundColor:t,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word"},children:J.jsx("p",{children:r(a)})})})},Yte=({link:e,colorCode:t,transcription:a})=>{const r=x.useRef(null),o=x.useRef(null),[c,f]=x.useState(!1),[m,g]=x.useState(!1);x.useEffect(()=>{if(r.current)return o.current?.destroy(),o.current=sp.create({container:r.current,waveColor:"white",progressColor:"white",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),o.current.load(e),o.current.on("finish",()=>f(!1)),()=>{o.current?.destroy()}},[e,t]);const p=()=>{o.current&&(o.current.playPause(),f(y=>!y))};return J.jsxs("div",{style:{backgroundColor:t,padding:"12px",borderRadius:"20px",color:"white",maxWidth:"350px",marginBottom:"16px"},children:[J.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[J.jsx("button",{onClick:p,style:{background:"transparent",border:"none",color:"white",marginRight:"12px",cursor:"pointer"},children:c?J.jsx(uO,{style:{fontSize:"24px"}}):J.jsx(cO,{style:{fontSize:"24px"}})}),J.jsx("div",{ref:r,style:{width:"130px",height:"40px",overflow:"hidden",color:"white"}})]}),a&&J.jsxs("div",{style:{marginTop:"12px",fontSize:"14px",color:"rgba(255,255,255,0.85)"},children:[J.jsx("button",{onClick:()=>g(!m),style:{background:"none",border:"none",color:"white",textDecoration:"underline",fontSize:"13px",cursor:"pointer",padding:0},children:m?"Hide transcript":"Show transcript"}),m&&J.jsx("p",{style:{marginTop:"6px",lineHeight:"1.4"},children:a})]})]})},Wte=({status:e,user:t})=>{if(!e||!t)return null;let a=`${t} is ${e}`;return e==="typing"?a=`${t} is typing...`:a="",J.jsx(J.Fragment,{children:a&&J.jsx("div",{className:"flex justify-center mb-2",children:J.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-500 text-sm rounded-full",children:a})})})},Zte=({message:e})=>{const t=r=>{const o=/(https?:\/\/[^\s]+)/g;return r?.split(o).map((c,f)=>o.test(c)?J.jsx("a",{href:c.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:c},f):J.jsx("span",{children:c},f))};if(e?.startsWith("Add this to cart for me")&&e?.includes("name:")){const o=e?.match(/name:([^,]+)/i)?.[1]?.trim()||"Product";return J.jsxs("div",{style:{backgroundColor:"#E8F5E9",border:"1px solid #C8E6C9",borderRadius:"12px",padding:"12px 16px",color:"#2E7D32",fontWeight:500,fontSize:"15px",maxWidth:"360px",margin:"0 auto",textAlign:"center"},children:["✅ ",J.jsx("strong",{children:o})," has been added to your cart."]})}return J.jsx("p",{style:{color:"white"},children:t(e)})};/**
653
653
  * @license lucide-react v0.525.0 - ISC
654
654
  *
655
655
  * This source code is licensed under the ISC license.
@@ -674,7 +674,7 @@ html body {
674
674
  *
675
675
  * This source code is licensed under the ISC license.
676
676
  * See the LICENSE file in the root directory of this source tree.
677
- */const ane=nne("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]),rne=({sessionId:e,colorCode:t="#000"})=>{const[a,r]=x.useState(null),[o,c]=x.useState({}),[f,m]=x.useState(0),g=[0,1,2];return x.useEffect(()=>{if(!e)return;const p=new WebSocket(`${ii.websocketUrl}/support/${e}/`);return p.onmessage=({data:y})=>{const S=JSON.parse(y);r(S.stage),c(S.data||{})},p.onclose=()=>console.log("Support socket closed"),()=>p.close()},[e]),x.useEffect(()=>{let p,y;return a==="connecting"&&(y=Date.now(),m(100),p=window.setInterval(()=>{const S=(Date.now()-y)/1e3,E=Math.max(100-S/7*100,0);m(E),E<=0&&window.clearInterval(p)},100)),()=>{p&&window.clearInterval(p)}},[a]),a?J.jsx("div",{className:"bg-opacity-50 flex items-center justify-center z-50",children:J.jsxs(Jz,{children:[a==="email_sent"&&J.jsxs(Yi.div,{className:"bg-white rounded-2xl shadow-xl p-6 flex flex-col items-center",initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},children:[J.jsx(ane,{size:32,className:"mb-2",style:{color:t}}),J.jsx("p",{className:"text-lg font-semibold",children:"Sending your request to support…"}),J.jsx("div",{className:"flex space-x-2 mt-2",children:g.map((p,y)=>J.jsx(Yi.span,{className:"text-2xl",style:{color:t},animate:{scale:[.7,1.3,.7]},transition:{delay:y*.2,repeat:1/0,duration:.8},children:"•"},y))})]},"email"),a==="connecting"&&J.jsxs(Yi.div,{className:"bg-white rounded-2xl shadow-xl p-6 flex flex-col items-center",initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},children:[J.jsxs("div",{className:"flex items-center space-x-4",children:[J.jsx("img",{src:o.userImage,alt:"User",className:"w-12 h-12 rounded-full border-2",style:{borderColor:t}}),J.jsxs("p",{className:"text-lg",children:["Connecting you to"," ",J.jsx("span",{className:"text-indigo-600",children:o.agentName||"Support Agent"})]}),J.jsx("img",{src:o.companyImage,alt:"Company",className:"w-12 h-12 rounded-full border"})]}),J.jsx("div",{className:"flex space-x-2 mt-3",children:g.map((p,y)=>J.jsx(Yi.span,{className:"text-2xl",style:{color:t},animate:{scale:[.7,1.3,.7]},transition:{delay:y*.2,repeat:1/0,duration:.8},children:"•"},y))}),J.jsx("div",{className:"w-full bg-gray-200 h-1 rounded-full mt-4 overflow-hidden",children:J.jsx(Yi.div,{className:"h-full",style:{width:`${f}%`,backgroundColor:t},transition:{ease:"linear",duration:1}})})]},"connecting"),a==="auto"&&J.jsxs(Yi.div,{className:"bg-white rounded-2xl shadow-xl p-6 flex items-center space-x-4",initial:{y:50,opacity:0},animate:{y:0,opacity:1},exit:{y:-50,opacity:0},children:[J.jsx("img",{src:o.agentAvatar||"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSaC0jamaBcOGTbS86459UezKUs2Wo0lPU_mw&s",alt:"Auto Support",className:"w-12 h-12 rounded-2xl"}),J.jsxs("p",{className:"text-lg",children:["You’re now connected to"," ",J.jsx("span",{style:{color:t},children:o.agentName||"Auto-Support"})]})]},"auto")]})}):null},ine=({message:e})=>{const t=e.find(r=>r.type==="text")?.text,a=r=>{const o=/(https?:\/\/[^\s]+)/g;return r.split(o).map((c,f)=>o.test(c)?J.jsx("a",{href:c.trim(),style:{color:"black"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:c},f):J.jsx("span",{children:c},f))};return J.jsx(J.Fragment,{children:t&&J.jsx("div",{style:{color:"black",border:1,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word",backgroundColor:"#f0f0f0"},children:J.jsx("p",{children:a(t)})})})},one=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y})=>!y||y===0?null:J.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:J.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([S,E])=>{const T=t[S]||(E.length>0?E[0].variant_id:""),O=E.find(N=>N.variant_id===T)||E[0];if(!O)return null;const M=r[O.variant_id]||0,A=Array.from(new Set(E.map(N=>N.option?.trim()??"").filter(N=>N&&N.toLowerCase()!=="none"))),D=N=>{const V=E.find(B=>B.option===N);V&&a(B=>({...B,[S]:V.variant_id}))},_=async()=>{o(N=>({...N,[O.variant_id]:(N[O.variant_id]||0)+1})),await c(O.variant_id,O.name,1)},j=async()=>{M!==0&&(o(N=>({...N,[O.variant_id]:Math.max(0,(N[O.variant_id]||0)-1)})),await f(O.variant_id,1))},L=O.option??A[0]??"";return J.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[J.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(O.link,"_blank"),children:[J.jsx("img",{src:O.image,alt:O.name,className:"sallaX-img",loading:"lazy"}),J.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:N=>N.stopPropagation(),children:"View"})]}),J.jsxs("div",{className:"sallaX-body",children:[J.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:O.name,children:g(O.name)}),J.jsx("div",{className:"sallaX-row",children:J.jsx("span",{className:"sallaX-price","aria-label":"Price",children:O.price})}),A.length>0&&J.jsxs("div",{className:"sallaX-selectWrap",children:[J.jsx("label",{htmlFor:`sallaX-select-${S}`,className:"sallaX-selectLabel",children:"Choose an option"}),J.jsx("select",{id:`sallaX-select-${S}`,className:"sallaX-select","aria-label":"Choose an option",value:L,onChange:N=>D(N.target.value),children:A.map(N=>J.jsx("option",{value:N,children:N},N))})]}),J.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:j,"aria-label":"Decrease quantity",disabled:M===0,children:"–"}),J.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:M}),J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:_,"aria-label":"Increase quantity",children:"+"})]})]})]},S)})})}),lne=({message:e,colorCode:t,handleAddToCart:a,handleRemoveFromCart:r})=>{const[o,c]=x.useState({}),[f,m]=x.useState({}),g=_=>{const j=/(https?:\/\/[^\s]+)/g;return _.split(j).map((L,N)=>j.test(L)?J.jsx("a",{href:L.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:L},N):J.jsx("span",{children:L},N))},p=_=>{const j=_.trim();if(!j.includes("Name:")||!j.includes("VariantId"))return null;const L=j.match(/Name\s*[:\-]\s*(.+)/i),N=j.match(/Price\s*[:\-]\s*(.+)/i),V=j.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),B=j.match(/VariantId\s*[:\-]\s*(.+)/i),z=j.match(/variant_tag_name\s*[:\-]\s*(.+)/i),U=j.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!L||!N||!V||!B||!z?null:{name:L[1].trim(),price:N[1].trim(),link:V[1].trim(),image:"",variant_id:B[1].trim(),variant_tag_name:z[1].trim(),option:U?.[1]?.trim()}},y=x.useMemo(()=>{const _=e.split("|||").map(N=>N.trim()).filter(Boolean),j=[];let L=null;return _.forEach(N=>{if(N.startsWith("img - ")){const V=N.replace(/^img\s*[-:]\s*/,"").trim();if(L)L.image=V;else{const B=[...j].reverse().find(z=>z.type==="product");B&&(B.data.image=V)}}else if(N.includes("Name:")&&N.includes("VariantId")){const V=p(N);V&&(j.push({type:"product",data:V}),L=V)}else j.push({type:"text",data:N}),L=null}),j},[e]),S=x.useMemo(()=>{const _={};return y.forEach(j=>{if(j.type==="product"){const L=j.data;_[L.variant_tag_name]=_[L.variant_tag_name]||[],_[L.variant_tag_name].push(L)}}),_},[y]),E=(_,j=22)=>_.length>j?_.slice(0,j)+"...":_,[T,O]=x.useState(0),M=Object.keys(S).length,[A,D]=HR.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(_){O(_.track.details.rel)}});return J.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[y.filter(_=>_.type==="text").map((_,j)=>J.jsx("p",{className:"whitespace-pre-wrap break-words",children:g(_.data)},j)),Object.keys(S).length>0&&J.jsxs(J.Fragment,{children:[Object.keys(S).length>1&&J.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[J.jsx(Kr,{shape:"circle",icon:J.jsx(Xm,{}),onClick:()=>D.current?.prev(),disabled:T===0}),J.jsx(Kr,{shape:"circle",icon:J.jsx(K1,{}),onClick:()=>D.current?.next(),disabled:T===M-1})]}),J.jsx("div",{ref:A,className:"keen-slider",children:J.jsx(one,{groupedProducts:S,selectedVariants:f,setSelectedVariants:m,counts:o,setCounts:c,handleAddToCart:a,handleRemoveFromCart:r,colorCode:t,shortenName:E,sliderInstance:D,currentSlide:T,totalSlides:M,sliderRef:A})})]})]})},sne=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y})=>!y||y===0?null:J.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:J.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([S,E])=>{const T=t[S]||(E.length>0?E[0].variant_id:""),O=E.find(N=>N.variant_id===T)||E[0];if(!O)return null;const M=r[O.variant_id]||0,A=Array.from(new Set(E.map(N=>N.option?.trim()??"").filter(N=>N&&N.toLowerCase()!=="none"))),D=N=>{const V=E.find(B=>B.option===N);V&&a(B=>({...B,[S]:V.variant_id}))},_=async()=>{o(N=>({...N,[O.variant_id]:(N[O.variant_id]||0)+1})),await c(O.variant_id,O.name,1)},j=async()=>{M!==0&&(o(N=>({...N,[O.variant_id]:Math.max(0,(N[O.variant_id]||0)-1)})),await f(O.variant_id,1))},L=O.option??A[0]??"";return J.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[J.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(O.link,"_blank"),children:[J.jsx("img",{src:O.image,alt:O.name,className:"sallaX-img",loading:"lazy"}),J.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:N=>N.stopPropagation(),children:"View"})]}),J.jsxs("div",{className:"sallaX-body",children:[J.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:O.name,children:g(O.name)}),J.jsx("div",{className:"sallaX-row",children:J.jsx("span",{className:"sallaX-price","aria-label":"Price",children:O.price})}),A.length>0&&J.jsxs("div",{className:"sallaX-selectWrap",children:[J.jsx("label",{htmlFor:`sallaX-select-${S}`,className:"sallaX-selectLabel",children:"Choose an option"}),J.jsx("select",{id:`sallaX-select-${S}`,className:"sallaX-select","aria-label":"Choose an option",value:L,onChange:N=>D(N.target.value),children:A.map(N=>J.jsx("option",{value:N,children:N},N))})]}),J.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:j,"aria-label":"Decrease quantity",disabled:M===0,children:"–"}),J.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:M}),J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:_,"aria-label":"Increase quantity",children:"+"})]})]})]},S)})})}),une=({message:e,colorCode:t,handleAddToCart:a,handleRemoveFromCart:r})=>{const[o,c]=x.useState({}),[f,m]=x.useState({}),g=_=>{const j=/(https?:\/\/[^\s]+)/g;return _.split(j).map((L,N)=>j.test(L)?J.jsx("a",{href:L.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:L},N):J.jsx("span",{children:L},N))},p=_=>{const j=_.trim();if(!j.includes("Name:")||!j.includes("VariantId"))return null;const L=j.match(/Name\s*[:\-]\s*(.+)/i),N=j.match(/Price\s*[:\-]\s*(.+)/i),V=j.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),B=j.match(/VariantId\s*[:\-]\s*(.+)/i),z=j.match(/variant_tag_name\s*[:\-]\s*(.+)/i),U=j.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!L||!N||!V||!B||!z?null:{name:L[1].trim(),price:N[1].trim(),link:V[1].trim(),image:"",variant_id:B[1].trim(),variant_tag_name:z[1].trim(),option:U?.[1]?.trim()}},y=x.useMemo(()=>{const _=e.split("|||").map(N=>N.trim()).filter(Boolean),j=[];let L=null;return _.forEach(N=>{if(N.startsWith("img - ")){const V=N.replace(/^img\s*[-:]\s*/,"").trim();if(L)L.image=V;else{const B=[...j].reverse().find(z=>z.type==="product");B&&(B.data.image=V)}}else if(N.includes("Name:")&&N.includes("VariantId")){const V=p(N);V&&(j.push({type:"product",data:V}),L=V)}else j.push({type:"text",data:N}),L=null}),j},[e]),S=x.useMemo(()=>{const _={};return y.forEach(j=>{if(j.type==="product"){const L=j.data;_[L.variant_tag_name]=_[L.variant_tag_name]||[],_[L.variant_tag_name].push(L)}}),_},[y]),E=(_,j=22)=>_.length>j?_.slice(0,j)+"...":_,[T,O]=x.useState(0),M=Object.keys(S).length,[A,D]=HR.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(_){O(_.track.details.rel)}});return J.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[y.filter(_=>_.type==="text").map((_,j)=>J.jsx("p",{className:"whitespace-pre-wrap break-words",children:g(_.data)},j)),Object.keys(S).length>0&&J.jsxs(J.Fragment,{children:[Object.keys(S).length>1&&J.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[J.jsx(Kr,{shape:"circle",icon:J.jsx(Xm,{}),onClick:()=>D.current?.prev(),disabled:T===0}),J.jsx(Kr,{shape:"circle",icon:J.jsx(K1,{}),onClick:()=>D.current?.next(),disabled:T===M-1})]}),J.jsx("div",{ref:A,className:"keen-slider",children:J.jsx(sne,{groupedProducts:S,selectedVariants:f,setSelectedVariants:m,counts:o,setCounts:c,handleAddToCart:a,handleRemoveFromCart:r,colorCode:t,shortenName:E,sliderInstance:D,currentSlide:T,totalSlides:M,sliderRef:A})})]})]})};function cne({calendlyLink:e}){const t=x.useRef(null),[a,r]=x.useState(!1);return x.useEffect(()=>{if(window.Calendly)r(!0);else{const o=document.createElement("script");return o.src="https://assets.calendly.com/assets/external/widget.js",o.async=!0,o.onload=()=>r(!0),document.body.appendChild(o),()=>{document.body.removeChild(o)}}},[]),x.useEffect(()=>{a&&e&&t.current&&window.Calendly&&window.Calendly.initInlineWidget({url:e,parentElement:t.current,prefill:{},utm:{}})},[a,e]),J.jsx("div",{ref:t,style:{minWidth:"320px",height:"350px",borderRadius:"8px",boxShadow:"0 0 10px rgba(0, 0, 0, 0.1)"}})}const fne=({messages:e,colorCode:t,handleAddToCart:a,handleRemoveFromCart:r,isLoading:o,agentStatus:c,sessionId:f,userType:m,calendly:g,disableCheckout:p,isfetchingMessage:y})=>{const S=x.useRef(null);return x.useEffect(()=>{if(!S.current)return;const E=setTimeout(()=>{S.current?.scrollIntoView({behavior:"smooth"})},150);return()=>clearTimeout(E)},[e]),y||o||!e?J.jsxs("div",{className:"loader-wrapper",style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",gap:"8px"},children:[J.jsx("div",{style:{backgroundColor:t},className:"box-loader"}),J.jsx("div",{style:{backgroundColor:t},className:"box-loader"}),J.jsx("div",{style:{backgroundColor:t},className:"box-loader"})]}):J.jsxs("div",{className:"chatbot-messages space-y-4",children:[e.map((E,T)=>E.typing?J.jsx("div",{className:"chat-msg typing",children:J.jsx(Ite,{color:t})},T):E.isConnect?J.jsx(rne,{sessionId:f}):E.role==="assistant"?Array.isArray(E.content)?J.jsxs("div",{className:"chat-msg assistant",style:{backgroundColor:"transparent",padding:0},children:[E.image_url&&J.jsx("img",{src:E.image_url,alt:"Chat image",style:{width:200},className:"rounded-md mt-2 max-w-xs border border-green-400 shadow-sm"}),J.jsx(L5,{message:E.content}),J.jsx("div",{className:"flex justify-start",children:J.jsx(ine,{message:E.content})})]},T):E.calendly?J.jsx("div",{style:{borderRadius:5,color:"white",width:"100%"},children:J.jsx(cne,{calendlyLink:g})},T):J.jsxs("div",{className:"chat-msg assistant",children:[E.image_url&&J.jsx("img",{src:E.image_url,alt:"Chat image",style:{width:200},className:"rounded-md mt-2 max-w-xs border border-green-400 shadow-sm"}),m==="shopify"?J.jsx(Gte,{message:E.content||E.text||"",colorCode:t,disableCheckout:p,handleAddToCart:a,handleRemoveFromCart:r}):m==="salla"?J.jsx(une,{message:E.content||E.text||"",colorCode:t,handleAddToCart:a,handleRemoveFromCart:r}):J.jsx(lne,{message:E.content||E.text||"",colorCode:t,handleAddToCart:a,handleRemoveFromCart:r})]},T):E?.audio_url?J.jsxs("div",{className:"chat-msg user",style:{backgroundColor:"transparent",padding:0},children:[J.jsx("div",{style:{borderRadius:12},children:J.jsx(Yte,{link:E.audio_url,transcription:E.content,colorCode:t})}),J.jsx("div",{className:"mt-1 mr-2 flex items-end justify-end",children:E.status==="uploading"?J.jsx(Wu,{indicator:J.jsx(Ks,{spin:!0}),size:"small"}):E.status==="delivered"?J.jsx(sO,{style:{color:"green"}}):E.status==="failed"?J.jsx(y0,{style:{color:"red"}}):null})]}):E.image_url?J.jsxs("div",{className:"chat-msg user",style:{backgroundColor:"transparent"},children:[J.jsx("img",{src:E.image_url,alt:"Chat image",style:{width:200},className:`rounded-md mt-2 max-w-xs ${E.content==="user"?"border border-gray-300 shadow-sm":"border border-green-400 shadow-sm"}`}),J.jsx("div",{className:"mt-1 mr-2 flex items-end justify-end",children:E.status==="uploading"?J.jsx(Wu,{indicator:J.jsx(Ks,{spin:!0}),size:"small"}):E.status==="delivered"?J.jsx(sO,{style:{color:"green"}}):E.status==="failed"?J.jsx(y0,{style:{color:"red"}}):null}),E.content&&J.jsx("div",{className:"flex justify-end mt-2",children:J.jsx("div",{style:{color:"white",border:1,backgroundColor:t,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word"},children:J.jsx("span",{children:E.content})})})]},T):Array.isArray(E.content)?J.jsxs("div",{className:"chat-msg user",style:{backgroundColor:"transparent",padding:0},children:[J.jsx("div",{style:{backgroundColor:"transparent",padding:0},children:J.jsx(L5,{message:E.content})}),J.jsx("div",{className:"flex justify-end",children:J.jsx(Xte,{message:E.content,colorCode:t})},T)]},T):J.jsx("div",{className:`chat-msg ${E.role}`,style:E.role==="user"?{backgroundColor:t,color:"#fff"}:{},children:J.jsx(Zte,{message:E.content,colorCode:t})},T)),J.jsx(Wte,{status:c?.status,user:c?.user}),J.jsx("div",{ref:S})]})},dne=e=>{const{disableChatbot:t,disableChatbotGlobally:a,isChatlogCreated:r,createNew:o,disableForm:c,calendlyLink:f,socket:m,newSession:g,setNewSession:p,setMessages:y}=e;return{apiCall:x.useCallback(async(E,T,O,M,A)=>{T&&(await fetch(`${ii.apiUrl}chatlog-create/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({visitor_id:localStorage.getItem("visitor_id"),company_username:localStorage.getItem("company_username"),session_id:O})}),p(!1)),!t&&!a&&y(D=>[...D,{role:"assistant",content:"typing",typing:!0}]);try{const D=await fetch(`${ii.apiUrl}message-create/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:E,isBusiness:!0,session_id:O,organization:localStorage.getItem("company_username"),isImage:A,image_url:M})});if(D.ok){const _=await D.json();if(_.message_history){const j=_.isConnect?{role:"assistant",content:"Your support request is on its way—please stand by!",isConnect:!0,sender:"Ai Agent",isBusiness:!1,isHtml:_.isHtml}:{role:"assistant",content:_.message,sender:"Ai Agent",isBusiness:!1,isHtml:_.isHtml};m?.readyState===WebSocket.OPEN&&m.send(JSON.stringify({message:_.message,additionalData:{isBusiness:!1,SessionId:O,sender:"AI",response:"from_ai_web"}})),y(L=>{const V=[...L.filter(B=>!B.typing),j];return console.log(f),_.message&&f&&/book\s?(a\s?)?meeting|schedule\s?(a\s?)?(call|meeting)|let\s?('s)?\s?meet|set\s?up\s?(a\s?)?meeting|book\s?(an\s?)?appointment/i.test(_.message)&&(console.log("meeting please"),V.push({role:"assistant",content:"Scheduling a meeting...",isBusiness:!1,calendly:!0})),V})}else _.status==="success"&&y(j=>j.filter(L=>!L.typing))}else console.error("message-create failed")}catch(D){console.error("Message error:",D)}},[t,a,r,o,c,f,m,g])}};/*! js-cookie v3.0.5 | MIT */function Sx(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)e[r]=a[r]}return e}var hne={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function BR(e,t){function a(o,c,f){if(!(typeof document>"u")){f=Sx({},t,f),typeof f.expires=="number"&&(f.expires=new Date(Date.now()+f.expires*864e5)),f.expires&&(f.expires=f.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var m="";for(var g in f)f[g]&&(m+="; "+g,f[g]!==!0&&(m+="="+f[g].split(";")[0]));return document.cookie=o+"="+e.write(c,o)+m}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var c=document.cookie?document.cookie.split("; "):[],f={},m=0;m<c.length;m++){var g=c[m].split("="),p=g.slice(1).join("=");try{var y=decodeURIComponent(g[0]);if(f[y]=e.read(p,y),o===y)break}catch{}}return o?f[o]:f}}return Object.create({set:a,get:r,remove:function(o,c){a(o,"",Sx({},c,{expires:-1}))},withAttributes:function(o){return BR(this.converter,Sx({},this.attributes,o))},withConverter:function(o){return BR(Sx({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var mne=BR(hne,{path:"/"});const pne=e=>mne.get(e);function gne(e,t){const a=x.useRef(null),r=x.useRef(t);return x.useEffect(()=>{r.current=t},[t]),x.useEffect(()=>{if(!e)return;const o=new WebSocket(`${ii.websocketUrl}/chat/${e}/`);a.current=o;const c=m=>{try{const g=JSON.parse(m.data);r.current(g)}catch(g){console.error("Invalid JSON",g)}};o.addEventListener("message",c);const f=()=>{};return o.addEventListener("close",f),()=>{o.removeEventListener("message",c),o.removeEventListener("close",f),o.close()}},[e]),a.current}const vne=({message:e,onClose:t,duration:a=1e3})=>(x.useEffect(()=>{const r=setTimeout(t,a);return()=>clearTimeout(r)},[t,a]),J.jsx("div",{className:"jawebcss-notification",children:e}));function yne({items:e,loading:t,colorCode:a,sessionId:r,onRefresh:o,onRemove:c}){const[f,m]=x.useState(!1),g=x.useRef(null),[p,y]=x.useState(!1),S=async()=>{y(!0);try{const T=await fetch(`${ii.apiUrl}checkout/shopify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:r,company_username:localStorage.getItem("company_username")})});if(!T.ok)throw new Error("Failed to initiate checkout.");const O=await T.json();O?.checkoutUrl?window.parent?.postMessage({type:"JAWEB_CHAT",action:"navigate",target:"_blank",url:O.checkoutUrl},"*"):alert("No checkout URL returned.")}catch(T){console.error("Checkout error:",T)}finally{y(!1)}};x.useEffect(()=>{const T=O=>{g.current&&!g.current.contains(O.target)&&m(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const E=e.reduce((T,O)=>T+O.quantity,0);return J.jsxs("div",{className:"jawebchatbotcss-cart-widget",ref:g,children:[J.jsxs("button",{onClick:()=>m(T=>!T),className:"jawebchatbotcss-cart-button",children:[J.jsx(C6,{className:"jawebchatbotcss-cart-icon"}),J.jsxs("span",{className:"jawebchatbotcss-cart-label",children:["Cart (",E,")"]})]}),f&&J.jsxs("div",{className:"jawebchatbotcss-cart-dropdown",children:[J.jsxs("div",{className:"jawebchatbotcss-cart-header",children:[J.jsx("span",{className:"jawebchatbotcss-cart-title",children:"Your Cart"}),J.jsx("button",{onClick:o,disabled:t,className:"jawebchatbotcss-refresh-button",children:t?"Refreshing…":"Refresh"})]}),e.length===0?J.jsx("div",{className:"jawebchatbotcss-cart-empty",children:"Your cart is empty."}):J.jsx("ul",{className:"jawebchatbotcss-cart-list",children:e.map(T=>J.jsxs("li",{className:"jawebchatbotcss-cart-item",children:[J.jsx("span",{className:"jawebchatbotcss-item-name",children:T.name}),J.jsxs("div",{className:"jawebchatbotcss-item-controls",children:[J.jsxs("span",{className:"jawebchatbotcss-item-qty",children:["×",T.quantity]}),J.jsx(e0,{onClick:()=>c(T.variantId,T.quantity),className:"jawebchatbotcss-remove-icon"})]})]},T.variantId))}),e.length>0&&J.jsx("div",{className:"jawebchatbotcss-cart-footer",children:J.jsxs(Kr,{type:"primary",style:{backgroundColor:a},block:!0,disabled:E===0,loading:p,onClick:()=>{S()},children:["Checkout (",E,")"]})})]})]})}function bne(e){const[t,a]=x.useState([]),[r,o]=x.useState(!1),c=x.useCallback(async()=>{if(e){o(!0);try{const p=await(await fetch(`${ii.apiUrl}cart?session_id=${e}`)).json();a(p.items||[])}catch(g){console.error("Failed to fetch cart",g)}finally{o(!1)}}},[e]),f=async(g,p,y)=>{if(e){a(S=>S.find(T=>T.variantId===g)?S.map(T=>T.variantId===g?{...T,quantity:T.quantity+y}:T):[...S,{variantId:g,name:p,quantity:y}]);try{await fetch(`${ii.apiUrl}cart/add/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:e,variantId:g,name:p,quantity:y})})}catch(S){console.error("Failed to sync addToCart to server",S)}await c()}},m=async(g,p)=>{if(e){a(y=>y.map(S=>S.variantId===g?{...S,quantity:S.quantity-p}:S).filter(S=>S.quantity>0));try{await fetch(`${ii.apiUrl}cart/remove/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:e,variantId:g,quantity:p})})}catch(y){console.error("Failed to sync removeFromCart to server",y)}await c()}};return x.useEffect(()=>{c()},[c]),{items:t,loading:r,addToCart:f,removeFromCart:m,refresh:c}}const Sne=({chatbotLogo:e,agentName:t,colorCode:a,newSession:r,userType:o,setNewSession:c,messagesSuggestions:f,disableForm:m,sessionId:g,setOpen:p,Opened:y,setView:S,calendly:E,disbleCheckout:T})=>{const[O,M]=x.useState(""),[A,D]=x.useState(null),[_,j]=x.useState(null),[L,N]=x.useState(!1),[,V]=x.useState(()=>pne("new_user")==="true"),[B,z]=x.useState(!1),[,U]=x.useState(!1),[H,ee]=x.useState(!1),[,Y]=x.useState(!1),{messages:Z,setMessages:W,isFetchingMessages:ie}=$te(g),[G,k]=x.useState({}),[Q,se]=x.useState(null),q=x.useCallback(he=>{if(he.status){k({status:he.status,user:he.user||"Support"});return}const{additionalData:Se={},message:ve,image_url:Oe}=he;!Se.isBusiness&&Se.sender!=="AI"&&W(Re=>[...Re,{role:"assistant",content:ve,isBusiness:!1,sender:Se.sender,image_url:Oe}])},[W]),F=gne(g,q),{apiCall:te}=dne({disableChatbot:!1,disableChatbotGlobally:!1,isChatlogCreated:B,createNew:H,disableForm:m,calendlyLink:E,socket:F,newSession:r,setMessages:W,setNewSession:c}),ae=async()=>{if(!O.trim())return;let he=O;N(!0);const Se={role:"user",content:he};if(W(ve=>[...ve,Se]),F&&F.readyState===WebSocket.OPEN){const Oe=JSON.stringify({message:he,additionalData:{isBusiness:!0,SessionId:g}});F.send(Oe)}try{await te(O,r,g)}catch(ve){console.error(ve)}finally{N(!1)}},oe=async he=>{if(!he.trim())return;N(!0);const Se={role:"user",content:he};if(W(ve=>[...ve,Se]),F&&F.readyState===WebSocket.OPEN){const Oe=JSON.stringify({message:he,additionalData:{isBusiness:!0,SessionId:g}});F.send(Oe)}try{await te(he,r,g)}catch(ve){console.error("Error sending suggestion:",ve)}finally{N(!1)}};async function le(he,Se){const ve=Date.now(),Oe=URL.createObjectURL(he);if(!he)return;const Re={id:ve,role:"user",content:Se||"",image_url:Oe,isBusiness:!0,status:"uploading"};W(we=>[...we,Re]);let Ae=null;if(he)try{const we=new FormData;we.append("image",he);const _e=await $a.post(`${ii.apiUrl}upload-image/`,we);_e.status===201&&_e.data?.image_url&&(Ae=_e.data.image_url,W(Ve=>Ve.map(it=>it.id===ve&&Ae?{...it,image_url:Ae}:it)))}catch(we){console.error("Error uploading image:",we),W(_e=>_e.map(Ve=>Ve.id===ve?{...Ve,status:"failed"}:Ve));return}try{if(F&&F.readyState===WebSocket.OPEN){const we={isBusiness:!0,SessionId:g},_e=JSON.stringify({image_url:Ae||null,message:O.trim()||"",additionalData:we});F.send(_e)}Ae&&(W(we=>we.map(_e=>_e.id===ve?{..._e,status:"delivered"}:_e)),te(Se.trim()||"",r,g,Ae,!0))}catch(we){console.error("Error sending Image message:",we),W(_e=>_e.map(Ve=>Ve.id===ve?{...Ve,status:"failed"}:Ve))}finally{D(null)}}const ue=async he=>{if(!he)return;const Se=URL.createObjectURL(he),ve=Date.now(),Oe={id:ve,role:"user",content:"",audio_url:Se,isBusiness:!0,status:"uploading"};W(we=>[...we,Oe]);let Re,Ae="";try{const we=new FormData;we.append("audio",he);const _e=await $a.post(`${ii.apiUrl}upload-audio/`,we);_e.status===201&&(Re=_e.data.audio_url,Ae=_e.data.transcription_text||"[Audio]",W(Ve=>Ve.map(ze=>ze.id===ve?{...ze,audio_url:Re,content:Ae,status:"delivered"}:ze)))}catch(we){console.error("Audio upload failed:",we),W(_e=>_e.map(Ve=>Ve.id===ve?{...Ve,status:"failed"}:Ve));return}try{if(F&&F.readyState===WebSocket.OPEN){const we=JSON.stringify({audio_url:Re,message:Ae,additionalData:{isBusiness:!0,SessionId:g}});F.send(we)}Re&&te(Ae,r,g,Re,!1)}catch(we){console.error("Sending audio to API/WebSocket failed:",we),W(_e=>_e.map(Ve=>Ve.id===ve?{...Ve,status:"failed"}:Ve))}finally{j(null)}},{items:Ee,loading:je,addToCart:Ne,removeFromCart:ke,refresh:ye}=bne(g);function me(he,Se=20){return he.length>Se?`${he.slice(0,Se)}…`:he}const Le=x.useCallback(async(he,Se,ve=1)=>{await Ne(he,Se,ve);const Oe=me(Se,20);se(`✅ ${ve}× ${Oe} added to cart`)},[Ne]),Qe=x.useCallback(async(he,Se=1)=>{await ke(he,Se),se(`❌ Removed ${Se} item(s) from cart`)},[ke]);return J.jsxs("div",{className:"chatbot-box",children:[J.jsxs("div",{className:"chatbot-header",children:[J.jsx(Kr,{type:"text",style:{marginRight:8},onClick:()=>S("sessions"),icon:J.jsx(Xm,{})}),J.jsx(GT,{src:e||"https://t4.ftcdn.net/jpg/08/90/53/75/360_F_890537572_m7EIYLzXgeTYGDNoIr7KEDOElFUTzFy0.jpg"}),J.jsx("span",{className:"chatbot-title",children:t||"Ai Assistant"}),Ee.length>0&&J.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:J.jsx(yne,{items:Ee,loading:je,sessionId:g,onRefresh:ye,onRemove:ke,colorCode:a,sendMessage:oe})}),J.jsx(e0,{onClick:()=>p(!y),className:"chatbot-close",style:{marginLeft:"auto"}})]}),Q&&J.jsx(vne,{message:Q,onClose:()=>se(null)}),J.jsx(fne,{messages:Z,colorCode:a,isLoading:!1,handleAddToCart:Le,agentStatus:G,sessionId:g,handleRemoveFromCart:Qe,userType:o,calendly:E,disableCheckout:T,isfetchingMessage:ie}),J.jsxs("div",{className:"chatbot-input-area",children:[J.jsx(Pte,{sendMessageSuggestion:oe,colorCode:a,suggestions:f}),J.jsx(Bte,{userMessage:O,setUserMessage:M,handleSendMessage:ae,handleSendImage:le,handleSendVoice:ue,selectedImage:A,setSelectedImage:D,audioBlob:_,setAudioBlob:j,isSending:L}),J.jsx(Ute,{})]})]})};var PR=function(){return PR=Object.assign||function(t){for(var a,r=1,o=arguments.length;r<o;r++){a=arguments[r];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(t[c]=a[c])}return t},PR.apply(this,arguments)};function nu(e,t,a,r){function o(c){return c instanceof a?c:new a(function(f){f(c)})}return new(a||(a=Promise))(function(c,f){function m(y){try{p(r.next(y))}catch(S){f(S)}}function g(y){try{p(r.throw(y))}catch(S){f(S)}}function p(y){y.done?c(y.value):o(y.value).then(m,g)}p((r=r.apply(e,t||[])).next())})}function au(e,t){var a={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},r,o,c,f=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return f.next=m(0),f.throw=m(1),f.return=m(2),typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(p){return function(y){return g([p,y])}}function g(p){if(r)throw new TypeError("Generator is already executing.");for(;f&&(f=0,p[0]&&(a=0)),a;)try{if(r=1,o&&(c=p[0]&2?o.return:p[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,p[1])).done)return c;switch(o=0,c&&(p=[p[0]&2,c.value]),p[0]){case 0:case 1:c=p;break;case 4:return a.label++,{value:p[1],done:!1};case 5:a.label++,o=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(c=a.trys,!(c=c.length>0&&c[c.length-1])&&(p[0]===6||p[0]===2)){a=0;continue}if(p[0]===3&&(!c||p[1]>c[0]&&p[1]<c[3])){a.label=p[1];break}if(p[0]===6&&a.label<c[1]){a.label=c[1],c=p;break}if(c&&a.label<c[2]){a.label=c[2],a.ops.push(p);break}c[2]&&a.ops.pop(),a.trys.pop();continue}p=t.call(e,a)}catch(y){p=[6,y],o=0}finally{r=c=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function B5(e,t,a){if(a||arguments.length===2)for(var r=0,o=t.length,c;r<o;r++)(c||!(r in t))&&(c||(c=Array.prototype.slice.call(t,0,r)),c[r]=t[r]);return e.concat(c||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var P5="4.6.2";function xx(e,t){return new Promise(function(a){return setTimeout(a,e,t)})}function xne(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Cne(e,t){t===void 0&&(t=1/0);var a=window.requestIdleCallback;return a?new Promise(function(r){return a.call(window,function(){return r()},{timeout:t})}):xx(Math.min(e,t))}function U5(e){return!!e&&typeof e.then=="function"}function I5(e,t){try{var a=e();U5(a)?a.then(function(r){return t(!0,r)},function(r){return t(!1,r)}):t(!0,a)}catch(r){t(!1,r)}}function k5(e,t,a){return a===void 0&&(a=16),nu(this,void 0,void 0,function(){var r,o,c,f;return au(this,function(m){switch(m.label){case 0:r=Array(e.length),o=Date.now(),c=0,m.label=1;case 1:return c<e.length?(r[c]=t(e[c],c),f=Date.now(),f>=o+a?(o=f,[4,xne()]):[3,3]):[3,4];case 2:m.sent(),m.label=3;case 3:return++c,[3,1];case 4:return[2,r]}})})}function V0(e){return e.then(void 0,function(){}),e}function Ene(e,t){for(var a=0,r=e.length;a<r;++a)if(e[a]===t)return!0;return!1}function wne(e,t){return!Ene(e,t)}function UR(e){return parseInt(e)}function ss(e){return parseFloat(e)}function Ju(e,t){return typeof e=="number"&&isNaN(e)?t:e}function Wi(e){return e.reduce(function(t,a){return t+(a?1:0)},0)}function F5(e,t){if(t===void 0&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var a=1/t;return Math.round(e*a)/a}function Tne(e){for(var t,a,r="Unexpected syntax '".concat(e,"'"),o=/^\s*([a-z-]*)(.*)$/i.exec(e),c=o[1]||void 0,f={},m=/([.:#][\w-]+|\[.+?\])/gi,g=function(E,T){f[E]=f[E]||[],f[E].push(T)};;){var p=m.exec(o[2]);if(!p)break;var y=p[0];switch(y[0]){case".":g("class",y.slice(1));break;case"#":g("id",y.slice(1));break;case"[":{var S=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(y);if(S)g(S[1],(a=(t=S[4])!==null&&t!==void 0?t:S[5])!==null&&a!==void 0?a:"");else throw new Error(r);break}default:throw new Error(r)}}return[c,f]}function One(e){for(var t=new Uint8Array(e.length),a=0;a<e.length;a++){var r=e.charCodeAt(a);if(r>127)return new TextEncoder().encode(e);t[a]=r}return t}function lf(e,t){var a=e[0]>>>16,r=e[0]&65535,o=e[1]>>>16,c=e[1]&65535,f=t[0]>>>16,m=t[0]&65535,g=t[1]>>>16,p=t[1]&65535,y=0,S=0,E=0,T=0;T+=c+p,E+=T>>>16,T&=65535,E+=o+g,S+=E>>>16,E&=65535,S+=r+m,y+=S>>>16,S&=65535,y+=a+f,y&=65535,e[0]=y<<16|S,e[1]=E<<16|T}function wl(e,t){var a=e[0]>>>16,r=e[0]&65535,o=e[1]>>>16,c=e[1]&65535,f=t[0]>>>16,m=t[0]&65535,g=t[1]>>>16,p=t[1]&65535,y=0,S=0,E=0,T=0;T+=c*p,E+=T>>>16,T&=65535,E+=o*p,S+=E>>>16,E&=65535,E+=c*g,S+=E>>>16,E&=65535,S+=r*p,y+=S>>>16,S&=65535,S+=o*g,y+=S>>>16,S&=65535,S+=c*m,y+=S>>>16,S&=65535,y+=a*p+r*g+o*m+c*f,y&=65535,e[0]=y<<16|S,e[1]=E<<16|T}function up(e,t){var a=e[0];t%=64,t===32?(e[0]=e[1],e[1]=a):t<32?(e[0]=a<<t|e[1]>>>32-t,e[1]=e[1]<<t|a>>>32-t):(t-=32,e[0]=e[1]<<t|a>>>32-t,e[1]=a<<t|e[1]>>>32-t)}function Uo(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function Ua(e,t){e[0]^=t[0],e[1]^=t[1]}var Rne=[4283543511,3981806797],Ane=[3301882366,444984403];function q5(e){var t=[0,e[0]>>>1];Ua(e,t),wl(e,Rne),t[1]=e[0]>>>1,Ua(e,t),wl(e,Ane),t[1]=e[0]>>>1,Ua(e,t)}var Cx=[2277735313,289559509],Ex=[1291169091,658871167],G5=[0,5],Mne=[0,1390208809],_ne=[0,944331445];function Dne(e,t){var a=One(e);t=t||0;var r=[0,a.length],o=r[1]%16,c=r[1]-o,f=[0,t],m=[0,t],g=[0,0],p=[0,0],y;for(y=0;y<c;y=y+16)g[0]=a[y+4]|a[y+5]<<8|a[y+6]<<16|a[y+7]<<24,g[1]=a[y]|a[y+1]<<8|a[y+2]<<16|a[y+3]<<24,p[0]=a[y+12]|a[y+13]<<8|a[y+14]<<16|a[y+15]<<24,p[1]=a[y+8]|a[y+9]<<8|a[y+10]<<16|a[y+11]<<24,wl(g,Cx),up(g,31),wl(g,Ex),Ua(f,g),up(f,27),lf(f,m),wl(f,G5),lf(f,Mne),wl(p,Ex),up(p,33),wl(p,Cx),Ua(m,p),up(m,31),lf(m,f),wl(m,G5),lf(m,_ne);g[0]=0,g[1]=0,p[0]=0,p[1]=0;var S=[0,0];switch(o){case 15:S[1]=a[y+14],Uo(S,48),Ua(p,S);case 14:S[1]=a[y+13],Uo(S,40),Ua(p,S);case 13:S[1]=a[y+12],Uo(S,32),Ua(p,S);case 12:S[1]=a[y+11],Uo(S,24),Ua(p,S);case 11:S[1]=a[y+10],Uo(S,16),Ua(p,S);case 10:S[1]=a[y+9],Uo(S,8),Ua(p,S);case 9:S[1]=a[y+8],Ua(p,S),wl(p,Ex),up(p,33),wl(p,Cx),Ua(m,p);case 8:S[1]=a[y+7],Uo(S,56),Ua(g,S);case 7:S[1]=a[y+6],Uo(S,48),Ua(g,S);case 6:S[1]=a[y+5],Uo(S,40),Ua(g,S);case 5:S[1]=a[y+4],Uo(S,32),Ua(g,S);case 4:S[1]=a[y+3],Uo(S,24),Ua(g,S);case 3:S[1]=a[y+2],Uo(S,16),Ua(g,S);case 2:S[1]=a[y+1],Uo(S,8),Ua(g,S);case 1:S[1]=a[y],Ua(g,S),wl(g,Cx),up(g,31),wl(g,Ex),Ua(f,g)}return Ua(f,r),Ua(m,r),lf(f,m),lf(m,f),q5(f),q5(m),lf(f,m),lf(m,f),("00000000"+(f[0]>>>0).toString(16)).slice(-8)+("00000000"+(f[1]>>>0).toString(16)).slice(-8)+("00000000"+(m[0]>>>0).toString(16)).slice(-8)+("00000000"+(m[1]>>>0).toString(16)).slice(-8)}function Nne(e){var t;return PR({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
677
+ */const ane=nne("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]),rne=({sessionId:e,colorCode:t="#000"})=>{const[a,r]=x.useState(null),[o,c]=x.useState({}),[f,m]=x.useState(0),g=[0,1,2];return x.useEffect(()=>{if(!e)return;const p=new WebSocket(`${ii.websocketUrl}/support/${e}/`);return p.onmessage=({data:y})=>{const S=JSON.parse(y);r(S.stage),c(S.data||{})},p.onclose=()=>console.log("Support socket closed"),()=>p.close()},[e]),x.useEffect(()=>{let p,y;return a==="connecting"&&(y=Date.now(),m(100),p=window.setInterval(()=>{const S=(Date.now()-y)/1e3,E=Math.max(100-S/7*100,0);m(E),E<=0&&window.clearInterval(p)},100)),()=>{p&&window.clearInterval(p)}},[a]),a?J.jsx("div",{className:"bg-opacity-50 flex items-center justify-center z-50",children:J.jsxs(Jz,{children:[a==="email_sent"&&J.jsxs(Yi.div,{className:"bg-white rounded-2xl shadow-xl p-6 flex flex-col items-center",initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},children:[J.jsx(ane,{size:32,className:"mb-2",style:{color:t}}),J.jsx("p",{className:"text-lg font-semibold",children:"Sending your request to support…"}),J.jsx("div",{className:"flex space-x-2 mt-2",children:g.map((p,y)=>J.jsx(Yi.span,{className:"text-2xl",style:{color:t},animate:{scale:[.7,1.3,.7]},transition:{delay:y*.2,repeat:1/0,duration:.8},children:"•"},y))})]},"email"),a==="connecting"&&J.jsxs(Yi.div,{className:"bg-white rounded-2xl shadow-xl p-6 flex flex-col items-center",initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},children:[J.jsxs("div",{className:"flex items-center space-x-4",children:[J.jsx("img",{src:o.userImage,alt:"User",className:"w-12 h-12 rounded-full border-2",style:{borderColor:t}}),J.jsxs("p",{className:"text-lg",children:["Connecting you to"," ",J.jsx("span",{className:"text-indigo-600",children:o.agentName||"Support Agent"})]}),J.jsx("img",{src:o.companyImage,alt:"Company",className:"w-12 h-12 rounded-full border"})]}),J.jsx("div",{className:"flex space-x-2 mt-3",children:g.map((p,y)=>J.jsx(Yi.span,{className:"text-2xl",style:{color:t},animate:{scale:[.7,1.3,.7]},transition:{delay:y*.2,repeat:1/0,duration:.8},children:"•"},y))}),J.jsx("div",{className:"w-full bg-gray-200 h-1 rounded-full mt-4 overflow-hidden",children:J.jsx(Yi.div,{className:"h-full",style:{width:`${f}%`,backgroundColor:t},transition:{ease:"linear",duration:1}})})]},"connecting"),a==="auto"&&J.jsxs(Yi.div,{className:"bg-white rounded-2xl shadow-xl p-6 flex items-center space-x-4",initial:{y:50,opacity:0},animate:{y:0,opacity:1},exit:{y:-50,opacity:0},children:[J.jsx("img",{src:o.agentAvatar||"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSaC0jamaBcOGTbS86459UezKUs2Wo0lPU_mw&s",alt:"Auto Support",className:"w-12 h-12 rounded-2xl"}),J.jsxs("p",{className:"text-lg",children:["You’re now connected to"," ",J.jsx("span",{style:{color:t},children:o.agentName||"Auto-Support"})]})]},"auto")]})}):null},ine=({message:e})=>{const t=e.find(r=>r.type==="text")?.text,a=r=>{const o=/(https?:\/\/[^\s]+)/g;return r.split(o).map((c,f)=>o.test(c)?J.jsx("a",{href:c.trim(),style:{color:"black"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:c},f):J.jsx("span",{children:c},f))};return J.jsx(J.Fragment,{children:t&&J.jsx("div",{style:{color:"black",border:1,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word",backgroundColor:"#f0f0f0"},children:J.jsx("p",{children:a(t)})})})},one=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y})=>!y||y===0?null:J.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:J.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([S,E])=>{const T=t[S]||(E.length>0?E[0].variant_id:""),O=E.find(N=>N.variant_id===T)||E[0];if(!O)return null;const M=r[O.variant_id]||0,A=Array.from(new Set(E.map(N=>N.option?.trim()??"").filter(N=>N&&N.toLowerCase()!=="none"))),D=N=>{const V=E.find(B=>B.option===N);V&&a(B=>({...B,[S]:V.variant_id}))},_=async()=>{o(N=>({...N,[O.variant_id]:(N[O.variant_id]||0)+1})),await c(O.variant_id,O.name,1)},j=async()=>{M!==0&&(o(N=>({...N,[O.variant_id]:Math.max(0,(N[O.variant_id]||0)-1)})),await f(O.variant_id,1))},L=O.option??A[0]??"";return J.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[J.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(O.link,"_blank"),children:[J.jsx("img",{src:O.image,alt:O.name,className:"sallaX-img",loading:"lazy"}),J.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:N=>N.stopPropagation(),children:"View"})]}),J.jsxs("div",{className:"sallaX-body",children:[J.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:O.name,children:g(O.name)}),J.jsx("div",{className:"sallaX-row",children:J.jsx("span",{className:"sallaX-price","aria-label":"Price",children:O.price})}),A.length>0&&J.jsxs("div",{className:"sallaX-selectWrap",children:[J.jsx("label",{htmlFor:`sallaX-select-${S}`,className:"sallaX-selectLabel",children:"Choose an option"}),J.jsx("select",{id:`sallaX-select-${S}`,className:"sallaX-select","aria-label":"Choose an option",value:L,onChange:N=>D(N.target.value),children:A.map(N=>J.jsx("option",{value:N,children:N},N))})]}),J.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:j,"aria-label":"Decrease quantity",disabled:M===0,children:"–"}),J.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:M}),J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:_,"aria-label":"Increase quantity",children:"+"})]})]})]},S)})})}),lne=({message:e,colorCode:t,handleAddToCart:a,handleRemoveFromCart:r})=>{const[o,c]=x.useState({}),[f,m]=x.useState({}),g=_=>{const j=/(https?:\/\/[^\s]+)/g;return _.split(j).map((L,N)=>j.test(L)?J.jsx("a",{href:L.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:L},N):J.jsx("span",{children:L},N))},p=_=>{const j=_.trim();if(!j.includes("Name:")||!j.includes("VariantId"))return null;const L=j.match(/Name\s*[:\-]\s*(.+)/i),N=j.match(/Price\s*[:\-]\s*(.+)/i),V=j.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),B=j.match(/VariantId\s*[:\-]\s*(.+)/i),z=j.match(/variant_tag_name\s*[:\-]\s*(.+)/i),U=j.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!L||!N||!V||!B||!z?null:{name:L[1].trim(),price:N[1].trim(),link:V[1].trim(),image:"",variant_id:B[1].trim(),variant_tag_name:z[1].trim(),option:U?.[1]?.trim()}},y=x.useMemo(()=>{const _=e.split("|||").map(N=>N.trim()).filter(Boolean),j=[];let L=null;return _.forEach(N=>{if(N.startsWith("img - ")){const V=N.replace(/^img\s*[-:]\s*/,"").trim();if(L)L.image=V;else{const B=[...j].reverse().find(z=>z.type==="product");B&&(B.data.image=V)}}else if(N.includes("Name:")&&N.includes("VariantId")){const V=p(N);V&&(j.push({type:"product",data:V}),L=V)}else j.push({type:"text",data:N}),L=null}),j},[e]),S=x.useMemo(()=>{const _={};return y.forEach(j=>{if(j.type==="product"){const L=j.data;_[L.variant_tag_name]=_[L.variant_tag_name]||[],_[L.variant_tag_name].push(L)}}),_},[y]),E=(_,j=22)=>_.length>j?_.slice(0,j)+"...":_,[T,O]=x.useState(0),M=Object.keys(S).length,[A,D]=HR.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(_){O(_.track.details.rel)}});return J.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[y.filter(_=>_.type==="text").map((_,j)=>J.jsx("p",{className:"whitespace-pre-wrap break-words",children:g(_.data)},j)),Object.keys(S).length>0&&J.jsxs(J.Fragment,{children:[Object.keys(S).length>1&&J.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[J.jsx(Kr,{shape:"circle",icon:J.jsx(Xm,{}),onClick:()=>D.current?.prev(),disabled:T===0}),J.jsx(Kr,{shape:"circle",icon:J.jsx(K1,{}),onClick:()=>D.current?.next(),disabled:T===M-1})]}),J.jsx("div",{ref:A,className:"keen-slider",children:J.jsx(one,{groupedProducts:S,selectedVariants:f,setSelectedVariants:m,counts:o,setCounts:c,handleAddToCart:a,handleRemoveFromCart:r,colorCode:t,shortenName:E,sliderInstance:D,currentSlide:T,totalSlides:M,sliderRef:A})})]})]})},sne=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y})=>!y||y===0?null:J.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:J.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([S,E])=>{const T=t[S]||(E.length>0?E[0].variant_id:""),O=E.find(N=>N.variant_id===T)||E[0];if(!O)return null;const M=r[O.variant_id]||0,A=Array.from(new Set(E.map(N=>N.option?.trim()??"").filter(N=>N&&N.toLowerCase()!=="none"))),D=N=>{const V=E.find(B=>B.option===N);V&&a(B=>({...B,[S]:V.variant_id}))},_=async()=>{o(N=>({...N,[O.variant_id]:(N[O.variant_id]||0)+1})),await c(O.variant_id,O.name,1)},j=async()=>{M!==0&&(o(N=>({...N,[O.variant_id]:Math.max(0,(N[O.variant_id]||0)-1)})),await f(O.variant_id,1))},L=O.option??A[0]??"";return J.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[J.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(O.link,"_blank"),children:[J.jsx("img",{src:O.image,alt:O.name,className:"sallaX-img",loading:"lazy"}),J.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:N=>N.stopPropagation(),children:"View"})]}),J.jsxs("div",{className:"sallaX-body",children:[J.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:O.name,children:g(O.name)}),J.jsx("div",{className:"sallaX-row",children:J.jsx("span",{className:"sallaX-price","aria-label":"Price",children:O.price})}),A.length>0&&J.jsxs("div",{className:"sallaX-selectWrap",children:[J.jsx("label",{htmlFor:`sallaX-select-${S}`,className:"sallaX-selectLabel",children:"Choose an option"}),J.jsx("select",{id:`sallaX-select-${S}`,className:"sallaX-select","aria-label":"Choose an option",value:L,onChange:N=>D(N.target.value),children:A.map(N=>J.jsx("option",{value:N,children:N},N))})]}),J.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:j,"aria-label":"Decrease quantity",disabled:M===0,children:"–"}),J.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:M}),J.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:_,"aria-label":"Increase quantity",children:"+"})]})]})]},S)})})}),une=({message:e,colorCode:t,handleAddToCart:a,handleRemoveFromCart:r})=>{const[o,c]=x.useState({}),[f,m]=x.useState({}),g=_=>{const j=/(https?:\/\/[^\s]+)/g;return _.split(j).map((L,N)=>j.test(L)?J.jsx("a",{href:L.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:L},N):J.jsx("span",{children:L},N))},p=_=>{const j=_.trim();if(!j.includes("Name:")||!j.includes("VariantId"))return null;const L=j.match(/Name\s*[:\-]\s*(.+)/i),N=j.match(/Price\s*[:\-]\s*(.+)/i),V=j.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),B=j.match(/VariantId\s*[:\-]\s*(.+)/i),z=j.match(/variant_tag_name\s*[:\-]\s*(.+)/i),U=j.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!L||!N||!V||!B||!z?null:{name:L[1].trim(),price:N[1].trim(),link:V[1].trim(),image:"",variant_id:B[1].trim(),variant_tag_name:z[1].trim(),option:U?.[1]?.trim()}},y=x.useMemo(()=>{const _=e.split("|||").map(N=>N.trim()).filter(Boolean),j=[];let L=null;return _.forEach(N=>{if(N.startsWith("img - ")){const V=N.replace(/^img\s*[-:]\s*/,"").trim();if(L)L.image=V;else{const B=[...j].reverse().find(z=>z.type==="product");B&&(B.data.image=V)}}else if(N.includes("Name:")&&N.includes("VariantId")){const V=p(N);V&&(j.push({type:"product",data:V}),L=V)}else j.push({type:"text",data:N}),L=null}),j},[e]),S=x.useMemo(()=>{const _={};return y.forEach(j=>{if(j.type==="product"){const L=j.data;_[L.variant_tag_name]=_[L.variant_tag_name]||[],_[L.variant_tag_name].push(L)}}),_},[y]),E=(_,j=22)=>_.length>j?_.slice(0,j)+"...":_,[T,O]=x.useState(0),M=Object.keys(S).length,[A,D]=HR.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(_){O(_.track.details.rel)}});return J.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[y.filter(_=>_.type==="text").map((_,j)=>J.jsx("p",{className:"whitespace-pre-wrap break-words",children:g(_.data)},j)),Object.keys(S).length>0&&J.jsxs(J.Fragment,{children:[Object.keys(S).length>1&&J.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[J.jsx(Kr,{shape:"circle",icon:J.jsx(Xm,{}),onClick:()=>D.current?.prev(),disabled:T===0}),J.jsx(Kr,{shape:"circle",icon:J.jsx(K1,{}),onClick:()=>D.current?.next(),disabled:T===M-1})]}),J.jsx("div",{ref:A,className:"keen-slider",children:J.jsx(sne,{groupedProducts:S,selectedVariants:f,setSelectedVariants:m,counts:o,setCounts:c,handleAddToCart:a,handleRemoveFromCart:r,colorCode:t,shortenName:E,sliderInstance:D,currentSlide:T,totalSlides:M,sliderRef:A})})]})]})};function cne({calendlyLink:e}){const t=x.useRef(null),[a,r]=x.useState(!1);return x.useEffect(()=>{if(window.Calendly)r(!0);else{const o=document.createElement("script");return o.src="https://assets.calendly.com/assets/external/widget.js",o.async=!0,o.onload=()=>r(!0),document.body.appendChild(o),()=>{document.body.removeChild(o)}}},[]),x.useEffect(()=>{a&&e&&t.current&&window.Calendly&&window.Calendly.initInlineWidget({url:e,parentElement:t.current,prefill:{},utm:{}})},[a,e]),J.jsx("div",{ref:t,style:{minWidth:"320px",height:"350px",borderRadius:"8px",boxShadow:"0 0 10px rgba(0, 0, 0, 0.1)"}})}const fne=({messages:e,colorCode:t,handleAddToCart:a,handleRemoveFromCart:r,isLoading:o,agentStatus:c,sessionId:f,userType:m,calendly:g,disableCheckout:p,isfetchingMessage:y})=>{const S=x.useRef(null);return x.useEffect(()=>{if(!S.current)return;const E=setTimeout(()=>{S.current?.scrollIntoView({behavior:"smooth"})},150);return()=>clearTimeout(E)},[e]),y||o||!e?J.jsxs("div",{className:"loader-wrapper",style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",gap:"8px"},children:[J.jsx("div",{style:{backgroundColor:t},className:"box-loader"}),J.jsx("div",{style:{backgroundColor:t},className:"box-loader"}),J.jsx("div",{style:{backgroundColor:t},className:"box-loader"})]}):J.jsxs("div",{className:"chatbot-messages space-y-4",children:[e.map((E,T)=>E.typing?J.jsx("div",{className:"chat-msg typing",children:J.jsx(Ite,{color:t})},T):E.isConnect?J.jsx(rne,{sessionId:f}):E.role==="assistant"?Array.isArray(E.content)?J.jsxs("div",{className:"chat-msg assistant",style:{backgroundColor:"transparent",padding:0},children:[E.image_url&&J.jsx("img",{src:E.image_url,alt:"Chat image",style:{width:200},className:"rounded-md mt-2 max-w-xs border border-green-400 shadow-sm"}),J.jsx(L5,{message:E.content}),J.jsx("div",{className:"flex justify-start",children:J.jsx(ine,{message:E.content})})]},T):E.calendly?J.jsx("div",{style:{borderRadius:5,color:"white",width:"100%"},children:J.jsx(cne,{calendlyLink:g})},T):J.jsxs("div",{className:"chat-msg assistant",children:[E.image_url&&J.jsx("img",{src:E.image_url,alt:"Chat image",style:{width:200},className:"rounded-md mt-2 max-w-xs border border-green-400 shadow-sm"}),m==="shopify"?J.jsx(Gte,{message:E.content||E.text||"",colorCode:t,disableCheckout:p,handleAddToCart:a,handleRemoveFromCart:r}):m==="salla"?J.jsx(une,{message:E.content||E.text||"",colorCode:t,handleAddToCart:a,handleRemoveFromCart:r}):J.jsx(lne,{message:E.content||E.text||"",colorCode:t,handleAddToCart:a,handleRemoveFromCart:r})]},T):E?.audio_url?J.jsxs("div",{className:"chat-msg user",style:{backgroundColor:"transparent",padding:0},children:[J.jsx("div",{style:{borderRadius:12},children:J.jsx(Yte,{link:E.audio_url,transcription:E.content,colorCode:t})}),J.jsx("div",{className:"mt-1 mr-2 flex items-end justify-end",children:E.status==="uploading"?J.jsx(Wu,{indicator:J.jsx(Ks,{spin:!0}),size:"small"}):E.status==="delivered"?J.jsx(sO,{style:{color:"green"}}):E.status==="failed"?J.jsx(y0,{style:{color:"red"}}):null})]}):E.image_url?J.jsxs("div",{className:"chat-msg user",style:{backgroundColor:"transparent"},children:[J.jsx("img",{src:E.image_url,alt:"Chat image",style:{width:200},className:`rounded-md mt-2 max-w-xs ${E.content==="user"?"border border-gray-300 shadow-sm":"border border-green-400 shadow-sm"}`}),J.jsx("div",{className:"mt-1 mr-2 flex items-end justify-end",children:E.status==="uploading"?J.jsx(Wu,{indicator:J.jsx(Ks,{spin:!0}),size:"small"}):E.status==="delivered"?J.jsx(sO,{style:{color:"green"}}):E.status==="failed"?J.jsx(y0,{style:{color:"red"}}):null}),E.content&&J.jsx("div",{className:"flex justify-end mt-2",children:J.jsx("div",{style:{color:"white",border:1,backgroundColor:t,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word"},children:J.jsx("span",{children:E.content})})})]},T):Array.isArray(E.content)?J.jsxs("div",{className:"chat-msg user",style:{backgroundColor:"transparent",padding:0},children:[J.jsx("div",{style:{backgroundColor:"transparent",padding:0},children:J.jsx(L5,{message:E.content})}),J.jsx("div",{className:"flex justify-end",children:J.jsx(Xte,{message:E.content,colorCode:t})},T)]},T):J.jsx("div",{className:`chat-msg ${E.role}`,style:E.role==="user"?{backgroundColor:t,color:"#fff"}:{},children:J.jsx(Zte,{message:E.content,colorCode:t})},T)),J.jsx(Wte,{status:c?.status,user:c?.user}),J.jsx("div",{ref:S})]})},dne=e=>{const{disableChatbot:t,disableChatbotGlobally:a,isChatlogCreated:r,createNew:o,disableForm:c,calendlyLink:f,socket:m,newSession:g,setNewSession:p,setMessages:y}=e;return{apiCall:x.useCallback(async(E,T,O,M,A)=>{T&&(y(D=>[...D,{role:"assistant",content:"typing",typing:!0}]),await fetch(`${ii.apiUrl}chatlog-create/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({visitor_id:localStorage.getItem("visitor_id"),company_username:localStorage.getItem("company_username"),session_id:O})}),p(!1)),!t&&!a&&y(D=>[...D.filter(j=>!j.typing),{role:"assistant",content:"typing",typing:!0}]);try{const D=await fetch(`${ii.apiUrl}message-create/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:E,isBusiness:!0,session_id:O,organization:localStorage.getItem("company_username"),isImage:A,image_url:M})});if(D.ok){const _=await D.json();if(_.message_history){const j=_.isConnect?{role:"assistant",content:"Your support request is on its way—please stand by!",isConnect:!0,sender:"Ai Agent",isBusiness:!1,isHtml:_.isHtml}:{role:"assistant",content:_.message,sender:"Ai Agent",isBusiness:!1,isHtml:_.isHtml};m?.readyState===WebSocket.OPEN&&m.send(JSON.stringify({message:_.message,additionalData:{isBusiness:!1,SessionId:O,sender:"AI",response:"from_ai_web"}})),y(L=>{const V=[...L.filter(B=>!B.typing),j];return console.log(f),_.message&&f&&/book\s?(a\s?)?meeting|schedule\s?(a\s?)?(call|meeting)|let\s?('s)?\s?meet|set\s?up\s?(a\s?)?meeting|book\s?(an\s?)?appointment/i.test(_.message)&&(console.log("meeting please"),V.push({role:"assistant",content:"Scheduling a meeting...",isBusiness:!1,calendly:!0})),V})}else _.status==="success"&&y(j=>j.filter(L=>!L.typing))}else console.error("message-create failed")}catch(D){console.error("Message error:",D)}},[t,a,r,o,c,f,m,g])}};/*! js-cookie v3.0.5 | MIT */function Sx(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)e[r]=a[r]}return e}var hne={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function BR(e,t){function a(o,c,f){if(!(typeof document>"u")){f=Sx({},t,f),typeof f.expires=="number"&&(f.expires=new Date(Date.now()+f.expires*864e5)),f.expires&&(f.expires=f.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var m="";for(var g in f)f[g]&&(m+="; "+g,f[g]!==!0&&(m+="="+f[g].split(";")[0]));return document.cookie=o+"="+e.write(c,o)+m}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var c=document.cookie?document.cookie.split("; "):[],f={},m=0;m<c.length;m++){var g=c[m].split("="),p=g.slice(1).join("=");try{var y=decodeURIComponent(g[0]);if(f[y]=e.read(p,y),o===y)break}catch{}}return o?f[o]:f}}return Object.create({set:a,get:r,remove:function(o,c){a(o,"",Sx({},c,{expires:-1}))},withAttributes:function(o){return BR(this.converter,Sx({},this.attributes,o))},withConverter:function(o){return BR(Sx({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var mne=BR(hne,{path:"/"});const pne=e=>mne.get(e);function gne(e,t){const a=x.useRef(null),r=x.useRef(t);return x.useEffect(()=>{r.current=t},[t]),x.useEffect(()=>{if(!e)return;const o=new WebSocket(`${ii.websocketUrl}/chat/${e}/`);a.current=o;const c=m=>{try{const g=JSON.parse(m.data);r.current(g)}catch(g){console.error("Invalid JSON",g)}};o.addEventListener("message",c);const f=()=>{};return o.addEventListener("close",f),()=>{o.removeEventListener("message",c),o.removeEventListener("close",f),o.close()}},[e]),a.current}const vne=({message:e,onClose:t,duration:a=1e3})=>(x.useEffect(()=>{const r=setTimeout(t,a);return()=>clearTimeout(r)},[t,a]),J.jsx("div",{className:"jawebcss-notification",children:e}));function yne({items:e,loading:t,colorCode:a,sessionId:r,onRefresh:o,onRemove:c}){const[f,m]=x.useState(!1),g=x.useRef(null),[p,y]=x.useState(!1),S=async()=>{y(!0);try{const T=await fetch(`${ii.apiUrl}checkout/shopify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:r,company_username:localStorage.getItem("company_username")})});if(!T.ok)throw new Error("Failed to initiate checkout.");const O=await T.json();O?.checkoutUrl?window.parent?.postMessage({type:"JAWEB_CHAT",action:"navigate",target:"_blank",url:O.checkoutUrl},"*"):alert("No checkout URL returned.")}catch(T){console.error("Checkout error:",T)}finally{y(!1)}};x.useEffect(()=>{const T=O=>{g.current&&!g.current.contains(O.target)&&m(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const E=e.reduce((T,O)=>T+O.quantity,0);return J.jsxs("div",{className:"jawebchatbotcss-cart-widget",ref:g,children:[J.jsxs("button",{onClick:()=>m(T=>!T),className:"jawebchatbotcss-cart-button",children:[J.jsx(C6,{className:"jawebchatbotcss-cart-icon"}),J.jsxs("span",{className:"jawebchatbotcss-cart-label",children:["Cart (",E,")"]})]}),f&&J.jsxs("div",{className:"jawebchatbotcss-cart-dropdown",children:[J.jsxs("div",{className:"jawebchatbotcss-cart-header",children:[J.jsx("span",{className:"jawebchatbotcss-cart-title",children:"Your Cart"}),J.jsx("button",{onClick:o,disabled:t,className:"jawebchatbotcss-refresh-button",children:t?"Refreshing…":"Refresh"})]}),e.length===0?J.jsx("div",{className:"jawebchatbotcss-cart-empty",children:"Your cart is empty."}):J.jsx("ul",{className:"jawebchatbotcss-cart-list",children:e.map(T=>J.jsxs("li",{className:"jawebchatbotcss-cart-item",children:[J.jsx("span",{className:"jawebchatbotcss-item-name",children:T.name}),J.jsxs("div",{className:"jawebchatbotcss-item-controls",children:[J.jsxs("span",{className:"jawebchatbotcss-item-qty",children:["×",T.quantity]}),J.jsx(e0,{onClick:()=>c(T.variantId,T.quantity),className:"jawebchatbotcss-remove-icon"})]})]},T.variantId))}),e.length>0&&J.jsx("div",{className:"jawebchatbotcss-cart-footer",children:J.jsxs(Kr,{type:"primary",style:{backgroundColor:a},block:!0,disabled:E===0,loading:p,onClick:()=>{S()},children:["Checkout (",E,")"]})})]})]})}function bne(e){const[t,a]=x.useState([]),[r,o]=x.useState(!1),c=x.useCallback(async()=>{if(e){o(!0);try{const p=await(await fetch(`${ii.apiUrl}cart?session_id=${e}`)).json();a(p.items||[])}catch(g){console.error("Failed to fetch cart",g)}finally{o(!1)}}},[e]),f=async(g,p,y)=>{if(e){try{const S=await fetch(`${ii.apiUrl}cart/add/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:e,variantId:g,name:p,quantity:y})}),E=await S.json();if(S.ok)a(T=>T.find(M=>M.variantId===g)?T.map(M=>M.variantId===g?{...M,quantity:M.quantity+y}:M):[...T,{variantId:g,name:p,quantity:y}]);else throw new Error(E.error||"Failed to add to cart")}catch(S){throw S}await c()}},m=async(g,p)=>{if(e){a(y=>y.map(S=>S.variantId===g?{...S,quantity:S.quantity-p}:S).filter(S=>S.quantity>0));try{await fetch(`${ii.apiUrl}cart/remove/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:e,variantId:g,quantity:p})})}catch{}await c()}};return x.useEffect(()=>{c()},[c]),{items:t,loading:r,addToCart:f,removeFromCart:m,refresh:c}}const Sne=({chatbotLogo:e,agentName:t,colorCode:a,newSession:r,userType:o,setNewSession:c,messagesSuggestions:f,disableForm:m,sessionId:g,setOpen:p,Opened:y,setView:S,calendly:E,disbleCheckout:T})=>{const[O,M]=x.useState(""),[A,D]=x.useState(null),[_,j]=x.useState(null),[L,N]=x.useState(!1),[,V]=x.useState(()=>pne("new_user")==="true"),[B,z]=x.useState(!1),[,U]=x.useState(!1),[H,ee]=x.useState(!1),[,Y]=x.useState(!1),{messages:Z,setMessages:W,isFetchingMessages:ie}=$te(g),[G,k]=x.useState({}),[Q,se]=x.useState(null),q=x.useCallback(he=>{if(he.status){k({status:he.status,user:he.user||"Support"});return}const{additionalData:Se={},message:ve,image_url:Oe}=he;!Se.isBusiness&&Se.sender!=="AI"&&W(Re=>[...Re,{role:"assistant",content:ve,isBusiness:!1,sender:Se.sender,image_url:Oe}])},[W]),F=gne(g,q),{apiCall:te}=dne({disableChatbot:!1,disableChatbotGlobally:!1,isChatlogCreated:B,createNew:H,disableForm:m,calendlyLink:E,socket:F,newSession:r,setMessages:W,setNewSession:c}),ae=async()=>{if(!O.trim())return;let he=O;N(!0);const Se={role:"user",content:he};if(W(ve=>[...ve,Se]),F&&F.readyState===WebSocket.OPEN){const Oe=JSON.stringify({message:he,additionalData:{isBusiness:!0,SessionId:g}});F.send(Oe)}try{await te(O,r,g)}catch(ve){console.error(ve)}finally{N(!1)}},oe=async he=>{if(!he.trim())return;N(!0);const Se={role:"user",content:he};if(W(ve=>[...ve,Se]),F&&F.readyState===WebSocket.OPEN){const Oe=JSON.stringify({message:he,additionalData:{isBusiness:!0,SessionId:g}});F.send(Oe)}try{await te(he,r,g)}catch(ve){console.error("Error sending suggestion:",ve)}finally{N(!1)}};async function le(he,Se){const ve=Date.now(),Oe=URL.createObjectURL(he);if(!he)return;const Re={id:ve,role:"user",content:Se||"",image_url:Oe,isBusiness:!0,status:"uploading"};W(we=>[...we,Re]);let Ae=null;if(he)try{const we=new FormData;we.append("image",he);const _e=await $a.post(`${ii.apiUrl}upload-image/`,we);_e.status===201&&_e.data?.image_url&&(Ae=_e.data.image_url,W(Ve=>Ve.map(it=>it.id===ve&&Ae?{...it,image_url:Ae}:it)))}catch(we){console.error("Error uploading image:",we),W(_e=>_e.map(Ve=>Ve.id===ve?{...Ve,status:"failed"}:Ve));return}try{if(F&&F.readyState===WebSocket.OPEN){const we={isBusiness:!0,SessionId:g},_e=JSON.stringify({image_url:Ae||null,message:O.trim()||"",additionalData:we});F.send(_e)}Ae&&(W(we=>we.map(_e=>_e.id===ve?{..._e,status:"delivered"}:_e)),te(Se.trim()||"",r,g,Ae,!0))}catch(we){console.error("Error sending Image message:",we),W(_e=>_e.map(Ve=>Ve.id===ve?{...Ve,status:"failed"}:Ve))}finally{D(null)}}const ue=async he=>{if(!he)return;const Se=URL.createObjectURL(he),ve=Date.now(),Oe={id:ve,role:"user",content:"",audio_url:Se,isBusiness:!0,status:"uploading"};W(we=>[...we,Oe]);let Re,Ae="";try{const we=new FormData;we.append("audio",he);const _e=await $a.post(`${ii.apiUrl}upload-audio/`,we);_e.status===201&&(Re=_e.data.audio_url,Ae=_e.data.transcription_text||"[Audio]",W(Ve=>Ve.map(ze=>ze.id===ve?{...ze,audio_url:Re,content:Ae,status:"delivered"}:ze)))}catch(we){console.error("Audio upload failed:",we),W(_e=>_e.map(Ve=>Ve.id===ve?{...Ve,status:"failed"}:Ve));return}try{if(F&&F.readyState===WebSocket.OPEN){const we=JSON.stringify({audio_url:Re,message:Ae,additionalData:{isBusiness:!0,SessionId:g}});F.send(we)}Re&&te(Ae,r,g,Re,!1)}catch(we){console.error("Sending audio to API/WebSocket failed:",we),W(_e=>_e.map(Ve=>Ve.id===ve?{...Ve,status:"failed"}:Ve))}finally{j(null)}},{items:Ee,loading:je,addToCart:Ne,removeFromCart:ke,refresh:ye}=bne(g);function me(he,Se=20){return he.length>Se?`${he.slice(0,Se)}…`:he}const Le=x.useCallback(async(he,Se,ve=1)=>{try{await Ne(he,Se,ve);const Oe=me(Se,20);se(`✅ ${ve}× ${Oe} added to cart`)}catch(Oe){se(`❌ ${Oe.message||"Failed to add item"}`)}},[Ne]),Qe=x.useCallback(async(he,Se=1)=>{await ke(he,Se),se(`❌ Removed ${Se} item(s) from cart`)},[ke]);return J.jsxs("div",{className:"chatbot-box",children:[J.jsxs("div",{className:"chatbot-header",children:[J.jsx(Kr,{type:"text",style:{marginRight:8},onClick:()=>S("sessions"),icon:J.jsx(Xm,{})}),J.jsx(GT,{src:e||"https://t4.ftcdn.net/jpg/08/90/53/75/360_F_890537572_m7EIYLzXgeTYGDNoIr7KEDOElFUTzFy0.jpg"}),J.jsx("span",{className:"chatbot-title",children:t||"Ai Assistant"}),Ee.length>0&&J.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:J.jsx(yne,{items:Ee,loading:je,sessionId:g,onRefresh:ye,onRemove:ke,colorCode:a,sendMessage:oe})}),J.jsx(e0,{onClick:()=>p(!y),className:"chatbot-close",style:{marginLeft:"auto"}})]}),Q&&J.jsx(vne,{message:Q,onClose:()=>se(null)}),J.jsx(fne,{messages:Z,colorCode:a,isLoading:!1,handleAddToCart:Le,agentStatus:G,sessionId:g,handleRemoveFromCart:Qe,userType:o,calendly:E,disableCheckout:T,isfetchingMessage:ie}),J.jsxs("div",{className:"chatbot-input-area",children:[J.jsx(Pte,{sendMessageSuggestion:oe,colorCode:a,suggestions:f}),J.jsx(Bte,{userMessage:O,setUserMessage:M,handleSendMessage:ae,handleSendImage:le,handleSendVoice:ue,selectedImage:A,setSelectedImage:D,audioBlob:_,setAudioBlob:j,isSending:L}),J.jsx(Ute,{})]})]})};var PR=function(){return PR=Object.assign||function(t){for(var a,r=1,o=arguments.length;r<o;r++){a=arguments[r];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(t[c]=a[c])}return t},PR.apply(this,arguments)};function nu(e,t,a,r){function o(c){return c instanceof a?c:new a(function(f){f(c)})}return new(a||(a=Promise))(function(c,f){function m(y){try{p(r.next(y))}catch(S){f(S)}}function g(y){try{p(r.throw(y))}catch(S){f(S)}}function p(y){y.done?c(y.value):o(y.value).then(m,g)}p((r=r.apply(e,t||[])).next())})}function au(e,t){var a={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},r,o,c,f=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return f.next=m(0),f.throw=m(1),f.return=m(2),typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(p){return function(y){return g([p,y])}}function g(p){if(r)throw new TypeError("Generator is already executing.");for(;f&&(f=0,p[0]&&(a=0)),a;)try{if(r=1,o&&(c=p[0]&2?o.return:p[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,p[1])).done)return c;switch(o=0,c&&(p=[p[0]&2,c.value]),p[0]){case 0:case 1:c=p;break;case 4:return a.label++,{value:p[1],done:!1};case 5:a.label++,o=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(c=a.trys,!(c=c.length>0&&c[c.length-1])&&(p[0]===6||p[0]===2)){a=0;continue}if(p[0]===3&&(!c||p[1]>c[0]&&p[1]<c[3])){a.label=p[1];break}if(p[0]===6&&a.label<c[1]){a.label=c[1],c=p;break}if(c&&a.label<c[2]){a.label=c[2],a.ops.push(p);break}c[2]&&a.ops.pop(),a.trys.pop();continue}p=t.call(e,a)}catch(y){p=[6,y],o=0}finally{r=c=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function B5(e,t,a){if(a||arguments.length===2)for(var r=0,o=t.length,c;r<o;r++)(c||!(r in t))&&(c||(c=Array.prototype.slice.call(t,0,r)),c[r]=t[r]);return e.concat(c||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var P5="4.6.2";function xx(e,t){return new Promise(function(a){return setTimeout(a,e,t)})}function xne(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Cne(e,t){t===void 0&&(t=1/0);var a=window.requestIdleCallback;return a?new Promise(function(r){return a.call(window,function(){return r()},{timeout:t})}):xx(Math.min(e,t))}function U5(e){return!!e&&typeof e.then=="function"}function I5(e,t){try{var a=e();U5(a)?a.then(function(r){return t(!0,r)},function(r){return t(!1,r)}):t(!0,a)}catch(r){t(!1,r)}}function k5(e,t,a){return a===void 0&&(a=16),nu(this,void 0,void 0,function(){var r,o,c,f;return au(this,function(m){switch(m.label){case 0:r=Array(e.length),o=Date.now(),c=0,m.label=1;case 1:return c<e.length?(r[c]=t(e[c],c),f=Date.now(),f>=o+a?(o=f,[4,xne()]):[3,3]):[3,4];case 2:m.sent(),m.label=3;case 3:return++c,[3,1];case 4:return[2,r]}})})}function V0(e){return e.then(void 0,function(){}),e}function Ene(e,t){for(var a=0,r=e.length;a<r;++a)if(e[a]===t)return!0;return!1}function wne(e,t){return!Ene(e,t)}function UR(e){return parseInt(e)}function ss(e){return parseFloat(e)}function Ju(e,t){return typeof e=="number"&&isNaN(e)?t:e}function Wi(e){return e.reduce(function(t,a){return t+(a?1:0)},0)}function F5(e,t){if(t===void 0&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var a=1/t;return Math.round(e*a)/a}function Tne(e){for(var t,a,r="Unexpected syntax '".concat(e,"'"),o=/^\s*([a-z-]*)(.*)$/i.exec(e),c=o[1]||void 0,f={},m=/([.:#][\w-]+|\[.+?\])/gi,g=function(E,T){f[E]=f[E]||[],f[E].push(T)};;){var p=m.exec(o[2]);if(!p)break;var y=p[0];switch(y[0]){case".":g("class",y.slice(1));break;case"#":g("id",y.slice(1));break;case"[":{var S=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(y);if(S)g(S[1],(a=(t=S[4])!==null&&t!==void 0?t:S[5])!==null&&a!==void 0?a:"");else throw new Error(r);break}default:throw new Error(r)}}return[c,f]}function One(e){for(var t=new Uint8Array(e.length),a=0;a<e.length;a++){var r=e.charCodeAt(a);if(r>127)return new TextEncoder().encode(e);t[a]=r}return t}function lf(e,t){var a=e[0]>>>16,r=e[0]&65535,o=e[1]>>>16,c=e[1]&65535,f=t[0]>>>16,m=t[0]&65535,g=t[1]>>>16,p=t[1]&65535,y=0,S=0,E=0,T=0;T+=c+p,E+=T>>>16,T&=65535,E+=o+g,S+=E>>>16,E&=65535,S+=r+m,y+=S>>>16,S&=65535,y+=a+f,y&=65535,e[0]=y<<16|S,e[1]=E<<16|T}function wl(e,t){var a=e[0]>>>16,r=e[0]&65535,o=e[1]>>>16,c=e[1]&65535,f=t[0]>>>16,m=t[0]&65535,g=t[1]>>>16,p=t[1]&65535,y=0,S=0,E=0,T=0;T+=c*p,E+=T>>>16,T&=65535,E+=o*p,S+=E>>>16,E&=65535,E+=c*g,S+=E>>>16,E&=65535,S+=r*p,y+=S>>>16,S&=65535,S+=o*g,y+=S>>>16,S&=65535,S+=c*m,y+=S>>>16,S&=65535,y+=a*p+r*g+o*m+c*f,y&=65535,e[0]=y<<16|S,e[1]=E<<16|T}function up(e,t){var a=e[0];t%=64,t===32?(e[0]=e[1],e[1]=a):t<32?(e[0]=a<<t|e[1]>>>32-t,e[1]=e[1]<<t|a>>>32-t):(t-=32,e[0]=e[1]<<t|a>>>32-t,e[1]=a<<t|e[1]>>>32-t)}function Uo(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function Ua(e,t){e[0]^=t[0],e[1]^=t[1]}var Rne=[4283543511,3981806797],Ane=[3301882366,444984403];function q5(e){var t=[0,e[0]>>>1];Ua(e,t),wl(e,Rne),t[1]=e[0]>>>1,Ua(e,t),wl(e,Ane),t[1]=e[0]>>>1,Ua(e,t)}var Cx=[2277735313,289559509],Ex=[1291169091,658871167],G5=[0,5],Mne=[0,1390208809],_ne=[0,944331445];function Dne(e,t){var a=One(e);t=t||0;var r=[0,a.length],o=r[1]%16,c=r[1]-o,f=[0,t],m=[0,t],g=[0,0],p=[0,0],y;for(y=0;y<c;y=y+16)g[0]=a[y+4]|a[y+5]<<8|a[y+6]<<16|a[y+7]<<24,g[1]=a[y]|a[y+1]<<8|a[y+2]<<16|a[y+3]<<24,p[0]=a[y+12]|a[y+13]<<8|a[y+14]<<16|a[y+15]<<24,p[1]=a[y+8]|a[y+9]<<8|a[y+10]<<16|a[y+11]<<24,wl(g,Cx),up(g,31),wl(g,Ex),Ua(f,g),up(f,27),lf(f,m),wl(f,G5),lf(f,Mne),wl(p,Ex),up(p,33),wl(p,Cx),Ua(m,p),up(m,31),lf(m,f),wl(m,G5),lf(m,_ne);g[0]=0,g[1]=0,p[0]=0,p[1]=0;var S=[0,0];switch(o){case 15:S[1]=a[y+14],Uo(S,48),Ua(p,S);case 14:S[1]=a[y+13],Uo(S,40),Ua(p,S);case 13:S[1]=a[y+12],Uo(S,32),Ua(p,S);case 12:S[1]=a[y+11],Uo(S,24),Ua(p,S);case 11:S[1]=a[y+10],Uo(S,16),Ua(p,S);case 10:S[1]=a[y+9],Uo(S,8),Ua(p,S);case 9:S[1]=a[y+8],Ua(p,S),wl(p,Ex),up(p,33),wl(p,Cx),Ua(m,p);case 8:S[1]=a[y+7],Uo(S,56),Ua(g,S);case 7:S[1]=a[y+6],Uo(S,48),Ua(g,S);case 6:S[1]=a[y+5],Uo(S,40),Ua(g,S);case 5:S[1]=a[y+4],Uo(S,32),Ua(g,S);case 4:S[1]=a[y+3],Uo(S,24),Ua(g,S);case 3:S[1]=a[y+2],Uo(S,16),Ua(g,S);case 2:S[1]=a[y+1],Uo(S,8),Ua(g,S);case 1:S[1]=a[y],Ua(g,S),wl(g,Cx),up(g,31),wl(g,Ex),Ua(f,g)}return Ua(f,r),Ua(m,r),lf(f,m),lf(m,f),q5(f),q5(m),lf(f,m),lf(m,f),("00000000"+(f[0]>>>0).toString(16)).slice(-8)+("00000000"+(f[1]>>>0).toString(16)).slice(-8)+("00000000"+(m[0]>>>0).toString(16)).slice(-8)+("00000000"+(m[1]>>>0).toString(16)).slice(-8)}function Nne(e){var t;return PR({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
678
678
  `)},e)}function $ne(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function zne(e){return typeof e!="function"}function jne(e,t){var a=V0(new Promise(function(r){var o=Date.now();I5(e.bind(null,t),function(){for(var c=[],f=0;f<arguments.length;f++)c[f]=arguments[f];var m=Date.now()-o;if(!c[0])return r(function(){return{error:c[1],duration:m}});var g=c[1];if(zne(g))return r(function(){return{value:g,duration:m}});r(function(){return new Promise(function(p){var y=Date.now();I5(g,function(){for(var S=[],E=0;E<arguments.length;E++)S[E]=arguments[E];var T=m+Date.now()-y;if(!S[0])return p({error:S[1],duration:T});p({value:S[1],duration:T})})})})})}));return function(){return a.then(function(o){return o()})}}function Lne(e,t,a,r){var o=Object.keys(e).filter(function(f){return wne(a,f)}),c=V0(k5(o,function(f){return jne(e[f],t)},r));return function(){return nu(this,void 0,void 0,function(){var m,g,p,y,S;return au(this,function(E){switch(E.label){case 0:return[4,c];case 1:return m=E.sent(),[4,k5(m,function(T){return V0(T())},r)];case 2:return g=E.sent(),[4,Promise.all(g)];case 3:for(p=E.sent(),y={},S=0;S<o.length;++S)y[o[S]]=p[S];return[2,y]}})})}}function X5(){var e=window,t=navigator;return Wi(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function Vne(){var e=window,t=navigator;return Wi(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!X5()}function H0(){var e=window,t=navigator;return Wi(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,(t.vendor||"").indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function us(){var e=window,t=navigator;return Wi(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function IR(){var e=window,t=e.HTMLElement,a=e.Document;return Wi(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),a&&"pointerLockElement"in a.prototype])>=4}function B0(){var e=window;return $ne(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function Y5(){var e,t,a=window;return Wi(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in a,"mozInnerScreenX"in a,"CSSMozDocumentRule"in a,"CanvasCaptureMediaStream"in a])>=4}function Hne(){var e=window;return Wi([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3}function Bne(){var e=window,t=e.URLPattern;return Wi(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function Pne(){var e=window;return Wi(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function P0(){var e=window,t=navigator,a=e.CSS,r=e.HTMLButtonElement;return Wi([!("getStorageUpdates"in t),r&&"popover"in r.prototype,"CSSCounterStyleRule"in e,a.supports("font-size-adjust: ex-height 0.5"),a.supports("text-transform: full-width")])>=4}function Une(){if(navigator.platform==="iPad")return!0;var e=screen,t=e.width/e.height;return Wi(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function Ine(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function kne(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function kR(){var e=H0(),t=Y5(),a=window,r=navigator,o="connection";return e?Wi([!("SharedWorker"in a),r[o]&&"ontypechange"in r[o],!("sinkId"in new Audio)])>=2:t?Wi(["onorientationchange"in a,"orientation"in a,/android/i.test(r.appVersion)])>=2:!1}function Fne(){var e=navigator,t=window,a=Audio.prototype,r=t.visualViewport;return Wi(["srLatency"in a,"srChannelCount"in a,"devicePosture"in e,r&&"segments"in r,"getTextInformation"in Image.prototype])>=3}function qne(){return Yne()?-4:Gne()}function Gne(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(Xne())return-1;var a=4500,r=5e3,o=new t(1,r,44100),c=o.createOscillator();c.type="triangle",c.frequency.value=1e4;var f=o.createDynamicsCompressor();f.threshold.value=-50,f.knee.value=40,f.ratio.value=12,f.attack.value=0,f.release.value=.25,c.connect(f),f.connect(o.destination),c.start(0);var m=Wne(o),g=m[0],p=m[1],y=V0(g.then(function(S){return Zne(S.getChannelData(0).subarray(a))},function(S){if(S.name==="timeout"||S.name==="suspended")return-3;throw S}));return function(){return p(),y}}function Xne(){return us()&&!IR()&&!Pne()}function Yne(){return us()&&P0()&&B0()||H0()&&Fne()&&Bne()}function Wne(e){var t=3,a=500,r=500,o=5e3,c=function(){},f=new Promise(function(m,g){var p=!1,y=0,S=0;e.oncomplete=function(O){return m(O.renderedBuffer)};var E=function(){setTimeout(function(){return g(W5("timeout"))},Math.min(r,S+o-Date.now()))},T=function(){try{var O=e.startRendering();switch(U5(O)&&V0(O),e.state){case"running":S=Date.now(),p&&E();break;case"suspended":document.hidden||y++,p&&y>=t?g(W5("suspended")):setTimeout(T,a);break}}catch(M){g(M)}};T(),c=function(){p||(p=!0,S>0&&E())}});return[f,c]}function Zne(e){for(var t=0,a=0;a<e.length;++a)t+=Math.abs(e[a]);return t}function W5(e){var t=new Error(e);return t.name=e,t}function Z5(e,t,a){var r,o,c;return a===void 0&&(a=50),nu(this,void 0,void 0,function(){var f,m;return au(this,function(g){switch(g.label){case 0:f=document,g.label=1;case 1:return f.body?[3,3]:[4,xx(a)];case 2:return g.sent(),[3,1];case 3:m=f.createElement("iframe"),g.label=4;case 4:return g.trys.push([4,,10,11]),[4,new Promise(function(p,y){var S=!1,E=function(){S=!0,p()},T=function(A){S=!0,y(A)};m.onload=E,m.onerror=T;var O=m.style;O.setProperty("display","block","important"),O.position="absolute",O.top="0",O.left="0",O.visibility="hidden",t&&"srcdoc"in m?m.srcdoc=t:m.src="about:blank",f.body.appendChild(m);var M=function(){var A,D;S||(((D=(A=m.contentWindow)===null||A===void 0?void 0:A.document)===null||D===void 0?void 0:D.readyState)==="complete"?E():setTimeout(M,10))};M()})];case 5:g.sent(),g.label=6;case 6:return!((o=(r=m.contentWindow)===null||r===void 0?void 0:r.document)===null||o===void 0)&&o.body?[3,8]:[4,xx(a)];case 7:return g.sent(),[3,6];case 8:return[4,e(m,m.contentWindow)];case 9:return[2,g.sent()];case 10:return(c=m.parentNode)===null||c===void 0||c.removeChild(m),[7];case 11:return[2]}})})}function Kne(e){for(var t=Tne(e),a=t[0],r=t[1],o=document.createElement(a??"div"),c=0,f=Object.keys(r);c<f.length;c++){var m=f[c],g=r[m].join(" ");m==="style"?Qne(o.style,g):o.setAttribute(m,g)}return o}function Qne(e,t){for(var a=0,r=t.split(";");a<r.length;a++){var o=r[a],c=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(o);if(c){var f=c[1],m=c[2],g=c[4];e.setProperty(f,m,g||"")}}}function Jne(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(a){if(a instanceof Error&&a.name==="SecurityError")return!0;throw a}e=t}}var eae="mmMwWLliI0O&1",tae="48px",cp=["monospace","sans-serif","serif"],K5=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function nae(){var e=this;return Z5(function(t,a){var r=a.document;return nu(e,void 0,void 0,function(){var o,c,f,m,g,p,y,S,E,T,O,M;return au(this,function(A){for(o=r.body,o.style.fontSize=tae,c=r.createElement("div"),c.style.setProperty("visibility","hidden","important"),f={},m={},g=function(D){var _=r.createElement("span"),j=_.style;return j.position="absolute",j.top="0",j.left="0",j.fontFamily=D,_.textContent=eae,c.appendChild(_),_},p=function(D,_){return g("'".concat(D,"',").concat(_))},y=function(){return cp.map(g)},S=function(){for(var D={},_=function(V){D[V]=cp.map(function(B){return p(V,B)})},j=0,L=K5;j<L.length;j++){var N=L[j];_(N)}return D},E=function(D){return cp.some(function(_,j){return D[j].offsetWidth!==f[_]||D[j].offsetHeight!==m[_]})},T=y(),O=S(),o.appendChild(c),M=0;M<cp.length;M++)f[cp[M]]=T[M].offsetWidth,m[cp[M]]=T[M].offsetHeight;return[2,K5.filter(function(D){return E(O[D])})]})})})}function aae(){var e=navigator.plugins;if(e){for(var t=[],a=0;a<e.length;++a){var r=e[a];if(r){for(var o=[],c=0;c<r.length;++c){var f=r[c];o.push({type:f.type,suffixes:f.suffixes})}t.push({name:r.name,description:r.description,mimeTypes:o})}}return t}}function rae(){return iae(dae())}function iae(e){var t,a=!1,r,o,c=oae(),f=c[0],m=c[1];return lae(f,m)?(a=sae(m),e?r=o="skipped":(t=uae(f,m),r=t[0],o=t[1])):r=o="unsupported",{winding:a,geometry:r,text:o}}function oae(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function lae(e,t){return!!(t&&e.toDataURL)}function sae(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function uae(e,t){cae(e,t);var a=FR(e),r=FR(e);if(a!==r)return["unstable","unstable"];fae(e,t);var o=FR(e);return[o,a]}function cae(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var a="Cwm fjordbank gly ".concat("😃");t.fillText(a,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(a,4,45)}function fae(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var a=0,r=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];a<r.length;a++){var o=r[a],c=o[0],f=o[1],m=o[2];t.fillStyle=c,t.beginPath(),t.arc(f,m,40,0,Math.PI*2,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,Math.PI*2,!0),t.arc(60,60,20,0,Math.PI*2,!0),t.fill("evenodd")}function FR(e){return e.toDataURL()}function dae(){return us()&&P0()&&B0()}function hae(){var e=navigator,t=0,a;e.maxTouchPoints!==void 0?t=UR(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),a=!0}catch{a=!1}var r="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:a,touchStart:r}}function mae(){return navigator.oscpu}function pae(){var e=navigator,t=[],a=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(a!==void 0&&t.push([a]),Array.isArray(e.languages))H0()&&Hne()||t.push(e.languages);else if(typeof e.languages=="string"){var r=e.languages;r&&t.push(r.split(","))}return t}function gae(){return window.screen.colorDepth}function vae(){return Ju(ss(navigator.deviceMemory),void 0)}function yae(){if(!(us()&&P0()&&B0()))return bae()}function bae(){var e=screen,t=function(r){return Ju(UR(r),null)},a=[t(e.width),t(e.height)];return a.sort().reverse(),a}var Sae=2500,xae=10,wx,qR;function Cae(){if(qR===void 0){var e=function(){var t=GR();XR(t)?qR=setTimeout(e,Sae):(wx=t,qR=void 0)};e()}}function Eae(){var e=this;return Cae(),function(){return nu(e,void 0,void 0,function(){var t;return au(this,function(a){switch(a.label){case 0:return t=GR(),XR(t)?wx?[2,B5([],wx,!0)]:Ine()?[4,kne()]:[3,2]:[3,2];case 1:a.sent(),t=GR(),a.label=2;case 2:return XR(t)||(wx=t),[2,t]}})})}}function wae(){var e=this;if(us()&&P0()&&B0())return function(){return Promise.resolve(void 0)};var t=Eae();return function(){return nu(e,void 0,void 0,function(){var a,r;return au(this,function(o){switch(o.label){case 0:return[4,t()];case 1:return a=o.sent(),r=function(c){return c===null?null:F5(c,xae)},[2,[r(a[0]),r(a[1]),r(a[2]),r(a[3])]]}})})}}function GR(){var e=screen;return[Ju(ss(e.availTop),null),Ju(ss(e.width)-ss(e.availWidth)-Ju(ss(e.availLeft),0),null),Ju(ss(e.height)-ss(e.availHeight)-Ju(ss(e.availTop),0),null),Ju(ss(e.availLeft),null)]}function XR(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function Tae(){return Ju(UR(navigator.hardwareConcurrency),void 0)}function Oae(){var e,t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){var a=new t().resolvedOptions().timeZone;if(a)return a}var r=-Rae();return"UTC".concat(r>=0?"+":"").concat(r)}function Rae(){var e=new Date().getFullYear();return Math.max(ss(new Date(e,0,1).getTimezoneOffset()),ss(new Date(e,6,1).getTimezoneOffset()))}function Aae(){try{return!!window.sessionStorage}catch{return!0}}function Mae(){try{return!!window.localStorage}catch{return!0}}function _ae(){if(!(X5()||Vne()))try{return!!window.indexedDB}catch{return!0}}function Dae(){return!!window.openDatabase}function Nae(){return navigator.cpuClass}function $ae(){var e=navigator.platform;return e==="MacIntel"&&us()&&!IR()?Une()?"iPad":"iPhone":e}function zae(){return navigator.vendor||""}function jae(){for(var e=[],t=0,a=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<a.length;t++){var r=a[t],o=window[r];o&&typeof o=="object"&&e.push(r)}return e.sort()}function Lae(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=e.cookie.indexOf("cookietest=")!==-1;return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch{return!1}}function Vae(){var e=atob;return{abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}function Hae(e){var t=e===void 0?{}:e,a=t.debug;return nu(this,void 0,void 0,function(){var r,o,c,f,m,g;return au(this,function(p){switch(p.label){case 0:return Bae()?(r=Vae(),o=Object.keys(r),c=(g=[]).concat.apply(g,o.map(function(y){return r[y]})),[4,Pae(c)]):[2,void 0];case 1:return f=p.sent(),a&&Uae(r,f),m=o.filter(function(y){var S=r[y],E=Wi(S.map(function(T){return f[T]}));return E>S.length*.6}),m.sort(),[2,m]}})})}function Bae(){return us()||kR()}function Pae(e){var t;return nu(this,void 0,void 0,function(){var a,r,o,c,g,f,m,g;return au(this,function(p){switch(p.label){case 0:for(a=document,r=a.createElement("div"),o=new Array(e.length),c={},Q5(r),g=0;g<e.length;++g)f=Kne(e[g]),f.tagName==="DIALOG"&&f.show(),m=a.createElement("div"),Q5(m),m.appendChild(f),r.appendChild(m),o[g]=f;p.label=1;case 1:return a.body?[3,3]:[4,xx(50)];case 2:return p.sent(),[3,1];case 3:a.body.appendChild(r);try{for(g=0;g<e.length;++g)o[g].offsetParent||(c[e[g]]=!0)}finally{(t=r.parentNode)===null||t===void 0||t.removeChild(r)}return[2,c]}})})}function Q5(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function Uae(e,t){for(var a="DOM blockers debug:\n```",r=0,o=Object.keys(e);r<o.length;r++){var c=o[r];a+=`
679
679
  `.concat(c,":");for(var f=0,m=e[c];f<m.length;f++){var g=m[f];a+=`
680
680
  `.concat(t[g]?"🚫":"➡️"," ").concat(g)}}console.log("".concat(a,"\n```"))}function Iae(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var a=t[e];if(matchMedia("(color-gamut: ".concat(a,")")).matches)return a}}function kae(){if(J5("inverted"))return!0;if(J5("none"))return!1}function J5(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function Fae(){if(e2("active"))return!0;if(e2("none"))return!1}function e2(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var qae=100;function Gae(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=qae;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function Xae(){if(fp("no-preference"))return 0;if(fp("high")||fp("more"))return 1;if(fp("low")||fp("less"))return-1;if(fp("forced"))return 10}function fp(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function Yae(){if(t2("reduce"))return!0;if(t2("no-preference"))return!1}function t2(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function Wae(){if(n2("reduce"))return!0;if(n2("no-preference"))return!1}function n2(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function Zae(){if(a2("high"))return!0;if(a2("standard"))return!1}function a2(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var la=Math,Zi=function(){return 0};function Kae(){var e=la.acos||Zi,t=la.acosh||Zi,a=la.asin||Zi,r=la.asinh||Zi,o=la.atanh||Zi,c=la.atan||Zi,f=la.sin||Zi,m=la.sinh||Zi,g=la.cos||Zi,p=la.cosh||Zi,y=la.tan||Zi,S=la.tanh||Zi,E=la.exp||Zi,T=la.expm1||Zi,O=la.log1p||Zi,M=function(z){return la.pow(la.PI,z)},A=function(z){return la.log(z+la.sqrt(z*z-1))},D=function(z){return la.log(z+la.sqrt(z*z+1))},_=function(z){return la.log((1+z)/(1-z))/2},j=function(z){return la.exp(z)-1/la.exp(z)/2},L=function(z){return(la.exp(z)+1/la.exp(z))/2},N=function(z){return la.exp(z)-1},V=function(z){return(la.exp(2*z)-1)/(la.exp(2*z)+1)},B=function(z){return la.log(1+z)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:A(1e154),asin:a(.12312423423423424),asinh:r(1),asinhPf:D(1),atanh:o(.5),atanhPf:_(.5),atan:c(.5),sin:f(-1e300),sinh:m(1),sinhPf:j(1),cos:g(10.000000000123),cosh:p(1),coshPf:L(1),tan:y(-1e300),tanh:S(1),tanhPf:V(1),exp:E(1),expm1:T(1),expm1Pf:N(1),log1p:O(10),log1pPf:B(10),powPI:M(-100)}}var Qae="mmMwWLliI0fiflO&1",YR={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function Jae(){return ere(function(e,t){for(var a={},r={},o=0,c=Object.keys(YR);o<c.length;o++){var f=c[o],m=YR[f],g=m[0],p=g===void 0?{}:g,y=m[1],S=y===void 0?Qae:y,E=e.createElement("span");E.textContent=S,E.style.whiteSpace="nowrap";for(var T=0,O=Object.keys(p);T<O.length;T++){var M=O[T],A=p[M];A!==void 0&&(E.style[M]=A)}a[f]=E,t.append(e.createElement("br"),E)}for(var D=0,_=Object.keys(YR);D<_.length;D++){var f=_[D];r[f]=a[f].getBoundingClientRect().width}return r})}function ere(e,t){return t===void 0&&(t=4e3),Z5(function(a,r){var o=r.document,c=o.body,f=c.style;f.width="".concat(t,"px"),f.webkitTextSizeAdjust=f.textSizeAdjust="none",H0()?c.style.zoom="".concat(1/r.devicePixelRatio):us()&&(c.style.zoom="reset");var m=o.createElement("div");return m.textContent=B5([],Array(t/20<<0),!0).map(function(){return"word"}).join(" "),c.appendChild(m),e(o,c)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}function tre(){return navigator.pdfViewerEnabled}function nre(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function are(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(rre())return-3;try{return e.canMakePayments()?1:0}catch(t){return ire(t)}}var rre=Jne;function ire(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function ore(){var e,t=document.createElement("a"),a=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return a===void 0?void 0:String(a)}var r2=-1,i2=-2,lre=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),sre=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),ure=["FRAGMENT_SHADER","VERTEX_SHADER"],cre=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],o2="WEBGL_debug_renderer_info",fre="WEBGL_polygon_mode";function dre(e){var t,a,r,o,c,f,m=e.cache,g=l2(m);if(!g)return r2;if(!c2(g))return i2;var p=u2()?null:g.getExtension(o2);return{version:((t=g.getParameter(g.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((a=g.getParameter(g.VENDOR))===null||a===void 0?void 0:a.toString())||"",vendorUnmasked:p?(r=g.getParameter(p.UNMASKED_VENDOR_WEBGL))===null||r===void 0?void 0:r.toString():"",renderer:((o=g.getParameter(g.RENDERER))===null||o===void 0?void 0:o.toString())||"",rendererUnmasked:p?(c=g.getParameter(p.UNMASKED_RENDERER_WEBGL))===null||c===void 0?void 0:c.toString():"",shadingLanguageVersion:((f=g.getParameter(g.SHADING_LANGUAGE_VERSION))===null||f===void 0?void 0:f.toString())||""}}function hre(e){var t=e.cache,a=l2(t);if(!a)return r2;if(!c2(a))return i2;var r=a.getSupportedExtensions(),o=a.getContextAttributes(),c=[],f=[],m=[],g=[],p=[];if(o)for(var y=0,S=Object.keys(o);y<S.length;y++){var E=S[y];f.push("".concat(E,"=").concat(o[E]))}for(var T=s2(a),O=0,M=T;O<M.length;O++){var A=M[O],D=a[A];m.push("".concat(A,"=").concat(D).concat(lre.has(D)?"=".concat(a.getParameter(D)):""))}if(r)for(var _=0,j=r;_<j.length;_++){var L=j[_];if(!(L===o2&&u2()||L===fre&&gre())){var N=a.getExtension(L);if(!N){c.push(L);continue}for(var V=0,B=s2(N);V<B.length;V++){var A=B[V],D=N[A];g.push("".concat(A,"=").concat(D).concat(sre.has(D)?"=".concat(a.getParameter(D)):""))}}}for(var z=0,U=ure;z<U.length;z++)for(var H=U[z],ee=0,Y=cre;ee<Y.length;ee++){var Z=Y[ee],W=mre(a,H,Z);p.push("".concat(H,".").concat(Z,"=").concat(W.join(",")))}return g.sort(),m.sort(),{contextAttributes:f,parameters:m,shaderPrecisions:p,extensions:r,extensionParameters:g,unsupportedExtensions:c}}function l2(e){if(e.webgl)return e.webgl.context;var t=document.createElement("canvas"),a;t.addEventListener("webglCreateContextError",function(){return a=void 0});for(var r=0,o=["webgl","experimental-webgl"];r<o.length;r++){var c=o[r];try{a=t.getContext(c)}catch{}if(a)break}return e.webgl={context:a},a}function mre(e,t,a){var r=e.getShaderPrecisionFormat(e[t],e[a]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function s2(e){var t=Object.keys(e.__proto__);return t.filter(pre)}function pre(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function u2(){return Y5()}function gre(){return H0()||us()}function c2(e){return typeof e.getParameter=="function"}function vre(){var e=kR()||us();if(!e)return-2;if(!window.AudioContext)return-1;var t=new AudioContext().baseLatency;return t==null?-1:isFinite(t)?t:-3}function yre(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}var bre={fonts:nae,domBlockers:Hae,fontPreferences:Jae,audio:qne,screenFrame:wae,canvas:rae,osCpu:mae,languages:pae,colorDepth:gae,deviceMemory:vae,screenResolution:yae,hardwareConcurrency:Tae,timezone:Oae,sessionStorage:Aae,localStorage:Mae,indexedDB:_ae,openDatabase:Dae,cpuClass:Nae,platform:$ae,plugins:aae,touchSupport:hae,vendor:zae,vendorFlavors:jae,cookiesEnabled:Lae,colorGamut:Iae,invertedColors:kae,forcedColors:Fae,monochrome:Gae,contrast:Xae,reducedMotion:Yae,reducedTransparency:Wae,hdr:Zae,math:Kae,pdfViewerEnabled:tre,architecture:nre,applePay:are,privateClickMeasurement:ore,audioBaseLatency:vre,dateTimeLocale:yre,webGlBasics:dre,webGlExtensions:hre};function Sre(e){return Lne(bre,e,[])}var xre="$ if upgrade to Pro: https://fpjs.dev/pro";function Cre(e){var t=Ere(e),a=wre(t);return{score:t,comment:xre.replace(/\$/g,"".concat(a))}}function Ere(e){if(kR())return .4;if(us())return IR()&&!(P0()&&B0())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function wre(e){return F5(.99+.01*e,1e-4)}function Tre(e){for(var t="",a=0,r=Object.keys(e).sort();a<r.length;a++){var o=r[a],c=e[o],f="error"in c?"error":JSON.stringify(c.value);t+="".concat(t?"|":"").concat(o.replace(/([:|\\])/g,"\\$1"),":").concat(f)}return t}function f2(e){return JSON.stringify(e,function(t,a){return a instanceof Error?Nne(a):a},2)}function d2(e){return Dne(Tre(e))}function Ore(e){var t,a=Cre(e);return{get visitorId(){return t===void 0&&(t=d2(this.components)),t},set visitorId(r){t=r},confidence:a,components:e,version:P5}}function Rre(e){return e===void 0&&(e=50),Cne(e,e*2)}function Are(e,t){var a=Date.now();return{get:function(r){return nu(this,void 0,void 0,function(){var o,c,f;return au(this,function(m){switch(m.label){case 0:return o=Date.now(),[4,e()];case 1:return c=m.sent(),f=Ore(c),(t||r?.debug)&&console.log("Copy the text below to get the debug data:\n\n```\nversion: ".concat(f.version,`