@cimulate/copilot-widget 1.55.6 → 1.55.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -1
- package/dist/messaging.es.js +1 -1
- package/dist/messaging.umd.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
`@cimulate/copilot-widget` follows [Semantic Versioning](https://semver.org/). Each entry is a released `package.json` version (deployed on merge to `master`), newest first.
|
|
4
4
|
|
|
5
|
+
## 1.55.7 — 2026-11-12
|
|
6
|
+
|
|
7
|
+
- Bug fix: Messaging telemetry no longer sends `op` and `feature` fields in CurrentState and FailureEvent payloads, which caused “Extra fields” uxerr entries in Splunk. Only InteractionEvent payloads include those fields.
|
|
8
|
+
|
|
5
9
|
## 1.55.6 — 2026-11-12
|
|
6
10
|
|
|
7
|
-
- The minimized launcher announces whether it opens a dialog. Dialog and modal expose `aria-haspopup
|
|
11
|
+
- The minimized launcher announces whether it opens a dialog. Dialog and modal expose `aria-haspopup=”dialog”` and `aria-expanded`; embedded chat exposes `aria-expanded` only.
|
|
8
12
|
- Composer fields keep focus while an agent response is in progress by using `aria-disabled` instead of HTML `disabled` or `readOnly`. Messaging does the same when the session cannot send.
|
|
9
13
|
- Decorative icons are hidden from assistive technology so controls are announced by their labels.
|
|
10
14
|
- Dialog and modal windows take their accessible name from the header text. The live conversation is no longer the dialog description.
|
package/dist/messaging.es.js
CHANGED
|
@@ -3569,7 +3569,7 @@ function Eb(e) {
|
|
|
3569
3569
|
const b = d === "state" ? R.currentStateSchema : d === "failure" ? R.failureEventSchema : R.interactionEventSchema;
|
|
3570
3570
|
R.app.log(b, C(V(C({
|
|
3571
3571
|
convId: (v = m.conversationId) != null ? v : ""
|
|
3572
|
-
}, h ? { op: h, feature: "agentforce-messaging" } : {}), {
|
|
3572
|
+
}, h && d === "interaction" ? { op: h, feature: "agentforce-messaging" } : {}), {
|
|
3573
3573
|
method: "sse",
|
|
3574
3574
|
clientName: "copilot-widget",
|
|
3575
3575
|
participantType: "EndUser",
|
package/dist/messaging.umd.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
`))>=0;){const d=i.slice(0,c);i=i.slice(c+2),this.parseFrame(d)}}}catch(s){return s instanceof DOMException&&s.name==="AbortError"?void this.logger.debug("SSE stream aborted (intentional disconnect)"):(this.logger.error("SSE stream error:",s),this.reading=!1,void this.onClose(s instanceof Error?s.message:"Unknown stream error"))}finally{n.releaseLock()}this.reading=!1,this.logger.info("SSE stream ended"),this.onClose("stream_ended")})}parseFrame(t){let n="message";const r=[];for(const s of t.split(`
|
|
7
7
|
`))if(s.startsWith("event:"))n=s.slice(6).trim();else if(s.startsWith("data:")){const u=s.slice(5);r.push(u.startsWith(" ")?u.slice(1):u)}else s.startsWith(":");if(r.length===0)return;const i=r.join(`
|
|
8
|
-
`);this.logger.debug(`SSE event: ${n}`,i.slice(0,200)),this.onEvent(n,i)}}class Vr extends Error{constructor(t,n="unknown",r){super(t,r),this.name="AgentforceClientError",this.type=n}}let T1=class extends Vr{constructor(t,n,r,i){super(t,"api",i),this.name="AgentforceApiError",this.statusCode=n,this.responseBody=r}};class _1 extends Vr{constructor(t,n=1,r){super(t,"network",r),this.name="AgentforceNetworkError",this.attemptsMade=n}}let Hf=class extends Vr{constructor(t,n){super(t,"auth",n),this.name="AgentforceAuthError"}};class wk{constructor(t){this.prefix="[Agentforce]",this.enabled=t}info(t,...n){this.enabled&&console.log(`${this.prefix} ${t}`,...n)}warn(t,...n){this.enabled&&console.warn(`${this.prefix} ${t}`,...n)}error(t,...n){this.enabled&&console.error(`${this.prefix} ${t}`,...n)}debug(t,...n){this.enabled&&console.debug(`${this.prefix} ${t}`,...n)}}const xk="0Mw";let Tk=class extends Ek{constructor({baseURL:t,orgId:n,esDeveloperName:r,options:i={}}){var u,c,d,f,h,m,E;super(),this._accessToken=null,this._tokenExpiresAt=0,this._conversationId=null,this._isConnected=!1,this._usingContinuationToken=!1,this.sseReader=null,this.reconnectAttempts=0,this.reconnectTimeout=null,this.intentionalDisconnect=!1,this.baseURL=t.replace(/\/+$/,""),this.orgId=n,this.esDeveloperName=r;const s={maxRetries:(u=i.maxRetries)!=null?u:3,timeout:(c=i.timeout)!=null?c:15e3,maxReconnectAttempts:(d=i.maxReconnectAttempts)!=null?d:5,reconnectDelay:(f=i.reconnectDelay)!=null?f:2e3,enableLogging:(h=i.enableLogging)!=null?h:!1,platform:(m=i.platform)!=null?m:"Web",capabilitiesVersion:(E=i.capabilitiesVersion)!=null?E:"1"};this.maxRetries=s.maxRetries,this.timeout=s.timeout,this.maxReconnectAttempts=s.maxReconnectAttempts,this.reconnectDelay=s.reconnectDelay,this.platform=s.platform,this.capabilitiesVersion=s.capabilitiesVersion,this.logger=new wk(s.enableLogging),this.logger.info(`Client initialized for ${this.baseURL}`)}get isConnected(){return this._isConnected}get conversationId(){return this._conversationId}get accessToken(){return this._accessToken}connect(t){return Ie(this,null,function*(){this.intentionalDisconnect=!1,this.reconnectAttempts=0,this.logger.info("Connecting..."),t!=null&&t.continuationToken?(this._accessToken=t.continuationToken,this._tokenExpiresAt=this.getTokenExpiry(t.continuationToken),this._usingContinuationToken=!0,this.logger.info("Using continuation token")):(this._accessToken=yield this.fetchAccessToken(),this._usingContinuationToken=!1,this.logger.info("Access token acquired")),yield this.openSSE(t==null?void 0:t.lastEventId)})}disconnect(){this.intentionalDisconnect=!0,this.clearReconnectTimer(),this.closeSSE(),this._isConnected=!1,this.logger.info("Disconnected")}reconnect(){this._isConnected||(this.intentionalDisconnect=!1,this.reconnectAttempts=0,this.attemptReconnect())}createConversation(t,n){return Ie(this,null,function*(){this.assertConnected();const r=crypto.randomUUID(),i=M({conversationId:r,esDeveloperName:this.esDeveloperName,routingAttributes:t!=null?t:{}},n?{context:n}:{});return yield this.executeRequest("POST","/iamessage/api/v2/conversation",i),this._conversationId=r,this.logger.info(`Conversation created: ${r}`),r})}sendMessage(t,n){return Ie(this,null,function*(){var f,h;if(this.assertConnected(),!this._conversationId)throw new Vr("No active conversation. Call createConversation() first.","unknown");const r=this._conversationId,i=crypto.randomUUID(),s=M({message:{id:i,messageType:"StaticContentMessage",staticContent:{formatType:"Text",text:t}},esDeveloperName:this.esDeveloperName},n?{context:n}:{}),u=yield this.executeRequest("POST",`/iamessage/api/v2/conversation/${r}/message`,s),c={conversationEntries:(f=u==null?void 0:u.conversationEntries)!=null?f:[]},d=u==null?void 0:u.warning;if(d){c.warning=d;const m=(h=c.conversationEntries[0])==null?void 0:h.id;this.logger.warn(`Message acknowledgement warning: conversationId=${r}, esDeveloperName=${this.esDeveloperName}, warningCode=${d.warningCode}, warningMessage=${d.warningMessage}, messageEntryId=${m!=null?m:"not-returned"}`)}return this.logger.debug(`Message sent: ${i}`),c})}sendFile(t,n){return Ie(this,null,function*(){var u;if(this.assertConnected(),!this._conversationId)throw new Vr("No active conversation. Call createConversation() first.","unknown");const r={message:M({id:crypto.randomUUID(),fileId:crypto.randomUUID()},n!=null&&n.text?{text:n.text}:{}),esDeveloperName:this.esDeveloperName},i=new FormData;i.append("messageEntry",new Blob([JSON.stringify(r)],{type:"application/json"})),i.append("fileData",t);const s=yield this.executeRequest("POST",`/iamessage/api/v2/conversation/${this._conversationId}/file`,i);return this.logger.debug(`File sent: ${r.message.fileId}`),{conversationEntries:(u=s==null?void 0:s.conversationEntries)!=null?u:[]}})}endConversation(){return Ie(this,null,function*(){if(!this._conversationId||!this._accessToken)return;const t=this._conversationId;this._conversationId=null;try{yield this.executeRequest("DELETE",`/iamessage/api/v2/conversation/${t}?esDeveloperName=${encodeURIComponent(this.esDeveloperName)}`),this.logger.info(`Conversation ended: ${t}`)}catch(n){this.logger.warn(`Failed to end conversation (best effort): ${n instanceof Error?n.message:String(n)}`)}})}listConversations(t){return Ie(this,null,function*(){var u,c,d;this.assertConnected();const n=new URLSearchParams;(t==null?void 0:t.inclClosedConvs)!=null&&n.set("inclClosedConvs",String(t.inclClosedConvs)),(t==null?void 0:t.limit)!=null&&n.set("limit",String(t.limit)),t!=null&&t.conversationId&&n.set("conversationId",t.conversationId),(t==null?void 0:t.startTimestamp)!=null&&n.set("startTimestamp",String(t.startTimestamp)),(t==null?void 0:t.endTimestamp)!=null&&n.set("endTimestamp",String(t.endTimestamp));const r=n.toString(),i="/iamessage/api/v2/conversation/list"+(r?`?${r}`:""),s=yield this.executeRequest("GET",i);return{conversations:(u=s.conversations)!=null?u:[],openConversationsFound:(c=s.openConversationsFound)!=null?c:0,closedConversationsFound:(d=s.closedConversationsFound)!=null?d:0}})}listConversationEntries(t,n){return Ie(this,null,function*(){var u;this.assertConnected();const r=new URLSearchParams;(n==null?void 0:n.limit)!=null&&r.set("limit",String(n.limit)),(n==null?void 0:n.startTimestamp)!=null&&r.set("startTimestamp",String(n.startTimestamp)),(n==null?void 0:n.endTimestamp)!=null&&r.set("endTimestamp",String(n.endTimestamp)),n!=null&&n.direction&&r.set("direction",n.direction),n!=null&&n.entryTypeFilter&&n.entryTypeFilter.length>0&&r.set("entryTypeFilter",n.entryTypeFilter.join(","));const i=r.toString(),s=`/iamessage/api/v2/conversation/${t}/entries${i?`?${i}`:""}`;return{conversationEntries:(u=(yield this.executeRequest("GET",s)).conversationEntries)!=null?u:[]}})}retrieveConversationTranscript(t){return Ie(this,null,function*(){this.assertConnected();const n=t!=null?t:this._conversationId;if(!n)throw new Vr("No active conversation. Call createConversation() first or pass a conversationId.","unknown");const r=`/iamessage/api/v2/conversation/${n}/transcript?esDeveloperName=${encodeURIComponent(this.esDeveloperName)}`;return this.executeRequest("GET",r,void 0,{responseType:"blob"})})}resumeConversation(t){if(this.assertConnected(),!t)throw new Vr("conversationId is required to resume a conversation.","unknown");this._conversationId=t,this.logger.info(`Conversation resumed: ${t}`)}generateContinuationToken(){return Ie(this,null,function*(){this.assertConnected();const t=yield this.executeRequest("GET","/iamessage/api/v2/authorization/continuation-access-token");return this.logger.info("Continuation token generated"),t})}getAuthLinkKey(){return Ie(this,null,function*(){this.assertConnected();const t=yield this.executeRequest("GET","/iamessage/api/v2/authorization/authlink");if(!t||!t.authLinkKey)throw new T1("Auth link response did not contain an authLinkKey",200,t);return this.logger.info("Auth link key retrieved"),t.authLinkKey})}openSSE(t){return Ie(this,null,function*(){this.closeSSE();const n=`${this.baseURL}/eventrouter/v1/sse`,r={Authorization:`Bearer ${this._accessToken}`,"X-Org-Id":this.orgId};t&&(r["Last-Event-ID"]=t),this.sseReader=new bk(n,r,(i,s)=>this.handleSSEEvent(i,s),i=>this.handleSSEClose(i),this.logger),yield this.sseReader.connect(),this._isConnected=!0,this.emit("connected"),this.logger.info("SSE stream connected")})}closeSSE(){this.sseReader&&(this.sseReader.disconnect(),this.sseReader=null)}handleSSEClose(t){this._isConnected=!1,this.emit("disconnected",{reason:t}),this.intentionalDisconnect||this.attemptReconnect()}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return this.logger.error(`Max reconnect attempts (${this.maxReconnectAttempts}) reached.`),void this.emit("error",{code:"MAX_RECONNECT",message:`Failed to reconnect after ${this.maxReconnectAttempts} attempts`,recoverable:!1});this.reconnectAttempts++;const t=500*Math.random(),n=Math.min(this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1)+t,3e4);this.logger.info(`Reconnecting in ${n.toFixed(0)}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})...`),this.emit("reconnecting",{attempt:this.reconnectAttempts,maxAttempts:this.maxReconnectAttempts}),this.reconnectTimeout=setTimeout(()=>Ie(this,null,function*(){try{if(this.intentionalDisconnect)return;if(!(this._accessToken&&Date.now()<this._tokenExpiresAt))return this.logger.error("Access token expired — session cannot be resumed"),this.emit("error",{code:"SESSION_EXPIRED",message:"Session expired. Call connect() to start a new session.",recoverable:!1}),void(this._conversationId=null);if(this.logger.info("Reusing existing access token for SSE reconnection"),this.intentionalDisconnect)return;yield this.openSSE(),this.reconnectAttempts=0,this.logger.info("Reconnected successfully")}catch(r){if(this.intentionalDisconnect)return;const i=r instanceof Error?r.message:String(r);if(i.includes("(401)"))return this.logger.error("SSE rejected token (401) — session expired"),this.emit("error",{code:"SESSION_EXPIRED",message:"Session expired. Call connect() to start a new session.",recoverable:!1}),void(this._conversationId=null);this.logger.error(`Reconnect attempt ${this.reconnectAttempts} failed: ${i}`),this.attemptReconnect()}}),n)}clearReconnectTimer(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}handleSSEEvent(t,n){if(t==="ping")return;let r;try{r=JSON.parse(n)}catch(i){return void this.logger.debug(`Non-JSON SSE event (${t}): ${n.slice(0,100)}`)}switch(t){case"CONVERSATION_ROUTING_RESULT":this.handleRoutingResult(r);break;case"CONVERSATION_MESSAGE":this.handleConversationMessage(r);break;case"CONVERSATION_STREAMING_TOKEN":this.handleStreamingToken(r);break;case"CONVERSATION_TYPING_STARTED_INDICATOR":this.handleTypingStarted(r);break;case"CONVERSATION_TYPING_STOPPED_INDICATOR":this.handleTypingStopped(r);break;case"CONVERSATION_PROGRESS_INDICATOR":this.handleProgressIndicator(r);break;case"CONVERSATION_PARTICIPANT_CHANGED":this.handleParticipantChanged(r);break;case"CONVERSATION_CLOSE_CONVERSATION":this.handleConversationClosed(r);break;default:this.logger.debug(`Unhandled SSE event type: ${t}`)}}handleRoutingResult(t){let n=t;t.conversationEntry&&(n=this.parseEntryPayload(t.conversationEntry));const r=n.failureType||n.routingFailureType||"",i=!r||r==="None"||r==="NO_ERROR";this.emit("routing_result",{conversationId:this._conversationId||"",isSuccessful:i,failureType:i?void 0:r,raw:n}),i||this.emit("error",{code:"ROUTING_FAILED",message:`Routing failed: ${r}`,recoverable:!1})}handleConversationMessage(t){var c;const n=t.conversationEntry;if(!n)return;const r=((c=n.sender)==null?void 0:c.role)||"";if(r==="EndUser"||r==="Customer")return;const i=this.parseEntryPayload(n),s=this.getNestedValue(i,"abstractMessage"),u=this.getNestedString(s,"staticContent","text")||this.getNestedString(s,"content","text")||"";u&&this.emit("message",{conversationId:this._conversationId||"",messageId:n.identifier||"",content:u,sender:{role:r,name:n.senderDisplayName},timestamp:n.transcriptedTimestamp||new Date().toISOString(),raw:i,messagingSessionId:this.extractMessagingSessionId(n)})}handleStreamingToken(t){let n,r,i,s="";if(t.conversationEntry){const u=this.parseEntryPayload(t.conversationEntry),c=this.getNestedValue(u,"streamingToken");s=this.getNestedString(c,"token","text")||this.getNestedString(c,"token","content")||"";const d=this.getNestedValue(c,"sequenceNumber");typeof d=="number"&&(n=d);const f=this.getNestedString(c,"targetMessageIdentifier");f&&(r=f);const h=this.getNestedString(c,"tokenType");h&&(i=h)}s||(s=t.token||t.text||""),s?this.emit("streaming_token",M(M(M({conversationId:this._conversationId||"",token:String(s)},n!==void 0?{sequenceNumber:n}:{}),r?{targetMessageId:r}:{}),i?{tokenType:i}:{})):this.logger.warn("STREAMING_TOKEN received but no token text could be extracted — payload shape may have changed")}handleTypingStarted(t){var n;this.emit("typing_started",{conversationId:this._conversationId||"",participant:(n=t.conversationEntry)!=null&&n.sender?{role:t.conversationEntry.sender.role||"",name:t.conversationEntry.senderDisplayName}:void 0})}handleTypingStopped(t){var n;this.emit("typing_stopped",{conversationId:this._conversationId||"",participant:(n=t.conversationEntry)!=null&&n.sender?{role:t.conversationEntry.sender.role||"",name:t.conversationEntry.senderDisplayName}:void 0})}handleProgressIndicator(t){const n=t.conversationEntry;if(!n)return;const r=this.parseEntryPayload(n),i=this.getNestedValue(r,"progressIndicator"),s=this.getNestedString(i,"progressMessage","text")||this.getNestedString(i,"progressMessage","content")||t.text||"";if(!s)return;const u=this.getNestedString(i,"indicatorType")||void 0;this.emit("progress_indicator",{conversationId:this._conversationId||"",message:String(s),indicatorType:u,raw:r})}handleParticipantChanged(t){var s,u,c,d,f;let n=t;t.conversationEntry&&(n=this.parseEntryPayload(t.conversationEntry));const r=n.entries,i=(s=t.conversationEntry)==null?void 0:s.identifier;if(r&&r.length>0)r.forEach((h,m)=>{var I,v,S;const E=h.participant,b=h.displayName||(E==null?void 0:E.displayName)||((I=t.conversationEntry)==null?void 0:I.senderDisplayName)||"Agent",T=(E==null?void 0:E.role)||((S=(v=t.conversationEntry)==null?void 0:v.sender)==null?void 0:S.role)||"",_=h.operation||h.event||"";this.emit("participant_changed",M({conversationId:this._conversationId||"",participant:{role:T,name:b},action:this.normalizeParticipantAction(_)},i?{entryId:r.length>1?`${i}:${m}`:i}:{}))});else{const h=((u=t.conversationEntry)==null?void 0:u.senderDisplayName)||n.participantName||((c=n.participant)==null?void 0:c.displayName)||"Agent",m=n.operation||n.event||"";this.emit("participant_changed",M({conversationId:this._conversationId||"",participant:{role:((f=(d=t.conversationEntry)==null?void 0:d.sender)==null?void 0:f.role)||"",name:h},action:this.normalizeParticipantAction(m)},i?{entryId:i}:{}))}}normalizeParticipantAction(t){const n=t.toLowerCase();return n&&n!=="add"&&n!=="join"&&n!=="joined"&&n!=="transfer"?n==="remove"||n==="left"||n==="leave"?"remove":t:"add"}handleConversationClosed(t){this.emit("conversation_closed",{conversationId:t.conversationId||this._conversationId||""}),this._conversationId=null}fetchAccessToken(){return Ie(this,null,function*(){const t={orgId:this.orgId,esDeveloperName:this.esDeveloperName,capabilitiesVersion:this.capabilitiesVersion,platform:this.platform},n=yield this.executeRequest("POST","/iamessage/api/v2/authorization/unauthenticated/access-token",t,{useAuth:!1});if(!n.accessToken)throw new Hf("Token response missing accessToken field");return this._tokenExpiresAt=this.getTokenExpiry(n.accessToken),n.accessToken})}executeRequest(t,n,r,i){return Ie(this,null,function*(){const s=(i==null?void 0:i.useAuth)!==!1;let u=0;for(;;){let c;try{const d=new AbortController;c=setTimeout(()=>d.abort(),(i==null?void 0:i.timeout)||this.timeout);const f=r instanceof FormData,h=M(M({},f?{}:{"Content-Type":"application/json"}),i==null?void 0:i.headers);s&&this._accessToken&&(h.Authorization=`Bearer ${this._accessToken}`);const m={method:t,headers:h,signal:(i==null?void 0:i.signal)||d.signal};r&&t==="POST"&&(m.body=f?r:JSON.stringify(r));const E=yield fetch(`${this.baseURL}${n}`,m);if(clearTimeout(c),!E.ok){const b=yield E.text().catch(()=>E.statusText);if(E.status===401&&s&&u===0){if(this._usingContinuationToken)throw this.logger.warn("Got 401 with continuation token — cannot auto-refresh"),new Hf(`Request ${t} ${n} failed (401): continuation token expired or invalid. Reconnect without a continuation token to create a new session.`);if(this._conversationId)throw this.logger.warn("Got 401 with active conversation — cannot auto-refresh (would orphan conversation)"),new Hf(`Request ${t} ${n} failed (401): session expired. Call connect() to start a new session.`);this.logger.info("Got 401 — refreshing token and retrying..."),this._accessToken=yield this.fetchAccessToken(),u++;continue}throw new T1(`Request ${t} ${n} failed (${E.status}): ${b}`,E.status,b)}return E.status===204||t==="DELETE"?{}:(i==null?void 0:i.responseType)==="blob"?yield E.blob():E.text().then(b=>b?JSON.parse(b):null)}catch(d){if(clearTimeout(c),d instanceof Vr)throw d;if(d instanceof DOMException&&d.name==="AbortError")throw new _1("Request timeout exceeded",u+1,{cause:d});if(d instanceof TypeError){if(u<this.maxRetries){u++;const f=100*Math.random(),h=300*Math.pow(2,u-1)+f;this.logger.info(`Network error, retrying (${u}/${this.maxRetries}) in ${h.toFixed(0)}ms...`),yield new Promise(m=>setTimeout(m,h));continue}throw new _1(`Network error: ${d.message}`,u,{cause:d})}throw new Vr(`Unexpected error: ${d instanceof Error?d.message:String(d)}`,"unknown",{cause:d instanceof Error?d:void 0})}}})}assertConnected(){if(!this._isConnected||!this._accessToken)throw new Vr("Client is not connected. Call connect() first.","unknown")}getTokenExpiry(t){var n;try{const r=t.split(".")[1];return 1e3*((n=JSON.parse(atob(r)).exp)!=null?n:0)}catch(r){return 0}}extractMessagingSessionId(t){var n;return(n=t.relatedRecords)==null?void 0:n.find(r=>r.startsWith(xk))}parseEntryPayload(t){if(!t.entryPayload)return{};if(typeof t.entryPayload=="string")try{return JSON.parse(t.entryPayload)}catch(n){return{}}return t.entryPayload}getNestedValue(t,...n){let r=t;for(const i of n){if(r==null||typeof r!="object")return;r=r[i]}return r}getNestedString(t,...n){const r=this.getNestedValue(t,...n);return typeof r=="string"?r:""}};const _k={sessionStarted:()=>{},sessionEnded:()=>{},participantJoined:()=>{},participantLeft:()=>{},conversationEnded:()=>{},connectSucceeded:()=>{},reconnectSucceeded:()=>{},conversationStarted:()=>{},sessionInitialized:()=>{},agentReplied:()=>{},connectionState:()=>{},sessionState:()=>{},uiState:()=>{},viewState:()=>{},contentState:()=>{},failure:()=>{},overrideFailure:()=>{},overrideEvent:()=>{}},vk={conversationId:null,messagingSessionId:null},v1=performance.now(),S1=e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e)?e:"other",Sk=e=>typeof e=="number"&&Number.isInteger(e)&&e>=100&&e<=599,Ak=/^[a-z][a-z0-9_]{0,39}$/,kk=/^[a-zA-Z][a-zA-Z0-9_]{0,31}$/,Ck=8,Nk=20,Ik=50,Ok=new Set(["env","org","esdn","wsid","msid","source","override"]),A1=e=>typeof e=="string"&&Ak.test(e)?e:"invalid_code",k1=(e,t)=>{const n={source:"override",override:S1(e)};if(!t||typeof t!="object")return n;let r=0;for(const[i,s]of Object.entries(t)){if(r>=Ck)break;!kk.test(i)||Ok.has(i)||(typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s))&&(n[i]=String(s),r++)}return n},Pk=()=>{try{return window.location.origin}catch(e){return""}},Rk="production",Lk=()=>null;let $f=null;const Dk=50;let ws=null;const Mk=e=>{ws==null&&(ws=setTimeout(()=>{ws=null,e.collector.upload().catch(()=>{})},Dk))},Fk=e=>{ws!=null&&(clearTimeout(ws),ws=null),e.collector.upload().catch(()=>{})};function Bk(e){return Ie(this,null,function*(){return null})}function Uk(e){if(!Lk())return _k;const n=performance.now();$f||($f=Bk());const r=$f,i=[`env=${Rk}`,`org=${e.orgId}`,`esdn=${e.esDeveloperName}`,`wsid=${e.widgetSessionId}`].join(";"),s=(m,E,b)=>{var S,R;const T=(R=(S=e.getIdentity)==null?void 0:S.call(e))!=null?R:vk,_=Pk(),I=[i];if(T.messagingSessionId&&I.push(`msid=${T.messagingSessionId}`),b!=null&&b.configExtra)for(const[U,B]of Object.entries(b.configExtra))B!==null&&I.push(`${U}=${B}`);const v=I.join(";");r.then(U=>{var B;if(U)try{const A=m==="state"?U.currentStateSchema:m==="failure"?U.failureEventSchema:U.interactionEventSchema;U.app.log(A,M(ce(M({convId:(B=T.conversationId)!=null?B:""},E?{op:E,feature:"agentforce-messaging"}:{}),{method:"sse",clientName:"copilot-widget",participantType:"EndUser",hostUrl:_,convType:"agentforce",jwtClaims:"",configDev:v}),b==null?void 0:b.extra)),b!=null&&b.flushNow?Fk(U):Mk(U)}catch(A){}}).catch(()=>{})};let u=0,c=0;const d=(m,E)=>s("interaction",m,E),f=(m,E)=>s("state",m,{extra:{stateMessage:`${m}:${E}`}}),h=(m,E,b)=>s("failure",null,{extra:{errMessage:m,errCode:Sk(E)?E:0},configExtra:b});return{sessionStarted:()=>d("session_started",{configExtra:{evalAtMs:Math.round(v1),mountMs:Math.round(n-v1)}}),sessionEnded:(m,E,b)=>d("session_ended",{configExtra:{reason:m,durationMs:E,idleMs:b},flushNow:m==="navigated_away"}),participantJoined:m=>d("participant_joined",{extra:{participantType:"Agent",feature:m}}),participantLeft:(m,E)=>d("participant_left",{extra:{participantType:"Agent",feature:m},configExtra:{idleMs:E}}),conversationEnded:(m,E)=>d("conversation_ended",{configExtra:{reason:m,idleMs:E}}),connectSucceeded:m=>d("connect_succeeded",{configExtra:{connectMs:m}}),reconnectSucceeded:(m,E)=>d("reconnect_succeeded",{configExtra:{recoverMs:m,attempts:E}}),conversationStarted:m=>d("conversation_started",{configExtra:{via:m}}),sessionInitialized:(m,E)=>d("session_initialized",{configExtra:{outcome:m,restored:E}}),agentReplied:(m,E)=>d("agent_replied",{configExtra:{responseMs:m,firstTokenMs:E,streamed:E!==null}}),connectionState:m=>f("connection_state",m),sessionState:m=>f("session_state",m?"expired":"active"),uiState:m=>f("ui_state",m),viewState:m=>f("view_state",m),contentState:m=>f("content_state",m),failure:(m,E)=>{var T;const b={};for(const[_,I]of Object.entries((T=E==null?void 0:E.context)!=null?T:{}))I!==void 0&&(b[_]=typeof I=="string"?S1(I):String(I));h(m,E==null?void 0:E.status,b)},overrideFailure:(m,E,b)=>{u>=Nk||(u++,h(`override:${A1(E)}`,b==null?void 0:b.status,k1(m,b==null?void 0:b.details)))},overrideEvent:(m,E,b)=>{c>=Ik||(c++,d("override_event",{extra:{feature:A1(E)},configExtra:k1(m,b==null?void 0:b.details)}))}}}const Dc=k.createContext(null);function jk(){var e=k.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Hk(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)}function $k(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)}var zf=typeof window!="undefined",Mc=function(e){k.useEffect(e,[])},zk=function(e){var t=k.useRef(e);t.current=e,Mc(function(){return function(){return t.current()}})},Vk=function(e){var t=k.useRef(0),n=k.useState(e),r=n[0],i=n[1],s=k.useCallback(function(u){cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){i(u)})},[]);return zk(function(){cancelAnimationFrame(t.current)}),[r,s]},qk=function(e,t){return e===t};function Wk(e,t){t===void 0&&(t=qk);var n=k.useRef(),r=k.useRef(e),i=jk();return!i&&!t(r.current,e)&&(n.current=r.current,r.current=e),n.current}var Yk=function(e){var t={},n=t.initialWidth,r=n===void 0?1/0:n,i=t.initialHeight,s=i===void 0?1/0:i,u=t.onChange,c=Vk({width:zf?window.innerWidth:r,height:zf?window.innerHeight:s}),d=c[0],f=c[1];return k.useEffect(function(){if(zf){var h=function(){var m=window.innerWidth,E=window.innerHeight;f({width:m,height:E}),u&&u(m,E)};return Hk(window,"resize",h),function(){$k(window,"resize",h)}}},[]),d};const C1=k.createContext({mode:wt.modeProxy.mode,entryType:wt.entryType,status:wt.statusProxy,dialogPosition:wt.dialogProxy.position,isDialogFullHeight:wt.dialogProxy.isFullHeight,dialogWidth:wt.dialogProxy.width,isModalFullscreen:wt.modalProxy.isFullscreen,previousComponentType:wt.statusProxy.type}),Gk=({entryType:e,componentConfig:t,componentType:n,children:r})=>{const[i,s]=k.useState(e!=null?e:wt.entryTypeProxy.entryType),[u,c]=k.useState(wt.modeProxy.mode),[d,f]=k.useState({type:n||wt.statusProxy.type,isOpen:t&&"isOpen"in t?!!t.isOpen:wt.statusProxy.isOpen,isMinimized:t&&"isMinimized"in t?!!t.isMinimized:wt.statusProxy.isMinimized}),[h,m]=k.useState(wt.dialogProxy.position),[E,b]=k.useState(wt.dialogProxy.isFullHeight),[T,_]=k.useState(wt.dialogProxy.width),[I,v]=k.useState(wt.modalProxy.isFullscreen),S=k.useRef(!1),R=Wk(d.type);k.useEffect(()=>{const B=A=>{const{property:G,value:q}=A.detail||{};if(!(!G||q===void 0)){if(G==="mode"){c(q);return}if(G==="entryType"){s(q);return}if(G==="isMinimized"){f(te=>ce(M({},te),{isMinimized:q}));return}if(G==="isOpen"){f(te=>ce(M({},te),{isOpen:q}));return}if(G==="type"){f(te=>ce(M({},te),{type:q}));return}if(G==="position"){m(q);return}if(G==="isFullHeight"){b(q);return}if(G==="width"){_(q);return}if(G==="isFullscreen"){v(q);return}}};return p1(B),()=>{h1(B)}},[]),Mc(()=>{e&&Oc(e)}),Mc(()=>{if(S.current)return;S.current=!0;const B=n||(t==null?void 0:t.type);B&&Es(B);const A=ek();t&&"isOpen"in t&&zr(!!t.isOpen),t&&"isMinimized"in t&&wo(!!t.isMinimized),A&&wo(!0)}),Mc(()=>{if(!(t!=null&&t.options))return;const{dialogPosition:B}=t.options;B&&Rc(B),"dialogFullHeight"in t.options&&rk(!!t.options.dialogFullHeight),"dialogWidth"in t.options&&t.options.dialogWidth&&_(t.options.dialogWidth),"isModalFullscreen"in t.options&&Pc(!!t.options.isModalFullscreen)});const U=k.useMemo(()=>({mode:u,entryType:i,status:d,previousComponentType:R||"dialog",dialogPosition:h,isDialogFullHeight:E,dialogWidth:T,isModalFullscreen:I}),[u,i,d,R,h,E,T,I]);return w.jsx(C1.Provider,{value:U,children:r})},jn=()=>{const e=k.useContext(C1);if(!e)throw new Error("useUIState must be used within a UIStateProvider");return e},Vf=5*1024*1024,N1=["image/gif","image/jpg","image/jpeg","image/png","image/webp"],Xk=".gif,.jpg,.jpeg,.png,.webp",Kk=["image/bmp","image/jpg","image/jpeg","image/png","image/tiff"],Qk=1024,Jk=.8,Zk="image/jpeg",I1=100,eC=I1*1e6,qf=(i,...s)=>Ie(null,[i,...s],function*(e,{maxDimension:t=Qk,quality:n=Jk,mimeType:r=Zk}={}){if(typeof createImageBitmap!="function")throw new Error("createImageBitmap is not available");const{width:u,height:c}=yield tC(e);if(u*c>eC)throw new Error(`Image resolution ${u}x${c} exceeds the ${I1} MP limit`);const d=yield nC(e);try{const{width:f,height:h}=rC(d.width,d.height,t);if(f===d.width&&h===d.height&&e.type===r)return e;const m=document.createElement("canvas");m.width=f,m.height=h;const E=m.getContext("2d");if(!E)return e;E.imageSmoothingEnabled=!0,E.imageSmoothingQuality="high",r==="image/jpeg"&&(E.fillStyle="#ffffff",E.fillRect(0,0,f,h)),E.drawImage(d,0,0,f,h);const b=yield iC(m,r,n);return b?new File([b],oC(e.name,r),{type:r,lastModified:e.lastModified}):e}finally{"close"in d&&typeof d.close=="function"&&d.close()}}),O1=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>{var i;return n((i=r.error)!=null?i:new Error("FileReader failed"))},r.readAsDataURL(e)}),tC=e=>new Promise((t,n)=>{const r=URL.createObjectURL(e),i=new Image;i.onload=()=>{URL.revokeObjectURL(r),t({width:i.naturalWidth,height:i.naturalHeight})},i.onerror=()=>{URL.revokeObjectURL(r),n(new Error("Could not decode image"))},i.src=r}),nC=e=>createImageBitmap(e,{imageOrientation:"from-image"}),rC=(e,t,n)=>{const r=Math.max(e,t);if(r<=n)return{width:e,height:t};const i=n/r;return{width:Math.round(e*i),height:Math.round(t*i)}},iC=(e,t,n)=>new Promise(r=>e.toBlob(r,t,n)),oC=(e,t)=>{const n=t==="image/png"?"png":t==="image/webp"?"webp":"jpg";return`${e.replace(/\.[^./\\]+$/,"")||"image"}.${n}`},Ot={SET_PROMPTS_EXTENSION_INITIALIZED:"SET_PROMPTS_EXTENSION_INITIALIZED",SET_PROMPTS_EXTENSION_OPEN:"SET_PROMPTS_EXTENSION_OPEN",SET_PROMPTS_EXTENSION_INLINE:"SET_PROMPTS_EXTENSION_INLINE",SET_PROMPTS_EXTENSION_ELEMENT_ID:"SET_PROMPTS_EXTENSION_ELEMENT_ID",SET_PROMPTS_EXTENSION_ENTRY_TYPE:"SET_PROMPTS_EXTENSION_ENTRY_TYPE",SET_PROMPTS_EXTENSION_PARAMS:"SET_PROMPTS_EXTENSION_PARAMS",RESET_PROMPTS_EXTENSION_PARAMS:"RESET_PROMPTS_EXTENSION_PARAMS",SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:"SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID",RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:"RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID",SET_PROMPTS_EXTENSION_USER_PROMPT:"SET_PROMPTS_EXTENSION_USER_PROMPT",SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:"SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE",RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:"RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE",SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:"SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE",RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:"RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE",SET_PROMPTS_EXTENSION_RESPONSE_LOADING:"SET_PROMPTS_EXTENSION_RESPONSE_LOADING"},P1={isInitialized:!1,isOpen:!1,isInline:!1,elementId:null,placeholder:null,askElseButtonLabel:null,entryType:null,params:null,activePromptsId:null,userPrompt:null,promptsMessage:null,isResponseLoading:!1,responseMessage:null,promptsDisplay:"both",staticQuestions:[],staticQuestionsStrategy:"append",disableAskElseButton:!1};function R1(e,t){return function(){return e.apply(t,arguments)}}const{toString:sC}=Object.prototype,{getPrototypeOf:Pi}=Object,{iterator:Da,toStringTag:L1}=Symbol,Ma=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),D1=e=>typeof e=="string"&&(e==="__proto__"||e==="constructor"||e==="prototype"),M1=(e,t,n)=>e===Object.prototype||!n&&t===null,aC=e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(n=>{if(D1(n))return!1;const r=Object.getOwnPropertyDescriptor(e,n);return!!r&&r.configurable&&r.writable===!0})},Fa=(e,t)=>{let n=e;const r=[];for(;n!=null;){if(r.indexOf(n)!==-1)return!1;r.push(n);const i=Pi(n);if(M1(n,i,n===e))return!1;if(Ma(n,t))return!0;n=i}return!1},uC=(e,t)=>e!=null&&Fa(e,t)?e[t]:void 0,cC=e=>{if(e==null||typeof e!="object"&&typeof e!="function")return e;const t=Pi(e);if(t===null&&aC(e))return e;const n=Object.create(null),r=Object.create(null),i=[];let s=e;for(;s!=null&&i.indexOf(s)===-1;){i.push(s);const u=s===e?t:Pi(s);if(M1(s,u,s===e))break;const c=Object.getOwnPropertyNames(s);Object.getOwnPropertySymbols&&c.push(...Object.getOwnPropertySymbols(s));for(const d of c)D1(d)||Ma(r,d)||(n[d]=e[d],r[d]=!0);s=u}return n},Wf=(e=>t=>{const n=sC.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),pr=e=>(e=e.toLowerCase(),t=>Wf(t)===e),Fc=e=>t=>typeof t===e,{isArray:xo}=Array,To=Fc("undefined");function xs(e){return e!==null&&!To(e)&&e.constructor!==null&&!To(e.constructor)&&Hn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const F1=pr("ArrayBuffer");function lC(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&F1(e.buffer),t}const dC=Fc("string"),Hn=Fc("function"),B1=Fc("number"),Ts=e=>e!==null&&typeof e=="object",fC=e=>e===!0||e===!1,Bc=e=>{if(!Ts(e))return!1;const t=Pi(e);return(t===null||t===Object.prototype||Pi(t)===null)&&!Fa(e,L1)&&!Fa(e,Da)},pC=e=>{if(!Ts(e)||xs(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},hC=pr("Date"),mC=pr("File"),gC=e=>!!(e&&typeof e.uri!="undefined"),yC=e=>e&&typeof e.getParts!="undefined",EC=pr("Blob"),bC=pr("FileList"),wC=pr("Set"),xC=e=>Ts(e)&&Hn(e.pipe);function TC(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}}const U1=TC(),j1=typeof U1.FormData!="undefined"?U1.FormData:void 0,_C=e=>{if(!e)return!1;if(j1&&e instanceof j1)return!0;const t=Pi(e);if(!t||t===Object.prototype||!Hn(e.append))return!1;const n=Wf(e);return n==="formdata"||n==="object"&&Hn(e.toString)&&e.toString()==="[object FormData]"},vC=pr("URLSearchParams"),[SC,AC,kC,CC]=["ReadableStream","Request","Response","Headers"].map(pr),NC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ba(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e=="undefined")return;let r,i;if(typeof e!="object"&&(e=[e]),xo(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(xs(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),u=s.length;let c;for(r=0;r<u;r++)c=s[r],t.call(null,e[c],c,e)}}function H1(e,t){if(xs(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const _o=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,$1=e=>!To(e)&&e!==_o;function Yf(...e){const{caseless:t,skipUndefined:n}=$1(this)&&this||{},r={},i=(s,u)=>{if(u==="__proto__"||u==="constructor"||u==="prototype")return;const c=t&&typeof u=="string"&&H1(r,u)||u,d=Ma(r,c)?r[c]:void 0;Bc(d)&&Bc(s)?r[c]=Yf(d,s):Bc(s)?r[c]=Yf({},s):xo(s)?r[c]=s.slice():(!n||!To(s))&&(r[c]=s)};for(let s=0,u=e.length;s<u;s++){const c=e[s];if(!c||xs(c)||(Ba(c,i),typeof c!="object"||xo(c)))continue;const d=Object.getOwnPropertySymbols(c);for(let f=0;f<d.length;f++){const h=d[f];HC.call(c,h)&&i(c[h],h)}}return r}const IC=(e,t,n,{allOwnKeys:r}={})=>(Ba(t,(i,s)=>{n&&Hn(i)?Object.defineProperty(e,s,{__proto__:null,value:R1(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,s,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),OC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),PC=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},RC=(e,t,n,r)=>{let i,s,u;const c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)u=i[s],(!r||r(u,e,t))&&!c[u]&&(t[u]=e[u],c[u]=!0);e=n!==!1&&Pi(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},LC=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},DC=e=>{if(!e)return null;if(xo(e))return e;let t=e.length;if(!B1(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},MC=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&Pi(Uint8Array)),FC=(e,t)=>{const r=(e&&e[Da]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},BC=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},UC=pr("HTMLFormElement"),jC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),{propertyIsEnumerable:HC}=Object.prototype,$C=pr("RegExp"),z1=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ba(n,(i,s)=>{let u;(u=t(i,s,e))!==!1&&(r[s]=u||i)}),Object.defineProperties(e,r)},zC=e=>{z1(e,(t,n)=>{if(Hn(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Hn(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},VC=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return xo(e)?r(e):r(String(e).split(t)),n},qC=()=>{},WC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function YC(e){return!!(e&&Hn(e.append)&&e[L1]==="FormData"&&e[Da])}const GC=e=>{const t=new WeakSet,n=r=>{if(Ts(r)){if(t.has(r))return;if(xs(r))return r;if(!("toJSON"in r)){t.add(r);let i;if(wC(r)){i=[];for(const s of r){const u=n(s);!To(u)&&i.push(u)}}else i=xo(r)?[]:{},Ba(r,(s,u)=>{const c=n(s);!To(c)&&(i[u]=c)});return t.delete(r),i}}return r};return n(e)},XC=pr("AsyncFunction"),KC=e=>e&&(Ts(e)||Hn(e))&&Hn(e.then)&&Hn(e.catch),V1=((e,t)=>e?setImmediate:t?((n,r)=>(_o.addEventListener("message",({source:i,data:s})=>{i===_o&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),_o.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Hn(_o.postMessage)),QC=typeof queueMicrotask!="undefined"?queueMicrotask.bind(_o):typeof process!="undefined"&&process.nextTick||V1,q1=e=>e!=null&&Hn(e[Da]),Y={isArray:xo,isArrayBuffer:F1,isBuffer:xs,isFormData:_C,isArrayBufferView:lC,isString:dC,isNumber:B1,isBoolean:fC,isObject:Ts,isPlainObject:Bc,isEmptyObject:pC,isReadableStream:SC,isRequest:AC,isResponse:kC,isHeaders:CC,isUndefined:To,isDate:hC,isFile:mC,isReactNativeBlob:gC,isReactNative:yC,isBlob:EC,isRegExp:$C,isFunction:Hn,isStream:xC,isURLSearchParams:vC,isTypedArray:MC,isFileList:bC,forEach:Ba,merge:Yf,extend:IC,trim:NC,stripBOM:OC,inherits:PC,toFlatObject:RC,kindOf:Wf,kindOfTest:pr,endsWith:LC,toArray:DC,forEachEntry:FC,matchAll:BC,isHTMLForm:UC,hasOwnProperty:Ma,hasOwnProp:Ma,hasOwnInPrototypeChain:Fa,getSafeProp:uC,toSafeFlatObject:cC,reduceDescriptors:z1,freezeMethods:zC,toObjectSet:VC,toCamelCase:jC,noop:qC,toFiniteNumber:WC,findKey:H1,global:_o,isContextDefined:$1,isSpecCompliantForm:YC,toJSONObject:GC,isAsyncFn:XC,isThenable:KC,setImmediate:V1,asap:QC,isIterable:q1,isSafeIterable:e=>e!=null&&Fa(e,Da)&&q1(e)},JC=Y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ZC=e=>{const t={};let n,r,i;return e&&e.split(`
|
|
8
|
+
`);this.logger.debug(`SSE event: ${n}`,i.slice(0,200)),this.onEvent(n,i)}}class Vr extends Error{constructor(t,n="unknown",r){super(t,r),this.name="AgentforceClientError",this.type=n}}let T1=class extends Vr{constructor(t,n,r,i){super(t,"api",i),this.name="AgentforceApiError",this.statusCode=n,this.responseBody=r}};class _1 extends Vr{constructor(t,n=1,r){super(t,"network",r),this.name="AgentforceNetworkError",this.attemptsMade=n}}let Hf=class extends Vr{constructor(t,n){super(t,"auth",n),this.name="AgentforceAuthError"}};class wk{constructor(t){this.prefix="[Agentforce]",this.enabled=t}info(t,...n){this.enabled&&console.log(`${this.prefix} ${t}`,...n)}warn(t,...n){this.enabled&&console.warn(`${this.prefix} ${t}`,...n)}error(t,...n){this.enabled&&console.error(`${this.prefix} ${t}`,...n)}debug(t,...n){this.enabled&&console.debug(`${this.prefix} ${t}`,...n)}}const xk="0Mw";let Tk=class extends Ek{constructor({baseURL:t,orgId:n,esDeveloperName:r,options:i={}}){var u,c,d,f,h,m,E;super(),this._accessToken=null,this._tokenExpiresAt=0,this._conversationId=null,this._isConnected=!1,this._usingContinuationToken=!1,this.sseReader=null,this.reconnectAttempts=0,this.reconnectTimeout=null,this.intentionalDisconnect=!1,this.baseURL=t.replace(/\/+$/,""),this.orgId=n,this.esDeveloperName=r;const s={maxRetries:(u=i.maxRetries)!=null?u:3,timeout:(c=i.timeout)!=null?c:15e3,maxReconnectAttempts:(d=i.maxReconnectAttempts)!=null?d:5,reconnectDelay:(f=i.reconnectDelay)!=null?f:2e3,enableLogging:(h=i.enableLogging)!=null?h:!1,platform:(m=i.platform)!=null?m:"Web",capabilitiesVersion:(E=i.capabilitiesVersion)!=null?E:"1"};this.maxRetries=s.maxRetries,this.timeout=s.timeout,this.maxReconnectAttempts=s.maxReconnectAttempts,this.reconnectDelay=s.reconnectDelay,this.platform=s.platform,this.capabilitiesVersion=s.capabilitiesVersion,this.logger=new wk(s.enableLogging),this.logger.info(`Client initialized for ${this.baseURL}`)}get isConnected(){return this._isConnected}get conversationId(){return this._conversationId}get accessToken(){return this._accessToken}connect(t){return Ie(this,null,function*(){this.intentionalDisconnect=!1,this.reconnectAttempts=0,this.logger.info("Connecting..."),t!=null&&t.continuationToken?(this._accessToken=t.continuationToken,this._tokenExpiresAt=this.getTokenExpiry(t.continuationToken),this._usingContinuationToken=!0,this.logger.info("Using continuation token")):(this._accessToken=yield this.fetchAccessToken(),this._usingContinuationToken=!1,this.logger.info("Access token acquired")),yield this.openSSE(t==null?void 0:t.lastEventId)})}disconnect(){this.intentionalDisconnect=!0,this.clearReconnectTimer(),this.closeSSE(),this._isConnected=!1,this.logger.info("Disconnected")}reconnect(){this._isConnected||(this.intentionalDisconnect=!1,this.reconnectAttempts=0,this.attemptReconnect())}createConversation(t,n){return Ie(this,null,function*(){this.assertConnected();const r=crypto.randomUUID(),i=M({conversationId:r,esDeveloperName:this.esDeveloperName,routingAttributes:t!=null?t:{}},n?{context:n}:{});return yield this.executeRequest("POST","/iamessage/api/v2/conversation",i),this._conversationId=r,this.logger.info(`Conversation created: ${r}`),r})}sendMessage(t,n){return Ie(this,null,function*(){var f,h;if(this.assertConnected(),!this._conversationId)throw new Vr("No active conversation. Call createConversation() first.","unknown");const r=this._conversationId,i=crypto.randomUUID(),s=M({message:{id:i,messageType:"StaticContentMessage",staticContent:{formatType:"Text",text:t}},esDeveloperName:this.esDeveloperName},n?{context:n}:{}),u=yield this.executeRequest("POST",`/iamessage/api/v2/conversation/${r}/message`,s),c={conversationEntries:(f=u==null?void 0:u.conversationEntries)!=null?f:[]},d=u==null?void 0:u.warning;if(d){c.warning=d;const m=(h=c.conversationEntries[0])==null?void 0:h.id;this.logger.warn(`Message acknowledgement warning: conversationId=${r}, esDeveloperName=${this.esDeveloperName}, warningCode=${d.warningCode}, warningMessage=${d.warningMessage}, messageEntryId=${m!=null?m:"not-returned"}`)}return this.logger.debug(`Message sent: ${i}`),c})}sendFile(t,n){return Ie(this,null,function*(){var u;if(this.assertConnected(),!this._conversationId)throw new Vr("No active conversation. Call createConversation() first.","unknown");const r={message:M({id:crypto.randomUUID(),fileId:crypto.randomUUID()},n!=null&&n.text?{text:n.text}:{}),esDeveloperName:this.esDeveloperName},i=new FormData;i.append("messageEntry",new Blob([JSON.stringify(r)],{type:"application/json"})),i.append("fileData",t);const s=yield this.executeRequest("POST",`/iamessage/api/v2/conversation/${this._conversationId}/file`,i);return this.logger.debug(`File sent: ${r.message.fileId}`),{conversationEntries:(u=s==null?void 0:s.conversationEntries)!=null?u:[]}})}endConversation(){return Ie(this,null,function*(){if(!this._conversationId||!this._accessToken)return;const t=this._conversationId;this._conversationId=null;try{yield this.executeRequest("DELETE",`/iamessage/api/v2/conversation/${t}?esDeveloperName=${encodeURIComponent(this.esDeveloperName)}`),this.logger.info(`Conversation ended: ${t}`)}catch(n){this.logger.warn(`Failed to end conversation (best effort): ${n instanceof Error?n.message:String(n)}`)}})}listConversations(t){return Ie(this,null,function*(){var u,c,d;this.assertConnected();const n=new URLSearchParams;(t==null?void 0:t.inclClosedConvs)!=null&&n.set("inclClosedConvs",String(t.inclClosedConvs)),(t==null?void 0:t.limit)!=null&&n.set("limit",String(t.limit)),t!=null&&t.conversationId&&n.set("conversationId",t.conversationId),(t==null?void 0:t.startTimestamp)!=null&&n.set("startTimestamp",String(t.startTimestamp)),(t==null?void 0:t.endTimestamp)!=null&&n.set("endTimestamp",String(t.endTimestamp));const r=n.toString(),i="/iamessage/api/v2/conversation/list"+(r?`?${r}`:""),s=yield this.executeRequest("GET",i);return{conversations:(u=s.conversations)!=null?u:[],openConversationsFound:(c=s.openConversationsFound)!=null?c:0,closedConversationsFound:(d=s.closedConversationsFound)!=null?d:0}})}listConversationEntries(t,n){return Ie(this,null,function*(){var u;this.assertConnected();const r=new URLSearchParams;(n==null?void 0:n.limit)!=null&&r.set("limit",String(n.limit)),(n==null?void 0:n.startTimestamp)!=null&&r.set("startTimestamp",String(n.startTimestamp)),(n==null?void 0:n.endTimestamp)!=null&&r.set("endTimestamp",String(n.endTimestamp)),n!=null&&n.direction&&r.set("direction",n.direction),n!=null&&n.entryTypeFilter&&n.entryTypeFilter.length>0&&r.set("entryTypeFilter",n.entryTypeFilter.join(","));const i=r.toString(),s=`/iamessage/api/v2/conversation/${t}/entries${i?`?${i}`:""}`;return{conversationEntries:(u=(yield this.executeRequest("GET",s)).conversationEntries)!=null?u:[]}})}retrieveConversationTranscript(t){return Ie(this,null,function*(){this.assertConnected();const n=t!=null?t:this._conversationId;if(!n)throw new Vr("No active conversation. Call createConversation() first or pass a conversationId.","unknown");const r=`/iamessage/api/v2/conversation/${n}/transcript?esDeveloperName=${encodeURIComponent(this.esDeveloperName)}`;return this.executeRequest("GET",r,void 0,{responseType:"blob"})})}resumeConversation(t){if(this.assertConnected(),!t)throw new Vr("conversationId is required to resume a conversation.","unknown");this._conversationId=t,this.logger.info(`Conversation resumed: ${t}`)}generateContinuationToken(){return Ie(this,null,function*(){this.assertConnected();const t=yield this.executeRequest("GET","/iamessage/api/v2/authorization/continuation-access-token");return this.logger.info("Continuation token generated"),t})}getAuthLinkKey(){return Ie(this,null,function*(){this.assertConnected();const t=yield this.executeRequest("GET","/iamessage/api/v2/authorization/authlink");if(!t||!t.authLinkKey)throw new T1("Auth link response did not contain an authLinkKey",200,t);return this.logger.info("Auth link key retrieved"),t.authLinkKey})}openSSE(t){return Ie(this,null,function*(){this.closeSSE();const n=`${this.baseURL}/eventrouter/v1/sse`,r={Authorization:`Bearer ${this._accessToken}`,"X-Org-Id":this.orgId};t&&(r["Last-Event-ID"]=t),this.sseReader=new bk(n,r,(i,s)=>this.handleSSEEvent(i,s),i=>this.handleSSEClose(i),this.logger),yield this.sseReader.connect(),this._isConnected=!0,this.emit("connected"),this.logger.info("SSE stream connected")})}closeSSE(){this.sseReader&&(this.sseReader.disconnect(),this.sseReader=null)}handleSSEClose(t){this._isConnected=!1,this.emit("disconnected",{reason:t}),this.intentionalDisconnect||this.attemptReconnect()}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return this.logger.error(`Max reconnect attempts (${this.maxReconnectAttempts}) reached.`),void this.emit("error",{code:"MAX_RECONNECT",message:`Failed to reconnect after ${this.maxReconnectAttempts} attempts`,recoverable:!1});this.reconnectAttempts++;const t=500*Math.random(),n=Math.min(this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1)+t,3e4);this.logger.info(`Reconnecting in ${n.toFixed(0)}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})...`),this.emit("reconnecting",{attempt:this.reconnectAttempts,maxAttempts:this.maxReconnectAttempts}),this.reconnectTimeout=setTimeout(()=>Ie(this,null,function*(){try{if(this.intentionalDisconnect)return;if(!(this._accessToken&&Date.now()<this._tokenExpiresAt))return this.logger.error("Access token expired — session cannot be resumed"),this.emit("error",{code:"SESSION_EXPIRED",message:"Session expired. Call connect() to start a new session.",recoverable:!1}),void(this._conversationId=null);if(this.logger.info("Reusing existing access token for SSE reconnection"),this.intentionalDisconnect)return;yield this.openSSE(),this.reconnectAttempts=0,this.logger.info("Reconnected successfully")}catch(r){if(this.intentionalDisconnect)return;const i=r instanceof Error?r.message:String(r);if(i.includes("(401)"))return this.logger.error("SSE rejected token (401) — session expired"),this.emit("error",{code:"SESSION_EXPIRED",message:"Session expired. Call connect() to start a new session.",recoverable:!1}),void(this._conversationId=null);this.logger.error(`Reconnect attempt ${this.reconnectAttempts} failed: ${i}`),this.attemptReconnect()}}),n)}clearReconnectTimer(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}handleSSEEvent(t,n){if(t==="ping")return;let r;try{r=JSON.parse(n)}catch(i){return void this.logger.debug(`Non-JSON SSE event (${t}): ${n.slice(0,100)}`)}switch(t){case"CONVERSATION_ROUTING_RESULT":this.handleRoutingResult(r);break;case"CONVERSATION_MESSAGE":this.handleConversationMessage(r);break;case"CONVERSATION_STREAMING_TOKEN":this.handleStreamingToken(r);break;case"CONVERSATION_TYPING_STARTED_INDICATOR":this.handleTypingStarted(r);break;case"CONVERSATION_TYPING_STOPPED_INDICATOR":this.handleTypingStopped(r);break;case"CONVERSATION_PROGRESS_INDICATOR":this.handleProgressIndicator(r);break;case"CONVERSATION_PARTICIPANT_CHANGED":this.handleParticipantChanged(r);break;case"CONVERSATION_CLOSE_CONVERSATION":this.handleConversationClosed(r);break;default:this.logger.debug(`Unhandled SSE event type: ${t}`)}}handleRoutingResult(t){let n=t;t.conversationEntry&&(n=this.parseEntryPayload(t.conversationEntry));const r=n.failureType||n.routingFailureType||"",i=!r||r==="None"||r==="NO_ERROR";this.emit("routing_result",{conversationId:this._conversationId||"",isSuccessful:i,failureType:i?void 0:r,raw:n}),i||this.emit("error",{code:"ROUTING_FAILED",message:`Routing failed: ${r}`,recoverable:!1})}handleConversationMessage(t){var c;const n=t.conversationEntry;if(!n)return;const r=((c=n.sender)==null?void 0:c.role)||"";if(r==="EndUser"||r==="Customer")return;const i=this.parseEntryPayload(n),s=this.getNestedValue(i,"abstractMessage"),u=this.getNestedString(s,"staticContent","text")||this.getNestedString(s,"content","text")||"";u&&this.emit("message",{conversationId:this._conversationId||"",messageId:n.identifier||"",content:u,sender:{role:r,name:n.senderDisplayName},timestamp:n.transcriptedTimestamp||new Date().toISOString(),raw:i,messagingSessionId:this.extractMessagingSessionId(n)})}handleStreamingToken(t){let n,r,i,s="";if(t.conversationEntry){const u=this.parseEntryPayload(t.conversationEntry),c=this.getNestedValue(u,"streamingToken");s=this.getNestedString(c,"token","text")||this.getNestedString(c,"token","content")||"";const d=this.getNestedValue(c,"sequenceNumber");typeof d=="number"&&(n=d);const f=this.getNestedString(c,"targetMessageIdentifier");f&&(r=f);const h=this.getNestedString(c,"tokenType");h&&(i=h)}s||(s=t.token||t.text||""),s?this.emit("streaming_token",M(M(M({conversationId:this._conversationId||"",token:String(s)},n!==void 0?{sequenceNumber:n}:{}),r?{targetMessageId:r}:{}),i?{tokenType:i}:{})):this.logger.warn("STREAMING_TOKEN received but no token text could be extracted — payload shape may have changed")}handleTypingStarted(t){var n;this.emit("typing_started",{conversationId:this._conversationId||"",participant:(n=t.conversationEntry)!=null&&n.sender?{role:t.conversationEntry.sender.role||"",name:t.conversationEntry.senderDisplayName}:void 0})}handleTypingStopped(t){var n;this.emit("typing_stopped",{conversationId:this._conversationId||"",participant:(n=t.conversationEntry)!=null&&n.sender?{role:t.conversationEntry.sender.role||"",name:t.conversationEntry.senderDisplayName}:void 0})}handleProgressIndicator(t){const n=t.conversationEntry;if(!n)return;const r=this.parseEntryPayload(n),i=this.getNestedValue(r,"progressIndicator"),s=this.getNestedString(i,"progressMessage","text")||this.getNestedString(i,"progressMessage","content")||t.text||"";if(!s)return;const u=this.getNestedString(i,"indicatorType")||void 0;this.emit("progress_indicator",{conversationId:this._conversationId||"",message:String(s),indicatorType:u,raw:r})}handleParticipantChanged(t){var s,u,c,d,f;let n=t;t.conversationEntry&&(n=this.parseEntryPayload(t.conversationEntry));const r=n.entries,i=(s=t.conversationEntry)==null?void 0:s.identifier;if(r&&r.length>0)r.forEach((h,m)=>{var I,v,S;const E=h.participant,b=h.displayName||(E==null?void 0:E.displayName)||((I=t.conversationEntry)==null?void 0:I.senderDisplayName)||"Agent",T=(E==null?void 0:E.role)||((S=(v=t.conversationEntry)==null?void 0:v.sender)==null?void 0:S.role)||"",_=h.operation||h.event||"";this.emit("participant_changed",M({conversationId:this._conversationId||"",participant:{role:T,name:b},action:this.normalizeParticipantAction(_)},i?{entryId:r.length>1?`${i}:${m}`:i}:{}))});else{const h=((u=t.conversationEntry)==null?void 0:u.senderDisplayName)||n.participantName||((c=n.participant)==null?void 0:c.displayName)||"Agent",m=n.operation||n.event||"";this.emit("participant_changed",M({conversationId:this._conversationId||"",participant:{role:((f=(d=t.conversationEntry)==null?void 0:d.sender)==null?void 0:f.role)||"",name:h},action:this.normalizeParticipantAction(m)},i?{entryId:i}:{}))}}normalizeParticipantAction(t){const n=t.toLowerCase();return n&&n!=="add"&&n!=="join"&&n!=="joined"&&n!=="transfer"?n==="remove"||n==="left"||n==="leave"?"remove":t:"add"}handleConversationClosed(t){this.emit("conversation_closed",{conversationId:t.conversationId||this._conversationId||""}),this._conversationId=null}fetchAccessToken(){return Ie(this,null,function*(){const t={orgId:this.orgId,esDeveloperName:this.esDeveloperName,capabilitiesVersion:this.capabilitiesVersion,platform:this.platform},n=yield this.executeRequest("POST","/iamessage/api/v2/authorization/unauthenticated/access-token",t,{useAuth:!1});if(!n.accessToken)throw new Hf("Token response missing accessToken field");return this._tokenExpiresAt=this.getTokenExpiry(n.accessToken),n.accessToken})}executeRequest(t,n,r,i){return Ie(this,null,function*(){const s=(i==null?void 0:i.useAuth)!==!1;let u=0;for(;;){let c;try{const d=new AbortController;c=setTimeout(()=>d.abort(),(i==null?void 0:i.timeout)||this.timeout);const f=r instanceof FormData,h=M(M({},f?{}:{"Content-Type":"application/json"}),i==null?void 0:i.headers);s&&this._accessToken&&(h.Authorization=`Bearer ${this._accessToken}`);const m={method:t,headers:h,signal:(i==null?void 0:i.signal)||d.signal};r&&t==="POST"&&(m.body=f?r:JSON.stringify(r));const E=yield fetch(`${this.baseURL}${n}`,m);if(clearTimeout(c),!E.ok){const b=yield E.text().catch(()=>E.statusText);if(E.status===401&&s&&u===0){if(this._usingContinuationToken)throw this.logger.warn("Got 401 with continuation token — cannot auto-refresh"),new Hf(`Request ${t} ${n} failed (401): continuation token expired or invalid. Reconnect without a continuation token to create a new session.`);if(this._conversationId)throw this.logger.warn("Got 401 with active conversation — cannot auto-refresh (would orphan conversation)"),new Hf(`Request ${t} ${n} failed (401): session expired. Call connect() to start a new session.`);this.logger.info("Got 401 — refreshing token and retrying..."),this._accessToken=yield this.fetchAccessToken(),u++;continue}throw new T1(`Request ${t} ${n} failed (${E.status}): ${b}`,E.status,b)}return E.status===204||t==="DELETE"?{}:(i==null?void 0:i.responseType)==="blob"?yield E.blob():E.text().then(b=>b?JSON.parse(b):null)}catch(d){if(clearTimeout(c),d instanceof Vr)throw d;if(d instanceof DOMException&&d.name==="AbortError")throw new _1("Request timeout exceeded",u+1,{cause:d});if(d instanceof TypeError){if(u<this.maxRetries){u++;const f=100*Math.random(),h=300*Math.pow(2,u-1)+f;this.logger.info(`Network error, retrying (${u}/${this.maxRetries}) in ${h.toFixed(0)}ms...`),yield new Promise(m=>setTimeout(m,h));continue}throw new _1(`Network error: ${d.message}`,u,{cause:d})}throw new Vr(`Unexpected error: ${d instanceof Error?d.message:String(d)}`,"unknown",{cause:d instanceof Error?d:void 0})}}})}assertConnected(){if(!this._isConnected||!this._accessToken)throw new Vr("Client is not connected. Call connect() first.","unknown")}getTokenExpiry(t){var n;try{const r=t.split(".")[1];return 1e3*((n=JSON.parse(atob(r)).exp)!=null?n:0)}catch(r){return 0}}extractMessagingSessionId(t){var n;return(n=t.relatedRecords)==null?void 0:n.find(r=>r.startsWith(xk))}parseEntryPayload(t){if(!t.entryPayload)return{};if(typeof t.entryPayload=="string")try{return JSON.parse(t.entryPayload)}catch(n){return{}}return t.entryPayload}getNestedValue(t,...n){let r=t;for(const i of n){if(r==null||typeof r!="object")return;r=r[i]}return r}getNestedString(t,...n){const r=this.getNestedValue(t,...n);return typeof r=="string"?r:""}};const _k={sessionStarted:()=>{},sessionEnded:()=>{},participantJoined:()=>{},participantLeft:()=>{},conversationEnded:()=>{},connectSucceeded:()=>{},reconnectSucceeded:()=>{},conversationStarted:()=>{},sessionInitialized:()=>{},agentReplied:()=>{},connectionState:()=>{},sessionState:()=>{},uiState:()=>{},viewState:()=>{},contentState:()=>{},failure:()=>{},overrideFailure:()=>{},overrideEvent:()=>{}},vk={conversationId:null,messagingSessionId:null},v1=performance.now(),S1=e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e)?e:"other",Sk=e=>typeof e=="number"&&Number.isInteger(e)&&e>=100&&e<=599,Ak=/^[a-z][a-z0-9_]{0,39}$/,kk=/^[a-zA-Z][a-zA-Z0-9_]{0,31}$/,Ck=8,Nk=20,Ik=50,Ok=new Set(["env","org","esdn","wsid","msid","source","override"]),A1=e=>typeof e=="string"&&Ak.test(e)?e:"invalid_code",k1=(e,t)=>{const n={source:"override",override:S1(e)};if(!t||typeof t!="object")return n;let r=0;for(const[i,s]of Object.entries(t)){if(r>=Ck)break;!kk.test(i)||Ok.has(i)||(typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s))&&(n[i]=String(s),r++)}return n},Pk=()=>{try{return window.location.origin}catch(e){return""}},Rk="production",Lk=()=>null;let $f=null;const Dk=50;let ws=null;const Mk=e=>{ws==null&&(ws=setTimeout(()=>{ws=null,e.collector.upload().catch(()=>{})},Dk))},Fk=e=>{ws!=null&&(clearTimeout(ws),ws=null),e.collector.upload().catch(()=>{})};function Bk(e){return Ie(this,null,function*(){return null})}function Uk(e){if(!Lk())return _k;const n=performance.now();$f||($f=Bk());const r=$f,i=[`env=${Rk}`,`org=${e.orgId}`,`esdn=${e.esDeveloperName}`,`wsid=${e.widgetSessionId}`].join(";"),s=(m,E,b)=>{var S,R;const T=(R=(S=e.getIdentity)==null?void 0:S.call(e))!=null?R:vk,_=Pk(),I=[i];if(T.messagingSessionId&&I.push(`msid=${T.messagingSessionId}`),b!=null&&b.configExtra)for(const[U,B]of Object.entries(b.configExtra))B!==null&&I.push(`${U}=${B}`);const v=I.join(";");r.then(U=>{var B;if(U)try{const A=m==="state"?U.currentStateSchema:m==="failure"?U.failureEventSchema:U.interactionEventSchema;U.app.log(A,M(ce(M({convId:(B=T.conversationId)!=null?B:""},E&&m==="interaction"?{op:E,feature:"agentforce-messaging"}:{}),{method:"sse",clientName:"copilot-widget",participantType:"EndUser",hostUrl:_,convType:"agentforce",jwtClaims:"",configDev:v}),b==null?void 0:b.extra)),b!=null&&b.flushNow?Fk(U):Mk(U)}catch(A){}}).catch(()=>{})};let u=0,c=0;const d=(m,E)=>s("interaction",m,E),f=(m,E)=>s("state",m,{extra:{stateMessage:`${m}:${E}`}}),h=(m,E,b)=>s("failure",null,{extra:{errMessage:m,errCode:Sk(E)?E:0},configExtra:b});return{sessionStarted:()=>d("session_started",{configExtra:{evalAtMs:Math.round(v1),mountMs:Math.round(n-v1)}}),sessionEnded:(m,E,b)=>d("session_ended",{configExtra:{reason:m,durationMs:E,idleMs:b},flushNow:m==="navigated_away"}),participantJoined:m=>d("participant_joined",{extra:{participantType:"Agent",feature:m}}),participantLeft:(m,E)=>d("participant_left",{extra:{participantType:"Agent",feature:m},configExtra:{idleMs:E}}),conversationEnded:(m,E)=>d("conversation_ended",{configExtra:{reason:m,idleMs:E}}),connectSucceeded:m=>d("connect_succeeded",{configExtra:{connectMs:m}}),reconnectSucceeded:(m,E)=>d("reconnect_succeeded",{configExtra:{recoverMs:m,attempts:E}}),conversationStarted:m=>d("conversation_started",{configExtra:{via:m}}),sessionInitialized:(m,E)=>d("session_initialized",{configExtra:{outcome:m,restored:E}}),agentReplied:(m,E)=>d("agent_replied",{configExtra:{responseMs:m,firstTokenMs:E,streamed:E!==null}}),connectionState:m=>f("connection_state",m),sessionState:m=>f("session_state",m?"expired":"active"),uiState:m=>f("ui_state",m),viewState:m=>f("view_state",m),contentState:m=>f("content_state",m),failure:(m,E)=>{var T;const b={};for(const[_,I]of Object.entries((T=E==null?void 0:E.context)!=null?T:{}))I!==void 0&&(b[_]=typeof I=="string"?S1(I):String(I));h(m,E==null?void 0:E.status,b)},overrideFailure:(m,E,b)=>{u>=Nk||(u++,h(`override:${A1(E)}`,b==null?void 0:b.status,k1(m,b==null?void 0:b.details)))},overrideEvent:(m,E,b)=>{c>=Ik||(c++,d("override_event",{extra:{feature:A1(E)},configExtra:k1(m,b==null?void 0:b.details)}))}}}const Dc=k.createContext(null);function jk(){var e=k.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Hk(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)}function $k(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)}var zf=typeof window!="undefined",Mc=function(e){k.useEffect(e,[])},zk=function(e){var t=k.useRef(e);t.current=e,Mc(function(){return function(){return t.current()}})},Vk=function(e){var t=k.useRef(0),n=k.useState(e),r=n[0],i=n[1],s=k.useCallback(function(u){cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){i(u)})},[]);return zk(function(){cancelAnimationFrame(t.current)}),[r,s]},qk=function(e,t){return e===t};function Wk(e,t){t===void 0&&(t=qk);var n=k.useRef(),r=k.useRef(e),i=jk();return!i&&!t(r.current,e)&&(n.current=r.current,r.current=e),n.current}var Yk=function(e){var t={},n=t.initialWidth,r=n===void 0?1/0:n,i=t.initialHeight,s=i===void 0?1/0:i,u=t.onChange,c=Vk({width:zf?window.innerWidth:r,height:zf?window.innerHeight:s}),d=c[0],f=c[1];return k.useEffect(function(){if(zf){var h=function(){var m=window.innerWidth,E=window.innerHeight;f({width:m,height:E}),u&&u(m,E)};return Hk(window,"resize",h),function(){$k(window,"resize",h)}}},[]),d};const C1=k.createContext({mode:wt.modeProxy.mode,entryType:wt.entryType,status:wt.statusProxy,dialogPosition:wt.dialogProxy.position,isDialogFullHeight:wt.dialogProxy.isFullHeight,dialogWidth:wt.dialogProxy.width,isModalFullscreen:wt.modalProxy.isFullscreen,previousComponentType:wt.statusProxy.type}),Gk=({entryType:e,componentConfig:t,componentType:n,children:r})=>{const[i,s]=k.useState(e!=null?e:wt.entryTypeProxy.entryType),[u,c]=k.useState(wt.modeProxy.mode),[d,f]=k.useState({type:n||wt.statusProxy.type,isOpen:t&&"isOpen"in t?!!t.isOpen:wt.statusProxy.isOpen,isMinimized:t&&"isMinimized"in t?!!t.isMinimized:wt.statusProxy.isMinimized}),[h,m]=k.useState(wt.dialogProxy.position),[E,b]=k.useState(wt.dialogProxy.isFullHeight),[T,_]=k.useState(wt.dialogProxy.width),[I,v]=k.useState(wt.modalProxy.isFullscreen),S=k.useRef(!1),R=Wk(d.type);k.useEffect(()=>{const B=A=>{const{property:G,value:q}=A.detail||{};if(!(!G||q===void 0)){if(G==="mode"){c(q);return}if(G==="entryType"){s(q);return}if(G==="isMinimized"){f(te=>ce(M({},te),{isMinimized:q}));return}if(G==="isOpen"){f(te=>ce(M({},te),{isOpen:q}));return}if(G==="type"){f(te=>ce(M({},te),{type:q}));return}if(G==="position"){m(q);return}if(G==="isFullHeight"){b(q);return}if(G==="width"){_(q);return}if(G==="isFullscreen"){v(q);return}}};return p1(B),()=>{h1(B)}},[]),Mc(()=>{e&&Oc(e)}),Mc(()=>{if(S.current)return;S.current=!0;const B=n||(t==null?void 0:t.type);B&&Es(B);const A=ek();t&&"isOpen"in t&&zr(!!t.isOpen),t&&"isMinimized"in t&&wo(!!t.isMinimized),A&&wo(!0)}),Mc(()=>{if(!(t!=null&&t.options))return;const{dialogPosition:B}=t.options;B&&Rc(B),"dialogFullHeight"in t.options&&rk(!!t.options.dialogFullHeight),"dialogWidth"in t.options&&t.options.dialogWidth&&_(t.options.dialogWidth),"isModalFullscreen"in t.options&&Pc(!!t.options.isModalFullscreen)});const U=k.useMemo(()=>({mode:u,entryType:i,status:d,previousComponentType:R||"dialog",dialogPosition:h,isDialogFullHeight:E,dialogWidth:T,isModalFullscreen:I}),[u,i,d,R,h,E,T,I]);return w.jsx(C1.Provider,{value:U,children:r})},jn=()=>{const e=k.useContext(C1);if(!e)throw new Error("useUIState must be used within a UIStateProvider");return e},Vf=5*1024*1024,N1=["image/gif","image/jpg","image/jpeg","image/png","image/webp"],Xk=".gif,.jpg,.jpeg,.png,.webp",Kk=["image/bmp","image/jpg","image/jpeg","image/png","image/tiff"],Qk=1024,Jk=.8,Zk="image/jpeg",I1=100,eC=I1*1e6,qf=(i,...s)=>Ie(null,[i,...s],function*(e,{maxDimension:t=Qk,quality:n=Jk,mimeType:r=Zk}={}){if(typeof createImageBitmap!="function")throw new Error("createImageBitmap is not available");const{width:u,height:c}=yield tC(e);if(u*c>eC)throw new Error(`Image resolution ${u}x${c} exceeds the ${I1} MP limit`);const d=yield nC(e);try{const{width:f,height:h}=rC(d.width,d.height,t);if(f===d.width&&h===d.height&&e.type===r)return e;const m=document.createElement("canvas");m.width=f,m.height=h;const E=m.getContext("2d");if(!E)return e;E.imageSmoothingEnabled=!0,E.imageSmoothingQuality="high",r==="image/jpeg"&&(E.fillStyle="#ffffff",E.fillRect(0,0,f,h)),E.drawImage(d,0,0,f,h);const b=yield iC(m,r,n);return b?new File([b],oC(e.name,r),{type:r,lastModified:e.lastModified}):e}finally{"close"in d&&typeof d.close=="function"&&d.close()}}),O1=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>{var i;return n((i=r.error)!=null?i:new Error("FileReader failed"))},r.readAsDataURL(e)}),tC=e=>new Promise((t,n)=>{const r=URL.createObjectURL(e),i=new Image;i.onload=()=>{URL.revokeObjectURL(r),t({width:i.naturalWidth,height:i.naturalHeight})},i.onerror=()=>{URL.revokeObjectURL(r),n(new Error("Could not decode image"))},i.src=r}),nC=e=>createImageBitmap(e,{imageOrientation:"from-image"}),rC=(e,t,n)=>{const r=Math.max(e,t);if(r<=n)return{width:e,height:t};const i=n/r;return{width:Math.round(e*i),height:Math.round(t*i)}},iC=(e,t,n)=>new Promise(r=>e.toBlob(r,t,n)),oC=(e,t)=>{const n=t==="image/png"?"png":t==="image/webp"?"webp":"jpg";return`${e.replace(/\.[^./\\]+$/,"")||"image"}.${n}`},Ot={SET_PROMPTS_EXTENSION_INITIALIZED:"SET_PROMPTS_EXTENSION_INITIALIZED",SET_PROMPTS_EXTENSION_OPEN:"SET_PROMPTS_EXTENSION_OPEN",SET_PROMPTS_EXTENSION_INLINE:"SET_PROMPTS_EXTENSION_INLINE",SET_PROMPTS_EXTENSION_ELEMENT_ID:"SET_PROMPTS_EXTENSION_ELEMENT_ID",SET_PROMPTS_EXTENSION_ENTRY_TYPE:"SET_PROMPTS_EXTENSION_ENTRY_TYPE",SET_PROMPTS_EXTENSION_PARAMS:"SET_PROMPTS_EXTENSION_PARAMS",RESET_PROMPTS_EXTENSION_PARAMS:"RESET_PROMPTS_EXTENSION_PARAMS",SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:"SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID",RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:"RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID",SET_PROMPTS_EXTENSION_USER_PROMPT:"SET_PROMPTS_EXTENSION_USER_PROMPT",SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:"SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE",RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:"RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE",SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:"SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE",RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:"RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE",SET_PROMPTS_EXTENSION_RESPONSE_LOADING:"SET_PROMPTS_EXTENSION_RESPONSE_LOADING"},P1={isInitialized:!1,isOpen:!1,isInline:!1,elementId:null,placeholder:null,askElseButtonLabel:null,entryType:null,params:null,activePromptsId:null,userPrompt:null,promptsMessage:null,isResponseLoading:!1,responseMessage:null,promptsDisplay:"both",staticQuestions:[],staticQuestionsStrategy:"append",disableAskElseButton:!1};function R1(e,t){return function(){return e.apply(t,arguments)}}const{toString:sC}=Object.prototype,{getPrototypeOf:Pi}=Object,{iterator:Da,toStringTag:L1}=Symbol,Ma=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),D1=e=>typeof e=="string"&&(e==="__proto__"||e==="constructor"||e==="prototype"),M1=(e,t,n)=>e===Object.prototype||!n&&t===null,aC=e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(n=>{if(D1(n))return!1;const r=Object.getOwnPropertyDescriptor(e,n);return!!r&&r.configurable&&r.writable===!0})},Fa=(e,t)=>{let n=e;const r=[];for(;n!=null;){if(r.indexOf(n)!==-1)return!1;r.push(n);const i=Pi(n);if(M1(n,i,n===e))return!1;if(Ma(n,t))return!0;n=i}return!1},uC=(e,t)=>e!=null&&Fa(e,t)?e[t]:void 0,cC=e=>{if(e==null||typeof e!="object"&&typeof e!="function")return e;const t=Pi(e);if(t===null&&aC(e))return e;const n=Object.create(null),r=Object.create(null),i=[];let s=e;for(;s!=null&&i.indexOf(s)===-1;){i.push(s);const u=s===e?t:Pi(s);if(M1(s,u,s===e))break;const c=Object.getOwnPropertyNames(s);Object.getOwnPropertySymbols&&c.push(...Object.getOwnPropertySymbols(s));for(const d of c)D1(d)||Ma(r,d)||(n[d]=e[d],r[d]=!0);s=u}return n},Wf=(e=>t=>{const n=sC.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),pr=e=>(e=e.toLowerCase(),t=>Wf(t)===e),Fc=e=>t=>typeof t===e,{isArray:xo}=Array,To=Fc("undefined");function xs(e){return e!==null&&!To(e)&&e.constructor!==null&&!To(e.constructor)&&Hn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const F1=pr("ArrayBuffer");function lC(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&F1(e.buffer),t}const dC=Fc("string"),Hn=Fc("function"),B1=Fc("number"),Ts=e=>e!==null&&typeof e=="object",fC=e=>e===!0||e===!1,Bc=e=>{if(!Ts(e))return!1;const t=Pi(e);return(t===null||t===Object.prototype||Pi(t)===null)&&!Fa(e,L1)&&!Fa(e,Da)},pC=e=>{if(!Ts(e)||xs(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},hC=pr("Date"),mC=pr("File"),gC=e=>!!(e&&typeof e.uri!="undefined"),yC=e=>e&&typeof e.getParts!="undefined",EC=pr("Blob"),bC=pr("FileList"),wC=pr("Set"),xC=e=>Ts(e)&&Hn(e.pipe);function TC(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}}const U1=TC(),j1=typeof U1.FormData!="undefined"?U1.FormData:void 0,_C=e=>{if(!e)return!1;if(j1&&e instanceof j1)return!0;const t=Pi(e);if(!t||t===Object.prototype||!Hn(e.append))return!1;const n=Wf(e);return n==="formdata"||n==="object"&&Hn(e.toString)&&e.toString()==="[object FormData]"},vC=pr("URLSearchParams"),[SC,AC,kC,CC]=["ReadableStream","Request","Response","Headers"].map(pr),NC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ba(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e=="undefined")return;let r,i;if(typeof e!="object"&&(e=[e]),xo(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(xs(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),u=s.length;let c;for(r=0;r<u;r++)c=s[r],t.call(null,e[c],c,e)}}function H1(e,t){if(xs(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const _o=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,$1=e=>!To(e)&&e!==_o;function Yf(...e){const{caseless:t,skipUndefined:n}=$1(this)&&this||{},r={},i=(s,u)=>{if(u==="__proto__"||u==="constructor"||u==="prototype")return;const c=t&&typeof u=="string"&&H1(r,u)||u,d=Ma(r,c)?r[c]:void 0;Bc(d)&&Bc(s)?r[c]=Yf(d,s):Bc(s)?r[c]=Yf({},s):xo(s)?r[c]=s.slice():(!n||!To(s))&&(r[c]=s)};for(let s=0,u=e.length;s<u;s++){const c=e[s];if(!c||xs(c)||(Ba(c,i),typeof c!="object"||xo(c)))continue;const d=Object.getOwnPropertySymbols(c);for(let f=0;f<d.length;f++){const h=d[f];HC.call(c,h)&&i(c[h],h)}}return r}const IC=(e,t,n,{allOwnKeys:r}={})=>(Ba(t,(i,s)=>{n&&Hn(i)?Object.defineProperty(e,s,{__proto__:null,value:R1(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,s,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),OC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),PC=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},RC=(e,t,n,r)=>{let i,s,u;const c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)u=i[s],(!r||r(u,e,t))&&!c[u]&&(t[u]=e[u],c[u]=!0);e=n!==!1&&Pi(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},LC=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},DC=e=>{if(!e)return null;if(xo(e))return e;let t=e.length;if(!B1(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},MC=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&Pi(Uint8Array)),FC=(e,t)=>{const r=(e&&e[Da]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},BC=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},UC=pr("HTMLFormElement"),jC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),{propertyIsEnumerable:HC}=Object.prototype,$C=pr("RegExp"),z1=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ba(n,(i,s)=>{let u;(u=t(i,s,e))!==!1&&(r[s]=u||i)}),Object.defineProperties(e,r)},zC=e=>{z1(e,(t,n)=>{if(Hn(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Hn(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},VC=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return xo(e)?r(e):r(String(e).split(t)),n},qC=()=>{},WC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function YC(e){return!!(e&&Hn(e.append)&&e[L1]==="FormData"&&e[Da])}const GC=e=>{const t=new WeakSet,n=r=>{if(Ts(r)){if(t.has(r))return;if(xs(r))return r;if(!("toJSON"in r)){t.add(r);let i;if(wC(r)){i=[];for(const s of r){const u=n(s);!To(u)&&i.push(u)}}else i=xo(r)?[]:{},Ba(r,(s,u)=>{const c=n(s);!To(c)&&(i[u]=c)});return t.delete(r),i}}return r};return n(e)},XC=pr("AsyncFunction"),KC=e=>e&&(Ts(e)||Hn(e))&&Hn(e.then)&&Hn(e.catch),V1=((e,t)=>e?setImmediate:t?((n,r)=>(_o.addEventListener("message",({source:i,data:s})=>{i===_o&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),_o.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Hn(_o.postMessage)),QC=typeof queueMicrotask!="undefined"?queueMicrotask.bind(_o):typeof process!="undefined"&&process.nextTick||V1,q1=e=>e!=null&&Hn(e[Da]),Y={isArray:xo,isArrayBuffer:F1,isBuffer:xs,isFormData:_C,isArrayBufferView:lC,isString:dC,isNumber:B1,isBoolean:fC,isObject:Ts,isPlainObject:Bc,isEmptyObject:pC,isReadableStream:SC,isRequest:AC,isResponse:kC,isHeaders:CC,isUndefined:To,isDate:hC,isFile:mC,isReactNativeBlob:gC,isReactNative:yC,isBlob:EC,isRegExp:$C,isFunction:Hn,isStream:xC,isURLSearchParams:vC,isTypedArray:MC,isFileList:bC,forEach:Ba,merge:Yf,extend:IC,trim:NC,stripBOM:OC,inherits:PC,toFlatObject:RC,kindOf:Wf,kindOfTest:pr,endsWith:LC,toArray:DC,forEachEntry:FC,matchAll:BC,isHTMLForm:UC,hasOwnProperty:Ma,hasOwnProp:Ma,hasOwnInPrototypeChain:Fa,getSafeProp:uC,toSafeFlatObject:cC,reduceDescriptors:z1,freezeMethods:zC,toObjectSet:VC,toCamelCase:jC,noop:qC,toFiniteNumber:WC,findKey:H1,global:_o,isContextDefined:$1,isSpecCompliantForm:YC,toJSONObject:GC,isAsyncFn:XC,isThenable:KC,setImmediate:V1,asap:QC,isIterable:q1,isSafeIterable:e=>e!=null&&Fa(e,Da)&&q1(e)},JC=Y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ZC=e=>{const t={};let n,r,i;return e&&e.split(`
|
|
9
9
|
`).forEach(function(u){i=u.indexOf(":"),n=u.substring(0,i).trim().toLowerCase(),r=u.substring(i+1).trim();const c=Y.hasOwnProp(t,n);!n||c&&Y.hasOwnProp(JC,n)||(n==="set-cookie"?c?t[n].push(r):t[n]=[r]:t[n]=c?t[n]+", "+r:r)}),t};function e3(e){let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const t3=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),n3=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Gf(e,t){return Y.isArray(e)?e.map(n=>Gf(n,t)):e3(String(e).replace(t,""))}const r3=e=>Gf(e,t3),i3=e=>Gf(e,n3);function W1(e){const t=Object.create(null);return Y.forEach(e.toJSON(),(n,r)=>{t[r]=i3(n)}),t}const Y1=Symbol("internals");function Ua(e){return e&&String(e).trim().toLowerCase()}function Uc(e){return e===!1||e==null?e:Y.isArray(e)?e.map(Uc):r3(String(e))}function o3(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const s3=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function Xf(e){let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}function a3(e){const t=e.length-1;if(t<1||e.charCodeAt(0)!==34||e.charCodeAt(t)!==34)return e;let n="";for(let r=1;r<t;r++){const i=e.charCodeAt(r);if(i===34||i===92&&(r+=1,r>=t))return e;n+=e[r]}return n}function u3(e){const t=Object.create(null),n=String(e);let r=0,i=!1,s=!1;function u(c){const d=Xf(n.slice(r,c)),f=d.indexOf("=");if(f<1)return;const h=Xf(d.slice(0,f));if(!s3.test(h))return;const m=h.toLowerCase();if(m==="__proto__"||m==="constructor"||m==="prototype")return;const E=Xf(d.slice(f+1));t[m]=a3(E)}for(let c=0;c<n.length;c++){const d=n.charCodeAt(c);i?s?s=!1:d===92?s=!0:d===34&&(i=!1):d===34?i=!0:(d===44||d===59)&&(u(c),r=c+1)}return u(n.length),t}const c3=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Kf(e,t,n,r,i){if(Y.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!Y.isString(t)){if(Y.isString(r))return t.indexOf(r)!==-1;if(Y.isRegExp(r))return r.test(t)}}function l3(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function d3(e,t){const n=Y.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(i,s,u){return this[r].call(this,t,i,s,u)},configurable:!0})})}let vn=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function s(c,d,f){const h=Ua(d);if(!h)return;const m=Y.findKey(i,h);(!m||i[m]===void 0||f===!0||f===void 0&&i[m]!==!1)&&(i[m||d]=Uc(c))}const u=(c,d)=>Y.forEach(c,(f,h)=>s(f,h,d));if(Y.isPlainObject(t)||t instanceof this.constructor)u(t,n);else if(Y.isString(t)&&(t=t.trim())&&!c3(t))u(ZC(t),n);else if(Y.isObject(t)&&Y.isSafeIterable(t)){let c=Object.create(null),d,f;for(const h of t){if(!Y.isArray(h))throw new TypeError("Object iterator must return a key-value pair");f=h[0],Y.hasOwnProp(c,f)?(d=c[f],c[f]=Y.isArray(d)?[...d,h[1]]:[d,h[1]]):c[f]=h[1]}u(c,n)}else t!=null&&s(n,t,r);return this}get(t,n){if(t=Ua(t),t){const r=Y.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return o3(i);if(Y.isFunction(n))return n.call(this,i,r);if(Y.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Ua(t),t){const r=Y.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Kf(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function s(u){if(u=Ua(u),u){const c=Y.findKey(r,u);c&&(!n||Kf(r,r[c],c,n))&&(delete r[c],i=!0)}}return Y.isArray(t)?t.forEach(s):s(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!t||Kf(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const n=this,r={};return Y.forEach(this,(i,s)=>{const u=Y.findKey(r,s);if(u){n[u]=Uc(i),delete n[s];return}const c=t?l3(s):String(s).trim();c!==s&&delete n[s],n[c]=Uc(i),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return Y.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&Y.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
10
10
|
`)}getSetCookie(){const t=this.get("set-cookie");return Y.isArray(t)?t:t==null||t===!1?[]:[t]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static parseParameters(t){return u3(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[Y1]=this[Y1]={accessors:{}}).accessors,i=this.prototype;function s(u){const c=Ua(u);r[c]||(d3(i,u),r[c]=!0)}return Y.isArray(t)?t.forEach(s):s(t),this}};vn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Y.reduceDescriptors(vn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),Y.freezeMethods(vn);const jc="[REDACTED ****]";function f3(e){if(Y.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(Y.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function p3(e,t){const n=new Set(t.map(s=>String(s).toLowerCase())),r=[],i=s=>{if(s===null||typeof s!="object"||Y.isBuffer(s))return s;if(r.indexOf(s)!==-1)return;s instanceof vn&&(s=s.toJSON()),r.push(s);let u;if(Y.isArray(s))u=[],s.forEach((c,d)=>{const f=i(c);Y.isUndefined(f)||(u[d]=f)});else{if(!Y.isPlainObject(s)&&f3(s))return r.pop(),s;u=Object.create(null);for(const[c,d]of Object.entries(s)){const f=n.has(c.toLowerCase())?jc:i(d);Y.isUndefined(f)||(u[c]=f)}}return r.pop(),u};return i(e)}function G1(e){try{return String(e)}catch(t){return""}}function h3(e){return e.errors.map(n=>{try{return n&&n.message?G1(n.message):G1(n)}catch(r){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}let Re=class QS extends Error{static from(t,n,r,i,s,u){let c=t.message;!c&&Y.isArray(t.errors)&&t.errors.length&&(c=h3(t));const d=new QS(c,n||t.code,r,i,s);return Object.defineProperty(d,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),d.name=t.name,t.status!=null&&d.status==null&&(d.status=t.status),u&&Object.assign(d,u),d}constructor(t,n,r,i,s){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),i&&(this.request=i),s&&(this.response=s,this.status=s.status)}toJSON(){const t=this.config,n=t&&Y.hasOwnProp(t,"redact")?t.redact:void 0,r=Y.isArray(n)&&n.length>0?p3(t,n):Y.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};Re.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Re.ERR_BAD_OPTION="ERR_BAD_OPTION",Re.ECONNABORTED="ECONNABORTED",Re.ETIMEDOUT="ETIMEDOUT",Re.ECONNREFUSED="ECONNREFUSED",Re.ERR_NETWORK="ERR_NETWORK",Re.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Re.ERR_DEPRECATED="ERR_DEPRECATED",Re.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Re.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Re.ERR_CANCELED="ERR_CANCELED",Re.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Re.ERR_INVALID_URL="ERR_INVALID_URL",Re.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const m3=null,X1=100;function Qf(e){return Y.isPlainObject(e)||Y.isArray(e)}function K1(e){return Y.endsWith(e,"[]")?e.slice(0,-2):e}function Jf(e,t,n){return e?e.concat(t).map(function(i,s){return i=K1(i),!n&&s?"["+i+"]":i}).join(n?".":""):t}function g3(e){return Y.isArray(e)&&!e.some(Qf)}const y3=Y.toFlatObject(Y,{},null,function(t){return/^is[A-Z]/.test(t)});function Hc(e,t,n){if(!Y.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(S,R)=>{const U=Y.getSafeProp(n,S);return Y.isUndefined(U)?R:U},i=r("metaTokens",!0),s=r("visitor")||_,u=r("dots",!1),c=r("indexes",!1),d=r("Blob")||typeof Blob!="undefined"&&Blob,f=r("maxDepth",X1),h=d&&Y.isSpecCompliantForm(t),m=[];if(!Y.isFunction(s))throw new TypeError("visitor must be a function");function E(S){if(S===null)return"";if(Y.isDate(S))return S.toISOString();if(Y.isBoolean(S))return S.toString();if(!h&&Y.isBlob(S))throw new Re("Blob is not supported. Use a Buffer instead.");if(Y.isArrayBuffer(S)||Y.isTypedArray(S)){if(h&&typeof d=="function")return new d([S]);throw new Re("Blob is not supported. Use a Buffer instead.",Re.ERR_NOT_SUPPORT)}return S}function b(S){if(S>f)throw new Re("Object is too deeply nested ("+S+" levels). Max depth: "+f,Re.ERR_FORM_DATA_DEPTH_EXCEEDED)}function T(S,R){if(f===1/0)return JSON.stringify(S);const U=[];return JSON.stringify(S,function(A,G){if(!Y.isObject(G))return G;for(;U.length&&U[U.length-1]!==this;)U.pop();return U.push(G),b(R+U.length-1),G})}function _(S,R,U){let B=S;if(Y.isReactNative(t)&&Y.isReactNativeBlob(S))return t.append(Jf(U,R,u),E(S)),!1;if(S&&!U&&typeof S=="object"){if(Y.endsWith(R,"{}"))R=i?R:R.slice(0,-2),S=T(S,1);else if(Y.isArray(S)&&g3(S)||(Y.isFileList(S)||Y.endsWith(R,"[]"))&&(B=Y.toArray(S)))return R=K1(R),B.forEach(function(G,q){!(Y.isUndefined(G)||G===null)&&t.append(c===!0?Jf([R],q,u):c===null?R:R+"[]",E(G))}),!1}return Qf(S)?!0:(t.append(Jf(U,R,u),E(S)),!1)}const I=Object.assign(y3,{defaultVisitor:_,convertValue:E,isVisitable:Qf});function v(S,R,U=0){if(!Y.isUndefined(S)){if(b(U),m.indexOf(S)!==-1)throw new Error("Circular reference detected in "+R.join("."));m.push(S),Y.forEach(S,function(A,G){(!(Y.isUndefined(A)||A===null)&&s.call(t,A,Y.isString(G)?G.trim():G,R,I))===!0&&v(A,R?R.concat(G):[G],U+1)}),m.pop()}}if(!Y.isObject(e))throw new TypeError("data must be an object");return v(e),t}function Q1(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function Zf(e,t){this._pairs=[],e&&Hc(e,this,t)}const J1=Zf.prototype;J1.append=function(t,n){this._pairs.push([t,n])},J1.toString=function(t){const n=t?r=>t.call(this,r,Q1):Q1;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function E3(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Z1(e,t,n){if(!t)return e;e=e||"";const r=Y.isFunction(n)?{serialize:n}:n,i=Y.getSafeProp(r,"encode")||E3,s=Y.getSafeProp(r,"serialize");let u;if(s?u=s(t,r):u=Y.isURLSearchParams(t)?t.toString():new Zf(t,r).toString(i),u){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+u}return e}const ja=Symbol("internals");function ey(e){return e?e.length:0}function ty(e){if(e)for(;e.length&&e[e.length-1]===null;)e.pop()}function Ha(e,t){const n=e.handlers,r=ey(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):r!==t.handlersLength&&(r?t.handlerEntries.forEach(function(s,u){n[s.index]!==s.handler&&t.handlerEntries.delete(u)}):t.handlerEntries.clear()),t.handlersLength=r}class ny{constructor(){this.handlers=[],this[ja]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(t,n,r){const i={fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null},s=this[ja];this.handlers==null&&(this.handlers=[]),Ha(this,s);const u=s.nextId++;return this.handlers.push(i),s.handlerEntries.set(u,{handler:i,index:this.handlers.length-1}),s.handlersLength=this.handlers.length,u}eject(t){const n=this[ja];Ha(this,n);const r=n.handlerEntries.get(t);if(r){if(n.handlerEntries.delete(t),this.handlers[r.index]!==r.handler)return;this.handlers[r.index]=null,n.iterationDepth||(ty(this.handlers),n.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Ha(this,this[ja]))}forEach(t){const n=this[ja];Ha(this,n),n.iterationDepth++;try{Y.forEach(this.handlers,function(i){i!==null&&t(i)})}finally{--n.iterationDepth||(Ha(this,n),ty(this.handlers),n.handlersLength=ey(this.handlers))}}}const ep={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},b3={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams!="undefined"?URLSearchParams:Zf,FormData:typeof FormData!="undefined"?FormData:null,Blob:typeof Blob!="undefined"?Blob:null},protocols:["http","https","file","blob","url","data"]},tp=typeof window!="undefined"&&typeof document!="undefined",np=typeof navigator=="object"&&navigator||void 0,w3=tp&&(!np||["ReactNative","NativeScript","NS"].indexOf(np.product)<0),x3=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",T3=tp&&window.location.href||"http://localhost",cn=M(M({},Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:tp,hasStandardBrowserEnv:w3,hasStandardBrowserWebWorkerEnv:x3,navigator:np,origin:T3},Symbol.toStringTag,{value:"Module"}))),b3);function _3(e,t){return Hc(e,new cn.classes.URLSearchParams,M({visitor:function(n,r,i,s){return cn.isNode&&Y.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}const ry=X1;function iy(e){if(e>ry)throw new Re("FormData field is too deeply nested ("+e+" levels). Max depth: "+ry,Re.ERR_FORM_DATA_DEPTH_EXCEEDED)}function v3(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let r;for(;(r=n.exec(e))!==null;)iy(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function S3(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],t[s]=e[s];return t}function oy(e){function t(n,r,i,s){iy(s);let u=n[s++];if(u==="__proto__")return!0;const c=Number.isFinite(+u),d=s>=n.length;return u=!u&&Y.isArray(i)?i.length:u,d?(Y.hasOwnProp(i,u)?i[u]=Y.isArray(i[u])?i[u].concat(r):[i[u],r]:i[u]=r,!c):((!Y.hasOwnProp(i,u)||!Y.isObject(i[u]))&&(i[u]=[]),t(n,r,i[u],s)&&Y.isArray(i[u])&&(i[u]=S3(i[u])),!c)}if(Y.isFormData(e)&&Y.isFunction(e.entries)){const n={};return Y.forEachEntry(e,(r,i)=>{t(v3(r),i,n,0)}),n}return null}const sy=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),_s=(e,t)=>e!=null&&Y.hasOwnProp(e,t)?e[t]:void 0;function A3(e,t,n){if(Y.isString(e))try{return(t||JSON.parse)(e),Y.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const $a={transitional:ep,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=Y.isObject(t);if(s&&Y.isHTMLForm(t)&&(t=new FormData(t)),Y.isFormData(t))return i?JSON.stringify(oy(t)):t;if(Y.isArrayBuffer(t)||Y.isBuffer(t)||Y.isStream(t)||Y.isFile(t)||Y.isBlob(t)||Y.isReadableStream(t))return t;if(Y.isArrayBufferView(t))return t.buffer;if(Y.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(s){const d=_s(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return _3(t,d).toString();if((c=Y.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=_s(this,"env"),h=f&&f.FormData;return Hc(c?{"files[]":t}:t,h&&new h,d)}}return s||i?(n.setContentType("application/json",!1),A3(t)):t}],transformResponse:[function(t){const n=_s(this,"transitional")||$a.transitional,r=n&&n.forcedJSONParsing,i=_s(this,"responseType"),s=i==="json";if(Y.isResponse(t)||Y.isReadableStream(t))return t;if(t&&Y.isString(t)&&(r&&!i||s)){const c=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,_s(this,"parseReviver"))}catch(d){if(c)throw d.name==="SyntaxError"?Re.from(d,Re.ERR_BAD_RESPONSE,this,null,_s(this,"response")):d}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:cn.classes.FormData,Blob:cn.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Y.forEach(sy,e=>{$a.headers[e]={}});function rp(e,t){const n=this||$a,r=t||n,i=vn.from(r.headers);let s=r.data;return Y.forEach(e,function(c){s=c.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function ay(e){return!!(e&&e.__CANCEL__)}let za=class extends Re{constructor(t,n,r){super(t==null?"canceled":t,Re.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function uy(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Re("Request failed with status code "+n.status,n.status>=400&&n.status<500?Re.ERR_BAD_REQUEST:Re.ERR_BAD_RESPONSE,n.config,n.request,n))}const k3=/[\t\n\r]/g;function cy(e){if(typeof e!="string")return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(k3,"")}function ip(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function C3(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,u;return t=t!==void 0?t:1e3,function(d){const f=Date.now(),h=r[s];u||(u=f),n[i]=d,r[i]=f;let m=s,E=0;for(;m!==i;)E+=n[m++],m=m%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),f-u<t)return;const b=h&&f-h;return b?Math.round(E*1e3/b):void 0}}function N3(e,t){let n=0,r=1e3/t,i,s;const u=(h,m=Date.now())=>{n=m,i=null,s&&(clearTimeout(s),s=null),e(...h)};return[(...h)=>{const m=Date.now(),E=m-n;E>=r?u(h,m):(i=h,s||(s=setTimeout(()=>{s=null,u(i)},r-E)))},()=>i&&u(i),(...h)=>u(h)]}const $c=(e,t,n=3)=>{let r=0;const i=C3(50,250);return N3(s=>{if(!s||!Y.isNumber(s.loaded))return;const u=s.loaded,c=s.lengthComputable?s.total:void 0,d=Math.max(0,c!=null?Math.min(u,c):u),f=Math.max(0,d-r),h=i(f);r=Math.max(r,d);const m={loaded:d,total:c,progress:c?d/c:void 0,bytes:f,rate:h||void 0,estimated:h&&c?(c-d)/h:void 0,event:s,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(m)},n)},ly=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},dy=(e,t=Y.asap)=>(...n)=>t(()=>e(...n)),I3=cn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,cn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(cn.origin),cn.navigator&&/(msie|trident)/i.test(cn.navigator.userAgent)):()=>!0,O3=cn.hasStandardBrowserEnv?{write(e,t,n,r,i,s,u){if(typeof document=="undefined")return;const c=[`${e}=${encodeURIComponent(t)}`];Y.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),Y.isString(r)&&c.push(`path=${r}`),Y.isString(i)&&c.push(`domain=${i}`),s===!0&&c.push("secure"),Y.isString(u)&&c.push(`SameSite=${u}`),document.cookie=c.join("; ")},read(e){if(typeof document=="undefined")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),i=r.indexOf("=");if(i!==-1&&r.slice(0,i)===e)try{return decodeURIComponent(r.slice(i+1))}catch(s){return r.slice(i+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function P3(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function R3(e,t){if(!t)return e;let n=e.length;for(;n>0&&e.charCodeAt(n-1)===47;)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}const L3=/^https?:(?!\/\/)/i;function D3(e){return e&&e.replace(/(^|&)([^=&]*=)?[^&]+/g,(t,n,r="")=>`${n}${r}${jc}`)}function M3(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${jc}@`),n=t.indexOf("#"),i=(n===-1?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${jc}`);return n===-1?i:`${i}#${D3(t.slice(n+1))}`}function fy(e,t){if(typeof e=="string"){const n=cy(e);if(L3.test(n))throw new Re(`Invalid URL ${JSON.stringify(M3(n))}: missing "//" after protocol`,Re.ERR_INVALID_URL,t)}}function py(e,t,n,r){fy(t,r);let i=!P3(t);return e&&(i||n===!1)?(fy(e,r),R3(e,t)):t}const hy=e=>e instanceof vn?M({},e):e,F3=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)):Object.keys(e);function vo(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(h,m,E,b){return Y.isPlainObject(h)&&Y.isPlainObject(m)?Y.merge.call({caseless:b},h,m):Y.isPlainObject(m)?Y.merge({},m):Y.isArray(m)?m.slice():m}function i(h,m,E,b){if(Y.isUndefined(m)){if(!Y.isUndefined(h))return r(void 0,h,E,b)}else return r(h,m,E,b)}function s(h,m){if(!Y.isUndefined(m))return r(void 0,m)}function u(h,m){if(Y.isUndefined(m)){if(!Y.isUndefined(h))return r(void 0,h)}else return r(void 0,m)}function c(h){const m=Y.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!Y.isUndefined(m))if(Y.isPlainObject(m)){if(Y.hasOwnProp(m,h))return m[h]}else return;const E=Y.hasOwnProp(e,"transitional")?e.transitional:void 0;if(Y.isPlainObject(E)&&Y.hasOwnProp(E,h))return E[h]}function d(h,m,E){if(Y.hasOwnProp(t,E))return r(h,m);if(Y.hasOwnProp(e,E))return r(void 0,h)}const f={url:s,method:s,data:s,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutErrorMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,allowedSocketPaths:u,responseEncoding:u,validateStatus:d,headers:(h,m,E)=>i(hy(h),hy(m),E,!0)};return Y.forEach(F3(M(M({},e),t)),function(m){if(m==="__proto__"||m==="constructor"||m==="prototype")return;const E=Y.hasOwnProp(f,m)?f[m]:i,b=Y.hasOwnProp(e,m)?e[m]:void 0,T=Y.hasOwnProp(t,m)?t[m]:void 0,_=E(b,T,m);Y.isUndefined(_)&&E!==d||(n[m]=_)}),Y.hasOwnProp(t,"validateStatus")&&Y.isUndefined(t.validateStatus)&&c("validateStatusUndefinedResolves")===!1&&(Y.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const B3=["content-type","content-length"];function U3(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,i])=>{B3.includes(r.toLowerCase())&&e.set(r,i)})}const j3=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function my(e){const t=vo({},e),n=E=>Y.hasOwnProp(t,E)?t[E]:void 0,r=n("data");let i=n("withXSRFToken");const s=n("xsrfHeaderName"),u=n("xsrfCookieName");let c=n("headers");const d=n("auth"),f=n("baseURL"),h=n("allowAbsoluteUrls"),m=n("url");if(t.headers=c=vn.from(c),t.url=Z1(py(f,m,h,t),n("params"),n("paramsSerializer")),d){const E=Y.getSafeProp(d,"username")||"",b=Y.getSafeProp(d,"password")||"";try{c.set("Authorization","Basic "+btoa(E+":"+(b?j3(b):"")))}catch(T){throw Re.from(T,Re.ERR_BAD_OPTION_VALUE,e)}}if(Y.isFormData(r)){const E=Y.getSafeProp(r,"getHeaders");cn.hasStandardBrowserEnv||cn.hasStandardBrowserWebWorkerEnv||Y.isReactNative(r)?c.setContentType(void 0):Y.isFunction(E)&&U3(c,E.call(r),n("formDataHeaderPolicy"))}if(cn.hasStandardBrowserEnv&&(Y.isFunction(i)&&(i=i(t)),i===!0||i==null&&I3(t.url))){const b=s&&u&&O3.read(u);b&&c.set(s,b)}return t}const H3=typeof XMLHttpRequest!="undefined"&&function(e){return new Promise(function(n,r){const i=my(e);let s=i.data;const u=vn.from(i.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:f}=i,h,m,E,b,T,_;function I(){b&&b(),T&&T(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let v=new XMLHttpRequest;v.open(i.method.toUpperCase(),i.url,!0),v.timeout=i.timeout;function S(U){if(!v)return;if(v.status===0&&(ip(cy(i.url))||ip(cn.origin))!=="file"&&!(v.responseURL&&v.responseURL.startsWith("file:"))){r(new Re("Request aborted",Re.ECONNABORTED,e,v)),I(),v=null;return}try{U?_&&_(U):T&&T()}catch(q){setTimeout(()=>{throw q})}if(!v)return;const B=vn.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),G={data:!c||c==="text"||c==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:B,config:e,request:v};uy(function(te){n(te),I()},function(te){r(te),I()},G),v=null}"onloadend"in v?v.onloadend=S:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.startsWith("file:"))||setTimeout(S)},v.onabort=function(){v&&(r(new Re("Request aborted",Re.ECONNABORTED,e,v)),I(),v=null)},v.onerror=function(B){const A=B&&B.message?B.message:"Network Error",G=new Re(A,Re.ERR_NETWORK,e,v);G.event=B||null,r(G),I(),v=null},v.ontimeout=function(){let B=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const A=i.transitional||ep;i.timeoutErrorMessage&&(B=i.timeoutErrorMessage),r(new Re(B,A.clarifyTimeoutError?Re.ETIMEDOUT:Re.ECONNABORTED,e,v)),I(),v=null},s===void 0&&u.setContentType(null),"setRequestHeader"in v&&Y.forEach(W1(u),function(B,A){v.setRequestHeader(A,B)}),Y.isUndefined(i.withCredentials)||(v.withCredentials=!!i.withCredentials),c&&c!=="json"&&(v.responseType=i.responseType),f&&([E,T,_]=$c(f,!0),v.addEventListener("progress",E)),d&&v.upload&&([m,b]=$c(d),v.upload.addEventListener("progress",m),v.upload.addEventListener("loadend",b)),(i.cancelToken||i.signal)&&(h=U=>{v&&(r(!U||U.type?new za(null,e,v):U),v.abort(),I(),v=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));const R=ip(i.url);if(R&&!cn.protocols.includes(R)){r(new Re("Unsupported protocol "+R+":",Re.ERR_BAD_REQUEST,e)),I();return}v.send(s||null)})},$3=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const i=function(d){if(!r){r=!0,u();const f=d instanceof Error?d:this.reason;n.abort(f instanceof Re?f:new za(f instanceof Error?f.message:f))}};let s=t&&setTimeout(()=>{s=null,i(new Re(`timeout of ${t}ms exceeded`,Re.ETIMEDOUT))},t);const u=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>{if(!r){if(d.aborted){i.call(d);return}d.addEventListener("abort",i,{once:!0})}});const{signal:c}=n;return c.unsubscribe=()=>Y.asap(u),c},z3=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},V3=function(e,t){return L0(this,null,function*(){try{for(var n=KS(q3(e)),r,i,s;r=!(i=yield new ps(n.next())).done;r=!1){const u=i.value;yield*D0(z3(u,t))}}catch(i){s=[i]}finally{try{r&&(i=n.return)&&(yield new ps(i.call(n)))}finally{if(s)throw s[0]}}})},q3=function(e){return L0(this,null,function*(){if(e[Symbol.asyncIterator]){yield*D0(e);return}const t=e.getReader();try{for(;;){const{done:n,value:r}=yield new ps(t.read());if(n)break;yield r}}finally{yield new ps(t.cancel())}})},gy=(e,t,n,r)=>{const i=V3(e,t);let s=0,u,c=f=>{u||(u=!0,r&&r(f))};return new ReadableStream({pull(f){return Ie(this,null,function*(){try{const{done:h,value:m}=yield i.next();if(h){c(),f.close();return}let E=m.byteLength;if(n){let b=s+=E;n(b)}f.enqueue(new Uint8Array(m))}catch(h){throw c(h),h}})},cancel(f){return c(f),i.return()}},{highWaterMark:2})},yy=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Ey=(e,t,n)=>t+2<n&&yy(e.charCodeAt(t+1))&&yy(e.charCodeAt(t+2)),by=e=>e<=57?e-48:(e&223)-55,W3=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47||e===45||e===95,Y3=e=>e===9||e===10||e===12||e===13||e===32,G3=e=>{const t=Math.floor(e/4),n=e%4;return t*3+(n===2?1:n===3?2:0)},X3=e=>{const t=e.length;let n=0;return t>0&&e.charCodeAt(t-1)===61&&(n++,t>1&&e.charCodeAt(t-2)===61&&n++),Math.floor((t-n)*3/4)},K3=e=>{const t=e.length;let n=0,r=0,i=!1;for(let s=0;s<t;s++){let u=e.charCodeAt(s);if(u===37&&Ey(e,s,t)&&(u=by(e.charCodeAt(s+1))*16+by(e.charCodeAt(s+2)),s+=2),!Y3(u)){if(u===61){r++;continue}if(!W3(u)||r>0){i=!0;continue}n++}}return i||r>2||r>0&&(n+r)%4!==0||n%4===1?X3(e):G3(n)},Q3=(e,t)=>{if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const n=e.indexOf(",");if(n<0)return 0;const r=e.slice(5,n),i=e.slice(n+1);if(/;base64/i.test(r))return t(i);let u=0;for(let c=0,d=i.length;c<d;c++){const f=i.charCodeAt(c);if(f===37&&Ey(i,c,d))u+=1,c+=2;else if(f<128)u+=1;else if(f<2048)u+=2;else if(f>=55296&&f<=56319&&c+1<d){const h=i.charCodeAt(c+1);h>=56320&&h<=57343?(u+=4,c++):u+=3}else u+=3}return u};function J3(e){const t=typeof e=="string"?e.indexOf("#"):-1;return Q3(t===-1?e:e.slice(0,t),K3)}const op="1.20.0",wy=64*1024,Z3={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:zc}=Y,eN=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),xy=e=>{if(!Y.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},Ty=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},tN=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},nN=e=>{const t=Y.global!==void 0&&Y.global!==null?Y.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=Y.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:i,Request:s,Response:u}=e,c=i?zc(i):typeof fetch=="function",d=zc(s),f=zc(u);if(!c)return!1;const h=c&&zc(n),m=c&&(typeof r=="function"?(v=>S=>v.encode(S))(new r):v=>Ie(null,null,function*(){return new Uint8Array(yield new s(v).arrayBuffer())})),E=d&&h&&Ty(()=>{let v=!1;const S=new s(cn.origin,{body:new n,method:"POST",get duplex(){return v=!0,"half"}}),R=S.headers.has("Content-Type");return S.body!=null&&S.body.cancel(),v&&!R}),b=f&&h&&Ty(()=>Y.isReadableStream(new u("").body)),T={stream:b&&(v=>v.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!T[v]&&(T[v]=(S,R)=>{let U=S&&S[v];if(U)return U.call(S);throw new Re(`Response type '${v}' is not supported`,Re.ERR_NOT_SUPPORT,R)})});const _=v=>Ie(null,null,function*(){if(v==null)return 0;if(Y.isBlob(v))return v.size;if(Y.isSpecCompliantForm(v))return(yield new s(cn.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(Y.isArrayBufferView(v)||Y.isArrayBuffer(v))return v.byteLength;if(Y.isURLSearchParams(v)&&(v=v+""),Y.isString(v))return(yield m(v)).byteLength}),I=(v,S)=>Ie(null,null,function*(){const R=Y.toFiniteNumber(v.getContentLength());return R==null?_(S):R});return v=>Ie(null,null,function*(){let{url:S,method:R,data:U,signal:B,cancelToken:A,timeout:G,onDownloadProgress:q,onUploadProgress:te,responseType:H,headers:ee,withCredentials:Q="same-origin",fetchOptions:me,maxContentLength:V,maxBodyLength:ae,maxRedirects:pe}=my(v);const ue=Y.isNumber(V)&&V>-1,J=Y.isNumber(ae)&&ae>-1,se=Ne=>Y.hasOwnProp(v,Ne)?v[Ne]:void 0;let P=i||fetch;H=H?(H+"").toLowerCase():"text";let j=$3([B,A&&A.toAbortSignal()],G),K=null;const O=j&&j.unsubscribe&&(()=>{j.unsubscribe()});let fe,Pe=null;const he=()=>new Re("Request body larger than maxBodyLength limit",Re.ERR_BAD_REQUEST,v,K);try{let Ne;const ve=se("auth");if(ve){const Oe=Y.getSafeProp(ve,"username")||"",it=Y.getSafeProp(ve,"password")||"";Ne={username:Oe,password:it}}if(tN(S)){const Oe=new URL(S,cn.origin);if(!Ne&&(Oe.username||Oe.password)){const it=xy(Oe.username),lt=xy(Oe.password);Ne={username:it,password:lt}}(Oe.username||Oe.password)&&(Oe.username="",Oe.password="",S=Oe.href)}if(Ne&&(ee.delete("authorization"),ee.set("Authorization","Basic "+btoa(eN((Ne.username||"")+":"+(Ne.password||""))))),ue&&typeof S=="string"&&S.startsWith("data:")&&J3(S)>V)throw new Re("maxContentLength size of "+V+" exceeded",Re.ERR_BAD_RESPONSE,v,K);if(J&&R!=="get"&&R!=="head"){const Oe=yield _(U);if(typeof Oe=="number"&&isFinite(Oe)&&(fe=Oe,Oe>ae))throw he()}const qe=J&&(Y.isReadableStream(U)||Y.isStream(U)),tt=(Oe,it,lt)=>gy(Oe,wy,jt=>{if(J&&jt>ae)throw Pe=he();it&&it(jt)},lt);if(E&&R!=="get"&&R!=="head"&&(te||qe)){if(fe=fe==null?yield I(ee,U):fe,fe!==0||qe){let Oe=new s(S,{method:"POST",body:U,duplex:"half"}),it;if(Y.isFormData(U)&&(it=Oe.headers.get("content-type"))&&ee.setContentType(it),Oe.body){const[lt,jt]=te&&ly(fe,$c(dy(te)))||[];U=tt(Oe.body,lt,jt)}}}else if(qe&&!d&&h&&R!=="get"&&R!=="head")U=tt(U);else if(qe&&d&&!E&&R!=="get"&&R!=="head")throw new Re("Stream request bodies are not supported by the current fetch implementation",Re.ERR_NOT_SUPPORT,v,K);Y.isString(Q)||(Q=Q?"include":"omit");const It=d&&"credentials"in s.prototype;if(Y.isFormData(U)){const Oe=ee.getContentType();Oe&&/^multipart\/form-data/i.test(Oe)&&!/boundary=/i.test(Oe)&&ee.delete("content-type")}ee.set("User-Agent","axios/"+op,!1);const ct=me==null?me:Object.assign(Object.create(null),me);ct&&(delete ct.body,delete ct.headers,delete ct.method,delete ct.signal,delete ct.duplex,delete ct.credentials);const _t=Object.assign(Object.create(null),ct,{signal:j,method:R.toUpperCase(),headers:W1(ee.normalize()),body:U,duplex:"half",credentials:It?Q:void 0});d&&(Y.forEach(Z3,(Oe,it)=>{_t[it]===void 0&&(_t[it]=Oe)}),_t.signal===void 0&&(_t.signal=null),_t.body===void 0&&(_t.body=null)),pe===0&&(_t.redirect="manual",ct&&(ct.redirect="manual")),K=d&&new s(S,_t);let nt=yield d?P(K,ct):P(S,_t);const gt=vn.from(nt.headers);if(ue){const Oe=Y.toFiniteNumber(gt.getContentLength());if(Oe!=null&&Oe>V)throw new Re("maxContentLength size of "+V+" exceeded",Re.ERR_BAD_RESPONSE,v,K)}const De=b&&(H==="stream"||H==="response");if(b&&nt.body&&(q||ue||De&&O)){const Oe={};["status","statusText","headers"].forEach(sr=>{Oe[sr]=nt[sr]});const it=Y.toFiniteNumber(gt.getContentLength()),[lt,jt]=q&&ly(it,$c(dy(q),!0))||[];let At=0;const Ei=sr=>{if(ue&&(At=sr,At>V))throw new Re("maxContentLength size of "+V+" exceeded",Re.ERR_BAD_RESPONSE,v,K);lt&<(sr)};nt=new u(gy(nt.body,wy,Ei,()=>{jt&&jt(),O&&O()}),Oe)}H=H||"text";let ze=yield T[Y.findKey(T,H)||"text"](nt,v);if(ue&&!b&&!De){let Oe;if(ze!=null&&(typeof ze.byteLength=="number"?Oe=ze.byteLength:typeof ze.size=="number"?Oe=ze.size:typeof ze=="string"&&(Oe=typeof r=="function"?new r().encode(ze).byteLength:ze.length)),typeof Oe=="number"&&Oe>V)throw new Re("maxContentLength size of "+V+" exceeded",Re.ERR_BAD_RESPONSE,v,K)}return!De&&O&&O(),yield new Promise((Oe,it)=>{uy(Oe,it,{data:ze,headers:vn.from(nt.headers),status:nt.status,statusText:nt.statusText,config:v,request:K})})}catch(Ne){if(O&&O(),j&&j.aborted&&j.reason instanceof Re){const ve=j.reason;throw ve.config=v,K&&(ve.request=K),Ne!==ve&&Object.defineProperty(ve,"cause",{__proto__:null,value:Ne,writable:!0,enumerable:!1,configurable:!0}),ve}if(Pe)throw K&&!Pe.request&&(Pe.request=K),Pe;if(Ne instanceof Re)throw K&&!Ne.request&&(Ne.request=K),Ne;if(Ne&&Ne.name==="TypeError"&&/Load failed|fetch/i.test(Ne.message)){const ve=new Re("Network Error",Re.ERR_NETWORK,v,K,Ne&&Ne.response);throw Object.defineProperty(ve,"cause",{__proto__:null,value:Ne.cause||Ne,writable:!0,enumerable:!1,configurable:!0}),ve}throw Re.from(Ne,Ne&&Ne.code,v,K,Ne&&Ne.response)}})},rN=new Map,_y=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,s=[r,i,n];let u=s.length,c=u,d,f,h=rN;for(;c--;)d=s[c],f=h.get(d),f===void 0&&h.set(d,f=c?new Map:nN(t)),h=f;return f};_y();const sp={http:m3,xhr:H3,fetch:{get:_y}};Y.forEach(sp,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(n){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const vy=e=>`- ${e}`,iN=e=>Y.isFunction(e)||e===null||e===!1;function oN(e,t){e=Y.isArray(e)?e:[e];const{length:n}=e;let r,i;const s={};for(let u=0;u<n;u++){r=e[u];let c;if(i=r,!iN(r)&&(i=sp[(c=String(r)).toLowerCase()],i===void 0))throw new Re(`Unknown adapter '${c}'`);if(i&&(Y.isFunction(i)||(i=i.get(t))))break;s[c||"#"+u]=i}if(!i){const u=Object.entries(s).map(([d,f])=>`adapter ${d} `+(f===!1?"is not supported by the environment":"is not available in the build"));let c=n?u.length>1?`since :
|
|
11
11
|
`+u.map(vy).join(`
|