@cimulate/copilot-widget 1.8.0 → 1.8.1

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.
@@ -5476,7 +5476,7 @@ const Jy = te.createContext({
5476
5476
  });
5477
5477
  }, []), v = te.useCallback(() => {
5478
5478
  const N = b.current;
5479
- N && (g({ type: "RESET" }), g({ type: "SET_CONNECTION_STATUS", status: "connecting" }), N.endConversation().then(() => N.createConversation(r)).then((M) => {
5479
+ N && (g({ type: "RESET" }), g({ type: "SET_CONNECTION_STATUS", status: "connecting" }), N.endConversation().then(() => (N.disconnect(), N.connect())).then(() => N.createConversation(r)).then((M) => {
5480
5480
  g({ type: "SET_CONVERSATION_ID", id: M }), g({ type: "SET_CONNECTION_STATUS", status: "connected" });
5481
5481
  }).catch((M) => {
5482
5482
  var q;
@@ -13,7 +13,7 @@
13
13
  `);return u===-1?"":o.stack.slice(u+1)})();try{if(!r.stack)r.stack=a;else if(a){const u=a.indexOf(`
14
14
  `),c=u===-1?-1:a.indexOf(`
15
15
  `,u+1),d=c===-1?"":a.slice(c+1);String(r.stack).endsWith(d)||(r.stack+=`
16
- `+a)}}catch(u){}}throw r}})}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=wi(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&Eu.assertOptions(r,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean),legacyInterceptorReqResOrdering:In.transitional(In.boolean)},!1),o!=null&&(j.isFunction(o)?n.paramsSerializer={serialize:o}:Eu.assertOptions(o,{encode:In.function,serialize:In.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Eu.assertOptions(n,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=a&&j.merge(a.common,a[n.method]);a&&j.forEach(["delete","get","head","post","put","patch","query","common"],x=>{delete a[x]}),n.headers=en.concat(u,a);const c=[];let d=!0;this.interceptors.request.forEach(function(S){if(typeof S.runWhen=="function"&&S.runWhen(n)===!1)return;d=d&&S.synchronous;const A=n.transitional||nd;A&&A.legacyInterceptorReqResOrdering?c.unshift(S.fulfilled,S.rejected):c.push(S.fulfilled,S.rejected)});const h=[];this.interceptors.response.forEach(function(S){h.push(S.fulfilled,S.rejected)});let m,g=0,b;if(!d){const x=[n0.bind(this),void 0];for(x.unshift(...c),x.push(...h),b=x.length,m=Promise.resolve(n);g<b;)m=m.then(x[g++],x[g++]);return m}b=c.length;let T=n;for(;g<b;){const x=c[g++],S=c[g++];try{T=x(T)}catch(A){S.call(this,A);break}}try{m=n0.call(this,T)}catch(x){return Promise.reject(x)}for(g=0,b=h.length;g<b;)m=m.then(h[g++],h[g++]);return m}getUri(t){t=wi(this.defaults,t);const n=Wm(t.baseURL,t.url,t.allowAbsoluteUrls);return Hm(n,t.params,t.paramsSerializer)}};j.forEach(["delete","get","head","options"],function(t){Ai.prototype[t]=function(n,r){return this.request(wi(r||{},{method:t,url:n,data:(r||{}).data}))}}),j.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,u,c){return this.request(wi(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:u}))}}Ai.prototype[t]=n(),t!=="query"&&(Ai.prototype[t+"Form"]=n(!0))});let pw=class O_{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const u=new Promise(c=>{r.subscribe(c),a=c}).then(o);return u.cancel=function(){r.unsubscribe(a)},u},t(function(a,u,c){r.reason||(r.reason=new Ns(a,u,c),n(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 n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new O_(function(o){t=o}),cancel:t}}};function mw(e){return function(n){return e.apply(null,n)}}function gw(e){return j.isObject(e)&&e.isAxiosError===!0}const ld={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ld).forEach(([e,t])=>{ld[t]=e});function i0(e){const t=new Ai(e),n=Am(Ai.prototype.request,t);return j.extend(n,Ai.prototype,t,{allOwnKeys:!0}),j.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return i0(wi(e,o))},n}const bt=i0(ks);bt.Axios=Ai,bt.CanceledError=Ns,bt.CancelToken=pw,bt.isCancel=$m,bt.VERSION=sd,bt.toFormData=hu,bt.AxiosError=Ce,bt.Cancel=bt.CanceledError,bt.all=function(t){return Promise.all(t)},bt.spread=mw,bt.isAxiosError=gw,bt.mergeConfig=wi,bt.AxiosHeaders=en,bt.formToJSON=e=>jm(j.isHTMLForm(e)?new FormData(e):e),bt.getAdapter=t0.getAdapter,bt.HttpStatusCode=ld,bt.default=bt;const{Axios:VM,AxiosError:YM,CanceledError:qM,isCancel:WM,CancelToken:GM,VERSION:KM,all:QM,Cancel:XM,isAxiosError:JM,spread:ZM,toFormData:eF,AxiosHeaders:tF,HttpStatusCode:nF,formToJSON:rF,getAdapter:iF,mergeConfig:oF,create:sF}=bt;class Ew{constructor(t,n,r,o=!1){Ne(this,"CIMULATE_API_HEADER","x-cimulate-api-key");Ne(this,"CIMULATE_SEARCH_API_HOST","search.cimulate");Ne(this,"CIMULATE_SEARCH_API_PATH","api/v1");Ne(this,"baseApiUrl");Ne(this,"headers",{});Ne(this,"fetchConfig",()=>et(this,null,function*(){try{const t=yield bt.get(`${this.apiUrl}/configs/copilot`,{headers:this.headers}),{customer_config:n}=t.data,r=atob(n);return JSON.parse(r)}catch(t){throw console.error("Error fetching customer config:",t),t}}));Ne(this,"_mapCopilotUrlToSearchUrl",(t="",n=!1)=>{if(t.endsWith("io")){const o=new URL(t);return o.hostname=o.hostname.replace(/^copilot\./,"api."),o.origin}return n?`https://staging.${this.CIMULATE_SEARCH_API_HOST}.ai`:`https://prod.${this.CIMULATE_SEARCH_API_HOST}.ai`});if(n&&r||!n&&!r)throw new Error("Provide exactly one authentication method: either 'apiKey' or 'apiToken', but not both.");n?this.headers[this.CIMULATE_API_HEADER]=n:r&&(this.headers.Authorization=`Bearer ${r}`),this.baseApiUrl=this._mapCopilotUrlToSearchUrl(t,o)}get apiUrl(){return`${this.baseApiUrl}/${this.CIMULATE_SEARCH_API_PATH}`}}class yw{constructor(t,n,r,o=!1){Ne(this,"apiService");Ne(this,"config",null);Ne(this,"getConfig",()=>et(this,null,function*(){if(this.config)return this.config;try{const t=yield this.apiService.fetchConfig();return this.config=t,this.config}catch(t){throw console.error("Failed to fetch customer config:",t),t}}));Ne(this,"getPid",t=>this.getProductFieldValue(t,"pidCol"));Ne(this,"getName",t=>this.getProductFieldValue(t,"nameCol"));Ne(this,"getDescription",t=>this.getProductFieldValue(t,"description"));Ne(this,"getBrand",t=>this.getProductFieldValue(t,"productBrandCol"));Ne(this,"getPrice",t=>this.getProductFieldValue(t,"priceCol"));Ne(this,"getRelativePdp",t=>this.getProductFieldValue(t,"relativePdpCol"));Ne(this,"getPdp",t=>this.getProductFieldValue(t,"pdpCol"));Ne(this,"getImage",t=>this.getProductFieldValue(t,"imageCol"));Ne(this,"getProductHiddenFields",()=>{const t=this.getProductField("productHiddenFields");return Array.isArray(t)?t:[]});Ne(this,"getProductField",t=>this.config?this.config[t]:"");Ne(this,"getProductFieldValue",(t,n)=>{const r=this.getProductField(n);return r&&t[r]||""});this.apiService=new Ew(t,n,r,o)}getPriceDisplay(t){const n=this.getPrice(t);return n?typeof n=="string"?n.includes("$")?n:`$${n}`:typeof n=="number"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(n):n:""}}const Ci=(e,t,n,...r)=>{if(!e)return;const o=["background: linear-gradient(90deg,rgba(253, 99, 99, 1) 0%, rgba(245, 139, 35, 1) 65%)","font-weight: bold","color: transparent","background-clip: text","text-fill-color: transparent"].join(";");console[t]("%c[cimulate-widget]",o,n,...r)};class Tw{constructor(t=!1){Ne(this,"isDevelopment");Ne(this,"_log",(t,n,...r)=>{Ci(this.isDevelopment,t,n,...r)});this.isDevelopment=t}log(t,...n){this._log("log",t,...n)}warn(t,...n){this._log("warn",t,...n)}error(t,...n){this._log("error",t,...n)}info(t,...n){this._log("info",t,...n)}debug(t,...n){this._log("debug",t,...n)}}const o0=te.createContext(null),bw=({mode:e,logoUrl:t,headerText:n="Your Search Assistant",globalClassName:r="",entryMessage:o,openLinksInNewTab:a=!1,disclaimerText:u,disclaimerMarkdown:c,clientContext:d,searchPlaceholder:h,searchButtonLabel:m,searchConfig:g,componentConfig:b,conversationHistory:T,resetConversationMessage:x="",apiKey:S,apiToken:A,baseUrl:v,theme:I,isDevelopment:k,__features:M,children:Y})=>{const F=te.useMemo(()=>e==="messaging"?{config:null}:new yw(v,S,A,k),[e,v,S,A,k]),J=te.useMemo(()=>new Tw(k),[k]);te.useEffect(()=>{e!=="messaging"&&(!F||F.config||F.getConfig())},[F,e]);const Ee=te.useMemo(()=>Rx(I),[I]),xe=te.useMemo(()=>{const se=(g==null?void 0:g.placeholder)||h,me=(g==null?void 0:g.buttonLabel)||m;let de="icon";return g!=null&&g.buttonType?de=g.buttonType:m&&(de="text"),re(U({},g||{}),{placeholder:se,buttonLabel:me,buttonType:de})},[g,h,m]),z=te.useMemo(()=>({configModule:F,logoUrl:t,headerText:n,entryMessage:o,globalClassName:r,openLinksInNewTab:a,disclaimerText:u,disclaimerMarkdown:c,clientContext:d,themeVariables:Ee,logger:J,searchConfig:xe,enableMinimize:!!(b!=null&&b.enableMinimize),resetConversationMessage:x,conversationHistory:{sinceHours:typeof(T==null?void 0:T.sinceHours)=="number"?T.sinceHours:1,limit:T==null?void 0:T.limit},features:M}),[F,t,n,o,r,d,u,c,a,xe,b,x,J,Ee,T,M]);return L.jsx(o0.Provider,{value:z,children:Y})},tn=()=>{const e=te.useContext(o0);if(!e)throw new Error("useConfig must be used within a ConfigProvider");return e},s0={connectionStatus:"disconnected",loading:!0,conversationId:null,messages:[],streamingContent:"",isAgentTyping:!1,routingResult:null,error:null};function _w(e,t){switch(t.type){case"SET_CONNECTION_STATUS":return U(re(U({},e),{connectionStatus:t.status}),t.status==="connected"||t.status==="connecting"?{error:null}:{});case"SET_LOADING":return re(U({},e),{loading:t.isLoading});case"SET_CONVERSATION_ID":return re(U({},e),{conversationId:t.id});case"ADD_MESSAGE":return re(U({},e),{messages:[...e.messages,re(U({},t.message),{type:"ADD_MESSAGE"})]});case"APPEND_STREAMING_TOKEN":return re(U({},e),{streamingContent:e.streamingContent+t.token});case"FLUSH_STREAMING":return re(U({},e),{messages:[...e.messages,re(U({},t.message),{type:"FLUSH_STREAMING"})],streamingContent:"",isAgentTyping:!1,loading:!1});case"SET_AGENT_TYPING":return re(U({},e),{isAgentTyping:t.isTyping,loading:t.isTyping});case"SET_ROUTING_RESULT":return re(U({},e),{routingResult:t.result});case"SET_ERROR":return re(U({},e),{error:t.error,loading:!1});case"RESET":return re(U({},s0),{connectionStatus:e.connectionStatus,loading:!0});default:return e}}const a0=te.createContext({connectionStatus:"disconnected",isConnected:!1,isAgentTyping:!1,conversationId:null,messages:[],streamingContent:"",loading:!0,error:null,sendMessage:()=>{},resetConversation:()=>{}}),u0=({scrt2Url:e,orgId:t,esDeveloperName:n,routingAttributes:r,enableLogging:o=!1,onConnect:a,onMessage:u,onError:c,children:d})=>{const{logger:h}=tn(),[m,g]=te.useReducer(_w,s0),b=te.useRef(null),T=te.useRef(u),x=te.useRef(c),S=te.useRef(a);T.current=u,x.current=c,S.current=a,te.useEffect(()=>{const k=new Ix({baseURL:e,orgId:t,esDeveloperName:n,options:{enableLogging:o}});return b.current=k,k.on("connected",()=>{var M;g({type:"SET_CONNECTION_STATUS",status:"connected"}),(M=S.current)==null||M.call(S)}),k.on("disconnected",()=>{g({type:"SET_CONNECTION_STATUS",status:"disconnected"})}),k.on("reconnecting",()=>{g({type:"SET_CONNECTION_STATUS",status:"reconnecting"})}),k.on("message",M=>{var F;const Y={id:M.messageId||crypto.randomUUID(),role:"agent",content:M.content,timestamp:M.timestamp,sender:M.sender,raw:M};g({type:"FLUSH_STREAMING",message:Y}),(F=T.current)==null||F.call(T,Y)}),k.on("streaming_token",M=>{g({type:"APPEND_STREAMING_TOKEN",token:M.token})}),k.on("typing_started",()=>{g({type:"SET_AGENT_TYPING",isTyping:!0})}),k.on("typing_stopped",()=>{g({type:"SET_AGENT_TYPING",isTyping:!1})}),k.on("routing_result",M=>{var Y;if(g({type:"SET_ROUTING_RESULT",result:M}),!M.isSuccessful){const F=`Routing failed: ${M.failureType||"unknown"}`;g({type:"SET_ERROR",error:F}),(Y=x.current)==null||Y.call(x,F)}}),k.on("participant_changed",M=>{if(M.participant.name==="Automated Process")return;const Y={id:crypto.randomUUID(),role:"system",content:M.action==="add"?`${M.participant.name||"Agent"} joined the conversation`:`${M.participant.name||"Agent"} left the conversation`,timestamp:new Date().toISOString()};h==null||h.log("🦜 MessagingProvider participant_changed event received",{event:M}),g({type:"ADD_MESSAGE",message:Y})}),k.on("conversation_closed",()=>{const M={id:crypto.randomUUID(),role:"system",content:"Conversation reset",timestamp:new Date().toISOString()};g({type:"ADD_MESSAGE",message:M}),g({type:"SET_CONVERSATION_ID",id:null})}),k.on("error",M=>{var Y;h==null||h.log("🦜 MessagingProvider ERROR event received",{event:M}),g({type:"SET_ERROR",error:M.message}),M.recoverable||g({type:"SET_CONNECTION_STATUS",status:"error"}),(Y=x.current)==null||Y.call(x,M.message)}),g({type:"SET_CONNECTION_STATUS",status:"connecting"}),k.connect().then(()=>k.createConversation(r)).then(M=>{g({type:"SET_CONVERSATION_ID",id:M})}).catch(M=>{var Y;g({type:"SET_CONNECTION_STATUS",status:"error"}),g({type:"SET_ERROR",error:M.message}),(Y=x.current)==null||Y.call(x,M.message)}),()=>{k.endConversation().finally(()=>{k.disconnect(),k.off()}),b.current=null}},[e,t,n]);const A=te.useCallback(k=>{if(!k.trim())return;const M=b.current;if(!M)return;const Y={id:crypto.randomUUID(),role:"user",content:k,timestamp:new Date().toISOString()};g({type:"ADD_MESSAGE",message:Y}),g({type:"SET_LOADING",isLoading:!0}),M.sendMessage(k).catch(F=>{var J;g({type:"SET_ERROR",error:F.message}),(J=x.current)==null||J.call(x,F.message)})},[]),v=te.useCallback(()=>{const k=b.current;k&&(g({type:"RESET"}),g({type:"SET_CONNECTION_STATUS",status:"connecting"}),k.endConversation().then(()=>k.createConversation(r)).then(M=>{g({type:"SET_CONVERSATION_ID",id:M}),g({type:"SET_CONNECTION_STATUS",status:"connected"})}).catch(M=>{var Y;g({type:"SET_ERROR",error:M.message}),g({type:"SET_CONNECTION_STATUS",status:"error"}),(Y=x.current)==null||Y.call(x,M.message)}))},[r]),I=te.useMemo(()=>({connectionStatus:m.connectionStatus,isConnected:m.connectionStatus==="connected",isAgentTyping:m.isAgentTyping,conversationId:m.conversationId,messages:m.messages,streamingContent:m.streamingContent,error:m.error,loading:m.loading,sendMessage:A,resetConversation:v}),[m,A,v]);return L.jsx(a0.Provider,{value:I,children:d})};function xw(){var e=te.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Sw(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)}function ww(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)}var cd=typeof window!="undefined",yu=function(e){te.useEffect(e,[])},Aw=function(e){var t=te.useRef(e);t.current=e,yu(function(){return function(){return t.current()}})},Cw=function(e){var t=te.useRef(0),n=te.useState(e),r=n[0],o=n[1],a=te.useCallback(function(u){cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){o(u)})},[]);return Aw(function(){cancelAnimationFrame(t.current)}),[r,a]},vw=function(e,t){return e===t};function kw(e,t){t===void 0&&(t=vw);var n=te.useRef(),r=te.useRef(e),o=xw();return!o&&!t(r.current,e)&&(n.current=r.current,r.current=e),n.current}var Nw=function(e){var t={},n=t.initialWidth,r=n===void 0?1/0:n,o=t.initialHeight,a=o===void 0?1/0:o,u=t.onChange,c=Cw({width:cd?window.innerWidth:r,height:cd?window.innerHeight:a}),d=c[0],h=c[1];return te.useEffect(function(){if(cd){var m=function(){var g=window.innerWidth,b=window.innerHeight;h({width:g,height:b}),u&&u(g,b)};return Sw(window,"resize",m),function(){ww(window,"resize",m)}}},[]),d};const Tu="cimulate",Ow=`${Tu}:pdp-update`,Iw=`${Tu}:browse-update`,Pw=`${Tu}:search-update`,dd=`${Tu}:ui-state-update`,ar=U({CONTEXT_UPDATED:"browse-context-updated",CATEGORY_ID_CHANGED:"category-id-changed",CATEGORY_NAME_CHANGED:"category-name-changed"},wm),Rw={"browse-context":ar.CONTEXT_UPDATED,categoryId:ar.CATEGORY_ID_CHANGED,categoryName:ar.CATEGORY_NAME_CHANGED,page:ar.PAGE_CHANGED,pageSize:ar.PAGE_SIZE_CHANGED,includeFacets:ar.FACET_FILTERS_CHANGED,facetFilters:ar.FACET_FILTERS_CHANGED,rangeFilters:ar.RANGE_FILTERS_CHANGED,catalogSegment:ar.CATALOG_SEGMENT_CHANGED,pricebooks:ar.PRICEBOOKS_CHANGED},Lw=e=>{window.addEventListener(dd,e)},Dw=e=>{window.removeEventListener(dd,e)},Mw=(e,t)=>{const n=new CustomEvent(dd,{detail:{property:e,value:t}});window.dispatchEvent(n)},l0=e=>{if(!["ask_cim","search","browse","pdp"].includes(e))throw new Error(`Invalid entryType: "${e}". Must be 'ask_cim', 'search', 'browse', or 'pdp'.`);at.entryTypeProxy.entryType=e},vi=e=>{const t=at.statusProxy.isOpen,n=typeof e=="boolean"?e:!t;at.statusProxy.isOpen=n,n&&(at.statusProxy.isMinimized=!1)},bu=e=>{const t=at.statusProxy.isMinimized,n=typeof e=="boolean"?e:!t;at.statusProxy.isMinimized=n,n&&(at.statusProxy.isOpen=!1)},fd=e=>{at.modalProxy.isFullscreen=e},_u=e=>{if(!["chat","dialog","modal"].includes(e))throw new Error(`Invalid type: ${e}. Must be 'chat', 'dialog', or 'modal'.`);at.statusProxy.type=e,e==="dialog"||e==="chat"?at.modeProxy.mode="embedded":at.modeProxy.mode="standalone"},hd=e=>{const t=["top","top-left","top-right","bottom","bottom-left","bottom-right","left","right","center"];if(!t.includes(e))throw new Error(`Invalid position: ${e}. Must be one of ${t.join(", ")}.`);at.dialogProxy.position=e};class Fw{constructor(){Ne(this,"initialState",{connected:!1,mode:"embedded",entryType:"search",status:{type:"dialog",isOpen:!1,isMinimized:!1},dialog:{position:"bottom-left"},modal:{isFullscreen:!1}});Ne(this,"connectedProxy");Ne(this,"modeProxy");Ne(this,"entryTypeProxy");Ne(this,"statusProxy");Ne(this,"dialogProxy");Ne(this,"modalProxy",{isFullscreen:!1});Ne(this,"_fullGet",(t,n)=>Reflect.get(t,n));Ne(this,"_fullSet",(t,n,r)=>{if(!(n in t))throw new Error(`Property ${n} does not exist on UIState`);return Mw(n,r),Reflect.set(t,n,r)});this.connectedProxy=new Proxy({connected:this.initialState.connected},{get:this._fullGet,set:this._fullSet}),this.modeProxy=new Proxy({mode:this.initialState.mode},{get:this._fullGet,set:this._fullSet}),this.entryTypeProxy=new Proxy({entryType:this.initialState.entryType},{get:this._fullGet,set:this._fullSet}),this.statusProxy=new Proxy({type:this.initialState.status.type,isOpen:this.initialState.status.isOpen,isMinimized:this.initialState.status.isMinimized},{get:this._fullGet,set:this._fullSet}),this.dialogProxy=new Proxy({position:this.initialState.dialog.position},{get:this._fullGet,set:this._fullSet}),this.modalProxy=new Proxy({isFullscreen:this.initialState.modal.isFullscreen},{get:this._fullGet,set:this._fullSet})}get connected(){return this.connectedProxy.connected}get mode(){return this.modeProxy.mode}get isOpen(){return!!this.statusProxy.isOpen}get isMinimized(){return!!this.statusProxy.isMinimized}get type(){return this.statusProxy.type}get entryType(){return this.entryTypeProxy.entryType}get position(){return this.dialogProxy.position}get state(){return{connected:this.connected,mode:this.mode,entryType:this.entryType,status:{type:this.type,isOpen:this.isOpen,isMinimized:this.isMinimized},dialog:{position:this.position},modal:{isFullscreen:this.modalProxy.isFullscreen}}}}const at=new Fw,c0=te.createContext({mode:at.modeProxy.mode,entryType:at.entryType,status:at.statusProxy,dialogPosition:at.dialogProxy.position,isModalFullscreen:at.modalProxy.isFullscreen,previousComponentType:at.statusProxy.type}),Bw=({entryType:e,componentConfig:t,componentType:n,children:r})=>{const[o,a]=te.useState(e!=null?e:at.entryTypeProxy.entryType),[u,c]=te.useState(at.modeProxy.mode),[d,h]=te.useState({type:n||at.statusProxy.type,isOpen:at.statusProxy.isOpen,isMinimized:at.statusProxy.isMinimized}),[m,g]=te.useState(at.dialogProxy.position),[b,T]=te.useState(at.modalProxy.isFullscreen),x=kw(d.type);te.useEffect(()=>{const A=v=>{const{property:I,value:k}=v.detail||{};if(!(!I||k===void 0)){if(I==="mode"){c(k);return}if(I==="entryType"){a(k);return}if(I==="isMinimized"){h(M=>re(U({},M),{isMinimized:k}));return}if(I==="isOpen"){h(M=>re(U({},M),{isOpen:k}));return}if(I==="type"){h(M=>re(U({},M),{type:k}));return}if(I==="position"){g(k);return}if(I==="isFullscreen"){T(k);return}}};return Lw(A),()=>{Dw(A)}},[]),yu(()=>{e&&l0(e)}),yu(()=>{const A=n||(t==null?void 0:t.type);A&&_u(A),t&&"isOpen"in t&&vi(!!t.isOpen),t&&"isMinimized"in t&&bu(!!t.isMinimized)}),yu(()=>{if(!(t!=null&&t.options))return;const{dialogPosition:A}=t.options;A&&hd(A),"isModalFullscreen"in t.options&&fd(!!t.options.isModalFullscreen)});const S=te.useMemo(()=>({mode:u,entryType:o,status:d,previousComponentType:x||"dialog",dialogPosition:m,isModalFullscreen:b}),[u,o,d,x,m,b]);return L.jsx(c0.Provider,{value:S,children:r})},d0=({mode:e,apiKey:t,apiToken:n,baseUrl:r,logoUrl:o,headerText:a,theme:u,openLinksInNewTab:c,globalClassName:d,isDevelopment:h=!1,componentType:m,componentConfig:g,entryType:b,entryMessage:T,disclaimerText:x,disclaimerMarkdown:S,clientContext:A,searchPlaceholder:v,searchButtonLabel:I,searchConfig:k,resetConversationMessage:M,conversationHistory:Y,messagingConfig:F,__features:J,children:Ee})=>L.jsx(bw,{mode:e,baseUrl:r,apiKey:t,apiToken:n,logoUrl:o,headerText:a,entryMessage:T,theme:u,globalClassName:d,openLinksInNewTab:c,searchPlaceholder:v,searchButtonLabel:I,searchConfig:k,componentConfig:g,clientContext:A,disclaimerMarkdown:S,disclaimerText:x,resetConversationMessage:M,conversationHistory:Y,isDevelopment:h,__features:J,children:L.jsx(Bw,{entryType:b,componentConfig:g,componentType:m,children:L.jsx(u0,{scrt2Url:(F==null?void 0:F.scrt2Url)||"",orgId:(F==null?void 0:F.orgId)||"",esDeveloperName:(F==null?void 0:F.esDeveloperName)||"",routingAttributes:(F==null?void 0:F.routingAttributes)||{},enableLogging:h,children:Ee})})}),po=()=>{const e=te.useContext(c0);if(!e)throw new Error("useUIState must be used within a UIStateProvider");return e};var pd={exports:{}},un={},md={exports:{}},gd={};var f0;function Uw(){return f0||(f0=1,(function(e){function t(G,ee){var w=G.length;G.push(ee);e:for(;0<w;){var D=w-1>>>1,Q=G[D];if(0<o(Q,ee))G[D]=ee,G[w]=Q,w=D;else break e}}function n(G){return G.length===0?null:G[0]}function r(G){if(G.length===0)return null;var ee=G[0],w=G.pop();if(w!==ee){G[0]=w;e:for(var D=0,Q=G.length,N=Q>>>1;D<N;){var be=2*(D+1)-1,Le=G[be],Oe=be+1,ze=G[Oe];if(0>o(Le,w))Oe<Q&&0>o(ze,Le)?(G[D]=ze,G[Oe]=w,D=Oe):(G[D]=Le,G[be]=w,D=be);else if(Oe<Q&&0>o(ze,w))G[D]=ze,G[Oe]=w,D=Oe;else break e}}return ee}function o(G,ee){var w=G.sortIndex-ee.sortIndex;return w!==0?w:G.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var d=[],h=[],m=1,g=null,b=3,T=!1,x=!1,S=!1,A=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(G){for(var ee=n(h);ee!==null;){if(ee.callback===null)r(h);else if(ee.startTime<=G)r(h),ee.sortIndex=ee.expirationTime,t(d,ee);else break;ee=n(h)}}function M(G){if(S=!1,k(G),!x)if(n(d)!==null)x=!0,Re(Y);else{var ee=n(h);ee!==null&&ce(M,ee.startTime-G)}}function Y(G,ee){x=!1,S&&(S=!1,v(Ee),Ee=-1),T=!0;var w=b;try{for(k(ee),g=n(d);g!==null&&(!(g.expirationTime>ee)||G&&!se());){var D=g.callback;if(typeof D=="function"){g.callback=null,b=g.priorityLevel;var Q=D(g.expirationTime<=ee);ee=e.unstable_now(),typeof Q=="function"?g.callback=Q:g===n(d)&&r(d),k(ee)}else r(d);g=n(d)}if(g!==null)var N=!0;else{var be=n(h);be!==null&&ce(M,be.startTime-ee),N=!1}return N}finally{g=null,b=w,T=!1}}var F=!1,J=null,Ee=-1,xe=5,z=-1;function se(){return!(e.unstable_now()-z<xe)}function me(){if(J!==null){var G=e.unstable_now();z=G;var ee=!0;try{ee=J(!0,G)}finally{ee?de():(F=!1,J=null)}}else F=!1}var de;if(typeof I=="function")de=function(){I(me)};else if(typeof MessageChannel!="undefined"){var le=new MessageChannel,Te=le.port2;le.port1.onmessage=me,de=function(){Te.postMessage(null)}}else de=function(){A(me,0)};function Re(G){J=G,F||(F=!0,de())}function ce(G,ee){Ee=A(function(){G(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_continueExecution=function(){x||T||(x=!0,Re(Y))},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):xe=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(G){switch(b){case 1:case 2:case 3:var ee=3;break;default:ee=b}var w=b;b=ee;try{return G()}finally{b=w}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(G,ee){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var w=b;b=G;try{return ee()}finally{b=w}},e.unstable_scheduleCallback=function(G,ee,w){var D=e.unstable_now();switch(typeof w=="object"&&w!==null?(w=w.delay,w=typeof w=="number"&&0<w?D+w:D):w=D,G){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=w+Q,G={id:m++,callback:ee,priorityLevel:G,startTime:w,expirationTime:Q,sortIndex:-1},w>D?(G.sortIndex=w,t(h,G),n(d)===null&&G===n(h)&&(S?(v(Ee),Ee=-1):S=!0,ce(M,w-D))):(G.sortIndex=Q,t(d,G),x||T||(x=!0,Re(Y))),G},e.unstable_shouldYield=se,e.unstable_wrapCallback=function(G){var ee=b;return function(){var w=b;b=ee;try{return G.apply(this,arguments)}finally{b=w}}}})(gd)),gd}var h0;function Hw(){return h0||(h0=1,md.exports=Uw()),md.exports}var p0;function zw(){if(p0)return un;p0=1;var e=ao(),t=Hw();function n(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,l=1;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,o={};function a(i,s){u(i,s),u(i+"Capture",s)}function u(i,s){for(o[i]=s,i=0;i<s.length;i++)r.add(s[i])}var c=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),d=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,m={},g={};function b(i){return d.call(g,i)?!0:d.call(m,i)?!1:h.test(i)?g[i]=!0:(m[i]=!0,!1)}function T(i,s,l,f){if(l!==null&&l.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:l!==null?!l.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function x(i,s,l,f){if(s===null||typeof s=="undefined"||T(i,s,l,f))return!0;if(f)return!1;if(l!==null)switch(l.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function S(i,s,l,f,E,y,_){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=E,this.mustUseProperty=l,this.propertyName=i,this.type=s,this.sanitizeURL=y,this.removeEmptyString=_}var A={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){A[i]=new S(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var s=i[0];A[s]=new S(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){A[i]=new S(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){A[i]=new S(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){A[i]=new S(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){A[i]=new S(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){A[i]=new S(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){A[i]=new S(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){A[i]=new S(i,5,!1,i.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function I(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var s=i.replace(v,I);A[s]=new S(s,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var s=i.replace(v,I);A[s]=new S(s,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var s=i.replace(v,I);A[s]=new S(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){A[i]=new S(i,1,!1,i.toLowerCase(),null,!1,!1)}),A.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){A[i]=new S(i,1,!1,i.toLowerCase(),null,!0,!0)});function k(i,s,l,f){var E=A.hasOwnProperty(s)?A[s]:null;(E!==null?E.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(x(s,l,E,f)&&(l=null),f||E===null?b(s)&&(l===null?i.removeAttribute(s):i.setAttribute(s,""+l)):E.mustUseProperty?i[E.propertyName]=l===null?E.type===3?!1:"":l:(s=E.attributeName,f=E.attributeNamespace,l===null?i.removeAttribute(s):(E=E.type,l=E===3||E===4&&l===!0?"":""+l,f?i.setAttributeNS(f,s,l):i.setAttribute(s,l))))}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Y=Symbol.for("react.element"),F=Symbol.for("react.portal"),J=Symbol.for("react.fragment"),Ee=Symbol.for("react.strict_mode"),xe=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),se=Symbol.for("react.context"),me=Symbol.for("react.forward_ref"),de=Symbol.for("react.suspense"),le=Symbol.for("react.suspense_list"),Te=Symbol.for("react.memo"),Re=Symbol.for("react.lazy"),ce=Symbol.for("react.offscreen"),G=Symbol.iterator;function ee(i){return i===null||typeof i!="object"?null:(i=G&&i[G]||i["@@iterator"],typeof i=="function"?i:null)}var w=Object.assign,D;function Q(i){if(D===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);D=s&&s[1]||""}return`
16
+ `+a)}}catch(u){}}throw r}})}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=wi(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&Eu.assertOptions(r,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean),legacyInterceptorReqResOrdering:In.transitional(In.boolean)},!1),o!=null&&(j.isFunction(o)?n.paramsSerializer={serialize:o}:Eu.assertOptions(o,{encode:In.function,serialize:In.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Eu.assertOptions(n,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=a&&j.merge(a.common,a[n.method]);a&&j.forEach(["delete","get","head","post","put","patch","query","common"],x=>{delete a[x]}),n.headers=en.concat(u,a);const c=[];let d=!0;this.interceptors.request.forEach(function(S){if(typeof S.runWhen=="function"&&S.runWhen(n)===!1)return;d=d&&S.synchronous;const A=n.transitional||nd;A&&A.legacyInterceptorReqResOrdering?c.unshift(S.fulfilled,S.rejected):c.push(S.fulfilled,S.rejected)});const h=[];this.interceptors.response.forEach(function(S){h.push(S.fulfilled,S.rejected)});let m,g=0,b;if(!d){const x=[n0.bind(this),void 0];for(x.unshift(...c),x.push(...h),b=x.length,m=Promise.resolve(n);g<b;)m=m.then(x[g++],x[g++]);return m}b=c.length;let T=n;for(;g<b;){const x=c[g++],S=c[g++];try{T=x(T)}catch(A){S.call(this,A);break}}try{m=n0.call(this,T)}catch(x){return Promise.reject(x)}for(g=0,b=h.length;g<b;)m=m.then(h[g++],h[g++]);return m}getUri(t){t=wi(this.defaults,t);const n=Wm(t.baseURL,t.url,t.allowAbsoluteUrls);return Hm(n,t.params,t.paramsSerializer)}};j.forEach(["delete","get","head","options"],function(t){Ai.prototype[t]=function(n,r){return this.request(wi(r||{},{method:t,url:n,data:(r||{}).data}))}}),j.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,u,c){return this.request(wi(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:u}))}}Ai.prototype[t]=n(),t!=="query"&&(Ai.prototype[t+"Form"]=n(!0))});let pw=class O_{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const u=new Promise(c=>{r.subscribe(c),a=c}).then(o);return u.cancel=function(){r.unsubscribe(a)},u},t(function(a,u,c){r.reason||(r.reason=new Ns(a,u,c),n(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 n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new O_(function(o){t=o}),cancel:t}}};function mw(e){return function(n){return e.apply(null,n)}}function gw(e){return j.isObject(e)&&e.isAxiosError===!0}const ld={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ld).forEach(([e,t])=>{ld[t]=e});function i0(e){const t=new Ai(e),n=Am(Ai.prototype.request,t);return j.extend(n,Ai.prototype,t,{allOwnKeys:!0}),j.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return i0(wi(e,o))},n}const bt=i0(ks);bt.Axios=Ai,bt.CanceledError=Ns,bt.CancelToken=pw,bt.isCancel=$m,bt.VERSION=sd,bt.toFormData=hu,bt.AxiosError=Ce,bt.Cancel=bt.CanceledError,bt.all=function(t){return Promise.all(t)},bt.spread=mw,bt.isAxiosError=gw,bt.mergeConfig=wi,bt.AxiosHeaders=en,bt.formToJSON=e=>jm(j.isHTMLForm(e)?new FormData(e):e),bt.getAdapter=t0.getAdapter,bt.HttpStatusCode=ld,bt.default=bt;const{Axios:VM,AxiosError:YM,CanceledError:qM,isCancel:WM,CancelToken:GM,VERSION:KM,all:QM,Cancel:XM,isAxiosError:JM,spread:ZM,toFormData:eF,AxiosHeaders:tF,HttpStatusCode:nF,formToJSON:rF,getAdapter:iF,mergeConfig:oF,create:sF}=bt;class Ew{constructor(t,n,r,o=!1){Ne(this,"CIMULATE_API_HEADER","x-cimulate-api-key");Ne(this,"CIMULATE_SEARCH_API_HOST","search.cimulate");Ne(this,"CIMULATE_SEARCH_API_PATH","api/v1");Ne(this,"baseApiUrl");Ne(this,"headers",{});Ne(this,"fetchConfig",()=>et(this,null,function*(){try{const t=yield bt.get(`${this.apiUrl}/configs/copilot`,{headers:this.headers}),{customer_config:n}=t.data,r=atob(n);return JSON.parse(r)}catch(t){throw console.error("Error fetching customer config:",t),t}}));Ne(this,"_mapCopilotUrlToSearchUrl",(t="",n=!1)=>{if(t.endsWith("io")){const o=new URL(t);return o.hostname=o.hostname.replace(/^copilot\./,"api."),o.origin}return n?`https://staging.${this.CIMULATE_SEARCH_API_HOST}.ai`:`https://prod.${this.CIMULATE_SEARCH_API_HOST}.ai`});if(n&&r||!n&&!r)throw new Error("Provide exactly one authentication method: either 'apiKey' or 'apiToken', but not both.");n?this.headers[this.CIMULATE_API_HEADER]=n:r&&(this.headers.Authorization=`Bearer ${r}`),this.baseApiUrl=this._mapCopilotUrlToSearchUrl(t,o)}get apiUrl(){return`${this.baseApiUrl}/${this.CIMULATE_SEARCH_API_PATH}`}}class yw{constructor(t,n,r,o=!1){Ne(this,"apiService");Ne(this,"config",null);Ne(this,"getConfig",()=>et(this,null,function*(){if(this.config)return this.config;try{const t=yield this.apiService.fetchConfig();return this.config=t,this.config}catch(t){throw console.error("Failed to fetch customer config:",t),t}}));Ne(this,"getPid",t=>this.getProductFieldValue(t,"pidCol"));Ne(this,"getName",t=>this.getProductFieldValue(t,"nameCol"));Ne(this,"getDescription",t=>this.getProductFieldValue(t,"description"));Ne(this,"getBrand",t=>this.getProductFieldValue(t,"productBrandCol"));Ne(this,"getPrice",t=>this.getProductFieldValue(t,"priceCol"));Ne(this,"getRelativePdp",t=>this.getProductFieldValue(t,"relativePdpCol"));Ne(this,"getPdp",t=>this.getProductFieldValue(t,"pdpCol"));Ne(this,"getImage",t=>this.getProductFieldValue(t,"imageCol"));Ne(this,"getProductHiddenFields",()=>{const t=this.getProductField("productHiddenFields");return Array.isArray(t)?t:[]});Ne(this,"getProductField",t=>this.config?this.config[t]:"");Ne(this,"getProductFieldValue",(t,n)=>{const r=this.getProductField(n);return r&&t[r]||""});this.apiService=new Ew(t,n,r,o)}getPriceDisplay(t){const n=this.getPrice(t);return n?typeof n=="string"?n.includes("$")?n:`$${n}`:typeof n=="number"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(n):n:""}}const Ci=(e,t,n,...r)=>{if(!e)return;const o=["background: linear-gradient(90deg,rgba(253, 99, 99, 1) 0%, rgba(245, 139, 35, 1) 65%)","font-weight: bold","color: transparent","background-clip: text","text-fill-color: transparent"].join(";");console[t]("%c[cimulate-widget]",o,n,...r)};class Tw{constructor(t=!1){Ne(this,"isDevelopment");Ne(this,"_log",(t,n,...r)=>{Ci(this.isDevelopment,t,n,...r)});this.isDevelopment=t}log(t,...n){this._log("log",t,...n)}warn(t,...n){this._log("warn",t,...n)}error(t,...n){this._log("error",t,...n)}info(t,...n){this._log("info",t,...n)}debug(t,...n){this._log("debug",t,...n)}}const o0=te.createContext(null),bw=({mode:e,logoUrl:t,headerText:n="Your Search Assistant",globalClassName:r="",entryMessage:o,openLinksInNewTab:a=!1,disclaimerText:u,disclaimerMarkdown:c,clientContext:d,searchPlaceholder:h,searchButtonLabel:m,searchConfig:g,componentConfig:b,conversationHistory:T,resetConversationMessage:x="",apiKey:S,apiToken:A,baseUrl:v,theme:I,isDevelopment:k,__features:M,children:Y})=>{const F=te.useMemo(()=>e==="messaging"?{config:null}:new yw(v,S,A,k),[e,v,S,A,k]),J=te.useMemo(()=>new Tw(k),[k]);te.useEffect(()=>{e!=="messaging"&&(!F||F.config||F.getConfig())},[F,e]);const Ee=te.useMemo(()=>Rx(I),[I]),xe=te.useMemo(()=>{const se=(g==null?void 0:g.placeholder)||h,me=(g==null?void 0:g.buttonLabel)||m;let de="icon";return g!=null&&g.buttonType?de=g.buttonType:m&&(de="text"),re(U({},g||{}),{placeholder:se,buttonLabel:me,buttonType:de})},[g,h,m]),z=te.useMemo(()=>({configModule:F,logoUrl:t,headerText:n,entryMessage:o,globalClassName:r,openLinksInNewTab:a,disclaimerText:u,disclaimerMarkdown:c,clientContext:d,themeVariables:Ee,logger:J,searchConfig:xe,enableMinimize:!!(b!=null&&b.enableMinimize),resetConversationMessage:x,conversationHistory:{sinceHours:typeof(T==null?void 0:T.sinceHours)=="number"?T.sinceHours:1,limit:T==null?void 0:T.limit},features:M}),[F,t,n,o,r,d,u,c,a,xe,b,x,J,Ee,T,M]);return L.jsx(o0.Provider,{value:z,children:Y})},tn=()=>{const e=te.useContext(o0);if(!e)throw new Error("useConfig must be used within a ConfigProvider");return e},s0={connectionStatus:"disconnected",loading:!0,conversationId:null,messages:[],streamingContent:"",isAgentTyping:!1,routingResult:null,error:null};function _w(e,t){switch(t.type){case"SET_CONNECTION_STATUS":return U(re(U({},e),{connectionStatus:t.status}),t.status==="connected"||t.status==="connecting"?{error:null}:{});case"SET_LOADING":return re(U({},e),{loading:t.isLoading});case"SET_CONVERSATION_ID":return re(U({},e),{conversationId:t.id});case"ADD_MESSAGE":return re(U({},e),{messages:[...e.messages,re(U({},t.message),{type:"ADD_MESSAGE"})]});case"APPEND_STREAMING_TOKEN":return re(U({},e),{streamingContent:e.streamingContent+t.token});case"FLUSH_STREAMING":return re(U({},e),{messages:[...e.messages,re(U({},t.message),{type:"FLUSH_STREAMING"})],streamingContent:"",isAgentTyping:!1,loading:!1});case"SET_AGENT_TYPING":return re(U({},e),{isAgentTyping:t.isTyping,loading:t.isTyping});case"SET_ROUTING_RESULT":return re(U({},e),{routingResult:t.result});case"SET_ERROR":return re(U({},e),{error:t.error,loading:!1});case"RESET":return re(U({},s0),{connectionStatus:e.connectionStatus,loading:!0});default:return e}}const a0=te.createContext({connectionStatus:"disconnected",isConnected:!1,isAgentTyping:!1,conversationId:null,messages:[],streamingContent:"",loading:!0,error:null,sendMessage:()=>{},resetConversation:()=>{}}),u0=({scrt2Url:e,orgId:t,esDeveloperName:n,routingAttributes:r,enableLogging:o=!1,onConnect:a,onMessage:u,onError:c,children:d})=>{const{logger:h}=tn(),[m,g]=te.useReducer(_w,s0),b=te.useRef(null),T=te.useRef(u),x=te.useRef(c),S=te.useRef(a);T.current=u,x.current=c,S.current=a,te.useEffect(()=>{const k=new Ix({baseURL:e,orgId:t,esDeveloperName:n,options:{enableLogging:o}});return b.current=k,k.on("connected",()=>{var M;g({type:"SET_CONNECTION_STATUS",status:"connected"}),(M=S.current)==null||M.call(S)}),k.on("disconnected",()=>{g({type:"SET_CONNECTION_STATUS",status:"disconnected"})}),k.on("reconnecting",()=>{g({type:"SET_CONNECTION_STATUS",status:"reconnecting"})}),k.on("message",M=>{var F;const Y={id:M.messageId||crypto.randomUUID(),role:"agent",content:M.content,timestamp:M.timestamp,sender:M.sender,raw:M};g({type:"FLUSH_STREAMING",message:Y}),(F=T.current)==null||F.call(T,Y)}),k.on("streaming_token",M=>{g({type:"APPEND_STREAMING_TOKEN",token:M.token})}),k.on("typing_started",()=>{g({type:"SET_AGENT_TYPING",isTyping:!0})}),k.on("typing_stopped",()=>{g({type:"SET_AGENT_TYPING",isTyping:!1})}),k.on("routing_result",M=>{var Y;if(g({type:"SET_ROUTING_RESULT",result:M}),!M.isSuccessful){const F=`Routing failed: ${M.failureType||"unknown"}`;g({type:"SET_ERROR",error:F}),(Y=x.current)==null||Y.call(x,F)}}),k.on("participant_changed",M=>{if(M.participant.name==="Automated Process")return;const Y={id:crypto.randomUUID(),role:"system",content:M.action==="add"?`${M.participant.name||"Agent"} joined the conversation`:`${M.participant.name||"Agent"} left the conversation`,timestamp:new Date().toISOString()};h==null||h.log("🦜 MessagingProvider participant_changed event received",{event:M}),g({type:"ADD_MESSAGE",message:Y})}),k.on("conversation_closed",()=>{const M={id:crypto.randomUUID(),role:"system",content:"Conversation reset",timestamp:new Date().toISOString()};g({type:"ADD_MESSAGE",message:M}),g({type:"SET_CONVERSATION_ID",id:null})}),k.on("error",M=>{var Y;h==null||h.log("🦜 MessagingProvider ERROR event received",{event:M}),g({type:"SET_ERROR",error:M.message}),M.recoverable||g({type:"SET_CONNECTION_STATUS",status:"error"}),(Y=x.current)==null||Y.call(x,M.message)}),g({type:"SET_CONNECTION_STATUS",status:"connecting"}),k.connect().then(()=>k.createConversation(r)).then(M=>{g({type:"SET_CONVERSATION_ID",id:M})}).catch(M=>{var Y;g({type:"SET_CONNECTION_STATUS",status:"error"}),g({type:"SET_ERROR",error:M.message}),(Y=x.current)==null||Y.call(x,M.message)}),()=>{k.endConversation().finally(()=>{k.disconnect(),k.off()}),b.current=null}},[e,t,n]);const A=te.useCallback(k=>{if(!k.trim())return;const M=b.current;if(!M)return;const Y={id:crypto.randomUUID(),role:"user",content:k,timestamp:new Date().toISOString()};g({type:"ADD_MESSAGE",message:Y}),g({type:"SET_LOADING",isLoading:!0}),M.sendMessage(k).catch(F=>{var J;g({type:"SET_ERROR",error:F.message}),(J=x.current)==null||J.call(x,F.message)})},[]),v=te.useCallback(()=>{const k=b.current;k&&(g({type:"RESET"}),g({type:"SET_CONNECTION_STATUS",status:"connecting"}),k.endConversation().then(()=>(k.disconnect(),k.connect())).then(()=>k.createConversation(r)).then(M=>{g({type:"SET_CONVERSATION_ID",id:M}),g({type:"SET_CONNECTION_STATUS",status:"connected"})}).catch(M=>{var Y;g({type:"SET_ERROR",error:M.message}),g({type:"SET_CONNECTION_STATUS",status:"error"}),(Y=x.current)==null||Y.call(x,M.message)}))},[r]),I=te.useMemo(()=>({connectionStatus:m.connectionStatus,isConnected:m.connectionStatus==="connected",isAgentTyping:m.isAgentTyping,conversationId:m.conversationId,messages:m.messages,streamingContent:m.streamingContent,error:m.error,loading:m.loading,sendMessage:A,resetConversation:v}),[m,A,v]);return L.jsx(a0.Provider,{value:I,children:d})};function xw(){var e=te.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Sw(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)}function ww(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)}var cd=typeof window!="undefined",yu=function(e){te.useEffect(e,[])},Aw=function(e){var t=te.useRef(e);t.current=e,yu(function(){return function(){return t.current()}})},Cw=function(e){var t=te.useRef(0),n=te.useState(e),r=n[0],o=n[1],a=te.useCallback(function(u){cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){o(u)})},[]);return Aw(function(){cancelAnimationFrame(t.current)}),[r,a]},vw=function(e,t){return e===t};function kw(e,t){t===void 0&&(t=vw);var n=te.useRef(),r=te.useRef(e),o=xw();return!o&&!t(r.current,e)&&(n.current=r.current,r.current=e),n.current}var Nw=function(e){var t={},n=t.initialWidth,r=n===void 0?1/0:n,o=t.initialHeight,a=o===void 0?1/0:o,u=t.onChange,c=Cw({width:cd?window.innerWidth:r,height:cd?window.innerHeight:a}),d=c[0],h=c[1];return te.useEffect(function(){if(cd){var m=function(){var g=window.innerWidth,b=window.innerHeight;h({width:g,height:b}),u&&u(g,b)};return Sw(window,"resize",m),function(){ww(window,"resize",m)}}},[]),d};const Tu="cimulate",Ow=`${Tu}:pdp-update`,Iw=`${Tu}:browse-update`,Pw=`${Tu}:search-update`,dd=`${Tu}:ui-state-update`,ar=U({CONTEXT_UPDATED:"browse-context-updated",CATEGORY_ID_CHANGED:"category-id-changed",CATEGORY_NAME_CHANGED:"category-name-changed"},wm),Rw={"browse-context":ar.CONTEXT_UPDATED,categoryId:ar.CATEGORY_ID_CHANGED,categoryName:ar.CATEGORY_NAME_CHANGED,page:ar.PAGE_CHANGED,pageSize:ar.PAGE_SIZE_CHANGED,includeFacets:ar.FACET_FILTERS_CHANGED,facetFilters:ar.FACET_FILTERS_CHANGED,rangeFilters:ar.RANGE_FILTERS_CHANGED,catalogSegment:ar.CATALOG_SEGMENT_CHANGED,pricebooks:ar.PRICEBOOKS_CHANGED},Lw=e=>{window.addEventListener(dd,e)},Dw=e=>{window.removeEventListener(dd,e)},Mw=(e,t)=>{const n=new CustomEvent(dd,{detail:{property:e,value:t}});window.dispatchEvent(n)},l0=e=>{if(!["ask_cim","search","browse","pdp"].includes(e))throw new Error(`Invalid entryType: "${e}". Must be 'ask_cim', 'search', 'browse', or 'pdp'.`);at.entryTypeProxy.entryType=e},vi=e=>{const t=at.statusProxy.isOpen,n=typeof e=="boolean"?e:!t;at.statusProxy.isOpen=n,n&&(at.statusProxy.isMinimized=!1)},bu=e=>{const t=at.statusProxy.isMinimized,n=typeof e=="boolean"?e:!t;at.statusProxy.isMinimized=n,n&&(at.statusProxy.isOpen=!1)},fd=e=>{at.modalProxy.isFullscreen=e},_u=e=>{if(!["chat","dialog","modal"].includes(e))throw new Error(`Invalid type: ${e}. Must be 'chat', 'dialog', or 'modal'.`);at.statusProxy.type=e,e==="dialog"||e==="chat"?at.modeProxy.mode="embedded":at.modeProxy.mode="standalone"},hd=e=>{const t=["top","top-left","top-right","bottom","bottom-left","bottom-right","left","right","center"];if(!t.includes(e))throw new Error(`Invalid position: ${e}. Must be one of ${t.join(", ")}.`);at.dialogProxy.position=e};class Fw{constructor(){Ne(this,"initialState",{connected:!1,mode:"embedded",entryType:"search",status:{type:"dialog",isOpen:!1,isMinimized:!1},dialog:{position:"bottom-left"},modal:{isFullscreen:!1}});Ne(this,"connectedProxy");Ne(this,"modeProxy");Ne(this,"entryTypeProxy");Ne(this,"statusProxy");Ne(this,"dialogProxy");Ne(this,"modalProxy",{isFullscreen:!1});Ne(this,"_fullGet",(t,n)=>Reflect.get(t,n));Ne(this,"_fullSet",(t,n,r)=>{if(!(n in t))throw new Error(`Property ${n} does not exist on UIState`);return Mw(n,r),Reflect.set(t,n,r)});this.connectedProxy=new Proxy({connected:this.initialState.connected},{get:this._fullGet,set:this._fullSet}),this.modeProxy=new Proxy({mode:this.initialState.mode},{get:this._fullGet,set:this._fullSet}),this.entryTypeProxy=new Proxy({entryType:this.initialState.entryType},{get:this._fullGet,set:this._fullSet}),this.statusProxy=new Proxy({type:this.initialState.status.type,isOpen:this.initialState.status.isOpen,isMinimized:this.initialState.status.isMinimized},{get:this._fullGet,set:this._fullSet}),this.dialogProxy=new Proxy({position:this.initialState.dialog.position},{get:this._fullGet,set:this._fullSet}),this.modalProxy=new Proxy({isFullscreen:this.initialState.modal.isFullscreen},{get:this._fullGet,set:this._fullSet})}get connected(){return this.connectedProxy.connected}get mode(){return this.modeProxy.mode}get isOpen(){return!!this.statusProxy.isOpen}get isMinimized(){return!!this.statusProxy.isMinimized}get type(){return this.statusProxy.type}get entryType(){return this.entryTypeProxy.entryType}get position(){return this.dialogProxy.position}get state(){return{connected:this.connected,mode:this.mode,entryType:this.entryType,status:{type:this.type,isOpen:this.isOpen,isMinimized:this.isMinimized},dialog:{position:this.position},modal:{isFullscreen:this.modalProxy.isFullscreen}}}}const at=new Fw,c0=te.createContext({mode:at.modeProxy.mode,entryType:at.entryType,status:at.statusProxy,dialogPosition:at.dialogProxy.position,isModalFullscreen:at.modalProxy.isFullscreen,previousComponentType:at.statusProxy.type}),Bw=({entryType:e,componentConfig:t,componentType:n,children:r})=>{const[o,a]=te.useState(e!=null?e:at.entryTypeProxy.entryType),[u,c]=te.useState(at.modeProxy.mode),[d,h]=te.useState({type:n||at.statusProxy.type,isOpen:at.statusProxy.isOpen,isMinimized:at.statusProxy.isMinimized}),[m,g]=te.useState(at.dialogProxy.position),[b,T]=te.useState(at.modalProxy.isFullscreen),x=kw(d.type);te.useEffect(()=>{const A=v=>{const{property:I,value:k}=v.detail||{};if(!(!I||k===void 0)){if(I==="mode"){c(k);return}if(I==="entryType"){a(k);return}if(I==="isMinimized"){h(M=>re(U({},M),{isMinimized:k}));return}if(I==="isOpen"){h(M=>re(U({},M),{isOpen:k}));return}if(I==="type"){h(M=>re(U({},M),{type:k}));return}if(I==="position"){g(k);return}if(I==="isFullscreen"){T(k);return}}};return Lw(A),()=>{Dw(A)}},[]),yu(()=>{e&&l0(e)}),yu(()=>{const A=n||(t==null?void 0:t.type);A&&_u(A),t&&"isOpen"in t&&vi(!!t.isOpen),t&&"isMinimized"in t&&bu(!!t.isMinimized)}),yu(()=>{if(!(t!=null&&t.options))return;const{dialogPosition:A}=t.options;A&&hd(A),"isModalFullscreen"in t.options&&fd(!!t.options.isModalFullscreen)});const S=te.useMemo(()=>({mode:u,entryType:o,status:d,previousComponentType:x||"dialog",dialogPosition:m,isModalFullscreen:b}),[u,o,d,x,m,b]);return L.jsx(c0.Provider,{value:S,children:r})},d0=({mode:e,apiKey:t,apiToken:n,baseUrl:r,logoUrl:o,headerText:a,theme:u,openLinksInNewTab:c,globalClassName:d,isDevelopment:h=!1,componentType:m,componentConfig:g,entryType:b,entryMessage:T,disclaimerText:x,disclaimerMarkdown:S,clientContext:A,searchPlaceholder:v,searchButtonLabel:I,searchConfig:k,resetConversationMessage:M,conversationHistory:Y,messagingConfig:F,__features:J,children:Ee})=>L.jsx(bw,{mode:e,baseUrl:r,apiKey:t,apiToken:n,logoUrl:o,headerText:a,entryMessage:T,theme:u,globalClassName:d,openLinksInNewTab:c,searchPlaceholder:v,searchButtonLabel:I,searchConfig:k,componentConfig:g,clientContext:A,disclaimerMarkdown:S,disclaimerText:x,resetConversationMessage:M,conversationHistory:Y,isDevelopment:h,__features:J,children:L.jsx(Bw,{entryType:b,componentConfig:g,componentType:m,children:L.jsx(u0,{scrt2Url:(F==null?void 0:F.scrt2Url)||"",orgId:(F==null?void 0:F.orgId)||"",esDeveloperName:(F==null?void 0:F.esDeveloperName)||"",routingAttributes:(F==null?void 0:F.routingAttributes)||{},enableLogging:h,children:Ee})})}),po=()=>{const e=te.useContext(c0);if(!e)throw new Error("useUIState must be used within a UIStateProvider");return e};var pd={exports:{}},un={},md={exports:{}},gd={};var f0;function Uw(){return f0||(f0=1,(function(e){function t(G,ee){var w=G.length;G.push(ee);e:for(;0<w;){var D=w-1>>>1,Q=G[D];if(0<o(Q,ee))G[D]=ee,G[w]=Q,w=D;else break e}}function n(G){return G.length===0?null:G[0]}function r(G){if(G.length===0)return null;var ee=G[0],w=G.pop();if(w!==ee){G[0]=w;e:for(var D=0,Q=G.length,N=Q>>>1;D<N;){var be=2*(D+1)-1,Le=G[be],Oe=be+1,ze=G[Oe];if(0>o(Le,w))Oe<Q&&0>o(ze,Le)?(G[D]=ze,G[Oe]=w,D=Oe):(G[D]=Le,G[be]=w,D=be);else if(Oe<Q&&0>o(ze,w))G[D]=ze,G[Oe]=w,D=Oe;else break e}}return ee}function o(G,ee){var w=G.sortIndex-ee.sortIndex;return w!==0?w:G.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var d=[],h=[],m=1,g=null,b=3,T=!1,x=!1,S=!1,A=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(G){for(var ee=n(h);ee!==null;){if(ee.callback===null)r(h);else if(ee.startTime<=G)r(h),ee.sortIndex=ee.expirationTime,t(d,ee);else break;ee=n(h)}}function M(G){if(S=!1,k(G),!x)if(n(d)!==null)x=!0,Re(Y);else{var ee=n(h);ee!==null&&ce(M,ee.startTime-G)}}function Y(G,ee){x=!1,S&&(S=!1,v(Ee),Ee=-1),T=!0;var w=b;try{for(k(ee),g=n(d);g!==null&&(!(g.expirationTime>ee)||G&&!se());){var D=g.callback;if(typeof D=="function"){g.callback=null,b=g.priorityLevel;var Q=D(g.expirationTime<=ee);ee=e.unstable_now(),typeof Q=="function"?g.callback=Q:g===n(d)&&r(d),k(ee)}else r(d);g=n(d)}if(g!==null)var N=!0;else{var be=n(h);be!==null&&ce(M,be.startTime-ee),N=!1}return N}finally{g=null,b=w,T=!1}}var F=!1,J=null,Ee=-1,xe=5,z=-1;function se(){return!(e.unstable_now()-z<xe)}function me(){if(J!==null){var G=e.unstable_now();z=G;var ee=!0;try{ee=J(!0,G)}finally{ee?de():(F=!1,J=null)}}else F=!1}var de;if(typeof I=="function")de=function(){I(me)};else if(typeof MessageChannel!="undefined"){var le=new MessageChannel,Te=le.port2;le.port1.onmessage=me,de=function(){Te.postMessage(null)}}else de=function(){A(me,0)};function Re(G){J=G,F||(F=!0,de())}function ce(G,ee){Ee=A(function(){G(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_continueExecution=function(){x||T||(x=!0,Re(Y))},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):xe=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(G){switch(b){case 1:case 2:case 3:var ee=3;break;default:ee=b}var w=b;b=ee;try{return G()}finally{b=w}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(G,ee){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var w=b;b=G;try{return ee()}finally{b=w}},e.unstable_scheduleCallback=function(G,ee,w){var D=e.unstable_now();switch(typeof w=="object"&&w!==null?(w=w.delay,w=typeof w=="number"&&0<w?D+w:D):w=D,G){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=w+Q,G={id:m++,callback:ee,priorityLevel:G,startTime:w,expirationTime:Q,sortIndex:-1},w>D?(G.sortIndex=w,t(h,G),n(d)===null&&G===n(h)&&(S?(v(Ee),Ee=-1):S=!0,ce(M,w-D))):(G.sortIndex=Q,t(d,G),x||T||(x=!0,Re(Y))),G},e.unstable_shouldYield=se,e.unstable_wrapCallback=function(G){var ee=b;return function(){var w=b;b=ee;try{return G.apply(this,arguments)}finally{b=w}}}})(gd)),gd}var h0;function Hw(){return h0||(h0=1,md.exports=Uw()),md.exports}var p0;function zw(){if(p0)return un;p0=1;var e=ao(),t=Hw();function n(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,l=1;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,o={};function a(i,s){u(i,s),u(i+"Capture",s)}function u(i,s){for(o[i]=s,i=0;i<s.length;i++)r.add(s[i])}var c=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),d=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,m={},g={};function b(i){return d.call(g,i)?!0:d.call(m,i)?!1:h.test(i)?g[i]=!0:(m[i]=!0,!1)}function T(i,s,l,f){if(l!==null&&l.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:l!==null?!l.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function x(i,s,l,f){if(s===null||typeof s=="undefined"||T(i,s,l,f))return!0;if(f)return!1;if(l!==null)switch(l.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function S(i,s,l,f,E,y,_){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=E,this.mustUseProperty=l,this.propertyName=i,this.type=s,this.sanitizeURL=y,this.removeEmptyString=_}var A={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){A[i]=new S(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var s=i[0];A[s]=new S(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){A[i]=new S(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){A[i]=new S(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){A[i]=new S(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){A[i]=new S(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){A[i]=new S(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){A[i]=new S(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){A[i]=new S(i,5,!1,i.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function I(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var s=i.replace(v,I);A[s]=new S(s,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var s=i.replace(v,I);A[s]=new S(s,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var s=i.replace(v,I);A[s]=new S(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){A[i]=new S(i,1,!1,i.toLowerCase(),null,!1,!1)}),A.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){A[i]=new S(i,1,!1,i.toLowerCase(),null,!0,!0)});function k(i,s,l,f){var E=A.hasOwnProperty(s)?A[s]:null;(E!==null?E.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(x(s,l,E,f)&&(l=null),f||E===null?b(s)&&(l===null?i.removeAttribute(s):i.setAttribute(s,""+l)):E.mustUseProperty?i[E.propertyName]=l===null?E.type===3?!1:"":l:(s=E.attributeName,f=E.attributeNamespace,l===null?i.removeAttribute(s):(E=E.type,l=E===3||E===4&&l===!0?"":""+l,f?i.setAttributeNS(f,s,l):i.setAttribute(s,l))))}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Y=Symbol.for("react.element"),F=Symbol.for("react.portal"),J=Symbol.for("react.fragment"),Ee=Symbol.for("react.strict_mode"),xe=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),se=Symbol.for("react.context"),me=Symbol.for("react.forward_ref"),de=Symbol.for("react.suspense"),le=Symbol.for("react.suspense_list"),Te=Symbol.for("react.memo"),Re=Symbol.for("react.lazy"),ce=Symbol.for("react.offscreen"),G=Symbol.iterator;function ee(i){return i===null||typeof i!="object"?null:(i=G&&i[G]||i["@@iterator"],typeof i=="function"?i:null)}var w=Object.assign,D;function Q(i){if(D===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);D=s&&s[1]||""}return`
17
17
  `+D+i}var N=!1;function be(i,s){if(!i||N)return"";N=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(W){var f=W}Reflect.construct(i,[],s)}else{try{s.call()}catch(W){f=W}i.call(s.prototype)}else{try{throw Error()}catch(W){f=W}i()}}catch(W){if(W&&f&&typeof W.stack=="string"){for(var E=W.stack.split(`
18
18
  `),y=f.stack.split(`
19
19
  `),_=E.length-1,P=y.length-1;1<=_&&0<=P&&E[_]!==y[P];)P--;for(;1<=_&&0<=P;_--,P--)if(E[_]!==y[P]){if(_!==1||P!==1)do if(_--,P--,0>P||E[_]!==y[P]){var B=`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cimulate/copilot-widget",
3
3
  "description": "A frontend SDK for Cimulate Copilot",
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "keywords": [
6
6
  "cimulate",
7
7
  "copilot",